aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/locationinformation.h
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-09-23 14:18:40 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-09-23 14:18:40 -0700
commit6ee2a44235cd3cf391aec6d6a60098e19fd01e81 (patch)
tree6ffb0abae7092c10748a977ab5984850fbf72632 /qt-ui/locationinformation.h
parent148b30849abadef23fc20a0480964a1763f8104d (diff)
parent483320a0c094c57c5806fda39bd4a56d29ff7687 (diff)
downloadsubsurface-6ee2a44235cd3cf391aec6d6a60098e19fd01e81.tar.gz
Merge branch 'NewLocationEditDropdown'
Diffstat (limited to 'qt-ui/locationinformation.h')
-rw-r--r--qt-ui/locationinformation.h60
1 files changed, 52 insertions, 8 deletions
diff --git a/qt-ui/locationinformation.h b/qt-ui/locationinformation.h
index 080e013a8..3e8adeae2 100644
--- a/qt-ui/locationinformation.h
+++ b/qt-ui/locationinformation.h
@@ -4,6 +4,7 @@
#include "ui_locationInformation.h"
#include <stdint.h>
#include <QAbstractListModel>
+#include <QSortFilterProxyModel>
class LocationInformationWidget : public QGroupBox {
Q_OBJECT
@@ -45,17 +46,60 @@ private:
QAction *closeAction, *acceptAction, *rejectAction;
};
-class LocationManagementEditHelper : public QObject {
-Q_OBJECT
+class DiveLocationFilterProxyModel : public QSortFilterProxyModel {
+ Q_OBJECT
+public:
+ DiveLocationFilterProxyModel(QObject *parent = 0);
+ virtual bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const;
+ virtual bool lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const;
+};
+
+class DiveLocationModel : public QAbstractTableModel {
+ Q_OBJECT
+public:
+ enum columns{UUID, NAME, LATITUDE, LONGITUDE, DESCRIPTION, NOTES, COLUMNS};
+ DiveLocationModel(QObject *o = 0);
+ void resetModel();
+ QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const;
+ int rowCount(const QModelIndex& parent = QModelIndex()) const;
+ int columnCount(const QModelIndex& parent = QModelIndex()) const;
+ bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole);
+private:
+ QString new_ds_value[2];
+};
+
+class DiveLocationListView : public QListView {
+ Q_OBJECT
+public:
+ DiveLocationListView(QWidget *parent = 0);
+};
+
+class DiveLocationLineEdit : public QLineEdit {
+ Q_OBJECT
public:
- bool eventFilter(QObject *obj, QEvent *ev);
- void handleActivation(const QModelIndex& activated);
- void resetDiveSiteUuid();
- uint32_t diveSiteUuid() const;
+ enum DiveSiteType { NO_DIVE_SITE, NEW_DIVE_SITE, EXISTING_DIVE_SITE };
+ DiveLocationLineEdit(QWidget *parent =0 );
+ void refreshDiveSiteCache();
+ void setTemporaryDiveSiteName(const QString& s);
+ bool eventFilter(QObject*, QEvent*);
+ void itemActivated(const QModelIndex& index);
+ DiveSiteType currDiveSiteType() const;
+ uint32_t currDiveSiteUuid() const;
+ void fixPopupPosition();
signals:
- void setLineEditText(const QString& text);
+ void diveSiteSelected(uint32_t uuid);
+
+protected:
+ void keyPressEvent(QKeyEvent *ev);
+ void focusOutEvent(QFocusEvent *ev);
+ void showPopup();
+
private:
- uint32_t last_uuid;
+ DiveLocationFilterProxyModel *proxy;
+ DiveLocationModel *model;
+ DiveLocationListView *view;
+ DiveSiteType currType;
+ uint32_t currUuid;
};
#endif