remember toolbar placement area between sessions

This commit is contained in:
Jean-Francois Dockes 2014-05-27 11:57:24 +02:00
parent bd46735d9c
commit ba9543ac3c
3 changed files with 20 additions and 2 deletions

View File

@ -72,6 +72,8 @@ void rwSettings(bool writing)
SETTING_RW(prefs.mainheight, "/Recoll/geometry/height", 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.ssearchTyp, "/Recoll/prefs/simpleSearchTyp", Int, 3);
SETTING_RW(prefs.startWithAdvSearchOpen,
"/Recoll/prefs/startWithAdvSearchOpen", Bool, false);

View File

@ -68,6 +68,8 @@ class PrefsPack {
int mainheight;
int pvwidth; // Preview window geom
int pvheight;
int toolArea; // Area for "tools" toolbar
int resArea; // Area for "results" toolbar
int ssearchTyp;
// Use single app (default: xdg-open), instead of per-mime settings
bool useDesktopOpen;

View File

@ -94,6 +94,18 @@ QString g_stringAllStem, g_stringNoStem;
static const QKeySequence quitKeySeq("Ctrl+q");
static const QKeySequence closeKeySeq("Ctrl+w");
static Qt::ToolBarArea int2area(int in)
{
switch (in) {
case Qt::LeftToolBarArea: return Qt::LeftToolBarArea;
case Qt::RightToolBarArea: return Qt::RightToolBarArea;
case Qt::BottomToolBarArea: return Qt::BottomToolBarArea;
case Qt::TopToolBarArea:
default:
return Qt::TopToolBarArea;
}
}
void RclMain::init()
{
// This is just to get the common catg strings into the message file
@ -162,11 +174,11 @@ void RclMain::init()
m_toolsTB->addAction(toolsAdvanced_SearchAction);
m_toolsTB->addAction(toolsDoc_HistoryAction);
m_toolsTB->addAction(toolsSpellAction);
this->addToolBar(Qt::TopToolBarArea, m_toolsTB);
this->addToolBar(int2area(prefs.toolArea), m_toolsTB);
m_resTB = new QToolBar(this);
m_resTB->setObjectName(QString::fromUtf8("m_resTB"));
this->addToolBar(Qt::TopToolBarArea, m_resTB);
this->addToolBar(int2area(prefs.resArea), m_resTB);
// Document filter buttons and combobox
// Combobox version of the document filter control
@ -630,6 +642,8 @@ void RclMain::fileExit()
prefs.mainwidth = width();
prefs.mainheight = height();
}
prefs.toolArea = toolBarArea(m_toolsTB);
prefs.resArea = toolBarArea(m_resTB);
restable->saveColState();
prefs.ssearchTyp = sSearch->searchTypCMB->currentIndex();