Commit 22a262e8 authored by Alessandro Portale's avatar Alessandro Portale

ProjectExplorer: Flat desktop device icon for flat themes

This change flattens the desktop device icon in the mode bar. Only for
themes which set the FlatSideBarIcons flag.

":///DESKTOP///" deduplicates to Constants::DESKTOP_DEVICE_ICON

Change-Id: Ie31d9c501db2a1e36edbfac59abdd22a4d8c6773
Reviewed-by: default avatarEike Ziller <eike.ziller@theqtcompany.com>
parent c3711669
......@@ -253,7 +253,7 @@ void FancyToolButton::paintEvent(QPaintEvent *event)
}
// pop up arrow next to icon
if (!icon().isNull()) {
if (isEnabled() && !icon().isNull()) {
QStyleOption opt;
opt.initFrom(this);
opt.rect = rect().adjusted(rect().width() - 16, 0, -8, 0);
......
......@@ -29,9 +29,11 @@
#include "ioutputparser.h"
#include "osparser.h"
#include "projectexplorerconstants.h"
#include "projectexplorericons.h"
#include <utils/algorithm.h>
#include <utils/fileutils.h>
#include <utils/icon.h>
#include <utils/macroexpander.h>
#include <utils/qtcassert.h>
......@@ -83,7 +85,7 @@ public:
m_id = Id::fromString(QUuid::createUuid().toString());
m_unexpandedDisplayName = QCoreApplication::translate("ProjectExplorer::Kit", "Unnamed");
m_iconPath = FileName::fromLatin1(":///DESKTOP///");
m_iconPath = FileName::fromLatin1(Constants::DESKTOP_DEVICE_ICON);
m_macroExpander.setDisplayName(tr("Kit"));
m_macroExpander.setAccumulating(true);
......@@ -373,8 +375,12 @@ QIcon Kit::icon(const FileName &path)
{
if (path.isEmpty())
return QIcon();
if (path == FileName::fromLatin1(":///DESKTOP///"))
return qApp->style()->standardIcon(QStyle::SP_ComputerIcon);
if (path == FileName::fromLatin1(Constants::DESKTOP_DEVICE_ICON))
return creatorTheme()->flag(Theme::FlatSideBarIcons)
? Icon::combinedIcon({Icons::DESKTOP_DEVICE.icon(),
Icons::DESKTOP_DEVICE_SMALL.icon()})
: QApplication::style()->standardIcon(QStyle::SP_ComputerIcon);
QFileInfo fi = path.toFileInfo();
if (fi.isFile() && fi.isReadable())
......
......@@ -30,6 +30,7 @@
#include "kitfeatureprovider.h"
#include "kitmanagerconfigwidget.h"
#include "project.h"
#include "projectexplorerconstants.h"
#include "task.h"
#include <coreplugin/icore.h>
......@@ -207,7 +208,7 @@ void KitManager::restoreKits()
defaultKit->setUnexpandedDisplayName(tr("Desktop"));
defaultKit->setSdkProvided(false);
defaultKit->setAutoDetected(false);
defaultKit->setIconPath(FileName::fromLatin1(":///DESKTOP///"));
defaultKit->setIconPath(FileName::fromLatin1(ProjectExplorer::Constants::DESKTOP_DEVICE_ICON));
defaultKit->setup();
......
......@@ -28,6 +28,7 @@
#include "kitconfigwidget.h"
#include "kitmanager.h"
#include "target.h"
#include "projectexplorericons.h"
#include <utils/algorithm.h>
#include <utils/styledbar.h>
......@@ -664,7 +665,9 @@ MiniProjectTargetSelector::MiniProjectTargetSelector(QAction *targetSelectorActi
setContentsMargins(QMargins(0, 1, 1, 8));
setWindowFlags(Qt::Popup);
targetSelectorAction->setIcon(style()->standardIcon(QStyle::SP_ComputerIcon));
targetSelectorAction->setIcon(creatorTheme()->flag(Theme::FlatSideBarIcons)
? Icons::DESKTOP_DEVICE.icon()
: style()->standardIcon(QStyle::SP_ComputerIcon));
targetSelectorAction->setProperty("titledAction", true);
m_kitAreaWidget = new KitAreaWidget(this);
......@@ -1500,7 +1503,9 @@ void MiniProjectTargetSelector::updateActionAndSummary()
QString buildConfig;
QString deployConfig;
QString runConfig;
QIcon targetIcon = style()->standardIcon(QStyle::SP_ComputerIcon);
QIcon targetIcon = creatorTheme()->flag(Theme::FlatSideBarIcons)
? Icons::DESKTOP_DEVICE.icon()
: style()->standardIcon(QStyle::SP_ComputerIcon);
Project *project = SessionManager::startupProject();
if (project) {
......
......@@ -69,5 +69,9 @@
<file>images/targetchangebutton@2x.png</file>
<file>images/targetchangebutton2.png</file>
<file>images/targetchangebutton2@2x.png</file>
<file>images/desktopdevice.png</file>
<file>images/desktopdevice@2x.png</file>
<file>images/desktopdevicesmall.png</file>
<file>images/desktopdevicesmall@2x.png</file>
</qresource>
</RCC>
......@@ -223,6 +223,7 @@ const char DEFAULT_WORKING_DIR_ALTERNATE[] = "%{sourceDir}";
// Desktop Device related ids:
const char DESKTOP_DEVICE_ID[] = "Desktop Device";
const char DESKTOP_DEVICE_TYPE[] = "Desktop";
const char DESKTOP_DEVICE_ICON[] = ":///DESKTOP///";
const int DESKTOP_PORT_START = 30000;
const int DESKTOP_PORT_END = 31000;
......
......@@ -67,6 +67,11 @@ const Utils::Icon BUILDSTEP_DISABLE({
const Utils::Icon BUILDSTEP_REMOVE({
{QLatin1String(":/projectexplorer/images/buildstepremove.png"), Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint);
const Utils::Icon DESKTOP_DEVICE({
{QLatin1String(":/projectexplorer/images/desktopdevice.png"), Utils::Theme::IconsBaseColor}});
const Utils::Icon DESKTOP_DEVICE_SMALL({
{QLatin1String(":/projectexplorer/images/desktopdevicesmall.png"), Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint);
const Utils::Icon RUN_SMALL({
{QLatin1String(":/projectexplorer/images/run_small.png"), Utils::Theme::IconsRunColor}});
const Utils::Icon STOP_SMALL({
......
......@@ -2096,7 +2096,7 @@ QVariantMap UserFileVersion11Upgrader::upgrade(const QVariantMap &map)
tmpKit->setValue("PE.Profile.DeviceType", QString::fromLatin1("Desktop"));
tmpKit->setValue("PE.Profile.Device", QString());
} else if (oldTargetId == QLatin1String("RemoteLinux.EmbeddedLinuxTarget")) {
tmpKit->setIconPath(FileName::fromLatin1(":///DESKTOP///"));
tmpKit->setIconPath(FileName::fromLatin1(Constants::DESKTOP_DEVICE_ICON));
tmpKit->setValue("PE.Profile.DeviceType", QString::fromLatin1("GenericLinuxOsType"));
tmpKit->setValue("PE.Profile.Device", QString());
} else if (oldTargetId == QLatin1String("Qt4ProjectManager.Target.HarmattanDeviceTarget")) {
......@@ -2120,7 +2120,7 @@ QVariantMap UserFileVersion11Upgrader::upgrade(const QVariantMap &map)
tmpKit->setValue("PE.Profile.DeviceType", QString::fromLatin1("Desktop"));
tmpKit->setValue("PE.Profile.Device", QString::fromLatin1("Desktop Device"));
} else {
tmpKit->setIconPath(FileName::fromLatin1(":///DESKTOP///"));
tmpKit->setIconPath(FileName::fromLatin1(Constants::DESKTOP_DEVICE_ICON));
tmpKit->setValue("PE.Profile.DeviceType", QString::fromLatin1("Desktop"));
tmpKit->setValue("PE.Profile.Device", QString::fromLatin1("Desktop Device"));
}
......
......@@ -4173,5 +4173,36 @@
id="polygon5757-3-4" />
</g>
</g>
<g
transform="translate(6.5,297)"
id="src/plugins/projectexplorer/images/desktopdevice">
<rect
style="display:inline;fill:#ffffff;fill-opacity:1"
x="499.5"
y="50"
width="32"
height="32"
id="rect5759-5-9-0" />
<path
d="m 525.5,54 -20,0 c -1.1,0 -2,0.9 -2,2 l 0,14 c 0,1.1 0.9,2 2,2 l 20,0 c 1.1,0 2,-0.9 2,-2 l 0,-14 c 0,-1.1 -0.9,-2 -2,-2 l 0,0 z"
id="path5514" />
<path
d="m 521,78 -3.5,-7 -4,0 -3.5,7 z"
id="polygon5516"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccccc" />
<path
d="m 525.5,56 0,14 -20,0 0,-14 20,0"
id="path4825"
style="fill:#b3b3b3" />
</g>
<use
x="0"
y="0"
xlink:href="#src/plugins/projectexplorer/images/desktopdevice"
id="src/plugins/projectexplorer/images/desktopdevicesmall"
transform="matrix(0.5,0,0,0.5,285,189.5)"
width="100%"
height="100%" />
</g>
</svg>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment