diff options
author | Alessandro Portale <alessandro.portale@theqtcompany.com> | 2015-11-23 16:41:54 +0100 |
---|---|---|
committer | Alessandro Portale <alessandro.portale@theqtcompany.com> | 2015-11-25 12:30:52 +0000 |
commit | 033862f3057818df3123d07fc6cb34e193250c53 (patch) | |
tree | 884de0b3b8ac16e548e4f585bd8c821aa890f8b4 /src/plugins/diffeditor | |
parent | 00c75cd7ebde4f191c15e92550db369163a95b68 (diff) | |
download | qt-creator-033862f3057818df3123d07fc6cb34e193250c53.tar.gz |
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>
Diffstat (limited to 'src/plugins/diffeditor')
-rw-r--r-- | src/plugins/diffeditor/diffeditor.cpp | 12 | ||||
-rw-r--r-- | src/plugins/diffeditor/diffeditor.pro | 3 | ||||
-rw-r--r-- | src/plugins/diffeditor/diffeditor.qbs | 1 | ||||
-rw-r--r-- | src/plugins/diffeditor/diffeditorconstants.h | 2 | ||||
-rw-r--r-- | src/plugins/diffeditor/diffeditoricons.h | 49 | ||||
-rw-r--r-- | src/plugins/diffeditor/diffview.cpp | 8 |
6 files changed, 60 insertions, 15 deletions
diff --git a/src/plugins/diffeditor/diffeditor.cpp b/src/plugins/diffeditor/diffeditor.cpp index 7a9d9d0091..f01be54dec 100644 --- a/src/plugins/diffeditor/diffeditor.cpp +++ b/src/plugins/diffeditor/diffeditor.cpp @@ -30,11 +30,13 @@ #include "diffeditor.h" #include "diffeditorconstants.h" +#include "diffeditoricons.h" #include "diffeditordocument.h" #include "diffview.h" #include <coreplugin/icore.h> #include <coreplugin/coreconstants.h> +#include <coreplugin/coreicons.h> #include <coreplugin/minisplitter.h> #include <texteditor/texteditor.h> @@ -45,7 +47,6 @@ #include <utils/algorithm.h> #include <utils/fileutils.h> #include <utils/qtcassert.h> -#include <utils/themehelper.h> #include <QAction> #include <QStackedWidget> @@ -283,16 +284,13 @@ DiffEditor::DiffEditor() m_whitespaceButtonAction = m_toolBar->addAction(tr("Ignore Whitespace")); m_whitespaceButtonAction->setCheckable(true); - m_toggleDescriptionAction = m_toolBar->addAction( - Utils::ThemeHelper::themedIcon(QLatin1String(Constants::ICON_TOP_BAR)), QString()); + m_toggleDescriptionAction = m_toolBar->addAction(Icons::TOP_BAR.icon(), QString()); m_toggleDescriptionAction->setCheckable(true); - m_reloadAction = m_toolBar->addAction(QIcon(QLatin1String(Core::Constants::ICON_RELOAD_GRAY)), - tr("Reload Diff")); + m_reloadAction = m_toolBar->addAction(Core::Icons::RELOAD_GRAY.icon(), tr("Reload Diff")); m_reloadAction->setToolTip(tr("Reload Diff")); - m_toggleSyncAction = m_toolBar->addAction( - Utils::ThemeHelper::themedIcon(QLatin1String(Core::Constants::ICON_LINK)), QString()); + m_toggleSyncAction = m_toolBar->addAction(Core::Icons::LINK.icon(), QString()); m_toggleSyncAction->setCheckable(true); m_viewSwitcherAction = m_toolBar->addAction(QIcon(), QString()); diff --git a/src/plugins/diffeditor/diffeditor.pro b/src/plugins/diffeditor/diffeditor.pro index 829e7367f5..1f5873626d 100644 --- a/src/plugins/diffeditor/diffeditor.pro +++ b/src/plugins/diffeditor/diffeditor.pro @@ -13,7 +13,8 @@ HEADERS += diffeditor_global.h \ diffview.h \ selectabletexteditorwidget.h \ sidebysidediffeditorwidget.h \ - unifieddiffeditorwidget.h + unifieddiffeditorwidget.h \ + diffeditoricons.h SOURCES += diffeditor.cpp \ diffeditorcontroller.cpp \ diff --git a/src/plugins/diffeditor/diffeditor.qbs b/src/plugins/diffeditor/diffeditor.qbs index d7266c7dfc..b8f6c42c76 100644 --- a/src/plugins/diffeditor/diffeditor.qbs +++ b/src/plugins/diffeditor/diffeditor.qbs @@ -19,6 +19,7 @@ QtcPlugin { "diffeditor.qrc", "diffeditor_global.h", "diffeditorconstants.h", + "diffeditoricons.h", "diffeditorcontroller.cpp", "diffeditorcontroller.h", "diffeditordocument.cpp", diff --git a/src/plugins/diffeditor/diffeditorconstants.h b/src/plugins/diffeditor/diffeditorconstants.h index cb492cdd4e..7037417492 100644 --- a/src/plugins/diffeditor/diffeditorconstants.h +++ b/src/plugins/diffeditor/diffeditorconstants.h @@ -41,8 +41,6 @@ const char DIFF_EDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("DiffEditor", "Diff Ed const char DIFF_EDITOR_MIMETYPE[] = "text/x-patch"; const char G_TOOLS_DIFF[] = "QtCreator.Group.Tools.Options"; -const char ICON_TOP_BAR[] = ":/diffeditor/images/topbar.png"; - const char EXPAND_BRANCHES[] = "Branches: <Expand>"; } // namespace Constants diff --git a/src/plugins/diffeditor/diffeditoricons.h b/src/plugins/diffeditor/diffeditoricons.h new file mode 100644 index 0000000000..b3d0eb25e7 --- /dev/null +++ b/src/plugins/diffeditor/diffeditoricons.h @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** Copyright (C) 2015 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing +** +** This file is part of Qt Creator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms and +** conditions see http://www.qt.io/terms-conditions. For further information +** use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +****************************************************************************/ + +#ifndef DIFFEDITORICONS_H +#define DIFFEDITORICONS_H + +#include <utils/icon.h> + +namespace DiffEditor { +namespace Icons { + +const Utils::Icon TOP_BAR({ + {QLatin1String(":/diffeditor/images/topbar.png"), Utils::Theme::IconsBaseColor}}); +const Utils::Icon UNIFIED_DIFF({ + {QLatin1String(":/diffeditor/images/unifieddiff.png"), Utils::Theme::IconsBaseColor}}); +const Utils::Icon SIDEBYSIDE_DIFF({ + {QLatin1String(":/diffeditor/images/sidebysidediff.png"), Utils::Theme::IconsBaseColor}}); + +} // namespace Icons +} // namespace DiffEditor + +#endif // DIFFEDITORICONS_H diff --git a/src/plugins/diffeditor/diffview.cpp b/src/plugins/diffeditor/diffview.cpp index bb70085c90..0a43518c9f 100644 --- a/src/plugins/diffeditor/diffview.cpp +++ b/src/plugins/diffeditor/diffview.cpp @@ -30,11 +30,11 @@ #include "diffview.h" +#include "diffeditoricons.h" #include "unifieddiffeditorwidget.h" #include "sidebysidediffeditorwidget.h" #include <utils/qtcassert.h> -#include <utils/themehelper.h> #include <QCoreApplication> @@ -97,8 +97,7 @@ void IDiffView::setSyncToolTip(const QString &text) UnifiedView::UnifiedView() : m_widget(0) { setId(UNIFIED_VIEW_ID); - setIcon(Utils::ThemeHelper::themedIcon( - QLatin1String(":/diffeditor/images/unifieddiff.png"))); + setIcon(Icons::UNIFIED_DIFF.icon()); setToolTip(QCoreApplication::translate("DiffEditor::UnifiedView", "Switch to Unified Diff Editor")); } @@ -154,8 +153,7 @@ void UnifiedView::setSync(bool sync) SideBySideView::SideBySideView() : m_widget(0) { setId(SIDE_BY_SIDE_VIEW_ID); - setIcon(Utils::ThemeHelper::themedIcon( - QLatin1String(":/diffeditor/images/sidebysidediff.png"))); + setIcon(Icons::UNIFIED_DIFF.icon()); setToolTip(QCoreApplication::translate("DiffEditor::SideBySideView", "Switch to Side By Side Diff Editor")); setSupportsSync(true); |