diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2013-06-13 19:56:36 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2013-06-13 19:56:36 +0200 |
commit | e34da61362c0a64b8fd932c3363421c766595d4a (patch) | |
tree | a1e71824e9e94eafd791c0c005b78371fa7dc1e5 /qt-ui/mainwindow.cpp | |
parent | 863c48593949e91beb6b7ff02a1385b9977182f5 (diff) | |
parent | 7e9d6e28297432d4a15721a49a9dd0c0d067ce7e (diff) | |
download | subsurface-e34da61362c0a64b8fd932c3363421c766595d4a.tar.gz |
Merge branch 'linusDiveList' of https://github.com/tcanabrava/subsurface
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/mainwindow.cpp')
-rw-r--r-- | qt-ui/mainwindow.cpp | 52 |
1 files changed, 32 insertions, 20 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 339996845..8b216bd8c 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -240,44 +240,54 @@ void MainWindow::on_actionYearlyStatistics_triggered() qDebug("actionYearlyStatistics"); } +/** + * So, here's the deal. + * We have a few QSplitters that takes care of helping us with the + * size of a few widgets, they are ok, and we should continue using them + * to manage the visibility of them too. But the way that we did before was to + * widget->hide(); something, and if you hided something using the splitter, + * by holding it's handle and collapsing the widget, then you used the 'ctrl+number' + * shortcut to show it, it whould only show a gray panel. + * + * This patch makes everything behave using the splitters. + */ + +#define BEHAVIOR QList<int>() void MainWindow::on_actionViewList_triggered() { - ui->InfoWidget->setVisible(false); - ui->ListWidget->setVisible(true); - ui->ProfileWidget->setVisible(false); - ui->globe->setVisible(false); + ui->listGlobeSplitter->setSizes( BEHAVIOR << EXPANDED << COLLAPSED); + ui->mainSplitter->setSizes( BEHAVIOR << COLLAPSED << EXPANDED); } void MainWindow::on_actionViewProfile_triggered() { - ui->InfoWidget->setVisible(false); - ui->ListWidget->setVisible(false); - ui->ProfileWidget->setVisible(true); - ui->globe->setVisible(false); + ui->infoProfileSplitter->setSizes(BEHAVIOR << COLLAPSED << EXPANDED); + ui->mainSplitter->setSizes( BEHAVIOR << EXPANDED << COLLAPSED); } void MainWindow::on_actionViewInfo_triggered() { - ui->InfoWidget->setVisible(true); - ui->ListWidget->setVisible(false); - ui->ProfileWidget->setVisible(false); - ui->globe->setVisible(false); + ui->infoProfileSplitter->setSizes(BEHAVIOR << EXPANDED << COLLAPSED); + ui->mainSplitter->setSizes( BEHAVIOR << EXPANDED << COLLAPSED); } void MainWindow::on_actionViewGlobe_triggered() { - ui->InfoWidget->setVisible(false); - ui->ListWidget->setVisible(false); - ui->ProfileWidget->setVisible(false); - ui->globe->setVisible(true); + ui->infoProfileSplitter->setSizes(BEHAVIOR << COLLAPSED << EXPANDED); + ui->mainSplitter->setSizes( BEHAVIOR << COLLAPSED << EXPANDED); } +#undef BEHAVIOR void MainWindow::on_actionViewAll_triggered() { - ui->InfoWidget->setVisible(true); - ui->ListWidget->setVisible(true); - ui->ProfileWidget->setVisible(true); - ui->globe->setVisible(true); + // big number squash the info profile to it's minimum. + ui->infoProfileSplitter->setSizes(QList<int>() << 1 << 20000); + + // big number squash the globe view. + ui->listGlobeSplitter->setSizes(QList<int>() << 2000 << 1 ); + + // half and half? + ui->mainSplitter->setSizes( QList<int>() << 1 << 1); } void MainWindow::on_actionPreviousDC_triggered() @@ -417,6 +427,7 @@ void MainWindow::initialUiSetup() resize(sz); ui->mainSplitter->restoreState(settings.value("mainSplitter").toByteArray()); ui->infoProfileSplitter->restoreState(settings.value("infoProfileSplitter").toByteArray()); + ui->listGlobeSplitter->restoreState(settings.value("listGlobeSplitter").toByteArray()); settings.endGroup(); settings.beginGroup("ListWidget"); @@ -508,6 +519,7 @@ void MainWindow::writeSettings() settings.setValue("size",size()); settings.setValue("mainSplitter", ui->mainSplitter->saveState()); settings.setValue("infoProfileSplitter", ui->infoProfileSplitter->saveState()); + settings.setValue("listGlobeSplitter", ui->listGlobeSplitter->saveState()); settings.endGroup(); settings.beginGroup("ListWidget"); |