diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index 89b851aab..3e001166c 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -8,7 +8,9 @@ #include "filtermodels.h" #include "modeldelegates.h" #include "mainwindow.h" +#include "divepicturewidget.h" #include +#include #include #include "qthelper.h" #include "undobuffer.h" diff --git a/qt-ui/globe.cpp b/qt-ui/globe.cpp index 6bfd98734..a8586ebd0 100644 --- a/qt-ui/globe.cpp +++ b/qt-ui/globe.cpp @@ -3,7 +3,11 @@ #include "mainwindow.h" #include "helpers.h" #include "divelistview.h" +#include "maintab.h" + #include +#include +#include #include #include diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 34ec20fe4..48cc23e4a 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -22,6 +22,7 @@ #include "planner.h" #include "filtermodels.h" #include "globe.h" +#include "maintab.h" #ifndef NO_PRINTING #include #include "printdialog.h" @@ -85,7 +86,7 @@ MainWindow::MainWindow() : QMainWindow(), connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(readSettings())); connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), diveListView, SLOT(update())); connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), diveListView, SLOT(reloadHeaderActions())); - connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.InfoWidget, SLOT(updateDiveInfo())); + connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), information(), SLOT(updateDiveInfo())); connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.divePlannerWidget, SLOT(settingsChanged())); connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.plannerSettingsWidget, SLOT(settingsChanged())); connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), TankInfoModel::instance(), SLOT(update())); @@ -119,7 +120,7 @@ MainWindow::MainWindow() : QMainWindow(), ui.globePane->hide(); ui.menuView->removeAction(ui.actionViewGlobe); #else - connect(globe(), SIGNAL(coordinatesChanged()), ui.InfoWidget, SLOT(updateGpsCoordinates())); + connect(globe(), SIGNAL(coordinatesChanged()), information(), SLOT(updateGpsCoordinates())); #endif #ifdef NO_USERMANUAL ui.menuHelp->removeAction(ui.actionUserManual); @@ -199,7 +200,7 @@ MainWindow *MainWindow::instance() void MainWindow::refreshDisplay(bool doRecreateDiveList) { showError(get_error_string()); - ui.InfoWidget->reload(); + information()->reload(); TankInfoModel::instance()->update(); globe()->reload(); if (doRecreateDiveList) @@ -232,7 +233,7 @@ void MainWindow::current_dive_changed(int divenr) globe()->centerOnCurrentDive(); } ui.newProfile->plotDive(); - ui.InfoWidget->updateDiveInfo(); + information()->updateDiveInfo(); } void MainWindow::on_actionNew_triggered() @@ -280,10 +281,10 @@ ProfileWidget2 *MainWindow::graphics() const void MainWindow::cleanUpEmpty() { - ui.InfoWidget->clearStats(); - ui.InfoWidget->clearInfo(); - ui.InfoWidget->clearEquipment(); - ui.InfoWidget->updateDiveInfo(true); + information()->clearStats(); + information()->clearInfo(); + information()->clearEquipment(); + information()->updateDiveInfo(true); ui.newProfile->setEmptyState(); dive_list()->reload(DiveTripModel::TREE); globe()->reload(); @@ -295,7 +296,7 @@ void MainWindow::cleanUpEmpty() bool MainWindow::okToClose(QString message) { if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING || - ui.InfoWidget->isEditing()) { + information()->isEditing()) { QMessageBox::warning(this, tr("Warning"), message); return false; } @@ -394,9 +395,9 @@ void MainWindow::on_actionPreferences_triggered() void MainWindow::on_actionQuit_triggered() { - if (ui.InfoWidget->isEditing()) { - ui.InfoWidget->rejectChanges(); - if (ui.InfoWidget->isEditing()) + if (information()->isEditing()) { + information()->rejectChanges(); + if (information()->isEditing()) // didn't discard the edits return; } @@ -442,7 +443,7 @@ void MainWindow::on_actionEditDeviceNames_triggered() bool MainWindow::plannerStateClean() { if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING || - ui.InfoWidget->isEditing()) { + information()->isEditing()) { QMessageBox::warning(this, tr("Warning"), tr("Please save or cancel the current dive edit before trying to add a dive.")); return false; } @@ -472,7 +473,7 @@ void MainWindow::planCreated() set_dive_nr_for_current_dive(); } // make sure our UI is in a consistent state - ui.InfoWidget->updateDiveInfo(); + information()->updateDiveInfo(); showProfile(); refreshDisplay(); } @@ -578,12 +579,12 @@ void MainWindow::on_actionAddDive_triggered() setupForAddAndPlan("manually added dive"); // don't translate, stored in the XML file // now show the mostly empty main tab - ui.InfoWidget->updateDiveInfo(); + information()->updateDiveInfo(); // show main tab - ui.InfoWidget->setCurrentIndex(0); + information()->setCurrentIndex(0); - ui.InfoWidget->addDiveStarted(); + information()->addDiveStarted(); ui.infoPane->setCurrentIndex(MAINTAB); ui.newProfile->setAddState(); @@ -744,7 +745,7 @@ void MainWindow::on_actionPreviousDC_triggered() unsigned nrdc = number_of_computers(current_dive); dc_number = (dc_number + nrdc - 1) % nrdc; ui.newProfile->plotDive(); - ui.InfoWidget->updateDiveInfo(); + information()->updateDiveInfo(); } void MainWindow::on_actionNextDC_triggered() @@ -752,7 +753,7 @@ void MainWindow::on_actionNextDC_triggered() unsigned nrdc = number_of_computers(current_dive); dc_number = (dc_number + 1) % nrdc; ui.newProfile->plotDive(); - ui.InfoWidget->updateDiveInfo(); + information()->updateDiveInfo(); } void MainWindow::on_actionFullScreen_triggered(bool checked) @@ -986,7 +987,7 @@ void MainWindow::writeSettings() void MainWindow::closeEvent(QCloseEvent *event) { if (DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING || - ui.InfoWidget->isEditing()) { + information()->isEditing()) { on_actionQuit_triggered(); event->ignore(); return; @@ -1025,7 +1026,7 @@ GlobeGPS *MainWindow::globe() MainTab *MainWindow::information() { - return ui.InfoWidget; + return qobject_cast(applicationState["Default"].topLeft); } void MainWindow::loadRecentFiles(QSettings *s) @@ -1200,8 +1201,8 @@ int MainWindow::file_save_as(void) if (filename.isNull() || filename.isEmpty()) return report_error("No filename to save into"); - if (ui.InfoWidget->isEditing()) - ui.InfoWidget->acceptChanges(); + if (information()->isEditing()) + information()->acceptChanges(); if (save_dives(filename.toUtf8().data())) { showError(get_error_string()); @@ -1223,8 +1224,8 @@ int MainWindow::file_save(void) if (!existing_filename) return file_save_as(); - if (ui.InfoWidget->isEditing()) - ui.InfoWidget->acceptChanges(); + if (information()->isEditing()) + information()->acceptChanges(); current_default = prefs.default_filename; if (strcmp(existing_filename, current_default) == 0) { @@ -1392,7 +1393,7 @@ void MainWindow::editCurrentDive() ui.newProfile->setAddState(); ui.infoPane->setCurrentIndex(MAINTAB); DivePlannerPointsModel::instance()->loadFromDive(d); - ui.InfoWidget->enableEdition(MainTab::MANUALLY_ADDED_DIVE); + information()->enableEdition(MainTab::MANUALLY_ADDED_DIVE); } else if (defaultDC == "planned dive") { disableShortcuts(); DivePlannerPointsModel::instance()->setPlanMode(DivePlannerPointsModel::PLAN); @@ -1402,7 +1403,7 @@ void MainWindow::editCurrentDive() //ui.stackedWidget->setCurrentIndex(PLANNERPROFILE); // Planner. ui.infoPane->setCurrentIndex(PLANNERWIDGET); DivePlannerPointsModel::instance()->loadFromDive(d); - ui.InfoWidget->enableEdition(MainTab::MANUALLY_ADDED_DIVE); + information()->enableEdition(MainTab::MANUALLY_ADDED_DIVE); } } @@ -1477,7 +1478,7 @@ void MainWindow::on_paste_triggered() { // take the data in our copyPasteDive and apply it to selected dives selective_copy_dive(©PasteDive, &displayed_dive, what, false); - ui.InfoWidget->showAndTriggerEditSelective(what); + information()->showAndTriggerEditSelective(what); } void MainWindow::on_actionFilterTags_triggered() diff --git a/qt-ui/mainwindow.ui b/qt-ui/mainwindow.ui index 44b9a0b06..dfb58129b 100644 --- a/qt-ui/mainwindow.ui +++ b/qt-ui/mainwindow.ui @@ -36,9 +36,6 @@ 0 - - - @@ -833,12 +830,6 @@ p, li { white-space: pre-wrap; }
kmessagewidget.h
1 - - MainTab - QWidget -
qt-ui/maintab.h
- 1 -
DivePlannerWidget QWidget diff --git a/qt-ui/modeldelegates.cpp b/qt-ui/modeldelegates.cpp index d60b0ea93..415cedb2c 100644 --- a/qt-ui/modeldelegates.cpp +++ b/qt-ui/modeldelegates.cpp @@ -3,8 +3,10 @@ #include "gettextfromc.h" #include "mainwindow.h" #include "models.h" +#include "starwidget.h" #include +#include QSize DiveListDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const { diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp index c14561638..7384e5a65 100644 --- a/qt-ui/profile/diveprofileitem.cpp +++ b/qt-ui/profile/diveprofileitem.cpp @@ -9,6 +9,7 @@ #include "helpers.h" #include "libdivecomputer/parser.h" #include "mainwindow.h" +#include "maintab.h" #include diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index 89ab62db7..792ec104a 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -10,7 +10,9 @@ #include "ruleritem.h" #include "tankitem.h" #include "pref.h" +#include "divepicturewidget.h" #include "models.h" +#include "maintab.h" #include #include @@ -18,6 +20,7 @@ #include #include #include +#include #ifndef QT_NO_DEBUG #include diff --git a/qt-ui/simplewidgets.cpp b/qt-ui/simplewidgets.cpp index 42f00fbb0..6d7ce67d0 100644 --- a/qt-ui/simplewidgets.cpp +++ b/qt-ui/simplewidgets.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include "file.h" #include "mainwindow.h" diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp index de1925374..04dde3a0f 100644 --- a/qt-ui/subsurfacewebservices.cpp +++ b/qt-ui/subsurfacewebservices.cpp @@ -4,6 +4,7 @@ #include "usersurvey.h" #include "divelist.h" #include "globe.h" +#include "maintab.h" #include diff --git a/qt-ui/tagwidget.cpp b/qt-ui/tagwidget.cpp index 8365a2ea7..3b61b492a 100644 --- a/qt-ui/tagwidget.cpp +++ b/qt-ui/tagwidget.cpp @@ -1,5 +1,6 @@ #include "tagwidget.h" #include "mainwindow.h" +#include "maintab.h" #include TagWidget::TagWidget(QWidget *parent) : GroupedLineEdit(parent), m_completer(NULL), lastFinishedTag(false)