forked from qt-creator/qt-creator
Core: Introduce a IOptionsPage::setCategoryIconPath
Less noise on the user side. Change-Id: I34dea09e8a3c8639f5a7db89b22f8b825b946395 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -147,8 +147,7 @@ TestSettingsPage::TestSettingsPage(const QSharedPointer<TestSettings> &settings)
|
||||
setDisplayName(tr("General"));
|
||||
setCategory(Constants::AUTOTEST_SETTINGS_CATEGORY);
|
||||
setDisplayCategory(QCoreApplication::translate("AutoTest", Constants::AUTOTEST_SETTINGS_TR));
|
||||
setCategoryIcon(Utils::Icon({{":/autotest/images/settingscategory_autotest.png",
|
||||
Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint));
|
||||
setCategoryIconPath(":/autotest/images/settingscategory_autotest.png");
|
||||
}
|
||||
|
||||
QWidget *TestSettingsPage::widget()
|
||||
|
@@ -73,9 +73,8 @@ GeneralOptionsPage::GeneralOptionsPage(const QStringList &toolIds, QObject *pare
|
||||
setDisplayName(tr("General"));
|
||||
setCategory(Constants::OPTION_CATEGORY);
|
||||
setDisplayCategory(QCoreApplication::translate("Beautifier", "Beautifier"));
|
||||
setCategoryIcon(Utils::Icon({{":/beautifier/images/settingscategory_beautifier.png",
|
||||
Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint));
|
||||
setWidgetCreator([toolIds] { return new GeneralOptionsPageWidget(toolIds); });
|
||||
setCategoryIconPath(":/beautifier/images/settingscategory_beautifier.png");
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
@@ -85,7 +85,7 @@ public:
|
||||
"Clang Tools"));
|
||||
setCategory("T.Analyzer");
|
||||
setDisplayCategory(QCoreApplication::translate("Analyzer", "Analyzer"));
|
||||
setCategoryIcon(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
|
||||
setCategoryIconPath(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
|
||||
setWidgetCreator([] { return new SettingsWidget; });
|
||||
}
|
||||
};
|
||||
|
@@ -37,6 +37,8 @@
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
/*!
|
||||
\class Core::IOptionsPage
|
||||
\mainclass
|
||||
@@ -144,6 +146,11 @@ void Core::IOptionsPage::finish()
|
||||
}
|
||||
}
|
||||
|
||||
void Core::IOptionsPage::setCategoryIconPath(const QString &categoryIconPath)
|
||||
{
|
||||
m_categoryIcon = Icon({{categoryIconPath, Theme::PanelTextColorDark}}, Icon::Tint);
|
||||
}
|
||||
|
||||
/*!
|
||||
\fn void IOptionsPage::setId(Id id)
|
||||
|
||||
|
@@ -75,6 +75,7 @@ protected:
|
||||
void setCategory(Id category) { m_category = category; }
|
||||
void setDisplayCategory(const QString &displayCategory) { m_displayCategory = displayCategory; }
|
||||
void setCategoryIcon(const Utils::Icon &categoryIcon) { m_categoryIcon = categoryIcon; }
|
||||
void setCategoryIconPath(const QString &categoryIconPath);
|
||||
|
||||
Id m_id;
|
||||
Id m_category;
|
||||
|
@@ -58,8 +58,8 @@ GeneralSettings::GeneralSettings()
|
||||
setDisplayName(tr("Interface"));
|
||||
setCategory(Constants::SETTINGS_CATEGORY_CORE);
|
||||
setDisplayCategory(QCoreApplication::translate("Core", "Environment"));
|
||||
setCategoryIcon(Utils::Icon({{":/core/images/settingscategory_core.png",
|
||||
Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint));
|
||||
setCategoryIconPath(":/core/images/settingscategory_core.png");
|
||||
|
||||
m_defaultShowShortcutsInContextMenu = QGuiApplication::styleHints()
|
||||
->showShortcutsInContextMenus();
|
||||
}
|
||||
|
@@ -69,8 +69,7 @@ SettingsPage::SettingsPage(const QSharedPointer<Settings> &settings, QObject *pa
|
||||
setDisplayName(tr("General"));
|
||||
setCategory(Constants::CPASTER_SETTINGS_CATEGORY);
|
||||
setDisplayCategory(QCoreApplication::translate("CodePaster", "Code Pasting"));
|
||||
setCategoryIcon(Utils::Icon({{":/cpaster/images/settingscategory_cpaster.png",
|
||||
Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint));
|
||||
setCategoryIconPath(":/cpaster/images/settingscategory_cpaster.png");
|
||||
}
|
||||
|
||||
SettingsPage::~SettingsPage() = default;
|
||||
|
@@ -146,7 +146,7 @@ CppcheckOptionsPage::CppcheckOptionsPage(CppcheckTool &tool, CppcheckTrigger &tr
|
||||
setDisplayName(tr("Cppcheck"));
|
||||
setCategory("T.Analyzer");
|
||||
setDisplayCategory(QCoreApplication::translate("Analyzer", "Analyzer"));
|
||||
setCategoryIcon(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
|
||||
setCategoryIconPath(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
|
||||
|
||||
CppcheckOptions options;
|
||||
if (Utils::HostOsInfo::isAnyUnixHost()) {
|
||||
|
@@ -166,9 +166,7 @@ CppCodeModelSettingsPage::CppCodeModelSettingsPage(QSharedPointer<CppCodeModelSe
|
||||
setDisplayName(QCoreApplication::translate("CppTools",Constants::CPP_CODE_MODEL_SETTINGS_NAME));
|
||||
setCategory(Constants::CPP_SETTINGS_CATEGORY);
|
||||
setDisplayCategory(QCoreApplication::translate("CppTools", "C++"));
|
||||
setCategoryIcon(Utils::Icon({{":/projectexplorer/images/settingscategory_cpp.png",
|
||||
Utils::Theme::PanelTextColorDark}},
|
||||
Utils::Icon::Tint));
|
||||
setCategoryIconPath(":/projectexplorer/images/settingscategory_cpp.png");
|
||||
}
|
||||
|
||||
QWidget *CppCodeModelSettingsPage::widget()
|
||||
|
@@ -25,13 +25,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <utils/icon.h>
|
||||
|
||||
namespace Analyzer {
|
||||
namespace Icons {
|
||||
|
||||
const Utils::Icon SETTINGSCATEGORY_ANALYZER({
|
||||
{":/images/settingscategory_analyzer.png", Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint);
|
||||
const char SETTINGSCATEGORY_ANALYZER[] = ":/images/settingscategory_analyzer.png";
|
||||
|
||||
} // namespace Icons
|
||||
} // namespace Analyzer
|
||||
|
@@ -249,8 +249,7 @@ CommonOptionsPage::CommonOptionsPage()
|
||||
setDisplayName(QCoreApplication::translate("Debugger", "General"));
|
||||
setCategory(DEBUGGER_SETTINGS_CATEGORY);
|
||||
setDisplayCategory(QCoreApplication::translate("Debugger", "Debugger"));
|
||||
setCategoryIcon(Icon({{":/debugger/images/settingscategory_debugger.png",
|
||||
Theme::PanelTextColorDark}}, Icon::Tint));
|
||||
setCategoryIconPath(":/debugger/images/settingscategory_debugger.png");
|
||||
setWidgetCreator([] { return new CommonOptionsPageWidget; });
|
||||
}
|
||||
|
||||
|
@@ -366,8 +366,7 @@ public:
|
||||
setDisplayName(Tr::tr("General"));
|
||||
setCategory(SETTINGS_CATEGORY);
|
||||
setDisplayCategory(Tr::tr("FakeVim"));
|
||||
setCategoryIcon(Utils::Icon({{":/fakevim/images/settingscategory_fakevim.png",
|
||||
Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint));
|
||||
setCategoryIconPath(":/fakevim/images/settingscategory_fakevim.png");
|
||||
}
|
||||
|
||||
QWidget *widget() override;
|
||||
|
@@ -57,8 +57,7 @@ GeneralSettingsPage::GeneralSettingsPage()
|
||||
setDisplayName(tr("General"));
|
||||
setCategory(Help::Constants::HELP_CATEGORY);
|
||||
setDisplayCategory(QCoreApplication::translate("Help", "Help"));
|
||||
setCategoryIcon(Utils::Icon({{":/help/images/settingscategory_help.png",
|
||||
Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint));
|
||||
setCategoryIconPath(":/help/images/settingscategory_help.png");
|
||||
}
|
||||
|
||||
QWidget *GeneralSettingsPage::widget()
|
||||
|
@@ -254,8 +254,7 @@ LanguageClientSettingsPage::LanguageClientSettingsPage()
|
||||
setCategory(Constants::LANGUAGECLIENT_SETTINGS_CATEGORY);
|
||||
setDisplayCategory(QCoreApplication::translate("LanguageClient",
|
||||
Constants::LANGUAGECLIENT_SETTINGS_TR));
|
||||
setCategoryIcon(Utils::Icon({{":/languageclient/images/settingscategory_languageclient.png",
|
||||
Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint));
|
||||
setCategoryIconPath(":/languageclient/images/settingscategory_languageclient.png");
|
||||
}
|
||||
|
||||
LanguageClientSettingsPage::~LanguageClientSettingsPage()
|
||||
|
@@ -50,8 +50,7 @@ NimCodeStyleSettingsPage::NimCodeStyleSettingsPage()
|
||||
setDisplayName(tr(Nim::Constants::C_NIMCODESTYLESETTINGSPAGE_DISPLAY));
|
||||
setCategory(Nim::Constants::C_NIMCODESTYLESETTINGSPAGE_CATEGORY);
|
||||
setDisplayCategory(tr("Nim"));
|
||||
setCategoryIcon(Utils::Icon({{":/nim/images/settingscategory_nim.png",
|
||||
Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint));
|
||||
setCategoryIconPath(":/nim/images/settingscategory_nim.png");
|
||||
}
|
||||
|
||||
NimCodeStyleSettingsPage::~NimCodeStyleSettingsPage()
|
||||
|
@@ -62,9 +62,7 @@ NimToolsSettingsPage::NimToolsSettingsPage(NimSettings *settings)
|
||||
setDisplayName(tr(Nim::Constants::C_NIMTOOLSSETTINGSPAGE_DISPLAY));
|
||||
setCategory(Nim::Constants::C_NIMTOOLSSETTINGSPAGE_CATEGORY);
|
||||
setDisplayCategory(tr("Nim"));
|
||||
setCategoryIcon(Utils::Icon({{":/nim/images/settingscategory_nim.png",
|
||||
Utils::Theme::PanelTextColorDark
|
||||
}}, Utils::Icon::Tint));
|
||||
setCategoryIconPath(":/nim/images/settingscategory_nim.png");
|
||||
}
|
||||
|
||||
NimToolsSettingsPage::~NimToolsSettingsPage() = default;
|
||||
|
@@ -39,7 +39,7 @@ PerfOptionsPage::PerfOptionsPage()
|
||||
setDisplayName(QCoreApplication::translate("PerfProfiler::PerfOptionsPage", "CPU Usage"));
|
||||
setCategory("T.Analyzer");
|
||||
setDisplayCategory(QCoreApplication::translate("Analyzer", "Analyzer"));
|
||||
setCategoryIcon(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
|
||||
setCategoryIconPath(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
|
||||
}
|
||||
|
||||
QWidget *PerfOptionsPage::widget()
|
||||
|
@@ -40,8 +40,7 @@ DeviceSettingsPage::DeviceSettingsPage()
|
||||
setDisplayName(tr("Devices"));
|
||||
setCategory(Constants::DEVICE_SETTINGS_CATEGORY);
|
||||
setDisplayCategory(QCoreApplication::translate("ProjectExplorer", "Devices"));
|
||||
setCategoryIcon(Utils::Icon({{":/projectexplorer/images/settingscategory_devices.png",
|
||||
Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint));
|
||||
setCategoryIconPath(":/projectexplorer/images/settingscategory_devices.png");
|
||||
setWidgetCreator([] { return new DeviceSettingsWidget; });
|
||||
}
|
||||
|
||||
|
@@ -81,8 +81,7 @@ SshSettingsPage::SshSettingsPage()
|
||||
setDisplayName(SshSettingsWidget::tr("SSH"));
|
||||
setCategory(Constants::DEVICE_SETTINGS_CATEGORY);
|
||||
setDisplayCategory(QCoreApplication::translate("ProjectExplorer", "SSH"));
|
||||
setCategoryIcon(Utils::Icon({{":/projectexplorer/images/settingscategory_devices.png",
|
||||
Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint));
|
||||
setCategoryIconPath(":/projectexplorer/images/settingscategory_devices.png");
|
||||
setWidgetCreator([] { return new SshSettingsWidget; });
|
||||
}
|
||||
|
||||
|
@@ -272,8 +272,7 @@ KitOptionsPage::KitOptionsPage()
|
||||
setDisplayName(tr("Kits"));
|
||||
setCategory(Constants::KITS_SETTINGS_CATEGORY);
|
||||
setDisplayCategory(QCoreApplication::translate("ProjectExplorer", "Kits"));
|
||||
setCategoryIcon(Utils::Icon({{":/projectexplorer/images/settingscategory_kits.png",
|
||||
Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint));
|
||||
setCategoryIconPath(":/projectexplorer/images/settingscategory_kits.png");
|
||||
}
|
||||
|
||||
QWidget *KitOptionsPage::widget()
|
||||
|
@@ -206,8 +206,7 @@ ProjectExplorerSettingsPage::ProjectExplorerSettingsPage()
|
||||
setDisplayName(tr("General"));
|
||||
setCategory(Constants::BUILD_AND_RUN_SETTINGS_CATEGORY);
|
||||
setDisplayCategory(QCoreApplication::translate("ProjectExplorer", "Build & Run"));
|
||||
setCategoryIcon(Utils::Icon({{":/projectexplorer/images/settingscategory_buildrun.png",
|
||||
Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint));
|
||||
setCategoryIconPath(":/projectexplorer/images/settingscategory_buildrun.png");
|
||||
}
|
||||
|
||||
QWidget *ProjectExplorerSettingsPage::widget()
|
||||
|
@@ -233,8 +233,7 @@ InterpreterOptionsPage::InterpreterOptionsPage()
|
||||
setDisplayName(PythonSettings::tr("Interpreters"));
|
||||
setCategory(Constants::C_PYTHON_SETTINGS_CATEGORY);
|
||||
setDisplayCategory(PythonSettings::tr("Python"));
|
||||
setCategoryIcon(Utils::Icon({{":/python/images/settingscategory_python.png",
|
||||
Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint));
|
||||
setCategoryIconPath(":/python/images/settingscategory_python.png");
|
||||
}
|
||||
|
||||
Interpreter InterpreterOptionsPage::defaultInterpreter() const
|
||||
|
@@ -184,9 +184,7 @@ QbsSettingsPage::QbsSettingsPage()
|
||||
setCategory(Constants::QBS_SETTINGS_CATEGORY);
|
||||
setDisplayCategory(QCoreApplication::translate("QbsProjectManager",
|
||||
Constants::QBS_SETTINGS_TR_CATEGORY));
|
||||
setCategoryIcon(
|
||||
Utils::Icon({{":/qbsprojectmanager/images/settingscategory_qbsprojectmanager.png",
|
||||
Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint));
|
||||
setCategoryIconPath(":/qbsprojectmanager/images/settingscategory_qbsprojectmanager.png");
|
||||
}
|
||||
|
||||
QWidget *QbsSettingsPage::widget()
|
||||
|
@@ -127,8 +127,7 @@ QmlJSCodeStyleSettingsPage::QmlJSCodeStyleSettingsPage()
|
||||
setDisplayName(QCoreApplication::translate("QmlJSTools", Constants::QML_JS_CODE_STYLE_SETTINGS_NAME));
|
||||
setCategory(QmlJSEditor::Constants::SETTINGS_CATEGORY_QML);
|
||||
setDisplayCategory(QCoreApplication::translate("QmlJSEditor", "Qt Quick"));
|
||||
setCategoryIcon(Utils::Icon({{":/qmljstools/images/settingscategory_qml.png",
|
||||
Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint));
|
||||
setCategoryIconPath(":/qmljstools/images/settingscategory_qml.png");
|
||||
}
|
||||
|
||||
QWidget *QmlJSCodeStyleSettingsPage::widget()
|
||||
|
@@ -39,7 +39,7 @@ QmlProfilerOptionsPage::QmlProfilerOptionsPage()
|
||||
setDisplayName(tr("QML Profiler"));
|
||||
setCategory("T.Analyzer");
|
||||
setDisplayCategory(tr("Analyzer"));
|
||||
setCategoryIcon(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
|
||||
setCategoryIconPath(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
|
||||
}
|
||||
|
||||
QWidget *QmlProfilerOptionsPage::widget()
|
||||
|
@@ -96,9 +96,7 @@ CodeGenSettingsPage::CodeGenSettingsPage()
|
||||
setCategory(CppTools::Constants::CPP_SETTINGS_CATEGORY);
|
||||
setDisplayCategory(
|
||||
QCoreApplication::translate("CppTools", CppTools::Constants::CPP_SETTINGS_NAME));
|
||||
setCategoryIcon(Utils::Icon({{":/projectexplorer/images/settingscategory_cpp.png",
|
||||
Utils::Theme::PanelTextColorDark}},
|
||||
Utils::Icon::Tint));
|
||||
setCategoryIconPath(":/projectexplorer/images/settingscategory_cpp.png");
|
||||
setWidgetCreator([] { return new CodeGenSettingsPageWidget; });
|
||||
}
|
||||
|
||||
|
@@ -36,6 +36,5 @@ TextEditorOptionsPage::TextEditorOptionsPage(QObject *parent) :
|
||||
{
|
||||
setCategory(Constants::TEXT_EDITOR_SETTINGS_CATEGORY);
|
||||
setDisplayCategory(QCoreApplication::translate("TextEditor", "Text Editor"));
|
||||
setCategoryIcon(Utils::Icon({{":/texteditor/images/settingscategory_texteditor.png",
|
||||
Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint));
|
||||
setCategoryIconPath(":/texteditor/images/settingscategory_texteditor.png");
|
||||
}
|
||||
|
@@ -48,8 +48,7 @@ OptionsPage::OptionsPage(const Settings &settings, QObject *parent) :
|
||||
setDisplayName(tr("To-Do"));
|
||||
setCategory("To-Do");
|
||||
setDisplayCategory(tr("To-Do"));
|
||||
setCategoryIcon(Utils::Icon({{":/todoplugin/images/settingscategory_todo.png",
|
||||
Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint));
|
||||
setCategoryIconPath(":/todoplugin/images/settingscategory_todo.png");
|
||||
}
|
||||
|
||||
void OptionsPage::setSettings(const Settings &settings)
|
||||
|
@@ -63,7 +63,7 @@ public:
|
||||
setDisplayName(QCoreApplication::translate("Valgrind::Internal::ValgrindOptionsPage", "Valgrind"));
|
||||
setCategory("T.Analyzer");
|
||||
setDisplayCategory(QCoreApplication::translate("Analyzer", "Analyzer"));
|
||||
setCategoryIcon(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
|
||||
setCategoryIconPath(Analyzer::Icons::SETTINGSCATEGORY_ANALYZER);
|
||||
}
|
||||
|
||||
QWidget *widget() override
|
||||
|
@@ -48,8 +48,7 @@ VcsBaseOptionsPage::VcsBaseOptionsPage(QObject *parent) : Core::IOptionsPage(par
|
||||
{
|
||||
setCategory(Constants::VCS_SETTINGS_CATEGORY);
|
||||
setDisplayCategory(QCoreApplication::translate("VcsBase", "Version Control"));
|
||||
setCategoryIcon(Utils::Icon({{":/vcsbase/images/settingscategory_vcs.png",
|
||||
Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint));
|
||||
setCategoryIconPath(":/vcsbase/images/settingscategory_vcs.png");
|
||||
}
|
||||
|
||||
VcsBaseOptionsPage::~VcsBaseOptionsPage() = default;
|
||||
|
Reference in New Issue
Block a user