Themed Icons: Introduce Utils::Icon

Instead of describing icons via file name or in the themed icons case
via
a string that is a list of mask/color pairs, we have now a class for it.

Icons are now listed in per-plugin *icons.h headers.

RunControl::m_icon was The only place left where an icon property was in
fact a string. This patch changes that member to be a Utils::Icon.

Change-Id: Ibcfa8bb25e6d2e330c567ee7ccc0b97ead603177
Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
Alessandro Portale
2015-11-23 16:41:54 +01:00
parent 00c75cd7eb
commit 033862f305
139 changed files with 1090 additions and 629 deletions

View File

@@ -52,7 +52,7 @@
#include <analyzerbase/analyzerutils.h>
#include <analyzerbase/analyzerconstants.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/coreicons.h>
#include <coreplugin/icore.h>
#include <coreplugin/editormanager/editormanager.h>
@@ -68,7 +68,6 @@
#include <utils/qtcassert.h>
#include <utils/fancymainwindow.h>
#include <utils/styledbar.h>
#include <utils/themehelper.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorer.h>
@@ -656,7 +655,7 @@ QWidget *CallgrindToolPrivate::createWidgets()
// load external log file
action = new QAction(this);
action->setIcon(QIcon(QLatin1String(Core::Constants::ICON_OPENFILE)));
action->setIcon(Core::Icons::OPENFILE.icon());
action->setToolTip(tr("Load External Log File"));
connect(action, &QAction::triggered, this, &CallgrindToolPrivate::loadExternalLogFile);
layout->addWidget(createToolButton(action));
@@ -665,7 +664,7 @@ QWidget *CallgrindToolPrivate::createWidgets()
// dump action
action = new QAction(this);
action->setDisabled(true);
action->setIcon(QIcon(QLatin1String(Core::Constants::ICON_REDO)));
action->setIcon(Core::Icons::REDO.icon());
//action->setText(tr("Dump"));
action->setToolTip(tr("Request the dumping of profile information. This will update the Callgrind visualization."));
connect(action, &QAction::triggered, this, &CallgrindToolPrivate::slotRequestDump);
@@ -675,7 +674,7 @@ QWidget *CallgrindToolPrivate::createWidgets()
// reset action
action = new QAction(this);
action->setDisabled(true);
action->setIcon(QIcon(QLatin1String(Core::Constants::ICON_CLEAR)));
action->setIcon(Core::Icons::CLEAR.icon());
//action->setText(tr("Reset"));
action->setToolTip(tr("Reset all event counters."));
connect(action, &QAction::triggered, this, &CallgrindToolPrivate::resetRequested);
@@ -685,7 +684,7 @@ QWidget *CallgrindToolPrivate::createWidgets()
// pause action
action = new QAction(this);
action->setCheckable(true);
action->setIcon(QIcon(QLatin1String(Core::Constants::ICON_PAUSE)));
action->setIcon(Core::Icons::PAUSE.icon());
//action->setText(tr("Ignore"));
action->setToolTip(tr("Pause event logging. No events are counted which will speed up program execution during profiling."));
connect(action, &QAction::toggled, this, &CallgrindToolPrivate::pauseToggled);
@@ -696,7 +695,7 @@ QWidget *CallgrindToolPrivate::createWidgets()
// go back
action = new QAction(this);
action->setDisabled(true);
action->setIcon(Utils::ThemeHelper::themedIcon(QLatin1String(Core::Constants::ICON_PREV)));
action->setIcon(Core::Icons::PREV.icon());
action->setToolTip(tr("Go back one step in history. This will select the previously selected item."));
connect(action, &QAction::triggered, m_stackBrowser, &StackBrowser::goBack);
layout->addWidget(createToolButton(action));
@@ -705,7 +704,7 @@ QWidget *CallgrindToolPrivate::createWidgets()
// go forward
action = new QAction(this);
action->setDisabled(true);
action->setIcon(Utils::ThemeHelper::themedIcon(QLatin1String(Core::Constants::ICON_NEXT)));
action->setIcon(Core::Icons::NEXT.icon());
action->setToolTip(tr("Go forward one step in history."));
connect(action, &QAction::triggered, m_stackBrowser, &StackBrowser::goNext);
layout->addWidget(createToolButton(action));
@@ -783,7 +782,7 @@ QWidget *CallgrindToolPrivate::createWidgets()
// filtering
action = new QAction(tr("Show Project Costs Only"), this);
action->setIcon(Utils::ThemeHelper::themedIcon(QLatin1String(Core::Constants::ICON_FILTER)));
action->setIcon(Core::Icons::FILTER.icon());
action->setToolTip(tr("Show only profiling info that originated from this project source."));
action->setCheckable(true);
connect(action, &QAction::toggled, this, &CallgrindToolPrivate::handleFilterProjectCosts);

