From 6fd0087a275f9e66aadfe890cecb84a7cab0ce61 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Thu, 21 Nov 2013 23:52:21 -0200 Subject: 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 Signed-off-by: Dirk Hohndel --- qt-ui/mainwindow.cpp | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) (limited to 'qt-ui') 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 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 infoProfileSizes; + if (infoProfileSizes.empty()){ + infoProfileSizes.append( appW * 0.3 ); + infoProfileSizes.append( appW * 0.7 ); + } + + static QList 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 mainSizes; - mainSizes.append( qApp->desktop()->size().height() * 0.7 ); - mainSizes.append( qApp->desktop()->size().height() * 0.3 ); ui.mainSplitter->setSizes( mainSizes ); - - QList infoProfileSizes; - infoProfileSizes.append( qApp->desktop()->size().width() * 0.3 ); - infoProfileSizes.append( qApp->desktop()->size().width() * 0.7 ); ui.infoProfileSplitter->setSizes(infoProfileSizes); - - QList listGlobeSizes; - listGlobeSizes.append( qApp->desktop()->size().width() * 0.7 ); - listGlobeSizes.append( qApp->desktop()->size().width() * 0.3 ); ui.listGlobeSplitter->setSizes(listGlobeSizes); } redrawProfile(); -- cgit v1.2.3-70-g09d2