Utils: Add "Run File/Selected" icons and use them in ClangTools/AutoTest

In AutoTest, use the toolbar and menu variants accordingly.

Change-Id: I1405de1ace1efe6c3e51b17356a9e4dfb3b11dcd
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Alessandro Portale
2020-11-30 00:20:53 +01:00
parent d28533abd4
commit 19e13ddd6b
6 changed files with 33 additions and 34 deletions

View File

@@ -265,6 +265,20 @@ const Icon OVERLAY_WARNING({
const Icon OVERLAY_ERROR({
{":/utils/images/iconoverlay_error_background.png", Theme::BackgroundColorNormal},
{":/utils/images/iconoverlay_error.png", Theme::IconsErrorColor}}, Icon::Tint);
const Icon RUN_FILE({
{":/utils/images/run_small.png", Theme::IconsRunColor},
{":/utils/images/run_file.png", Theme::PanelTextColorMid}}, Icon::MenuTintedStyle);
const Icon RUN_FILE_TOOLBAR({
{":/utils/images/run_small.png", Theme::IconsRunToolBarColor},
{":/utils/images/run_file.png", Theme::IconsBaseColor}});
const Icon RUN_SELECTED({
{":/utils/images/run_small.png", Theme::IconsRunColor},
{":/utils/images/runselected_boxes.png", Theme::PanelTextColorMid},
{":/utils/images/runselected_tickmarks.png", Theme::PanelTextColorMid}}, Icon::MenuTintedStyle);
const Icon RUN_SELECTED_TOOLBAR({
{":/utils/images/run_small.png", Theme::IconsRunToolBarColor},
{":/utils/images/runselected_boxes.png", Theme::IconsBaseColor},
{":/utils/images/runselected_tickmarks.png", Theme::IconsBaseColor}});
const Icon CODEMODEL_ERROR({
{":/utils/images/codemodelerror.png", Theme::IconsErrorColor}}, Icon::Tint);

View File

@@ -149,6 +149,10 @@ QTCREATOR_UTILS_EXPORT extern const Icon EMPTY16;
QTCREATOR_UTILS_EXPORT extern const Icon OVERLAY_ADD;
QTCREATOR_UTILS_EXPORT extern const Icon OVERLAY_WARNING;
QTCREATOR_UTILS_EXPORT extern const Icon OVERLAY_ERROR;
QTCREATOR_UTILS_EXPORT extern const Icon RUN_FILE;
QTCREATOR_UTILS_EXPORT extern const Icon RUN_FILE_TOOLBAR;
QTCREATOR_UTILS_EXPORT extern const Icon RUN_SELECTED;
QTCREATOR_UTILS_EXPORT extern const Icon RUN_SELECTED_TOOLBAR;
QTCREATOR_UTILS_EXPORT extern const Icon CODEMODEL_ERROR;
QTCREATOR_UTILS_EXPORT extern const Icon CODEMODEL_WARNING;

View File

@@ -33,13 +33,8 @@ namespace Icons {
const Utils::Icon SORT_NATURALLY({
{":/autotest/images/leafsort.png", Utils::Theme::IconsBaseColor}});
const Utils::Icon RUN_SELECTED_OVERLAY({
{":/utils/images/runselected_boxes.png", Utils::Theme::BackgroundColorDark},
{":/utils/images/runselected_tickmarks.png", Utils::Theme::IconsBaseColor}});
const Utils::Icon RUN_FAILED_OVERLAY({
{":utils/images/iconoverlay_reset.png", Utils::Theme::OutputPanes_TestXPassTextColor}});
const Utils::Icon RUN_FILE_OVERLAY({
{":/utils/images/run_file.png", Utils::Theme::IconsBaseColor}});
const Utils::Icon RESULT_PASS({
{":/utils/images/filledcircle.png", Utils::Theme::OutputPanes_TestPassTextColor}},
Utils::Icon::Tint);

View File

@@ -214,10 +214,7 @@ void AutotestPluginPrivate::initializeMenuEntries()
menu->addAction(command);
action = new QAction(tr("&Run Selected Tests"), this);
Utils::Icon runSelectedIcon = Utils::Icons::RUN_SMALL_TOOLBAR;
for (const Utils::IconMaskAndColor &maskAndColor : Icons::RUN_SELECTED_OVERLAY)
runSelectedIcon.append(maskAndColor);
action->setIcon(runSelectedIcon.icon());
action->setIcon(Utils::Icons::RUN_SELECTED.icon());
action->setToolTip(tr("Run Selected Tests"));
command = ActionManager::registerAction(action, Constants::ACTION_RUN_SELECTED_ID);
command->setDefaultKeySequence(
@@ -240,10 +237,7 @@ void AutotestPluginPrivate::initializeMenuEntries()
menu->addAction(command);
action = new QAction(tr("Run Tests for &Current File"), this);
Utils::Icon runFileIcon = Utils::Icons::RUN_SMALL_TOOLBAR;
for (const Utils::IconMaskAndColor &maskAndColor : Icons::RUN_FILE_OVERLAY)
runFileIcon.append(maskAndColor);
action->setIcon(runFileIcon.icon());
action->setIcon(Utils::Icons::RUN_FILE.icon());
action->setToolTip(tr("Run Tests for Current File"));
command = ActionManager::registerAction(action, Constants::ACTION_RUN_FILE_ID);
command->setDefaultKeySequence(

View File

@@ -49,6 +49,7 @@
#include <texteditor/fontsettings.h>
#include <texteditor/texteditor.h>
#include <texteditor/texteditorsettings.h>
#include <utils/proxyaction.h>
#include <utils/qtcassert.h>
#include <utils/stylehelper.h>
#include <utils/theme/theme.h>
@@ -184,12 +185,18 @@ void TestResultsPane::createToolButtons()
m_runAll->setDefaultAction(ActionManager::command(Constants::ACTION_RUN_ALL_ID)->action());
m_runSelected = new QToolButton(m_treeView);
m_runSelected->setDefaultAction(ActionManager::command(Constants::ACTION_RUN_SELECTED_ID)->action());
m_runSelected->setDefaultAction(
Utils::ProxyAction::proxyActionWithIcon(
ActionManager::command(Constants::ACTION_RUN_SELECTED_ID)->action(),
Utils::Icons::RUN_SELECTED_TOOLBAR.icon()));
m_runFailed = new QToolButton(m_treeView);
m_runFailed->setDefaultAction(ActionManager::command(Constants::ACTION_RUN_FAILED_ID)->action());
m_runFile = new QToolButton(m_treeView);
m_runFile->setDefaultAction(ActionManager::command(Constants::ACTION_RUN_FILE_ID)->action());
m_runFile->setDefaultAction(
Utils::ProxyAction::proxyActionWithIcon(
ActionManager::command(Constants::ACTION_RUN_FILE_ID)->action(),
Utils::Icons::RUN_FILE_TOOLBAR.icon()));
m_stopTestRun = new QToolButton(m_treeView);
m_stopTestRun->setIcon(Utils::Icons::STOP_SMALL_TOOLBAR.icon());

View File

@@ -66,7 +66,6 @@
#include <utils/infolabel.h>
#include <utils/progressindicator.h>
#include <utils/proxyaction.h>
#include <utils/theme/theme.h>
#include <utils/utilsicons.h>
#include <QAction>
@@ -385,23 +384,12 @@ ClangTool::ClangTool()
s_instance = this;
m_diagnosticModel = new ClangToolsDiagnosticModel(this);
const Utils::Icon RUN_SELECTED_OVERLAY(
{{":/utils/images/runselected_boxes.png", Utils::Theme::BackgroundColorDark},
{":/utils/images/runselected_tickmarks.png", Utils::Theme::IconsBaseColor}});
auto action = new QAction(tr("Analyze Project..."), this);
Utils::Icon runSelectedIcon = Utils::Icons::RUN_SMALL_TOOLBAR;
for (const Utils::IconMaskAndColor &maskAndColor : RUN_SELECTED_OVERLAY)
runSelectedIcon.append(maskAndColor);
action->setIcon(runSelectedIcon.icon());
action->setIcon(Utils::Icons::RUN_SELECTED_TOOLBAR.icon());
m_startAction = action;
action = new QAction(tr("Analyze Current File"), this);
const QIcon runFileIcon = Icon(
{{":/utils/images/run_small.png", Theme::IconsRunColor},
{":/utils/images/run_file.png", Theme::PanelTextColorMid}},
Icon::MenuTintedStyle).icon();
action->setIcon(runFileIcon);
action->setIcon(Utils::Icons::RUN_FILE.icon());
m_startOnCurrentFileAction = action;
m_stopAction = Debugger::createStopAction();
@@ -581,13 +569,10 @@ ClangTool::ClangTool()
startTool(FileSelectionType::CurrentFile);
});
const QIcon runFileIconToolBar = Icon(
{{":/utils/images/run_small.png", Theme::IconsRunToolBarColor},
{":/utils/images/run_file.png", Theme::IconsBaseColor}}).icon();
m_perspective.addToolBarAction(m_startAction);
m_perspective.addToolBarAction(ProxyAction::proxyActionWithIcon(
m_startOnCurrentFileAction, runFileIconToolBar));
m_startOnCurrentFileAction,
Utils::Icons::RUN_FILE_TOOLBAR.icon()));
m_perspective.addToolBarAction(m_stopAction);
m_perspective.addToolBarAction(m_openProjectSettings);
m_perspective.addToolbarSeparator();