View File

@@ -61,7 +61,7 @@
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/command.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/coreicons.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/id.h>
@@ -69,7 +69,6 @@
#include <utils/fancymainwindow.h>
#include <utils/styledbar.h>
#include <utils/qtcassert.h>
#include <utils/themehelper.h>
#include <QString>
#include <QLatin1String>
@@ -376,7 +375,7 @@ QWidget *MemcheckTool::createWidgets()
// Load external XML log file
action = new QAction(this);
action->setIcon(QIcon(QLatin1String(Core::Constants::ICON_OPENFILE)));
action->setIcon(Core::Icons::OPENFILE.icon());
action->setToolTip(tr("Load External XML Log File"));
connect(action, &QAction::triggered, this, &MemcheckTool::loadExternalXmlLogFile);
button = new QToolButton;
@@ -387,7 +386,7 @@ QWidget *MemcheckTool::createWidgets()
// Go to previous leak.
action = new QAction(this);
action->setDisabled(true);
action->setIcon(Utils::ThemeHelper::themedIcon(QLatin1String(Core::Constants::ICON_PREV)));
action->setIcon(Core::Icons::PREV.icon());
action->setToolTip(tr("Go to previous leak."));
connect(action, &QAction::triggered, m_errorView, &MemcheckErrorView::goBack);
button = new QToolButton;
@@ -398,7 +397,7 @@ QWidget *MemcheckTool::createWidgets()
// Go to next leak.
action = new QAction(this);
action->setDisabled(true);
action->setIcon(Utils::ThemeHelper::themedIcon(QLatin1String(Core::Constants::ICON_NEXT)));
action->setIcon(Core::Icons::NEXT.icon());
action->setToolTip(tr("Go to next leak."));
connect(action, &QAction::triggered, m_errorView, &MemcheckErrorView::goNext);
button = new QToolButton;
@@ -407,7 +406,7 @@ QWidget *MemcheckTool::createWidgets()
m_goNext = action;
QToolButton *filterButton = new QToolButton;
filterButton->setIcon(Utils::ThemeHelper::themedIcon(QLatin1String(Core::Constants::ICON_FILTER)));
filterButton->setIcon(Core::Icons::FILTER.icon());
filterButton->setText(tr("Error Filter"));
filterButton->setPopupMode(QToolButton::InstantPopup);
filterButton->setProperty("noArrow", true);

View File

@@ -38,6 +38,7 @@
#include "valgrindsettings.h"
#include "valgrindconfigwidget.h"
#include <analyzerbase/analyzericons.h>
#include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerruncontrol.h>
#include <analyzerbase/analyzerstartparameters.h>
@@ -56,7 +57,6 @@
#include <projectexplorer/projectexplorer.h>
#include <utils/hostosinfo.h>
#include <utils/themehelper.h>
#include <QtPlugin>
#include <QCoreApplication>
@@ -249,8 +249,7 @@ void ValgrindPlugin::extensionsInitialized()
editorContextMenu->addSeparator(analyzerContext);
QAction *action = new QAction(tr("Profile Costs of This Function and Its Callees"), this);
action->setIcon(Utils::ThemeHelper::themedIcon(
QLatin1String(Analyzer::Constants::ANALYZER_CONTROL_START_ICON)));
action->setIcon(Analyzer::Icons::ANALYZER_CONTROL_START.icon());
connect(action, &QAction::triggered, cgTool,
&CallgrindTool::handleShowCostsOfFunction);
Command *cmd = ActionManager::registerAction(action, "Analyzer.Callgrind.ShowCostsOfFunction",