ProjectExplorer: Themable device status indicator overlay
Change-Id: I84ddd10a53e709cd57422ab323abdfb69d75c9a6 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
@@ -35,6 +35,7 @@
|
||||
#include "idevicefactory.h"
|
||||
#include "idevicewidget.h"
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
#include <projectexplorer/projectexplorericons.h>
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
@@ -178,13 +179,13 @@ void DeviceSettingsWidget::displayCurrent()
|
||||
m_ui->deviceStateValueIconLabel->show();
|
||||
switch (current->deviceState()) {
|
||||
case IDevice::DeviceReadyToUse:
|
||||
m_ui->deviceStateValueIconLabel->setPixmap(QPixmap(QLatin1String(":/projectexplorer/images/DeviceReadyToUse.png")));
|
||||
m_ui->deviceStateValueIconLabel->setPixmap(Icons::DEVICE_READY_INDICATOR.pixmap());
|
||||
break;
|
||||
case IDevice::DeviceConnected:
|
||||
m_ui->deviceStateValueIconLabel->setPixmap(QPixmap(QLatin1String(":/projectexplorer/images/DeviceConnected.png")));
|
||||
m_ui->deviceStateValueIconLabel->setPixmap(Icons::DEVICE_CONNECTED_INDICATOR.pixmap());
|
||||
break;
|
||||
case IDevice::DeviceDisconnected:
|
||||
m_ui->deviceStateValueIconLabel->setPixmap(QPixmap(QLatin1String(":/projectexplorer/images/DeviceDisconnected.png")));
|
||||
m_ui->deviceStateValueIconLabel->setPixmap(Icons::DEVICE_DISCONNECTED_INDICATOR.pixmap());
|
||||
break;
|
||||
case IDevice::DeviceStateUnknown:
|
||||
m_ui->deviceStateValueIconLabel->hide();
|
||||
|
||||
|
Before Width: | Height: | Size: 569 B |
|
Before Width: | Height: | Size: 446 B |
|
Before Width: | Height: | Size: 544 B |
|
After Width: | Height: | Size: 158 B |
|
After Width: | Height: | Size: 265 B |
@@ -32,9 +32,8 @@
|
||||
<file>images/ProjectDependencies.png</file>
|
||||
<file>images/MaemoDevice.png</file>
|
||||
<file>images/Simulator.png</file>
|
||||
<file>images/DeviceConnected.png</file>
|
||||
<file>images/DeviceDisconnected.png</file>
|
||||
<file>images/DeviceReadyToUse.png</file>
|
||||
<file>images/devicestatusindicator.png</file>
|
||||
<file>images/devicestatusindicator@2x.png</file>
|
||||
<file>images/build.png</file>
|
||||
<file>images/build@2x.png</file>
|
||||
<file>images/build_hammerhandle_mask.png</file>
|
||||
|
||||
@@ -43,6 +43,12 @@ const Icon RUN_FLAT({
|
||||
{":/projectexplorer/images/run_mask.png", Theme::IconsRunToolBarColor}});
|
||||
const Icon WINDOW(":/projectexplorer/images/window.png");
|
||||
const Icon DEBUG_START(":/projectexplorer/images/debugger_start.png");
|
||||
const Icon DEVICE_READY_INDICATOR({
|
||||
{":/projectexplorer/images/devicestatusindicator.png", Theme::IconsRunToolBarColor}});
|
||||
const Icon DEVICE_CONNECTED_INDICATOR({
|
||||
{":/projectexplorer/images/devicestatusindicator.png", Theme::IconsWarningToolBarColor}});
|
||||
const Icon DEVICE_DISCONNECTED_INDICATOR({
|
||||
{":/projectexplorer/images/devicestatusindicator.png", Theme::IconsStopToolBarColor}});
|
||||
|
||||
const Icon DEBUG_START_FLAT({
|
||||
{":/projectexplorer/images/run_mask.png", Theme::IconsRunToolBarColor},
|
||||
|
||||
@@ -40,6 +40,9 @@ PROJECTEXPLORER_EXPORT extern const Utils::Icon RUN;
|
||||
PROJECTEXPLORER_EXPORT extern const Utils::Icon RUN_FLAT;
|
||||
PROJECTEXPLORER_EXPORT extern const Utils::Icon WINDOW;
|
||||
PROJECTEXPLORER_EXPORT extern const Utils::Icon DEBUG_START;
|
||||
PROJECTEXPLORER_EXPORT extern const Utils::Icon DEVICE_READY_INDICATOR;
|
||||
PROJECTEXPLORER_EXPORT extern const Utils::Icon DEVICE_CONNECTED_INDICATOR;
|
||||
PROJECTEXPLORER_EXPORT extern const Utils::Icon DEVICE_DISCONNECTED_INDICATOR;
|
||||
|
||||
PROJECTEXPLORER_EXPORT extern const Utils::Icon DEBUG_START_FLAT;
|
||||
PROJECTEXPLORER_EXPORT extern const Utils::Icon DEBUG_START_SMALL;
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <projectexplorer/buildmanager.h>
|
||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||
#include <projectexplorer/projectexplorericons.h>
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <projectexplorer/projectexplorer.h>
|
||||
#include <utils/qtcassert.h>
|
||||
@@ -94,17 +95,10 @@ public:
|
||||
BuildTargetInfoList m_appTargets;
|
||||
QVariantMap m_pluginSettings;
|
||||
|
||||
QPixmap m_connectedPixmap;
|
||||
QPixmap m_readyToUsePixmap;
|
||||
QPixmap m_disconnectedPixmap;
|
||||
|
||||
Kit *const m_kit;
|
||||
};
|
||||
|
||||
TargetPrivate::TargetPrivate(Kit *k) :
|
||||
m_connectedPixmap(QLatin1String(":/projectexplorer/images/DeviceConnected.png")),
|
||||
m_readyToUsePixmap(QLatin1String(":/projectexplorer/images/DeviceReadyToUse.png")),
|
||||
m_disconnectedPixmap(QLatin1String(":/projectexplorer/images/DeviceDisconnected.png")),
|
||||
m_kit(k)
|
||||
{ }
|
||||
|
||||
@@ -728,41 +722,35 @@ void Target::updateDeviceState()
|
||||
{
|
||||
IDevice::ConstPtr current = DeviceKitInformation::device(kit());
|
||||
|
||||
QPixmap overlay;
|
||||
QIcon overlay;
|
||||
static const QIcon disconnected = Icons::DEVICE_DISCONNECTED_INDICATOR.icon();
|
||||
if (current.isNull()) {
|
||||
overlay = d->m_disconnectedPixmap;
|
||||
overlay = disconnected;
|
||||
} else {
|
||||
switch (current->deviceState()) {
|
||||
case IDevice::DeviceStateUnknown:
|
||||
setOverlayIcon(QIcon());
|
||||
overlay = QIcon();
|
||||
setToolTip(QString());
|
||||
return;
|
||||
case IDevice::DeviceReadyToUse:
|
||||
overlay = d->m_readyToUsePixmap;
|
||||
case IDevice::DeviceReadyToUse: {
|
||||
static const QIcon ready = Icons::DEVICE_READY_INDICATOR.icon();
|
||||
overlay = ready;
|
||||
break;
|
||||
case IDevice::DeviceConnected:
|
||||
overlay = d->m_connectedPixmap;
|
||||
}
|
||||
case IDevice::DeviceConnected: {
|
||||
static const QIcon connected = Icons::DEVICE_CONNECTED_INDICATOR.icon();
|
||||
overlay = connected;
|
||||
break;
|
||||
}
|
||||
case IDevice::DeviceDisconnected:
|
||||
overlay = d->m_disconnectedPixmap;
|
||||
overlay = disconnected;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static const int TARGET_OVERLAY_ORIGINAL_SIZE = 32;
|
||||
|
||||
double factor = Core::Constants::TARGET_ICON_SIZE / (double)TARGET_OVERLAY_ORIGINAL_SIZE;
|
||||
QSize overlaySize(overlay.size().width()*factor, overlay.size().height()*factor);
|
||||
QPixmap pixmap(Core::Constants::TARGET_ICON_SIZE, Core::Constants::TARGET_ICON_SIZE);
|
||||
pixmap.fill(Qt::transparent);
|
||||
QPainter painter(&pixmap);
|
||||
painter.drawPixmap(Core::Constants::TARGET_ICON_SIZE - overlaySize.width(),
|
||||
Core::Constants::TARGET_ICON_SIZE - overlaySize.height(),
|
||||
overlay.scaled(overlaySize));
|
||||
|
||||
setOverlayIcon(QIcon(pixmap));
|
||||
setOverlayIcon(overlay);
|
||||
setToolTip(current.isNull() ? QString() : formatToolTip(current->deviceInformation()));
|
||||
}
|
||||
|
||||
|
||||
@@ -5931,5 +5931,23 @@
|
||||
id="path5131"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
<g
|
||||
transform="translate(-286,-205)"
|
||||
style="display:inline"
|
||||
id="src/plugins/projectexplorer/images/devicestatusindicator">
|
||||
<rect
|
||||
id="rect6782-96-9-2"
|
||||
height="32"
|
||||
width="32"
|
||||
y="552"
|
||||
x="936"
|
||||
style="fill:#ffffff" />
|
||||
<circle
|
||||
style="fill:#000000"
|
||||
id="path4864-5"
|
||||
cx="961.5"
|
||||
cy="577.5"
|
||||
r="5.5" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 207 KiB After Width: | Height: | Size: 208 KiB |