Qt main window: use save/restoreGeometry() instead of just height/width
This commit is contained in:
parent
25a5f3a7e0
commit
6df64eb9f9
@ -75,9 +75,7 @@ void rwSettings(bool writing)
|
|||||||
LOGDEB1("rwSettings: write " << writing << "\n");
|
LOGDEB1("rwSettings: write " << writing << "\n");
|
||||||
if (writing && !havereadsettings)
|
if (writing && !havereadsettings)
|
||||||
return;
|
return;
|
||||||
QSettings settings("Recoll.org", "recoll");
|
QSettings settings;
|
||||||
SETTING_RW(prefs.mainwidth, "/Recoll/geometry/width", Int, 0);
|
|
||||||
SETTING_RW(prefs.mainheight, "/Recoll/geometry/height", Int, 0);
|
|
||||||
SETTING_RW(prefs.showmode, "/Recoll/geometry/showmode", Int, 0);
|
SETTING_RW(prefs.showmode, "/Recoll/geometry/showmode", Int, 0);
|
||||||
SETTING_RW(prefs.pvwidth, "/Recoll/geometry/pvwidth", Int, 0);
|
SETTING_RW(prefs.pvwidth, "/Recoll/geometry/pvwidth", Int, 0);
|
||||||
SETTING_RW(prefs.pvheight, "/Recoll/geometry/pvheight", Int, 0);
|
SETTING_RW(prefs.pvheight, "/Recoll/geometry/pvheight", Int, 0);
|
||||||
|
|||||||
@ -64,8 +64,6 @@ class PrefsPack {
|
|||||||
QString qssFile;
|
QString qssFile;
|
||||||
QString snipCssFile;
|
QString snipCssFile;
|
||||||
QString queryStemLang;
|
QString queryStemLang;
|
||||||
int mainwidth;
|
|
||||||
int mainheight;
|
|
||||||
enum ShowMode {SHOW_NORMAL, SHOW_MAX, SHOW_FULL};
|
enum ShowMode {SHOW_NORMAL, SHOW_MAX, SHOW_FULL};
|
||||||
int showmode{SHOW_NORMAL};
|
int showmode{SHOW_NORMAL};
|
||||||
int pvwidth; // Preview window geom
|
int pvwidth; // Preview window geom
|
||||||
|
|||||||
@ -375,11 +375,6 @@ int main(int argc, char **argv)
|
|||||||
RclMain w;
|
RclMain w;
|
||||||
mainWindow = &w;
|
mainWindow = &w;
|
||||||
|
|
||||||
if (prefs.mainwidth > 100) {
|
|
||||||
QSize s(prefs.mainwidth, prefs.mainheight);
|
|
||||||
mainWindow->resize(s);
|
|
||||||
}
|
|
||||||
|
|
||||||
string dbdir = theconfig->getDbDir();
|
string dbdir = theconfig->getDbDir();
|
||||||
if (dbdir.empty()) {
|
if (dbdir.empty()) {
|
||||||
QMessageBox::critical(
|
QMessageBox::critical(
|
||||||
|
|||||||
@ -41,6 +41,7 @@
|
|||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QProgressDialog>
|
#include <QProgressDialog>
|
||||||
#include <QToolBar>
|
#include <QToolBar>
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
#include "recoll.h"
|
#include "recoll.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
@ -435,6 +436,8 @@ void RclMain::init()
|
|||||||
onSortDataChanged(m_sortspec);
|
onSortDataChanged(m_sortspec);
|
||||||
emit sortDataChanged(m_sortspec);
|
emit sortDataChanged(m_sortspec);
|
||||||
}
|
}
|
||||||
|
QSettings settings;
|
||||||
|
restoreGeometry(settings.value("/Recoll/geometry/maingeom").toByteArray());
|
||||||
|
|
||||||
enableTrayIcon(prefs.showTrayIcon);
|
enableTrayIcon(prefs.showTrayIcon);
|
||||||
|
|
||||||
@ -660,11 +663,9 @@ void RclMain::fileExit()
|
|||||||
if (m_trayicon) {
|
if (m_trayicon) {
|
||||||
m_trayicon->setVisible(false);
|
m_trayicon->setVisible(false);
|
||||||
}
|
}
|
||||||
// Don't save geometry if we're currently fullscreened
|
|
||||||
if (!isFullScreen() && !isMaximized()) {
|
QSettings settings;
|
||||||
prefs.mainwidth = width();
|
settings.setValue("/Recoll/geometry/maingeom", saveGeometry());
|
||||||
prefs.mainheight = height();
|
|
||||||
}
|
|
||||||
|
|
||||||
prefs.toolArea = toolBarArea(m_toolsTB);
|
prefs.toolArea = toolBarArea(m_toolsTB);
|
||||||
prefs.resArea = toolBarArea(m_resTB);
|
prefs.resArea = toolBarArea(m_resTB);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user