forked from qt-creator/qt-creator
Make IDeviceFactory use data members
... for display name, icon, and "can create". Also add a convenience function for the special icon setup that's used in all re-implementations. Change-Id: I8332adb38fb4a77b6992007ffe62f861339ba188 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -28,10 +28,6 @@
|
||||
|
||||
#include "iosconstants.h"
|
||||
|
||||
#include <utils/icon.h>
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
namespace Ios {
|
||||
namespace Internal {
|
||||
|
||||
@@ -39,32 +35,9 @@ IosDeviceFactory::IosDeviceFactory()
|
||||
: ProjectExplorer::IDeviceFactory(Constants::IOS_DEVICE_ID)
|
||||
{
|
||||
setObjectName(QLatin1String("IosDeviceFactory"));
|
||||
}
|
||||
|
||||
QString IosDeviceFactory::displayName() const
|
||||
{
|
||||
return IosDevice::name();
|
||||
}
|
||||
|
||||
QIcon IosDeviceFactory::icon() const
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
ProjectExplorer::IDevice::Ptr IosDeviceFactory::create() const
|
||||
{
|
||||
return ProjectExplorer::IDevice::Ptr();
|
||||
setDisplayName(IosDevice::name());
|
||||
setCombinedIcon(":/ios/images/iosdevicesmall.png",
|
||||
":/ios/images/iosdevice.png");
|
||||
}
|
||||
|
||||
bool IosDeviceFactory::canRestore(const QVariantMap &map) const
|
||||
|
||||
@@ -27,10 +27,6 @@
|
||||
|
||||
#include <projectexplorer/devicesupport/idevicefactory.h>
|
||||
|
||||
#include <QTimer>
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
|
||||
namespace Ios {
|
||||
namespace Internal {
|
||||
|
||||
@@ -40,11 +36,6 @@ class IosDeviceFactory : public ProjectExplorer::IDeviceFactory
|
||||
public:
|
||||
IosDeviceFactory();
|
||||
|
||||
QString displayName() const override;
|
||||
QIcon icon() const override;
|
||||
|
||||
bool canCreate() const override;
|
||||
ProjectExplorer::IDevice::Ptr create() const override;
|
||||
bool canRestore(const QVariantMap &map) const override;
|
||||
ProjectExplorer::IDevice::Ptr restore(const QVariantMap &map) const override;
|
||||
};
|
||||
|
||||
@@ -24,13 +24,11 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include "iossimulatorfactory.h"
|
||||
#include <QLatin1String>
|
||||
|
||||
#include "iosconstants.h"
|
||||
#include "iossimulator.h"
|
||||
#include "utils/icon.h"
|
||||
#include "utils/qtcassert.h"
|
||||
|
||||
#include <QIcon>
|
||||
#include "utils/qtcassert.h"
|
||||
|
||||
namespace Ios {
|
||||
namespace Internal {
|
||||
@@ -39,32 +37,9 @@ IosSimulatorFactory::IosSimulatorFactory()
|
||||
: ProjectExplorer::IDeviceFactory(Constants::IOS_SIMULATOR_TYPE)
|
||||
{
|
||||
setObjectName(QLatin1String("IosSimulatorFactory"));
|
||||
}
|
||||
|
||||
QString IosSimulatorFactory::displayName() const
|
||||
{
|
||||
return tr("iOS Simulator");
|
||||
}
|
||||
|
||||
QIcon IosSimulatorFactory::icon() const
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
ProjectExplorer::IDevice::Ptr IosSimulatorFactory::create() const
|
||||
{
|
||||
return ProjectExplorer::IDevice::Ptr();
|
||||
setDisplayName(tr("iOS Simulator"));
|
||||
setCombinedIcon(":/ios/images/iosdevicesmall.png",
|
||||
":/ios/images/iosdevice.png");
|
||||
}
|
||||
|
||||
ProjectExplorer::IDevice::Ptr IosSimulatorFactory::restore(const QVariantMap &map) const
|
||||
|
||||
@@ -36,11 +36,6 @@ class IosSimulatorFactory : public ProjectExplorer::IDeviceFactory
|
||||
public:
|
||||
IosSimulatorFactory();
|
||||
|
||||
QString displayName() const override;
|
||||
QIcon icon() const override;
|
||||
|
||||
bool canCreate() const override;
|
||||
ProjectExplorer::IDevice::Ptr create() const override;
|
||||
ProjectExplorer::IDevice::Ptr restore(const QVariantMap &map) const override;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user