summaryrefslogtreecommitdiffstats
path: root/qt-ui
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-12 02:04:20 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-12 11:19:27 -0800
commit0e6345f65b041b5005c75b83792ca98d8ef4f766 (patch)
treeb0ec0df52a744e579be05442cab5da61d2329774 /qt-ui
parent5c4d2660604af8925b757025571a8dcc36da1cdc (diff)
downloadsubsurface-0e6345f65b041b5005c75b83792ca98d8ef4f766.tar.gz
Correctly connect the maintab to dive site management
We now have a working uuid - use it. And populate the fields accordingly. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r--qt-ui/maintab.cpp5
-rw-r--r--qt-ui/maintab.h2
-rw-r--r--qt-ui/mainwindow.cpp7
-rw-r--r--qt-ui/mainwindow.h2
-rw-r--r--qt-ui/simplewidgets.cpp13
-rw-r--r--qt-ui/simplewidgets.h5
6 files changed, 15 insertions, 19 deletions
diff --git a/qt-ui/maintab.cpp b/qt-ui/maintab.cpp
index ab691a4b4..b0c2009d3 100644
--- a/qt-ui/maintab.cpp
+++ b/qt-ui/maintab.cpp
@@ -214,10 +214,9 @@ MainTab::~MainTab()
}
void MainTab::prepareDiveSiteEdit() {
- //TODO: GET THE CORRECT DIVESITE UUID HERE
- QUuid id = QUuid::createUuid();
- emit requestDiveSiteEdit(id);
+ emit requestDiveSiteEdit(displayed_dive.dive_site_uuid);
}
+
void MainTab::toggleTriggeredColumn()
{
QAction *action = qobject_cast<QAction *>(sender());
diff --git a/qt-ui/maintab.h b/qt-ui/maintab.h
index c90b0fb09..505fa6f21 100644
--- a/qt-ui/maintab.h
+++ b/qt-ui/maintab.h
@@ -56,7 +56,7 @@ public:
signals:
void addDiveFinished();
void dateTimeChanged();
- void requestDiveSiteEdit(QUuid diveSiteId);
+ void requestDiveSiteEdit(uint32_t uuid);
public
slots:
void addCylinder_clicked();
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index eca4c08f8..30ab5e5df 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -111,7 +111,7 @@ MainWindow::MainWindow() : QMainWindow(),
connect(DivePlannerPointsModel::instance(), SIGNAL(planCreated()), this, SLOT(planCreated()));
connect(DivePlannerPointsModel::instance(), SIGNAL(planCanceled()), this, SLOT(planCanceled()));
connect(plannerDetails->printPlan(), SIGNAL(pressed()), divePlannerWidget(), SLOT(printDecoPlan()));
- connect(mainTab, SIGNAL(requestDiveSiteEdit(QUuid)), this, SLOT(enableDiveSiteEdit(QUuid)));
+ connect(mainTab, SIGNAL(requestDiveSiteEdit(uint32_t)), this, SLOT(enableDiveSiteEdit(uint32_t)));
connect(locationInformation, SIGNAL(informationManagementEnded()), this, SLOT(setDefaultState()));
#ifdef NO_PRINTING
ui.printPlan->hide();
@@ -214,9 +214,8 @@ LocationInformationWidget *MainWindow::locationInformationWidget() {
return qobject_cast<LocationInformationWidget*>(applicationState["EditDiveSite"].topLeft);
}
-void MainWindow::enableDiveSiteEdit(QUuid id) {
- locationInformationWidget()->setLocationName(current_dive->location);
- locationInformationWidget()->setLocationCoords(printGPSCoords(current_dive->latitude.udeg, current_dive->longitude.udeg));
+void MainWindow::enableDiveSiteEdit(uint32_t id) {
+ locationInformationWidget()->setLocationId(id);
setApplicationState("EditDiveSite");
}
diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h
index ef3e8fa18..85a63123b 100644
--- a/qt-ui/mainwindow.h
+++ b/qt-ui/mainwindow.h
@@ -160,7 +160,7 @@ slots:
void on_paste_triggered();
void on_actionFilterTags_triggered();
void on_actionConfigure_Dive_Computer_triggered();
- void enableDiveSiteEdit(QUuid id);
+ void enableDiveSiteEdit(uint32_t id);
void setDefaultState();
protected:
diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp
index c7dd47c6d..756251b51 100644
--- a/qt-ui/simplewidgets.cpp
+++ b/qt-ui/simplewidgets.cpp
@@ -665,14 +665,13 @@ LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBo
ui.diveSiteMessage->addAction(action);
}
-void LocationInformationWidget::setLocationName(const QString& name)
+void LocationInformationWidget::setLocationId(uint32_t uuid)
{
- ui.diveSiteName->setText(name);
-}
-
-void LocationInformationWidget::setLocationCoords(const QString& coords)
-{
- ui.diveSiteCoordinates->setText(coords);
+ currentDs = get_dive_site_by_uuid(uuid);
+ ui.diveSiteName->setText(currentDs->name);
+ ui.diveSiteDescription->setText(currentDs->description);
+ ui.diveSiteNotes->setPlainText(currentDs->notes);
+ ui.diveSiteCoordinates->setText(printGPSCoords(currentDs->latitude.udeg, currentDs->longitude.udeg));
}
void LocationInformationWidget::acceptChanges()
diff --git a/qt-ui/simplewidgets.h b/qt-ui/simplewidgets.h
index 24af171a7..9cedb8ad5 100644
--- a/qt-ui/simplewidgets.h
+++ b/qt-ui/simplewidgets.h
@@ -228,14 +228,13 @@ public slots:
void showEvent(QShowEvent *);
- /* change that to setLocationSite(QUuid diveSiteUid or something later */
- void setLocationName(const QString& name);
- void setLocationCoords(const QString& coords);
+ void setLocationId(uint32_t uuid);
signals:
void informationManagementEnded();
private:
+ struct dive_site *currentDs;
Ui::LocationInformation ui;
};