add pref to hide status bar

This commit is contained in:
Jean-Francois Dockes 2020-11-19 09:55:40 +01:00
parent a24759c4dd
commit c1f17f3e32
6 changed files with 31 additions and 6 deletions

View File

@ -295,6 +295,7 @@ void rwSettings(bool writing)
Bool, false);
SETTING_RW(prefs.noClearSearch, "/Recoll/prefs/noClearSearch", Bool, false);
SETTING_RW(prefs.noToolbars, "/Recoll/prefs/noToolbars", Bool, false);
SETTING_RW(prefs.noStatusBar, "/Recoll/prefs/noStatusBar", Bool, false);
SETTING_RW(prefs.showTrayIcon, "/Recoll/prefs/showTrayIcon", Bool, false);
SETTING_RW(prefs.closeToTray, "/Recoll/prefs/closeToTray", Bool, false);
SETTING_RW(prefs.trayMessages, "/Recoll/prefs/trayMessages", Bool, false);

View File

@ -142,6 +142,7 @@ class PrefsPack {
bool noToolbars{false};
bool noClearSearch{false};
bool noStatusBar{false};
bool showTrayIcon{false};
bool closeToTray{false};
bool trayMessages{false};

View File

@ -151,9 +151,7 @@ void RclMain::init()
qf.setPermissions(QFile::ReadOwner|QFile::WriteOwner);
qf.close();
m_watcher.addPath(idxfn);
// At least some versions of qt4 don't display the status bar if
// it's not created here.
(void)statusBar();
setupStatusBar();
(void)new HelpClient(this);
HelpClient::installMap((const char *)this->objectName().toUtf8(),
@ -483,6 +481,17 @@ void RclMain::setupToolbars()
}
}
void RclMain::setupStatusBar()
{
auto bar = statusBar();
if (prefs.noStatusBar) {
bar->hide();
} else {
bar->show();
}
}
void RclMain::enableTrayIcon(bool on)
{
on = on && QSystemTrayIcon::isSystemTrayAvailable();

View File

@ -90,7 +90,8 @@ public:
void enableTrayIcon(bool onoff);
QString readDarkCSS();
void setupToolbars();
void setupStatusBar();
public slots:
virtual void fileExit();
virtual void periodic100();

View File

@ -46,7 +46,7 @@
<item>
<widget class="QLabel" name="textLabelSST">
<property name="text">
<string>Start with simple search mode</string>
<string>Start with simple search mode: </string>
</property>
<property name="wordWrap">
<bool>false</bool>
@ -172,6 +172,16 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="noStatusBarCB">
<property name="text">
<string>Hide status bar.</string>
</property>
<property name="checked">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="noClearSearchCB">
<property name="text">

View File

@ -146,6 +146,7 @@ void UIPrefsDialog::setFromPrefs()
noToolbarsCB->setChecked(prefs.noToolbars);
noClearSearchCB->setChecked(prefs.noClearSearch);
noStatusBarCB->setChecked(prefs.noStatusBar);
showTrayIconCB->setChecked(prefs.showTrayIcon);
if (!prefs.showTrayIcon) {
prefs.closeToTray = false;
@ -350,9 +351,11 @@ void UIPrefsDialog::accept()
prefs.keepSort = keepSortCB->isChecked();
prefs.noToolbars = noToolbarsCB->isChecked();
m_mainWindow->setupToolbars();
prefs.noStatusBar = noStatusBarCB->isChecked();
m_mainWindow->setupStatusBar();
prefs.noClearSearch = noClearSearchCB->isChecked();
m_mainWindow->sSearch->setupButtons();
m_mainWindow->setupToolbars();
prefs.showTrayIcon = showTrayIconCB->isChecked();
m_mainWindow->enableTrayIcon(prefs.showTrayIcon);
prefs.closeToTray = closeToTrayCB->isChecked();