aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2015-02-09 18:27:59 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-10 10:45:45 -0800
commitcf4d55c4702ded9d57fa7d6aeeebd0bfb2476a29 (patch)
treebd50d1e2fb20f0d2251fa6cf620149f953031d7f /qt-ui/mainwindow.cpp
parentc69aab04f4d548a4e640bccba1e6d91770b7811d (diff)
downloadsubsurface-cf4d55c4702ded9d57fa7d6aeeebd0bfb2476a29.tar.gz
Remove the DiveList from the mainwindow.ui
It's now set up from the mainwindow.cpp file. 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.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index a993667f9..64f31ccf8 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -12,6 +12,7 @@
#include <QShortcut>
#include <QToolBar>
#include "ssrf-version.h"
+#include "divelistview.h"
#include "downloadfromdivecomputer.h"
#include "preferences.h"
#include "subsurfacewebservices.h"
@@ -79,10 +80,10 @@ MainWindow::MainWindow() : QMainWindow(),
if (!QIcon::hasThemeIcon("window-close")) {
QIcon::setThemeName("subsurface");
}
- connect(ui.ListWidget, SIGNAL(currentDiveChanged(int)), this, SLOT(current_dive_changed(int)));
+ connect(dive_list(), SIGNAL(currentDiveChanged(int)), this, SLOT(current_dive_changed(int)));
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(readSettings()));
- connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.ListWidget, SLOT(update()));
- connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.ListWidget, SLOT(reloadHeaderActions()));
+ 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()), ui.divePlannerWidget, SLOT(settingsChanged()));
connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), ui.plannerSettingsWidget, SLOT(settingsChanged()));
@@ -105,12 +106,12 @@ MainWindow::MainWindow() : QMainWindow(),
ui.newProfile->setEmptyState();
initialUiSetup();
readSettings();
- ui.ListWidget->reload(DiveTripModel::TREE);
- ui.ListWidget->reloadHeaderActions();
- ui.ListWidget->setFocus();
+ diveListView->reload(DiveTripModel::TREE);
+ diveListView->reloadHeaderActions();
+ diveListView->setFocus();
ui.globe->reload();
- ui.ListWidget->expand(ui.ListWidget->model()->index(0, 0));
- ui.ListWidget->scrollTo(ui.ListWidget->model()->index(0, 0), QAbstractItemView::PositionAtCenter);
+ diveListView->expand(dive_list()->model()->index(0, 0));
+ diveListView->scrollTo(dive_list()->model()->index(0, 0), QAbstractItemView::PositionAtCenter);
ui.divePlannerWidget->settingsChanged();
ui.plannerSettingsWidget->settingsChanged();
#ifdef NO_MARBLE
@@ -207,8 +208,8 @@ void MainWindow::refreshDisplay(bool doRecreateDiveList)
ui.globePane->hide();
#endif
ui.globePane->setCurrentIndex(0);
- ui.ListWidget->setEnabled(true);
- ui.ListWidget->setFocus();
+ dive_list()->setEnabled(true);
+ dive_list()->setFocus();
WSInfoModel::instance()->updateInfo();
if (amount_selected == 0)
cleanUpEmpty();
@@ -216,7 +217,7 @@ void MainWindow::refreshDisplay(bool doRecreateDiveList)
void MainWindow::recreateDiveList()
{
- ui.ListWidget->reload(DiveTripModel::CURRENT);
+ dive_list()->reload(DiveTripModel::CURRENT);
TagFilterModel::instance()->repopulate();
BuddyFilterModel::instance()->repopulate();
LocationFilterModel::instance()->repopulate();
@@ -283,7 +284,7 @@ void MainWindow::cleanUpEmpty()
ui.InfoWidget->clearEquipment();
ui.InfoWidget->updateDiveInfo(true);
ui.newProfile->setEmptyState();
- ui.ListWidget->reload(DiveTripModel::TREE);
+ dive_list()->reload(DiveTripModel::TREE);
ui.globe->reload();
if (!existing_filename)
setTitle(MWTF_DEFAULT);
@@ -1013,7 +1014,7 @@ void MainWindow::closeEvent(QCloseEvent *event)
DiveListView *MainWindow::dive_list()
{
- return ui.ListWidget;
+ return qobject_cast<DiveListView*>(applicationState["Default"].bottomLeft);
}
GlobeGPS *MainWindow::globe()