forked from qt-creator/qt-creator
ProjectExplorer: Introduce IDeviceFactory::iconForId()
This adds the possibility to have an icon for a device type. Now, a Kit can have a proper icon if just the device type but not device is selected. Change-Id: I2a382ffd5b46cbbf74cdd0b934b3d450d300bfff Reviewed-by: Tobias Hunger <tobias.hunger@qt.io> Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io> Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
@@ -31,7 +31,6 @@
|
||||
#include <projectexplorer/devicesupport/devicemanager.h>
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <coreplugin/helpmanager.h>
|
||||
#include <utils/icon.h>
|
||||
#include <utils/portlist.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
@@ -92,10 +91,6 @@ IosDevice::IosDevice()
|
||||
ports.addRange(Utils::Port(Constants::IOS_DEVICE_PORT_START),
|
||||
Utils::Port(Constants::IOS_DEVICE_PORT_END));
|
||||
setFreePorts(ports);
|
||||
setDeviceIcon({Utils::Icon({{":/ios/images/iosdevicesmall.png",
|
||||
Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint),
|
||||
Utils::Icon({{":/ios/images/iosdevice.png",
|
||||
Utils::Theme::IconsBaseColor}})});
|
||||
}
|
||||
|
||||
IosDevice::IosDevice(const IosDevice &other)
|
||||
|
||||
@@ -28,6 +28,10 @@
|
||||
|
||||
#include "iosconstants.h"
|
||||
|
||||
#include <utils/icon.h>
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
namespace Ios {
|
||||
namespace Internal {
|
||||
|
||||
@@ -46,6 +50,18 @@ QList<Core::Id> IosDeviceFactory::availableCreationIds() const
|
||||
return QList<Core::Id>() << Core::Id(Constants::IOS_DEVICE_TYPE);
|
||||
}
|
||||
|
||||
QIcon IosDeviceFactory::iconForId(Core::Id type) const
|
||||
{
|
||||
Q_UNUSED(type)
|
||||
using namespace Utils;
|
||||
static const QIcon icon =
|
||||
Icon::combinedIcon({Icon({{":/ios/images/iosdevicesmall.png",
|
||||
Theme::PanelTextColorDark}}, Icon::Tint),
|
||||
Icon({{":/ios/images/iosdevice.png",
|
||||
Theme::IconsBaseColor}})});
|
||||
return icon;
|
||||
}
|
||||
|
||||
bool IosDeviceFactory::canCreate() const
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -42,6 +42,7 @@ public:
|
||||
|
||||
QString displayNameForId(Core::Id type) const override;
|
||||
QList<Core::Id> availableCreationIds() const override;
|
||||
QIcon iconForId(Core::Id type) const override;
|
||||
|
||||
bool canCreate() const override;
|
||||
ProjectExplorer::IDevice::Ptr create(Core::Id id) const override;
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "iostoolhandler.h"
|
||||
|
||||
#include <projectexplorer/kitinformation.h>
|
||||
#include <utils/icon.h>
|
||||
#include <utils/port.h>
|
||||
|
||||
#include <QCoreApplication>
|
||||
@@ -54,10 +53,6 @@ IosSimulator::IosSimulator(Core::Id id)
|
||||
{
|
||||
setDisplayName(QCoreApplication::translate("Ios::Internal::IosSimulator", "iOS Simulator"));
|
||||
setDeviceState(DeviceReadyToUse);
|
||||
setDeviceIcon({Utils::Icon({{":/ios/images/iosdevicesmall.png",
|
||||
Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint),
|
||||
Utils::Icon({{":/ios/images/iosdevice.png",
|
||||
Utils::Theme::IconsBaseColor}})});
|
||||
}
|
||||
|
||||
IosSimulator::IosSimulator()
|
||||
|
||||
@@ -27,8 +27,11 @@
|
||||
#include <QLatin1String>
|
||||
#include "iosconstants.h"
|
||||
#include "iossimulator.h"
|
||||
#include "utils/icon.h"
|
||||
#include "utils/qtcassert.h"
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
namespace Ios {
|
||||
namespace Internal {
|
||||
|
||||
@@ -49,6 +52,18 @@ QList<Core::Id> IosSimulatorFactory::availableCreationIds() const
|
||||
return QList<Core::Id>() << Core::Id(Constants::IOS_SIMULATOR_TYPE);
|
||||
}
|
||||
|
||||
QIcon IosSimulatorFactory::iconForId(Core::Id type) const
|
||||
{
|
||||
Q_UNUSED(type)
|
||||
using namespace Utils;
|
||||
static const QIcon icon =
|
||||
Icon::combinedIcon({Icon({{":/ios/images/iosdevicesmall.png",
|
||||
Theme::PanelTextColorDark}}, Icon::Tint),
|
||||
Icon({{":/ios/images/iosdevice.png",
|
||||
Theme::IconsBaseColor}})});
|
||||
return icon;
|
||||
}
|
||||
|
||||
bool IosSimulatorFactory::canCreate() const
|
||||
{
|
||||
return false;
|
||||
|
||||
@@ -38,6 +38,7 @@ public:
|
||||
|
||||
QString displayNameForId(Core::Id type) const override;
|
||||
QList<Core::Id> availableCreationIds() const override;
|
||||
QIcon iconForId(Core::Id type) const override;
|
||||
|
||||
bool canCreate() const override;
|
||||
ProjectExplorer::IDevice::Ptr create(Core::Id id) const override;
|
||||
|
||||
Reference in New Issue
Block a user