Add preference to replace the main menu bar with a menu button
This commit is contained in:
parent
f12c2ca738
commit
773ba809ad
@ -296,6 +296,7 @@ void rwSettings(bool writing)
|
||||
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.noMenuBar, "/Recoll/prefs/noMenuBar", 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);
|
||||
|
||||
@ -143,6 +143,7 @@ class PrefsPack {
|
||||
bool noToolbars{false};
|
||||
bool noClearSearch{false};
|
||||
bool noStatusBar{false};
|
||||
bool noMenuBar{false};
|
||||
bool showTrayIcon{false};
|
||||
bool closeToTray{false};
|
||||
bool trayMessages{false};
|
||||
|
||||
BIN
src/qtgui/images/menu.png
Normal file
BIN
src/qtgui/images/menu.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 668 B |
104
src/qtgui/rclm_menus.cpp
Normal file
104
src/qtgui/rclm_menus.cpp
Normal file
@ -0,0 +1,104 @@
|
||||
#include "rclmain_w.h"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QPushButton>
|
||||
|
||||
void RclMain::buildMenus()
|
||||
{
|
||||
fileMenu = new QMenu();
|
||||
fileMenu->setObjectName(QString::fromUtf8("fileMenu"));
|
||||
viewMenu = new QMenu();
|
||||
viewMenu->setObjectName(QString::fromUtf8("viewMenu"));
|
||||
toolsMenu = new QMenu();
|
||||
toolsMenu->setObjectName(QString::fromUtf8("toolsMenu"));
|
||||
preferencesMenu = new QMenu();
|
||||
preferencesMenu->setObjectName(QString::fromUtf8("preferencesMenu"));
|
||||
helpMenu = new QMenu();
|
||||
helpMenu->setObjectName(QString::fromUtf8("helpMenu"));
|
||||
menuResults = new QMenu();
|
||||
menuResults->setObjectName(QString::fromUtf8("menuResults"));
|
||||
|
||||
fileMenu->setTitle(QApplication::translate("RclMainBase", "&File", nullptr));
|
||||
viewMenu->setTitle(QApplication::translate("RclMainBase", "&View", nullptr));
|
||||
toolsMenu->setTitle(QApplication::translate("RclMainBase", "&Tools", nullptr));
|
||||
preferencesMenu->setTitle(QApplication::translate("RclMainBase", "&Preferences", nullptr));
|
||||
helpMenu->setTitle(QApplication::translate("RclMainBase", "&Help", nullptr));
|
||||
menuResults->setTitle(QApplication::translate("RclMainBase", "&Results", nullptr));
|
||||
|
||||
|
||||
fileMenu->insertAction(fileRebuildIndexAction, fileBumpIndexingAction);
|
||||
fileMenu->addAction(fileToggleIndexingAction);
|
||||
fileMenu->addAction(fileRebuildIndexAction);
|
||||
fileMenu->addAction(actionSpecial_Indexing);
|
||||
fileMenu->addSeparator();
|
||||
fileMenu->addAction(actionSave_last_query);
|
||||
fileMenu->addAction(actionLoad_saved_query);
|
||||
fileMenu->addSeparator();
|
||||
fileMenu->addAction(fileExportSSearchHistoryAction);
|
||||
fileMenu->addAction(fileEraseSearchHistoryAction);
|
||||
fileMenu->addSeparator();
|
||||
fileMenu->addAction(fileEraseDocHistoryAction);
|
||||
fileMenu->addSeparator();
|
||||
fileMenu->addAction(fileExitAction);
|
||||
|
||||
viewMenu->addAction(showMissingHelpers_Action);
|
||||
viewMenu->addAction(showActiveTypes_Action);
|
||||
viewMenu->addAction(actionShow_index_statistics);
|
||||
viewMenu->addSeparator();
|
||||
viewMenu->addAction(toggleFullScreenAction);
|
||||
|
||||
toolsMenu->addAction(toolsDoc_HistoryAction);
|
||||
toolsMenu->addAction(toolsAdvanced_SearchAction);
|
||||
toolsMenu->addAction(toolsSpellAction);
|
||||
toolsMenu->addAction(actionShowQueryDetails);
|
||||
toolsMenu->addAction(actionQuery_Fragments);
|
||||
toolsMenu->addAction(actionWebcache_Editor);
|
||||
|
||||
preferencesMenu->addAction(indexConfigAction);
|
||||
preferencesMenu->addAction(indexScheduleAction);
|
||||
preferencesMenu->addSeparator();
|
||||
preferencesMenu->addAction(queryPrefsAction);
|
||||
preferencesMenu->addAction(extIdxAction);
|
||||
preferencesMenu->addSeparator();
|
||||
preferencesMenu->addAction(enbDarkModeAction);
|
||||
preferencesMenu->addSeparator();
|
||||
preferencesMenu->addAction(enbSynAction);
|
||||
preferencesMenu->addSeparator();
|
||||
|
||||
helpMenu->addAction(userManualAction);
|
||||
helpMenu->addAction(showMissingHelpers_Action);
|
||||
helpMenu->addAction(showActiveTypes_Action);
|
||||
helpMenu->addSeparator();
|
||||
helpMenu->addAction(helpAbout_RecollAction);
|
||||
|
||||
menuResults->addAction(nextPageAction);
|
||||
menuResults->addAction(prevPageAction);
|
||||
menuResults->addAction(firstPageAction);
|
||||
menuResults->addSeparator();
|
||||
menuResults->addAction(actionSortByDateAsc);
|
||||
menuResults->addAction(actionSortByDateDesc);
|
||||
menuResults->addSeparator();
|
||||
menuResults->addAction(actionShowResultsAsTable);
|
||||
menuResults->addSeparator();
|
||||
menuResults->addAction(actionSaveResultsAsCSV);
|
||||
|
||||
MenuBar->addAction(fileMenu->menuAction());
|
||||
MenuBar->addAction(viewMenu->menuAction());
|
||||
MenuBar->addAction(toolsMenu->menuAction());
|
||||
MenuBar->addAction(menuResults->menuAction());
|
||||
MenuBar->addAction(preferencesMenu->menuAction());
|
||||
MenuBar->addSeparator();
|
||||
MenuBar->addAction(helpMenu->menuAction());
|
||||
|
||||
QMenu *butmenu = new QMenu();
|
||||
butmenu->addAction(fileMenu->menuAction());
|
||||
butmenu->addAction(viewMenu->menuAction());
|
||||
butmenu->addAction(toolsMenu->menuAction());
|
||||
butmenu->addAction(menuResults->menuAction());
|
||||
butmenu->addAction(preferencesMenu->menuAction());
|
||||
butmenu->addSeparator();
|
||||
butmenu->addAction(helpMenu->menuAction());
|
||||
sSearch->menuPB->setMenu(butmenu);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -68,92 +68,7 @@
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<widget class="QMenu" name="fileMenu">
|
||||
<property name="title">
|
||||
<string>&File</string>
|
||||
</property>
|
||||
<addaction name="fileToggleIndexingAction"/>
|
||||
<addaction name="fileRebuildIndexAction"/>
|
||||
<addaction name="actionSpecial_Indexing"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionSave_last_query"/>
|
||||
<addaction name="actionLoad_saved_query"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="fileExportSSearchHistoryAction"/>
|
||||
<addaction name="fileEraseSearchHistoryAction"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="fileEraseDocHistoryAction"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="fileExitAction"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="viewMenu">
|
||||
<property name="title">
|
||||
<string>&View</string>
|
||||
</property>
|
||||
<addaction name="showMissingHelpers_Action"/>
|
||||
<addaction name="showActiveTypes_Action"/>
|
||||
<addaction name="actionShow_index_statistics"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="toggleFullScreenAction"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="toolsMenu">
|
||||
<property name="title">
|
||||
<string>&Tools</string>
|
||||
</property>
|
||||
<addaction name="toolsDoc_HistoryAction"/>
|
||||
<addaction name="toolsAdvanced_SearchAction"/>
|
||||
<addaction name="toolsSpellAction"/>
|
||||
<addaction name="actionShowQueryDetails"/>
|
||||
<addaction name="actionQuery_Fragments"/>
|
||||
<addaction name="actionWebcache_Editor"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="preferencesMenu">
|
||||
<property name="title">
|
||||
<string>&Preferences</string>
|
||||
</property>
|
||||
<addaction name="indexConfigAction"/>
|
||||
<addaction name="indexScheduleAction"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="queryPrefsAction"/>
|
||||
<addaction name="extIdxAction"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="enbDarkModeAction"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="enbSynAction"/>
|
||||
<addaction name="separator"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="helpMenu">
|
||||
<property name="title">
|
||||
<string>&Help</string>
|
||||
</property>
|
||||
<addaction name="userManualAction"/>
|
||||
<addaction name="showMissingHelpers_Action"/>
|
||||
<addaction name="showActiveTypes_Action"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="helpAbout_RecollAction"/>
|
||||
</widget>
|
||||
<widget class="QMenu" name="menuResults">
|
||||
<property name="title">
|
||||
<string>&Results</string>
|
||||
</property>
|
||||
<addaction name="nextPageAction"/>
|
||||
<addaction name="prevPageAction"/>
|
||||
<addaction name="firstPageAction"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionSortByDateAsc"/>
|
||||
<addaction name="actionSortByDateDesc"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionShowResultsAsTable"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionSaveResultsAsCSV"/>
|
||||
</widget>
|
||||
<addaction name="fileMenu"/>
|
||||
<addaction name="viewMenu"/>
|
||||
<addaction name="toolsMenu"/>
|
||||
<addaction name="menuResults"/>
|
||||
<addaction name="preferencesMenu"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="helpMenu"/>
|
||||
</widget>
|
||||
<action name="fileExitAction">
|
||||
<property name="text">
|
||||
@ -175,15 +90,15 @@
|
||||
</property>
|
||||
</action>
|
||||
<action name="fileBumpIndexingAction">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Trigger incremental pass</string>
|
||||
</property>
|
||||
<property name="name" stdset="0">
|
||||
<cstring>fileBumpIndexingAction</cstring>
|
||||
</property>
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</action>
|
||||
<action name="fileRebuildIndexAction">
|
||||
<property name="text">
|
||||
|
||||
@ -136,6 +136,8 @@ void RclMain::init()
|
||||
DocSequence::set_translations((const char *)tr("sorted").toUtf8(),
|
||||
(const char *)tr("filtered").toUtf8());
|
||||
|
||||
buildMenus();
|
||||
|
||||
// A shortcut to get the focus back to the search entry, in table
|
||||
// mode only.
|
||||
m_tablefocseq = new QShortcut(QKeySequence("Ctrl+r"), this);
|
||||
@ -152,6 +154,7 @@ void RclMain::init()
|
||||
qf.close();
|
||||
m_watcher.addPath(idxfn);
|
||||
setupStatusBar();
|
||||
setupMenus();
|
||||
|
||||
(void)new HelpClient(this);
|
||||
HelpClient::installMap((const char *)this->objectName().toUtf8(),
|
||||
@ -490,6 +493,16 @@ void RclMain::setupStatusBar()
|
||||
bar->show();
|
||||
}
|
||||
}
|
||||
void RclMain::setupMenus()
|
||||
{
|
||||
if (prefs.noMenuBar) {
|
||||
MenuBar->hide();
|
||||
sSearch->menuPB->show();
|
||||
} else {
|
||||
MenuBar->show();
|
||||
sSearch->menuPB->hide();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void RclMain::enableTrayIcon(bool on)
|
||||
|
||||
@ -91,7 +91,9 @@ public:
|
||||
QString readDarkCSS();
|
||||
void setupToolbars();
|
||||
void setupStatusBar();
|
||||
|
||||
void buildMenus();
|
||||
void setupMenus();
|
||||
|
||||
public slots:
|
||||
virtual void fileExit();
|
||||
virtual void periodic100();
|
||||
@ -238,6 +240,12 @@ private:
|
||||
RclTrayIcon *m_trayicon{0};
|
||||
// We sometimes take the indexer lock (e.g.: when editing the webcache)
|
||||
Pidfile *m_pidfile{0};
|
||||
QMenu *fileMenu;
|
||||
QMenu *viewMenu;
|
||||
QMenu *toolsMenu;
|
||||
QMenu *preferencesMenu;
|
||||
QMenu *helpMenu;
|
||||
QMenu *menuResults;
|
||||
|
||||
virtual void init();
|
||||
virtual void setupResTB(bool combo);
|
||||
|
||||
@ -72,6 +72,7 @@ SOURCES += \
|
||||
ptrans_w.cpp \
|
||||
rclhelp.cpp \
|
||||
rclm_idx.cpp \
|
||||
rclm_menus.cpp \
|
||||
rclm_preview.cpp \
|
||||
rclm_saveload.cpp \
|
||||
rclm_view.cpp \
|
||||
|
||||
@ -16,5 +16,6 @@
|
||||
<file>images/recoll.png</file>
|
||||
<file>images/interro.png</file>
|
||||
<file>images/clock.png</file>
|
||||
<file>images/menu.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
||||
@ -110,6 +110,24 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="menuPB">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Main menu</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset>
|
||||
<normalon>:/images/menu.png</normalon>
|
||||
</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
||||
@ -182,6 +182,16 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="noMenuBarCB">
|
||||
<property name="text">
|
||||
<string>Hide menu bar (show button instead).</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="noClearSearchCB">
|
||||
<property name="text">
|
||||
|
||||
@ -147,6 +147,7 @@ void UIPrefsDialog::setFromPrefs()
|
||||
noToolbarsCB->setChecked(prefs.noToolbars);
|
||||
noClearSearchCB->setChecked(prefs.noClearSearch);
|
||||
noStatusBarCB->setChecked(prefs.noStatusBar);
|
||||
noMenuBarCB->setChecked(prefs.noMenuBar);
|
||||
showTrayIconCB->setChecked(prefs.showTrayIcon);
|
||||
if (!prefs.showTrayIcon) {
|
||||
prefs.closeToTray = false;
|
||||
@ -352,6 +353,8 @@ void UIPrefsDialog::accept()
|
||||
prefs.keepSort = keepSortCB->isChecked();
|
||||
prefs.noToolbars = noToolbarsCB->isChecked();
|
||||
m_mainWindow->setupToolbars();
|
||||
prefs.noMenuBar = noMenuBarCB->isChecked();
|
||||
m_mainWindow->setupMenus();
|
||||
prefs.noStatusBar = noStatusBarCB->isChecked();
|
||||
m_mainWindow->setupStatusBar();
|
||||
prefs.noClearSearch = noClearSearchCB->isChecked();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user