Add options to hide and configure main window

These options allow to hide certain main menus
and move options to edit.

This allows hiding those menus in the Qt Design Studio context.
The options are separated so that power users can enable
Debug, Analyze and Tools.

HideBuild=true
HideDebug=true
HideAnalyze=true

Change-Id: I26758aaa965bb7b61a476d197d82db34e62003b7
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Thomas Hartmann
2022-02-14 12:11:30 +01:00
parent 7dc82dace6
commit b0589fb8fe
3 changed files with 27 additions and 3 deletions

View File

@@ -428,6 +428,13 @@ static QIcon interruptIcon(bool toolBarStyle)
return toolBarStyle ? iconToolBar : icon;
}
static bool hideAnalyzeMenu()
{
return Core::ICore::settings()
->value(ProjectExplorer::Constants::SETTINGS_MENU_HIDE_ANALYZE, false)
.toBool();
}
QAction *addAction(const QObject *parent, QMenu *menu, const QString &display, bool on,
const std::function<void()> &onTriggered)
{
@@ -775,6 +782,7 @@ DebuggerPluginPrivate::DebuggerPluginPrivate(const QStringList &arguments)
ActionContainer *menubar = ActionManager::actionContainer(MENU_BAR);
ActionContainer *mtools = ActionManager::actionContainer(M_TOOLS);
if (!hideAnalyzeMenu())
menubar->addMenu(mtools, m_menu);
m_menu->addSeparator(G_ANALYZER_TOOLS);

View File

@@ -314,6 +314,16 @@ static const RunConfiguration *runConfigForNode(const Target *target, const Proj
return target->activeRunConfiguration();
}
static bool hideBuildMenu()
{
return Core::ICore::settings()->value(Constants::SETTINGS_MENU_HIDE_BUILD, false).toBool();
}
static bool hideDebugMenu()
{
return Core::ICore::settings()->value(Constants::SETTINGS_MENU_HIDE_DEBUG, false).toBool();
}
static bool canOpenTerminalWithRunEnv(const Project *project, const ProjectNode *node)
{
if (!project)
@@ -938,13 +948,16 @@ bool ProjectExplorerPlugin::initialize(const QStringList &arguments, QString *er
// build menu
ActionContainer *mbuild =
ActionManager::createMenu(Constants::M_BUILDPROJECT);
mbuild->menu()->setTitle(tr("&Build"));
if (!hideBuildMenu())
menubar->addMenu(mbuild, Core::Constants::G_VIEW);
// debug menu
ActionContainer *mdebug =
ActionManager::createMenu(Constants::M_DEBUG);
mdebug->menu()->setTitle(tr("&Debug"));
if (!hideDebugMenu())
menubar->addMenu(mdebug, Core::Constants::G_VIEW);
ActionContainer *mstartdebugging =

View File

@@ -235,6 +235,9 @@ const char ADD_FILES_DIALOG_FILTER_HISTORY_KEY[] = "ProjectExplorer.AddFilesFilt
const char PROJECT_ROOT_PATH_KEY[] = "ProjectExplorer.Project.RootPath";
const char STARTUPSESSION_KEY[] = "ProjectExplorer/SessionToRestore";
const char LASTSESSION_KEY[] = "ProjectExplorer/StartupSession";
const char SETTINGS_MENU_HIDE_BUILD[] = "Menu/HideBuild";
const char SETTINGS_MENU_HIDE_DEBUG[] = "Menu/HideDebug";
const char SETTINGS_MENU_HIDE_ANALYZE[] = "Menu/HideAnalyze";
// UI texts
PROJECTEXPLORER_EXPORT QString msgAutoDetected();