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:
Alessandro Portale
2016-11-12 04:16:59 +01:00
parent 2584366f6e
commit a00ee753fe
22 changed files with 132 additions and 32 deletions

View File

@@ -45,10 +45,6 @@ AndroidDevice::AndroidDevice()
{
setDisplayName(QCoreApplication::translate("Android::Internal::AndroidDevice", "Run on Android"));
setDeviceState(DeviceReadyToUse);
setDeviceIcon({Utils::Icon({{":/android/images/androiddevicesmall.png",
Utils::Theme::PanelTextColorDark}}, Utils::Icon::Tint),
Utils::Icon({{":/android/images/androiddevice.png",
Utils::Theme::IconsBaseColor}})});
}
AndroidDevice::AndroidDevice(const AndroidDevice &other)

View File

@@ -28,6 +28,10 @@
#include "androidconstants.h"
#include <utils/icon.h>
#include <QIcon>
namespace Android {
namespace Internal {
@@ -48,6 +52,18 @@ QList<Core::Id> AndroidDeviceFactory::availableCreationIds() const
return QList<Core::Id>() << Core::Id(Constants::ANDROID_DEVICE_TYPE);
}
QIcon AndroidDeviceFactory::iconForId(Core::Id type) const
{
Q_UNUSED(type)
using namespace Utils;
static const QIcon icon =
Icon::combinedIcon({Icon({{":/android/images/androiddevicesmall.png",
Theme::PanelTextColorDark}}, Icon::Tint),
Icon({{":/android/images/androiddevice.png",
Theme::IconsBaseColor}})});
return icon;
}
bool AndroidDeviceFactory::canCreate() const
{
return false;

View File

@@ -38,6 +38,7 @@ public:
QString displayNameForId(Core::Id type) const;
QList<Core::Id> availableCreationIds() const;
QIcon iconForId(Core::Id type) const;
bool canCreate() const;
ProjectExplorer::IDevice::Ptr create(Core::Id id) const;