aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tcanabrava@kde.org>2013-11-21 23:52:21 -0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-11-22 07:35:10 -0800
commit6fd0087a275f9e66aadfe890cecb84a7cab0ce61 (patch)
tree29861dad4c3160609b6e41b7fb2377180a4b74d4
parent7ed2fde7787185df6d6635466866f29a86d1f250 (diff)
downloadsubsurface-6fd0087a275f9e66aadfe890cecb84a7cab0ce61.tar.gz
Show user-hidden widget when choosing Show All
A user could have hiddden and lost any of the four panels on the interface. Now when he chooses 'show all', if a part of the interface is hidden, it will be shown again. Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--qt-ui/mainwindow.cpp37
1 files changed, 26 insertions, 11 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index 1f3d7def9..df108f3d0 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -396,26 +396,41 @@ void MainWindow::on_actionViewGlobe_triggered()
void MainWindow::on_actionViewAll_triggered()
{
beginChangeState(VIEWALL);
+ static QList<int> mainSizes;
+ const int appH = qApp->desktop()->size().height();
+ const int appW = qApp->desktop()->size().width();
+ if (mainSizes.empty()){
+ mainSizes.append( appH * 0.7 );
+ mainSizes.append( appH * 0.3 );
+ }
+ static QList<int> infoProfileSizes;
+ if (infoProfileSizes.empty()){
+ infoProfileSizes.append( appW * 0.3 );
+ infoProfileSizes.append( appW * 0.7 );
+ }
+
+ static QList<int> listGlobeSizes;
+ if(listGlobeSizes.empty()){
+ listGlobeSizes.append( appW * 0.7 );
+ listGlobeSizes.append( appW * 0.3 );
+ }
+
QSettings settings;
settings.beginGroup("MainWindow");
if (settings.value("mainSplitter").isValid()){
ui.mainSplitter->restoreState(settings.value("mainSplitter").toByteArray());
ui.infoProfileSplitter->restoreState(settings.value("infoProfileSplitter").toByteArray());
ui.listGlobeSplitter->restoreState(settings.value("listGlobeSplitter").toByteArray());
+ if(ui.mainSplitter->sizes().first() == 0 || ui.mainSplitter->sizes().last() == 0)
+ ui.mainSplitter->setSizes(mainSizes);
+ if(ui.infoProfileSplitter->sizes().first() == 0 || ui.infoProfileSplitter->sizes().last() == 0)
+ ui.infoProfileSplitter->setSizes(infoProfileSizes);
+ if(ui.listGlobeSplitter->sizes().first() == 0 || ui.listGlobeSplitter->sizes().last() == 0)
+ ui.listGlobeSplitter->setSizes(listGlobeSizes);
+
} else {
- QList<int> mainSizes;
- mainSizes.append( qApp->desktop()->size().height() * 0.7 );
- mainSizes.append( qApp->desktop()->size().height() * 0.3 );
ui.mainSplitter->setSizes( mainSizes );
-
- QList<int> infoProfileSizes;
- infoProfileSizes.append( qApp->desktop()->size().width() * 0.3 );
- infoProfileSizes.append( qApp->desktop()->size().width() * 0.7 );
ui.infoProfileSplitter->setSizes(infoProfileSizes);
-
- QList<int> listGlobeSizes;
- listGlobeSizes.append( qApp->desktop()->size().width() * 0.7 );
- listGlobeSizes.append( qApp->desktop()->size().width() * 0.3 );
ui.listGlobeSplitter->setSizes(listGlobeSizes);
}
redrawProfile();