remember toolbar areas directly through qsettings

This commit is contained in:
Jean-Francois Dockes 2020-11-11 17:57:13 +01:00
parent dec9968bc5
commit cf2a1258f6
3 changed files with 10 additions and 12 deletions

View File

@ -102,8 +102,6 @@ void rwSettings(bool writing)
SETTING_RW(prefs.showmode, "/Recoll/geometry/showmode", Int, 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);
SETTING_RW(prefs.resArea, "/Recoll/geometry/resArea", Int, 0);
SETTING_RW(prefs.ssearchTypSav, "/Recoll/prefs/ssearchTypSav", Bool, 0);
SETTING_RW(prefs.ssearchTyp, "/Recoll/prefs/simpleSearchTyp", Int, 3);
SETTING_RW(prefs.startWithAdvSearchOpen,

View File

@ -69,8 +69,6 @@ class PrefsPack {
int showmode{SHOW_NORMAL};
int pvwidth; // Preview window geom
int pvheight;
int toolArea; // Area for "tools" toolbar
int resArea; // Area for "results" toolbar
bool ssearchTypSav; // Remember last search mode (else always
// start with same)
int ssearchTyp{0};

View File

@ -74,7 +74,8 @@
using std::pair;
QString g_stringAllStem, g_stringNoStem;
static const char *settingskey_toolarea="/Recoll/geometry/toolArea";
static const char *settingskey_resarea="/Recoll/geometry/resArea";
static Qt::ToolBarArea int2area(int in)
{
switch (in) {
@ -204,11 +205,14 @@ void RclMain::init()
m_toolsTB->addAction(toolsDoc_HistoryAction);
m_toolsTB->addAction(toolsSpellAction);
m_toolsTB->addAction(actionQuery_Fragments);
this->addToolBar(int2area(prefs.toolArea), m_toolsTB);
QSettings settings;
int val = settings.value(settingskey_toolarea).toInt();
this->addToolBar(int2area(val), m_toolsTB);
m_resTB = new QToolBar(tr("Results"), this);
m_resTB->setObjectName(QString::fromUtf8("m_resTB"));
this->addToolBar(int2area(prefs.resArea), m_resTB);
val = settings.value(settingskey_resarea).toInt();
this->addToolBar(int2area(val), m_resTB);
// Document filter buttons and combobox
// Combobox version of the document filter control
@ -448,7 +452,6 @@ void RclMain::init()
onSortDataChanged(m_sortspec);
emit sortDataChanged(m_sortspec);
}
QSettings settings;
restoreGeometry(settings.value("/Recoll/geometry/maingeom").toByteArray());
enableTrayIcon(prefs.showTrayIcon);
@ -732,13 +735,12 @@ void RclMain::fileExit()
// Don't save geometry if we're currently maximized. At least under X11
// this saves the maximized size. otoh isFullscreen() does not seem needed
QSettings settings;
if (!isMaximized()) {
QSettings settings;
settings.setValue("/Recoll/geometry/maingeom", saveGeometry());
}
prefs.toolArea = toolBarArea(m_toolsTB);
prefs.resArea = toolBarArea(m_resTB);
settings.setValue(settingskey_toolarea, toolBarArea(m_toolsTB));
settings.setValue(settingskey_resarea, toolBarArea(m_resTB));
restable->saveColState();
if (prefs.ssearchTypSav) {