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

@@ -33,6 +33,7 @@
#include "bookmarkmanager.h"
#include "contentwindow.h"
#include "helpconstants.h"
#include "helpicons.h"
#include "helpplugin.h"
#include "helpviewer.h"
#include "indexwindow.h"
@@ -45,6 +46,7 @@
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/command.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/coreicons.h>
#include <coreplugin/icore.h>
#include <coreplugin/findplaceholder.h>
#include <coreplugin/minisplitter.h>
@@ -52,7 +54,6 @@
#include <texteditor/texteditorconstants.h>
#include <utils/qtcassert.h>
#include <utils/styledbar.h>
#include <utils/themehelper.h>
#include <QCoreApplication>
#include <QHBoxLayout>
@@ -132,7 +133,7 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget
setAttribute(Qt::WA_QuitOnClose, false); // don't prevent Qt Creator from closing
}
if (style != SideBarWidget) {
m_toggleSideBarAction = new QAction(Utils::ThemeHelper::themedIcon(QLatin1String(Core::Constants::ICON_TOGGLE_SIDEBAR)),
m_toggleSideBarAction = new QAction(Core::Icons::TOGGLE_SIDEBAR.icon(),
QCoreApplication::translate("Core", Core::Constants::TR_SHOW_SIDEBAR),
toolBar);
m_toggleSideBarAction->setCheckable(true);
@@ -163,14 +164,12 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget
layout->addWidget(Core::Command::toolButtonWithAppendedShortcut(m_switchToHelp, cmd));
}
m_homeAction = new QAction(QIcon(QLatin1String(":/help/images/home.png")),
tr("Home"), this);
m_homeAction = new QAction(Icons::HOME.icon(), tr("Home"), this);
cmd = Core::ActionManager::registerAction(m_homeAction, Constants::HELP_HOME, context);
connect(m_homeAction, &QAction::triggered, this, &HelpWidget::goHome);
layout->addWidget(Core::Command::toolButtonWithAppendedShortcut(m_homeAction, cmd));
m_backAction = new QAction(Utils::ThemeHelper::themedIcon(QLatin1String(Core::Constants::ICON_PREV)),
tr("Back"), toolBar);
m_backAction = new QAction(Core::Icons::PREV.icon(), tr("Back"), toolBar);
connect(m_backAction, &QAction::triggered, this, &HelpWidget::backward);
m_backMenu = new QMenu(toolBar);
connect(m_backMenu, &QMenu::aboutToShow, this, &HelpWidget::updateBackMenu);
@@ -181,8 +180,7 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget
button->setPopupMode(QToolButton::DelayedPopup);
layout->addWidget(button);
m_forwardAction = new QAction(Utils::ThemeHelper::themedIcon(QLatin1String(Core::Constants::ICON_NEXT)),
tr("Forward"), toolBar);
m_forwardAction = new QAction(Core::Icons::NEXT.icon(), tr("Forward"), toolBar);
connect(m_forwardAction, &QAction::triggered, this, &HelpWidget::forward);
m_forwardMenu = new QMenu(toolBar);
connect(m_forwardMenu, &QMenu::aboutToShow, this, &HelpWidget::updateForwardMenu);
@@ -193,8 +191,7 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget
button->setPopupMode(QToolButton::DelayedPopup);
layout->addWidget(button);
m_addBookmarkAction = new QAction(QIcon(QLatin1String(":/help/images/bookmark.png")),
tr("Add Bookmark"), this);
m_addBookmarkAction = new QAction(Icons::BOOKMARK.icon(), tr("Add Bookmark"), this);
cmd = Core::ActionManager::registerAction(m_addBookmarkAction, Constants::HELP_ADDBOOKMARK, context);
cmd->setDefaultKeySequence(QKeySequence(Core::UseMacShortcuts ? tr("Meta+M") : tr("Ctrl+M")));
connect(m_addBookmarkAction, &QAction::triggered, this, &HelpWidget::addBookmark);
@@ -253,8 +250,7 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget
}
if (style != ExternalWindow) {
m_closeAction = new QAction(Utils::ThemeHelper::themedIcon(QLatin1String(Core::Constants::ICON_BUTTON_CLOSE)),
QString(), toolBar);
m_closeAction = new QAction(Core::Icons::BUTTON_CLOSE.icon(), QString(), toolBar);
connect(m_closeAction, SIGNAL(triggered()), this, SIGNAL(closeButtonClicked()));
button = new QToolButton;
button->setDefaultAction(m_closeAction);