forked from qt-creator/qt-creator
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:
@@ -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());
|
||||
|
||||
@@ -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 \
|
||||
|
||||
@@ -19,6 +19,7 @@ QtcPlugin {
|
||||
"diffeditor.qrc",
|
||||
"diffeditor_global.h",
|
||||
"diffeditorconstants.h",
|
||||
"diffeditoricons.h",
|
||||
"diffeditorcontroller.cpp",
|
||||
"diffeditorcontroller.h",
|
||||
"diffeditordocument.cpp",
|
||||
|
||||
@@ -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
|
||||
|
||||
49
src/plugins/diffeditor/diffeditoricons.h
Normal file
49
src/plugins/diffeditor/diffeditoricons.h
Normal file
@@ -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
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user