De-Q_OBJECT-ify most DeviceFactories

WinRt is the odd one out.

Some were using setObjectName, but only used for debug reasons,
not really needed.

Change-Id: I4a370e4694443bc1c455fda4337ef3acfb9259b8
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
hjk
2020-01-21 16:17:59 +01:00
parent 8265d1d710
commit d08c0f31c4
27 changed files with 53 additions and 80 deletions

View File

@@ -33,7 +33,6 @@
#include <utils/url.h>
#include <QCoreApplication>
#include <QLoggingCategory>
using namespace ProjectExplorer;
@@ -45,9 +44,8 @@ AndroidDevice::AndroidDevice()
{
setupId(IDevice::AutoDetected, Constants::ANDROID_DEVICE_ID);
setType(Constants::ANDROID_DEVICE_TYPE);
setDefaultDisplayName(QCoreApplication::translate("Android::Internal::AndroidDevice",
"Run on Android"));
setDisplayType(QCoreApplication::translate("Android::Internal::AndroidDevice", "Android"));
setDefaultDisplayName(tr("Run on Android"));
setDisplayType(tr("Android"));
setMachineType(IDevice::Hardware);
setOsType(Utils::OsTypeOtherUnix);
@@ -88,8 +86,7 @@ QUrl AndroidDevice::toolControlChannel(const ControlChannelHint &) const
AndroidDeviceFactory::AndroidDeviceFactory()
: ProjectExplorer::IDeviceFactory(Constants::ANDROID_DEVICE_TYPE)
{
setObjectName(QLatin1String("AndroidDeviceFactory"));
setDisplayName(tr("Android Device"));
setDisplayName(AndroidDevice::tr("Android Device"));
setCombinedIcon(":/android/images/androiddevicesmall.png",
":/android/images/androiddevice.png");
setConstructionFunction(&AndroidDevice::create);

View File

@@ -31,8 +31,10 @@
namespace Android {
namespace Internal {
class AndroidDevice : public ProjectExplorer::IDevice
class AndroidDevice final : public ProjectExplorer::IDevice
{
Q_DECLARE_TR_FUNCTIONS(Android::Internal::AndroidDevice)
public:
static IDevice::Ptr create() { return IDevice::Ptr(new AndroidDevice); }
@@ -48,9 +50,8 @@ private:
QUrl toolControlChannel(const ControlChannelHint &) const override;
};
class AndroidDeviceFactory : public ProjectExplorer::IDeviceFactory
class AndroidDeviceFactory final : public ProjectExplorer::IDeviceFactory
{
Q_OBJECT
public:
AndroidDeviceFactory();
};

View File

@@ -31,12 +31,8 @@
#include "debugserverprovidermanager.h"
#include "idebugserverprovider.h"
#include <coreplugin/id.h>
#include <utils/qtcassert.h>
#include <QCoreApplication>
using namespace ProjectExplorer;
namespace BareMetal {
@@ -48,8 +44,7 @@ const char debugServerProviderIdKeyC[] = "IDebugServerProviderId";
BareMetalDevice::BareMetalDevice()
{
setDisplayType(QCoreApplication::translate("BareMetal::Internal::BareMetalDevice",
"Bare Metal"));
setDisplayType(tr("Bare Metal"));
setDefaultDisplayName(defaultDisplayName());
setOsType(Utils::OsTypeOther);
}
@@ -63,8 +58,7 @@ BareMetalDevice::~BareMetalDevice()
QString BareMetalDevice::defaultDisplayName()
{
return QCoreApplication::translate("BareMetal::Internal::BareMetalDevice",
"Bare Metal Device");
return tr("Bare Metal Device");
}
QString BareMetalDevice::debugServerProviderId() const
@@ -128,7 +122,7 @@ IDeviceWidget *BareMetalDevice::createWidget()
BareMetalDeviceFactory::BareMetalDeviceFactory()
: IDeviceFactory(Constants::BareMetalOsType)
{
setDisplayName(tr("Bare Metal Device"));
setDisplayName(BareMetalDevice::tr("Bare Metal Device"));
setCombinedIcon(":/baremetal/images/baremetaldevicesmall.png",
":/baremetal/images/baremetaldevice.png");
setCanCreate(true);

View File

@@ -38,6 +38,8 @@ class IDebugServerProvider;
class BareMetalDevice final : public ProjectExplorer::IDevice
{
Q_DECLARE_TR_FUNCTIONS(BareMetal::Internal::BareMetalDevice)
public:
using Ptr = QSharedPointer<BareMetalDevice>;
using ConstPtr = QSharedPointer<const BareMetalDevice>;
@@ -67,8 +69,6 @@ private:
class BareMetalDeviceFactory final : public ProjectExplorer::IDeviceFactory
{
Q_OBJECT
public:
explicit BareMetalDeviceFactory();

View File

@@ -283,7 +283,7 @@ private:
QdbLinuxDeviceFactory::QdbLinuxDeviceFactory()
: IDeviceFactory(Constants::QdbLinuxOsType)
{
setDisplayName(tr("Boot2Qt Device"));
setDisplayName(QdbDevice::tr("Boot2Qt Device"));
setCombinedIcon(":/qdb/images/qdbdevicesmall.png", ":/qdb/images/qdbdevice.png");
setCanCreate(true);
setConstructionFunction(&QdbDevice::create);

View File

@@ -32,7 +32,7 @@
namespace Qdb {
namespace Internal {
class QdbDevice : public RemoteLinux::LinuxDevice
class QdbDevice final : public RemoteLinux::LinuxDevice
{
Q_DECLARE_TR_FUNCTIONS(Qdb::Internal::QdbDevice)
@@ -60,9 +60,8 @@ private:
QString m_serialNumber;
};
class QdbLinuxDeviceFactory : public ProjectExplorer::IDeviceFactory
class QdbLinuxDeviceFactory final : public ProjectExplorer::IDeviceFactory
{
Q_OBJECT
public:
QdbLinuxDeviceFactory();

View File

@@ -33,7 +33,6 @@
#include <coreplugin/helpmanager.h>
#include <utils/portlist.h>
#include <QCoreApplication>
#include <QVariant>
#include <QVariantMap>
#include <QMessageBox>
@@ -93,7 +92,7 @@ IosDevice::IosDevice(CtorHelper)
{
setType(Constants::IOS_DEVICE_TYPE);
setDefaultDisplayName(IosDevice::name());
setDisplayType(QCoreApplication::translate("Ios::Internal::IosDevice", "iOS"));
setDisplayType(tr("iOS"));
setMachineType(IDevice::Hardware);
setOsType(Utils::OsTypeMac);
setDeviceState(DeviceDisconnected);
@@ -538,7 +537,6 @@ void IosDeviceManager::updateAvailableDevices(const QStringList &devices)
IosDeviceFactory::IosDeviceFactory()
: IDeviceFactory(Constants::IOS_DEVICE_TYPE)
{
setObjectName(QLatin1String("IosDeviceFactory"));
setDisplayName(IosDevice::name());
setCombinedIcon(":/ios/images/iosdevicesmall.png",
":/ios/images/iosdevice.png");

View File

@@ -42,8 +42,10 @@ class IosConfigurations;
namespace Internal {
class IosDeviceManager;
class IosDevice : public ProjectExplorer::IDevice
class IosDevice final : public ProjectExplorer::IDevice
{
Q_DECLARE_TR_FUNCTIONS(Ios::Internal::IosDevice)
public:
using Dict = QMap<QString, QString>;
using ConstPtr = QSharedPointer<const IosDevice>;
@@ -76,9 +78,8 @@ protected:
mutable quint16 m_lastPort;
};
class IosDeviceFactory : public ProjectExplorer::IDeviceFactory
class IosDeviceFactory final : public ProjectExplorer::IDeviceFactory
{
Q_OBJECT
public:
IosDeviceFactory();

View File

@@ -51,9 +51,8 @@ IosSimulator::IosSimulator(Core::Id id)
setType(Constants::IOS_SIMULATOR_TYPE);
setMachineType(IDevice::Emulator);
setOsType(Utils::OsTypeMac);
setDefaultDisplayName(QCoreApplication::translate("Ios::Internal::IosSimulator",
"iOS Simulator"));
setDisplayType(QCoreApplication::translate("Ios::Internal::IosSimulator", "iOS Simulator"));
setDefaultDisplayName(tr("iOS Simulator"));
setDisplayType(tr("iOS Simulator"));
setDeviceState(DeviceReadyToUse);
}
@@ -242,8 +241,7 @@ QDebug operator <<(QDebug debug, const IosDeviceType &deviceType)
IosSimulatorFactory::IosSimulatorFactory()
: ProjectExplorer::IDeviceFactory(Constants::IOS_SIMULATOR_TYPE)
{
setObjectName(QLatin1String("IosSimulatorFactory"));
setDisplayName(tr("iOS Simulator"));
setDisplayName(IosSimulator::tr("iOS Simulator"));
setCombinedIcon(":/ios/images/iosdevicesmall.png",
":/ios/images/iosdevice.png");
setConstructionFunction([] { return ProjectExplorer::IDevice::Ptr(new IosSimulator()); });

View File

@@ -62,8 +62,10 @@ public:
QDebug operator <<(QDebug debug, const IosDeviceType &deviceType);
class IosSimulator : public ProjectExplorer::IDevice
class IosSimulator final : public ProjectExplorer::IDevice
{
Q_DECLARE_TR_FUNCTIONS(Ios::Internal::IosSimulator)
public:
using ConstPtr = QSharedPointer<const IosSimulator>;
using Ptr = QSharedPointer<IosSimulator>;
@@ -84,9 +86,8 @@ private:
mutable quint16 m_lastPort;
};
class IosSimulatorFactory : public ProjectExplorer::IDeviceFactory
class IosSimulatorFactory final : public ProjectExplorer::IDeviceFactory
{
Q_OBJECT
public:
IosSimulatorFactory();
};

View File

@@ -56,7 +56,7 @@ ProjectExplorer::IDevice::Ptr McuSupportDevice::create()
McuSupportDeviceFactory::McuSupportDeviceFactory()
: ProjectExplorer::IDeviceFactory(Constants::DEVICE_TYPE)
{
setDisplayName(tr("MCU Device"));
setDisplayName(McuSupportDevice::tr("MCU Device"));
setCombinedIcon(":/mcusupport/images/mcusupportdevicesmall.png",
":/mcusupport/images/mcusupportdevice.png");
setCanCreate(true);

View File

@@ -27,12 +27,10 @@
#include <projectexplorer/devicesupport/desktopdevice.h>
#include <QCoreApplication>
namespace McuSupport {
namespace Internal {
class McuSupportDevice : public ProjectExplorer::DesktopDevice
class McuSupportDevice final : public ProjectExplorer::DesktopDevice
{
Q_DECLARE_TR_FUNCTIONS(McuSupport::Internal::McuSupportDevice)
@@ -43,10 +41,8 @@ private:
McuSupportDevice();
};
class McuSupportDeviceFactory : public ProjectExplorer::IDeviceFactory
class McuSupportDeviceFactory final : public ProjectExplorer::IDeviceFactory
{
Q_OBJECT
public:
McuSupportDeviceFactory();

View File

@@ -53,8 +53,7 @@ DesktopDevice::DesktopDevice()
{
setupId(IDevice::AutoDetected, DESKTOP_DEVICE_ID);
setType(DESKTOP_DEVICE_TYPE);
setDefaultDisplayName(QCoreApplication::translate("ProjectExplorer::DesktopDevice",
"Local PC"));
setDefaultDisplayName(tr("Local PC"));
setDisplayType(QCoreApplication::translate("ProjectExplorer::DesktopDevice", "Desktop"));
setDeviceState(IDevice::DeviceStateUnknown);

View File

@@ -30,6 +30,8 @@
#include "idevice.h"
#include "idevicefactory.h"
#include <QApplication>
namespace ProjectExplorer {
class ProjectExplorerPlugin;
@@ -37,6 +39,8 @@ namespace Internal { class DesktopDeviceFactory; }
class PROJECTEXPLORER_EXPORT DesktopDevice : public IDevice
{
Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::DesktopDevice)
public:
IDevice::DeviceInfo deviceInformation() const override;

View File

@@ -31,7 +31,6 @@
#include <utils/icon.h>
#include <utils/qtcassert.h>
#include <QApplication>
#include <QStyle>
namespace ProjectExplorer {
@@ -41,7 +40,7 @@ DesktopDeviceFactory::DesktopDeviceFactory()
: IDeviceFactory(Constants::DESKTOP_DEVICE_TYPE)
{
setConstructionFunction([] { return IDevice::Ptr(new DesktopDevice); });
setDisplayName(tr("Desktop"));
setDisplayName(DesktopDevice::tr("Desktop"));
setIcon(Utils::creatorTheme()->flag(Utils::Theme::FlatSideBarIcons)
? Utils::Icon::combinedIcon({Icons::DESKTOP_DEVICE.icon(),
Icons::DESKTOP_DEVICE_SMALL.icon()})

View File

@@ -30,10 +30,8 @@
namespace ProjectExplorer {
namespace Internal {
class DesktopDeviceFactory : public IDeviceFactory
class DesktopDeviceFactory final : public IDeviceFactory
{
Q_OBJECT
public:
DesktopDeviceFactory();
};

View File

@@ -425,7 +425,7 @@ private:
}
};
class TestDeviceFactory : public IDeviceFactory
class TestDeviceFactory final : public IDeviceFactory
{
public:
TestDeviceFactory() : IDeviceFactory(TestDevice::testTypeId())

View File

@@ -31,6 +31,7 @@
#include <utils/hostosinfo.h>
#include <QAbstractSocket>
#include <QCoreApplication>
#include <QList>
#include <QObject>
#include <QSharedPointer>

View File

@@ -33,12 +33,10 @@
namespace ProjectExplorer {
class PROJECTEXPLORER_EXPORT IDeviceFactory : public QObject
class PROJECTEXPLORER_EXPORT IDeviceFactory
{
Q_OBJECT
public:
~IDeviceFactory() override;
virtual ~IDeviceFactory();
static const QList<IDeviceFactory *> allDeviceFactories();
Core::Id deviceType() const { return m_deviceType; }
@@ -55,6 +53,8 @@ public:
protected:
explicit IDeviceFactory(Core::Id deviceType);
IDeviceFactory(const IDeviceFactory &) = delete;
IDeviceFactory &operator=(const IDeviceFactory &) = delete;
void setDisplayName(const QString &displayName);
void setIcon(const QIcon &icon);

View File

@@ -176,7 +176,7 @@ DeviceProcessSignalOperation::Ptr QnxDevice::signalOperation() const
QnxDeviceFactory::QnxDeviceFactory()
: ProjectExplorer::IDeviceFactory(Constants::QNX_QNX_OS_TYPE)
{
setDisplayName(tr("QNX Device"));
setDisplayName(QnxDevice::tr("QNX Device"));
setCombinedIcon(":/qnx/images/qnxdevicesmall.png",
":/qnx/images/qnxdevice.png");
setCanCreate(true);

View File

@@ -32,7 +32,7 @@
namespace Qnx {
namespace Internal {
class QnxDevice : public RemoteLinux::LinuxDevice
class QnxDevice final : public RemoteLinux::LinuxDevice
{
Q_DECLARE_TR_FUNCTIONS(Qnx::Internal::QnxDevice)
@@ -66,10 +66,8 @@ private:
mutable int m_versionNumber = 0;
};
class QnxDeviceFactory : public ProjectExplorer::IDeviceFactory
class QnxDeviceFactory final : public ProjectExplorer::IDeviceFactory
{
Q_OBJECT
public:
QnxDeviceFactory();

View File

@@ -49,8 +49,6 @@
#include <utils/port.h>
#include <utils/qtcassert.h>
#include <QTimer>
using namespace ProjectExplorer;
using namespace Utils;
@@ -299,7 +297,7 @@ namespace Internal {
LinuxDeviceFactory::LinuxDeviceFactory()
: IDeviceFactory(Constants::GenericLinuxOsType)
{
setDisplayName(tr("Generic Linux Device"));
setDisplayName(LinuxDevice::tr("Generic Linux Device"));
setIcon(QIcon());
setCanCreate(true);
setConstructionFunction(&LinuxDevice::create);

View File

@@ -30,8 +30,6 @@
#include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/devicesupport/idevicefactory.h>
#include <QCoreApplication>
namespace RemoteLinux {
class REMOTELINUX_EXPORT LinuxDevice : public ProjectExplorer::IDevice
@@ -66,10 +64,8 @@ protected:
namespace Internal {
class LinuxDeviceFactory : public ProjectExplorer::IDeviceFactory
class LinuxDeviceFactory final : public ProjectExplorer::IDeviceFactory
{
Q_OBJECT
public:
LinuxDeviceFactory();

View File

@@ -56,7 +56,7 @@ ProjectExplorer::IDevice::Ptr WebAssemblyDevice::create()
WebAssemblyDeviceFactory::WebAssemblyDeviceFactory()
: ProjectExplorer::IDeviceFactory(Constants::WEBASSEMBLY_DEVICE_TYPE)
{
setDisplayName(tr("WebAssembly Runtime"));
setDisplayName(WebAssemblyDevice::tr("WebAssembly Runtime"));
setCombinedIcon(":/webassembly/images/webassemblydevicesmall.png",
":/webassembly/images/webassemblydevice.png");
setCanCreate(true);

View File

@@ -27,12 +27,10 @@
#include <projectexplorer/devicesupport/desktopdevice.h>
#include <QCoreApplication>
namespace WebAssembly {
namespace Internal {
class WebAssemblyDevice : public ProjectExplorer::DesktopDevice
class WebAssemblyDevice final : public ProjectExplorer::DesktopDevice
{
Q_DECLARE_TR_FUNCTIONS(WebAssembly::Internal::WebAssemblyDevice)
@@ -43,10 +41,8 @@ private:
WebAssemblyDevice();
};
class WebAssemblyDeviceFactory : public ProjectExplorer::IDeviceFactory
class WebAssemblyDeviceFactory final : public ProjectExplorer::IDeviceFactory
{
Q_OBJECT
public:
WebAssemblyDeviceFactory();

View File

@@ -40,7 +40,6 @@
#include <utils/portlist.h>
#include <QFileInfo>
#include <QCoreApplication>
#include <QIcon>
#include <QLoggingCategory>
#include <QWizard>

View File

@@ -33,7 +33,7 @@
namespace WinRt {
namespace Internal {
class WinRtDevice : public ProjectExplorer::IDevice
class WinRtDevice final : public ProjectExplorer::IDevice
{
public:
typedef QSharedPointer<WinRtDevice> Ptr;
@@ -56,7 +56,7 @@ private:
int m_deviceId = -1;
};
class WinRtDeviceFactory : public ProjectExplorer::IDeviceFactory
class WinRtDeviceFactory final : public QObject, public ProjectExplorer::IDeviceFactory
{
Q_OBJECT
public: