2015-05-17 19:13:41 +00:00
|
|
|
#ifndef LOCATIONINFORMATION_H
|
|
|
|
#define LOCATIONINFORMATION_H
|
|
|
|
|
|
|
|
#include "ui_locationInformation.h"
|
|
|
|
#include <stdint.h>
|
2015-05-17 19:33:23 +00:00
|
|
|
#include <QAbstractListModel>
|
2015-09-21 17:01:58 +00:00
|
|
|
#include <QSortFilterProxyModel>
|
2015-05-17 19:33:23 +00:00
|
|
|
|
2015-05-17 19:13:41 +00:00
|
|
|
class LocationInformationWidget : public QGroupBox {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
LocationInformationWidget(QWidget *parent = 0);
|
2015-09-01 00:11:28 +00:00
|
|
|
virtual bool eventFilter(QObject*, QEvent*);
|
|
|
|
|
2015-05-17 20:14:23 +00:00
|
|
|
protected:
|
|
|
|
void showEvent(QShowEvent *);
|
2015-05-26 20:36:06 +00:00
|
|
|
|
2015-05-17 19:13:41 +00:00
|
|
|
public slots:
|
|
|
|
void acceptChanges();
|
|
|
|
void rejectChanges();
|
2015-06-04 02:50:36 +00:00
|
|
|
void updateGpsCoordinates();
|
2015-05-17 19:13:41 +00:00
|
|
|
void markChangedWidget(QWidget *w);
|
|
|
|
void enableEdition();
|
|
|
|
void resetState();
|
|
|
|
void resetPallete();
|
|
|
|
void on_diveSiteCoordinates_textChanged(const QString& text);
|
|
|
|
void on_diveSiteDescription_textChanged(const QString& text);
|
|
|
|
void on_diveSiteName_textChanged(const QString& text);
|
|
|
|
void on_diveSiteNotes_textChanged();
|
2015-08-25 21:45:29 +00:00
|
|
|
void reverseGeocode();
|
2015-09-01 00:35:17 +00:00
|
|
|
void mergeSelectedDiveSites();
|
2015-06-04 02:50:36 +00:00
|
|
|
private slots:
|
2015-07-25 16:03:14 +00:00
|
|
|
void updateLabels();
|
2015-05-17 19:13:41 +00:00
|
|
|
signals:
|
2015-06-04 02:50:36 +00:00
|
|
|
void startEditDiveSite(uint32_t uuid);
|
|
|
|
void endEditDiveSite();
|
2015-05-22 19:15:53 +00:00
|
|
|
void coordinatesChanged();
|
2015-05-26 20:36:06 +00:00
|
|
|
void startFilterDiveSite(uint32_t uuid);
|
2015-05-26 20:42:45 +00:00
|
|
|
void stopFilterDiveSite();
|
2015-07-31 01:10:01 +00:00
|
|
|
void requestCoordinates();
|
|
|
|
void endRequestCoordinates();
|
2015-09-01 00:11:28 +00:00
|
|
|
|
2015-05-17 19:13:41 +00:00
|
|
|
private:
|
|
|
|
Ui::LocationInformation ui;
|
|
|
|
bool modified;
|
|
|
|
QAction *closeAction, *acceptAction, *rejectAction;
|
|
|
|
};
|
|
|
|
|
2015-07-08 17:27:17 +00:00
|
|
|
class LocationManagementEditHelper : public QObject {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
bool eventFilter(QObject *obj, QEvent *ev);
|
|
|
|
void handleActivation(const QModelIndex& activated);
|
|
|
|
void resetDiveSiteUuid();
|
2015-07-13 18:14:46 +00:00
|
|
|
uint32_t diveSiteUuid() const;
|
2015-07-14 22:09:37 +00:00
|
|
|
signals:
|
|
|
|
void setLineEditText(const QString& text);
|
2015-07-08 17:27:17 +00:00
|
|
|
private:
|
|
|
|
uint32_t last_uuid;
|
2015-06-26 16:23:53 +00:00
|
|
|
};
|
2015-08-06 13:14:18 +00:00
|
|
|
|
2015-09-21 17:01:58 +00:00
|
|
|
class DiveLocationFilterProxyModel : public QSortFilterProxyModel {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
DiveLocationFilterProxyModel(QObject *parent = 0);
|
|
|
|
virtual bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const;
|
2015-09-21 18:04:52 +00:00
|
|
|
virtual bool lessThan(const QModelIndex& source_left, const QModelIndex& source_right) const;
|
2015-09-21 17:01:58 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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:
|
|
|
|
DiveLocationLineEdit(QWidget *parent =0 );
|
|
|
|
void refreshDiveSiteCache();
|
|
|
|
void setTemporaryDiveSiteName(const QString& s);
|
|
|
|
private:
|
|
|
|
DiveLocationFilterProxyModel *proxy;
|
|
|
|
DiveLocationModel *model;
|
|
|
|
DiveLocationListView *view;
|
|
|
|
};
|
|
|
|
|
2015-05-17 19:13:41 +00:00
|
|
|
#endif
|