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 "androidconstants.h"
|
||||
|
||||
#include <utils/icon.h>
|
||||
|
||||
#include <QIcon>
|
||||
|
||||
namespace Android {
|
||||
namespace Internal {
|
||||
|
||||
@@ -39,32 +35,9 @@ AndroidDeviceFactory::AndroidDeviceFactory()
|
||||
: ProjectExplorer::IDeviceFactory(Constants::ANDROID_DEVICE_TYPE)
|
||||
{
|
||||
setObjectName(QLatin1String("AndroidDeviceFactory"));
|
||||
}
|
||||
|
||||
QString AndroidDeviceFactory::displayName() const
|
||||
{
|
||||
return tr("Android Device");
|
||||
}
|
||||
|
||||
QIcon AndroidDeviceFactory::icon() const
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
ProjectExplorer::IDevice::Ptr AndroidDeviceFactory::create() const
|
||||
{
|
||||
return ProjectExplorer::IDevice::Ptr();
|
||||
setDisplayName(tr("Android Device"));
|
||||
setCombinedIcon(":/android/images/androiddevicesmall.png",
|
||||
":/android/images/androiddevice.png");
|
||||
}
|
||||
|
||||
ProjectExplorer::IDevice::Ptr AndroidDeviceFactory::restore(const QVariantMap &map) const
|
||||
|
||||
@@ -36,11 +36,6 @@ class AndroidDeviceFactory : public ProjectExplorer::IDeviceFactory
|
||||
public:
|
||||
AndroidDeviceFactory();
|
||||
|
||||
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