summaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-06-26 12:58:47 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-06-26 18:50:22 -0700
commit266e754d08499a4ed45024d4886c4e799e7951e7 (patch)
treeae9b45c8cb8c9803002a1032dc7bc8130986e95a /qt-ui/mainwindow.cpp
parent4c7ce4aa1d5c8de067d7c3161f1bd1f904a6c5a5 (diff)
downloadsubsurface-266e754d08499a4ed45024d4886c4e799e7951e7.tar.gz
Dive site rewrite: remove a ton of code from the LocationManagement
The way I was doing the old location management was very dull: everything was tangled on the mainwindow. Now I think I've found the correct way to create this, and thus, this code can die. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/mainwindow.cpp')
-rw-r--r--qt-ui/mainwindow.cpp33
1 files changed, 1 insertions, 32 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 6acc3eeac..36eba41c9 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -38,7 +38,6 @@
#include "divelogexportdialog.h"
#include "usersurvey.h"
#include "divesitehelpers.h"
-#include "locationinformation.h"
#include "windowtitleupdate.h"
#ifndef NO_USERMANUAL
#include "usermanual.h"
@@ -80,7 +79,6 @@ MainWindow::MainWindow() : QMainWindow(),
PlannerSettingsWidget *plannerSettings = new PlannerSettingsWidget();
DivePlannerWidget *plannerWidget = new DivePlannerWidget();
PlannerDetails *plannerDetails = new PlannerDetails();
- LocationInformationWidget *locationInformation = new LocationInformationWidget();
// what is a sane order for those icons? we should have the ones the user is
// most likely to want towards the top so they are always visible
@@ -109,14 +107,11 @@ MainWindow::MainWindow() : QMainWindow(),
profLayout->addWidget(toolBar);
profLayout->addWidget(profileWidget);
profileContainer->setLayout(profLayout);
- DivePictureWidget *divePictures = new DivePictureWidget(this);
- divePictures->setModel(DivePictureModel::instance());
registerApplicationState("Default", mainTab, profileContainer, diveListView, globeGps );
registerApplicationState("AddDive", mainTab, profileContainer, diveListView, globeGps );
registerApplicationState("EditDive", mainTab, profileContainer, diveListView, globeGps );
registerApplicationState("PlanDive", plannerWidget, profileContainer, plannerSettings, plannerDetails );
registerApplicationState("EditPlannedDive", plannerWidget, profileContainer, diveListView, globeGps );
- registerApplicationState("EditDiveSite",locationInformation, divePictures, diveListView, globeGps );
setApplicationState("Default");
@@ -143,11 +138,6 @@ MainWindow::MainWindow() : QMainWindow(),
connect(DivePlannerPointsModel::instance(), SIGNAL(planCanceled()), this, SLOT(planCanceled()));
connect(plannerDetails->printPlan(), SIGNAL(pressed()), divePlannerWidget(), SLOT(printDecoPlan()));
connect(mainTab, SIGNAL(requestDiveSiteAdd()), this, SLOT(enableDiveSiteCreation()));
- connect(locationInformation, SIGNAL(informationManagementEnded()), this, SLOT(setDefaultState()));
- connect(locationInformation, SIGNAL(informationManagementEnded()), information(), SLOT(showLocation()));
- connect(locationInformation, SIGNAL(coordinatesChanged()), globe(), SLOT(repopulateLabels()));
- connect(locationInformation, SIGNAL(startEditDiveSite(uint32_t)), globeGps, SLOT(prepareForGetDiveCoordinates()));
- connect(locationInformation, SIGNAL(endEditDiveSite()), globeGps, SLOT(prepareForGetDiveCoordinates()));
connect(information(), SIGNAL(diveSiteChanged(uint32_t)), globeGps, SLOT(centerOnDiveSite(uint32_t)));
wtu = new WindowTitleUpdate();
connect(WindowTitleUpdate::instance(), SIGNAL(updateTitle()), this, SLOT(setAutomaticTitle()));
@@ -177,8 +167,6 @@ MainWindow::MainWindow() : QMainWindow(),
divePlannerSettingsWidget()->settingsChanged();
#ifdef NO_MARBLE
ui.menuView->removeAction(ui.actionViewGlobe);
-#else
- connect(globe(), SIGNAL(coordinatesChanged()), locationInformation, SLOT(updateGpsCoordinates()));
#endif
#ifdef NO_USERMANUAL
ui.menuHelp->removeAction(ui.actionUserManual);
@@ -224,24 +212,6 @@ PlannerSettingsWidget *MainWindow::divePlannerSettingsWidget() {
return qobject_cast<PlannerSettingsWidget*>(applicationState["PlanDive"].bottomLeft);
}
-LocationInformationWidget *MainWindow::locationInformationWidget() {
- return qobject_cast<LocationInformationWidget*>(applicationState["EditDiveSite"].topLeft);
-}
-
-void MainWindow::on_actionManage_dive_sites_triggered() {
- enableDiveSiteEdit(displayed_dive.dive_site_uuid);
-}
-
-void MainWindow::enableDiveSiteCreation() {
- locationInformationWidget()->createDiveSite();
- setApplicationState("EditDiveSite");
-}
-
-void MainWindow::enableDiveSiteEdit(uint32_t id) {
- locationInformationWidget()->editDiveSite(id);
- setApplicationState("EditDiveSite");
-}
-
void MainWindow::setDefaultState() {
setApplicationState("Default");
}
@@ -446,8 +416,7 @@ void MainWindow::cleanUpEmpty()
bool MainWindow::okToClose(QString message)
{
if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
- information()->isEditing() ||
- currentApplicationState == "EditDiveSite") {
+ information()->isEditing() ) {
QMessageBox::warning(this, tr("Warning"), message);
return false;
}