GUI: remember and manage maximized state

This commit is contained in:
Jean-Francois Dockes 2019-02-14 15:31:28 +01:00
parent 9a0ea1da06
commit 30d2c0f6c6
4 changed files with 10 additions and 2 deletions

View File

@ -79,6 +79,7 @@ void rwSettings(bool writing)
QSettings settings("Recoll.org", "recoll");
SETTING_RW(prefs.mainwidth, "/Recoll/geometry/width", Int, 0);
SETTING_RW(prefs.mainheight, "/Recoll/geometry/height", Int, 0);
SETTING_RW(prefs.maximized, "/Recoll/geometry/maximized", Bool, 0);
SETTING_RW(prefs.pvwidth, "/Recoll/geometry/pvwidth", Int, 0);
SETTING_RW(prefs.pvheight, "/Recoll/geometry/pvheight", Int, 0);
SETTING_RW(prefs.toolArea, "/Recoll/geometry/toolArea", Int, 0);

View File

@ -68,6 +68,7 @@ class PrefsPack {
QString queryStemLang;
int mainwidth;
int mainheight;
bool maximized{false};
int pvwidth; // Preview window geom
int pvheight;
int toolArea; // Area for "tools" toolbar

View File

@ -375,7 +375,11 @@ int main(int argc, char **argv)
maybeOpenDb(reason);
mainWindow->show();
if (prefs.maximized) {
mainWindow->showMaximized();
} else {
mainWindow->show();
}
QTimer::singleShot(0, mainWindow, SLOT(initDbOpen()));
// Connect exit handlers etc.. Beware, apparently this must come

View File

@ -646,10 +646,12 @@ void RclMain::fileExit()
{
LOGDEB("RclMain: fileExit\n");
// Don't save geometry if we're currently fullscreened
if (!isFullScreen()) {
if (!isFullScreen() && !isMaximized()) {
prefs.mainwidth = width();
prefs.mainheight = height();
}
prefs.maximized = isMaximized();
prefs.toolArea = toolBarArea(m_toolsTB);
prefs.resArea = toolBarArea(m_resTB);
restable->saveColState();