Commit b906360a authored by hjk's avatar hjk Committed by Christian Kandeler

madde/qnx/remotelinux: adjust after profile changes

More Profile use, less dependency on QtSupport,
Derive qtVersionId from profile instead of qt build configuration.
Replace qt4BuildConfiguration with buildConfiguration.
Use IDevice base class in AbstractRemoteLinuxApplicationRunner
and in other places.  Simplify remote linux runconfiguration

Change-Id: I6414d3d8146d16c360b3a0465c57a052ea71f899
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@nokia.com>
parent 0fcd30cc
......@@ -38,19 +38,14 @@
#include <projectexplorer/target.h>
#include <qtsupport/qtoutputformatter.h>
#include <qtsupport/qtprofileinformation.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qt4projectmanager/qt4project.h>
#include <utils/qtcassert.h>
using namespace Qt4ProjectManager;
using namespace ProjectExplorer;
namespace Android {
namespace Internal {
using namespace ProjectExplorer;
AndroidRunConfiguration::AndroidRunConfiguration(Target *parent, Core::Id id, const QString &path)
: RunConfiguration(parent, id)
, m_proFilePath(path)
......@@ -58,8 +53,7 @@ AndroidRunConfiguration::AndroidRunConfiguration(Target *parent, Core::Id id, co
init();
}
AndroidRunConfiguration::AndroidRunConfiguration(ProjectExplorer::Target *parent,
AndroidRunConfiguration *source)
AndroidRunConfiguration::AndroidRunConfiguration(Target *parent, AndroidRunConfiguration *source)
: RunConfiguration(parent, source)
, m_proFilePath(source->m_proFilePath)
{
......@@ -71,15 +65,6 @@ void AndroidRunConfiguration::init()
setDefaultDisplayName(defaultDisplayName());
}
AndroidRunConfiguration::~AndroidRunConfiguration()
{
}
Qt4BuildConfiguration *AndroidRunConfiguration::activeQt4BuildConfiguration() const
{
return static_cast<Qt4BuildConfiguration *>(activeBuildConfiguration());
}
QWidget *AndroidRunConfiguration::createConfigurationWidget()
{
return 0;// no special running configurations
......
......@@ -34,19 +34,8 @@
#include "androidconstants.h"
#include "androidconfigurations.h"
#include <utils/environment.h>
#include <projectexplorer/runconfiguration.h>
QT_FORWARD_DECLARE_CLASS(QWidget)
namespace Qt4ProjectManager {
class Qt4BuildConfiguration;
class Qt4Project;
class Qt4ProFileNode;
}
namespace Android {
namespace Internal {
......@@ -69,11 +58,9 @@ public:
enum DebuggingType { DebugCppOnly, DebugQmlOnly, DebugCppAndQml };
AndroidRunConfiguration(ProjectExplorer::Target *parent, Core::Id id, const QString &path);
virtual ~AndroidRunConfiguration();
QWidget *createConfigurationWidget();
Utils::OutputFormatter *createOutputFormatter() const;
Qt4ProjectManager::Qt4BuildConfiguration *activeQt4BuildConfiguration() const;
AndroidDeployStep *deployStep() const;
......@@ -95,7 +82,6 @@ private:
void init();
QString m_proFilePath;
};
} // namespace Internal
......
......@@ -59,7 +59,7 @@ MaddeDeviceTester::~MaddeDeviceTester()
{
}
void MaddeDeviceTester::testDevice(const LinuxDeviceConfiguration::ConstPtr &deviceConfiguration)
void MaddeDeviceTester::testDevice(const ProjectExplorer::IDevice::ConstPtr &deviceConfiguration)
{
QTC_ASSERT(m_state == Inactive, return);
......
......@@ -32,8 +32,6 @@
#include <remotelinux/linuxdevicetester.h>
#include <QByteArray>
namespace QSsh {
class SshRemoteProcessRunner;
}
......@@ -44,11 +42,12 @@ namespace Internal {
class MaddeDeviceTester : public RemoteLinux::AbstractLinuxDeviceTester
{
Q_OBJECT
public:
explicit MaddeDeviceTester(QObject *parent = 0);
~MaddeDeviceTester();
void testDevice(const QSharedPointer<const RemoteLinux::LinuxDeviceConfiguration> &deviceConfiguration);
void testDevice(const ProjectExplorer::IDevice::ConstPtr &deviceConfiguration);
void stopTest();
private slots:
......@@ -70,7 +69,7 @@ private:
State m_state;
TestResult m_result;
QSsh::SshRemoteProcessRunner *m_processRunner;
QSharedPointer<const RemoteLinux::LinuxDeviceConfiguration> m_deviceConfiguration;
ProjectExplorer::IDevice::ConstPtr m_deviceConfiguration;
};
} // namespace Internal
......
......@@ -33,16 +33,15 @@
#include "maemopackagecreationstep.h"
#include "maemopackageinstaller.h"
#include "maemoqemumanager.h"
#include "qt4maemodeployconfiguration.h"
#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtprofileinformation.h>
#include <remotelinux/abstractuploadandinstallpackageservice.h>
#include <remotelinux/linuxdeviceconfiguration.h>
#include <remotelinux/remotelinuxdeployconfiguration.h>
#include <ssh/sshconnection.h>
using namespace ProjectExplorer;
using namespace RemoteLinux;
namespace Madde {
......@@ -60,7 +59,7 @@ protected:
void doDeviceSetup()
{
if (deviceConfiguration()->machineType() == LinuxDeviceConfiguration::Hardware) {
if (deviceConfiguration()->machineType() == IDevice::Hardware) {
handleDeviceSetupDone(true);
return;
}
......@@ -71,8 +70,7 @@ protected:
}
MaemoQemuRuntime rt;
const int qtId = qt4BuildConfiguration()
? QtSupport::QtProfileInformation::qtVersionId(qt4BuildConfiguration()->target()->profile()) : -1;
const int qtId = QtSupport::QtProfileInformation::qtVersionId(profile());
if (MaemoQemuManager::instance().runtimeForQtVersion(qtId, &rt)) {
MaemoQemuManager::instance().startRuntime();
emit errorMessage(tr("Cannot deploy: Qemu was not running. "
......
......@@ -156,7 +156,7 @@ void AbstractMaemoDeployByMountService::doDeviceSetup()
{
QTC_ASSERT(m_state == Inactive, return);
if (deviceConfiguration()->machineType() == LinuxDeviceConfiguration::Hardware) {
if (deviceConfiguration()->machineType() == IDevice::Hardware) {
handleDeviceSetupDone(true);
return;
}
......@@ -167,8 +167,7 @@ void AbstractMaemoDeployByMountService::doDeviceSetup()
}
MaemoQemuRuntime rt;
const int qtId = qt4BuildConfiguration()
? QtSupport::QtProfileInformation::qtVersionId(qt4BuildConfiguration()->target()->profile()) : -1;
const int qtId = QtSupport::QtProfileInformation::qtVersionId(profile());
if (MaemoQemuManager::instance().runtimeForQtVersion(qtId, &rt)) {
MaemoQemuManager::instance().startRuntime();
emit errorMessage(tr("Cannot deploy: Qemu was not running. "
......@@ -192,14 +191,14 @@ void AbstractMaemoDeployByMountService::doDeploy()
{
QTC_ASSERT(m_state == Inactive, return);
if (!qt4BuildConfiguration()) {
if (!buildConfiguration()) {
emit errorMessage(tr("Missing build configuration."));
setFinished();
return;
}
m_state = Mounting;
m_mounter->setupMounts(connection(), deviceConfiguration(), mountSpecifications(), profile());
m_mounter->setupMounts(connection(), mountSpecifications(), profile());
}
void AbstractMaemoDeployByMountService::stopDeployment()
......@@ -279,7 +278,7 @@ QString AbstractMaemoDeployByMountService::deployMountPoint() const
{
return MaemoGlobal::homeDirOnDevice(deviceConfiguration()->sshParameters().userName)
+ QLatin1String("/deployMountPoint_")
+ qt4BuildConfiguration()->target()->project()->displayName();
+ buildConfiguration()->target()->project()->displayName();
}
......
......@@ -34,8 +34,7 @@
#include "maemoremotemounter.h"
#include <projectexplorer/target.h>
#include <qtsupport/qtprofileinformation.h>
#include <remotelinux/linuxdeviceconfiguration.h>
#include <projectexplorer/profileinformation.h>
#include <remotelinux/remotelinuxusedportsgatherer.h>
#include <utils/qtcassert.h>
#include <ssh/sshconnection.h>
......@@ -70,7 +69,6 @@ MaemoDeploymentMounter::MaemoDeploymentMounter(QObject *parent)
MaemoDeploymentMounter::~MaemoDeploymentMounter() {}
void MaemoDeploymentMounter::setupMounts(SshConnection *connection,
const LinuxDeviceConfiguration::ConstPtr &devConf,
const QList<MaemoMountSpecification> &mountSpecs,
const Profile *profile)
{
......@@ -78,9 +76,9 @@ void MaemoDeploymentMounter::setupMounts(SshConnection *connection,
m_mountSpecs = mountSpecs;
m_connection = connection;
m_devConf = devConf;
m_mounter->setConnection(m_connection, m_devConf);
m_profile = profile;
m_devConf = DeviceProfileInformation::device(profile);
m_mounter->setConnection(m_connection, m_devConf);
connect(m_connection, SIGNAL(error(QSsh::SshError)), SLOT(handleConnectionError()));
setState(UnmountingOldDirs);
unmount();
......@@ -172,7 +170,7 @@ void MaemoDeploymentMounter::handlePortListReady()
return;
setState(Mounting);
m_freePorts = MaemoGlobal::freePorts(m_devConf, QtSupport::QtProfileInformation::qtVersion(m_profile));
m_freePorts = MaemoGlobal::freePorts(m_profile);
m_mounter->mount(&m_freePorts, m_portsGatherer);
}
......
......@@ -33,19 +33,14 @@
#include "maemomountspecification.h"
#include <projectexplorer/devicesupport/idevice.h>
#include <utils/portlist.h>
#include <QList>
#include <QObject>
#include <QSharedPointer>
namespace QSsh { class SshConnection; }
namespace ProjectExplorer { class Profile; }
namespace RemoteLinux {
class LinuxDeviceConfiguration;
class RemoteLinuxUsedPortsGatherer;
}
namespace QSsh { class SshConnection; }
namespace RemoteLinux { class RemoteLinuxUsedPortsGatherer; }
namespace Madde {
namespace Internal {
......@@ -60,7 +55,6 @@ public:
// Connection must be in connected state.
void setupMounts(QSsh::SshConnection *connection,
const QSharedPointer<const RemoteLinux::LinuxDeviceConfiguration> &devConf,
const QList<MaemoMountSpecification> &mountSpecs,
const ProjectExplorer::Profile *profile);
void tearDownMounts();
......@@ -92,7 +86,7 @@ private:
State m_state;
QSsh::SshConnection *m_connection;
QSharedPointer<const RemoteLinux::LinuxDeviceConfiguration> m_devConf;
ProjectExplorer::IDevice::ConstPtr m_devConf;
MaemoRemoteMounter * const m_mounter;
RemoteLinux::RemoteLinuxUsedPortsGatherer * const m_portsGatherer;
Utils::PortList m_freePorts;
......
......@@ -68,9 +68,9 @@ QString defaultUser(Core::Id deviceType)
return QLatin1String("developer");
}
QString defaultHost(LinuxDeviceConfiguration::MachineType type)
QString defaultHost(IDevice::MachineType type)
{
return QLatin1String(type == LinuxDeviceConfiguration::Hardware ? "192.168.2.15" : "localhost");
return QLatin1String(type == IDevice::Hardware ? "192.168.2.15" : "localhost");
}
struct WizardData
......@@ -79,7 +79,7 @@ struct WizardData
QString hostName;
Core::Id deviceType;
SshConnectionParameters::AuthenticationType authType;
LinuxDeviceConfiguration::MachineType machineType;
IDevice::MachineType machineType;
QString privateKeyFilePath;
QString publicKeyFilePath;
QString userName;
......@@ -138,8 +138,8 @@ public:
QString hostName() const
{
return machineType() == LinuxDeviceConfiguration::Emulator
? defaultHost(LinuxDeviceConfiguration::Emulator)
return machineType() == IDevice::Emulator
? defaultHost(IDevice::Emulator)
: m_ui->hostNameLineEdit->text().trimmed();
}
......@@ -148,22 +148,20 @@ public:
return m_deviceType;
}
LinuxDeviceConfiguration::MachineType machineType() const
IDevice::MachineType machineType() const
{
return m_ui->hwButton->isChecked()
? LinuxDeviceConfiguration::Hardware : LinuxDeviceConfiguration::Emulator;
return m_ui->hwButton->isChecked() ? IDevice::Hardware : IDevice::Emulator;
}
int sshPort() const
{
return machineType() == LinuxDeviceConfiguration::Emulator
? 6666 : m_ui->sshPortSpinBox->value();
return machineType() == IDevice::Emulator ? 6666 : m_ui->sshPortSpinBox->value();
}
private slots:
void handleMachineTypeChanged()
{
const bool enable = machineType() == LinuxDeviceConfiguration::Hardware;
const bool enable = machineType() == IDevice::Hardware;
m_ui->hostNameLabel->setEnabled(enable);
m_ui->hostNameLineEdit->setEnabled(enable);
m_ui->sshPortLabel->setEnabled(enable);
......@@ -206,7 +204,7 @@ public:
virtual void initializePage()
{
m_ui->keyWasNotSetUpButton->setChecked(true);
m_ui->privateKeyFilePathChooser->setPath(LinuxDeviceConfiguration::defaultPrivateKeyFilePath());
m_ui->privateKeyFilePathChooser->setPath(IDevice::defaultPrivateKeyFilePath());
handleSelectionChanged();
}
......@@ -262,8 +260,8 @@ public:
virtual void initializePage()
{
m_ui->dontReuseButton->setChecked(true);
m_ui->privateKeyFilePathChooser->setPath(LinuxDeviceConfiguration::defaultPrivateKeyFilePath());
m_ui->publicKeyFilePathChooser->setPath(LinuxDeviceConfiguration::defaultPublicKeyFilePath());
m_ui->privateKeyFilePathChooser->setPath(IDevice::defaultPrivateKeyFilePath());
m_ui->publicKeyFilePathChooser->setPath(IDevice::defaultPublicKeyFilePath());
handleSelectionChanged();
}
......@@ -504,7 +502,7 @@ public:
private:
QString infoText() const
{
if (m_wizardData.machineType == LinuxDeviceConfiguration::Emulator)
if (m_wizardData.machineType == IDevice::Emulator)
return tr("The new device configuration will now be created.");
return GenericLinuxDeviceConfigurationWizardFinalPage::infoText();
}
......@@ -563,7 +561,7 @@ IDevice::Ptr MaemoDeviceConfigWizard::device()
sshParams.userName = defaultUser(d->wizardData.deviceType);
sshParams.host = d->wizardData.hostName;
sshParams.port = d->wizardData.sshPort;
if (d->wizardData.machineType == LinuxDeviceConfiguration::Emulator) {
if (d->wizardData.machineType == IDevice::Emulator) {
sshParams.authenticationType = QSsh::SshConnectionParameters::AuthenticationByPassword;
sshParams.password = d->wizardData.deviceType == Core::Id(MeeGoOsType)
? QLatin1String("meego") : QString();
......@@ -597,7 +595,7 @@ int MaemoDeviceConfigWizard::nextId() const
d->wizardData.machineType = d->startPage.machineType();
d->wizardData.hostName = d->startPage.hostName();
d->wizardData.sshPort = d->startPage.sshPort();
if (d->wizardData.machineType == LinuxDeviceConfiguration::Emulator)
if (d->wizardData.machineType == IDevice::Emulator)
return FinalPageId;
return PreviousKeySetupCheckPageId;
case PreviousKeySetupCheckPageId:
......
......@@ -32,11 +32,12 @@
#include "maemoconstants.h"
#include "maemoqemumanager.h"
#include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/profileinformation.h>
#include <projectexplorer/target.h>
#include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <qtsupport/baseqtversion.h>
#include <remotelinux/linuxdeviceconfiguration.h>
#include <qtsupport/qtprofileinformation.h>
#include <remotelinux/remotelinux_constants.h>
#include <utils/environment.h>
......@@ -46,6 +47,7 @@
#include <QString>
#include <QDesktopServices>
using namespace ProjectExplorer;
using namespace Qt4ProjectManager;
using namespace Qt4ProjectManager::Constants;
using namespace RemoteLinux;
......@@ -56,9 +58,9 @@ namespace {
static const QLatin1String binQmake("/bin/qmake" EXEC_SUFFIX);
} // namespace
bool MaemoGlobal::hasMaemoDevice(const ProjectExplorer::Profile *p)
bool MaemoGlobal::hasMaemoDevice(const Profile *p)
{
ProjectExplorer::IDevice::ConstPtr dev = ProjectExplorer::DeviceProfileInformation::device(p);
IDevice::ConstPtr dev = DeviceProfileInformation::device(p);
if (dev.isNull())
return false;
......@@ -67,9 +69,9 @@ bool MaemoGlobal::hasMaemoDevice(const ProjectExplorer::Profile *p)
|| type == Core::Id(MeeGoOsType);
}
bool MaemoGlobal::supportsMaemoDevice(const ProjectExplorer::Profile *p)
bool MaemoGlobal::supportsMaemoDevice(const Profile *p)
{
const Core::Id type = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(p);
const Core::Id type = DeviceTypeProfileInformation::deviceTypeId(p);
return type == Core::Id(Maemo5OsType) || type == Core::Id(HarmattanOsType)
|| type == Core::Id(MeeGoOsType);
}
......@@ -124,9 +126,9 @@ QString MaemoGlobal::devrootshPath()
return QLatin1String("/usr/lib/mad-developer/devrootsh");
}
int MaemoGlobal::applicationIconSize(const ProjectExplorer::Target *target)
int MaemoGlobal::applicationIconSize(const Target *target)
{
Core::Id deviceType = ProjectExplorer::DeviceTypeProfileInformation::deviceTypeId(target->profile());
Core::Id deviceType = DeviceTypeProfileInformation::deviceTypeId(target->profile());
return deviceType == Core::Id(HarmattanOsType) ? 80 : 64;
}
......@@ -151,12 +153,14 @@ QString MaemoGlobal::remoteSourceProfilesCommand()
return QString::fromAscii(remoteCall);
}
Utils::PortList MaemoGlobal::freePorts(const LinuxDeviceConfiguration::ConstPtr &devConf,
const QtSupport::BaseQtVersion *qtVersion)
Utils::PortList MaemoGlobal::freePorts(const Profile *profile)
{
IDevice::ConstPtr devConf = DeviceProfileInformation::device(profile);
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtProfileInformation::qtVersion(profile);
if (!devConf || !qtVersion)
return Utils::PortList();
if (devConf->machineType() == LinuxDeviceConfiguration::Emulator) {
if (devConf->machineType() == IDevice::Emulator) {
MaemoQemuRuntime rt;
const int id = qtVersion->uniqueId();
if (MaemoQemuManager::instance().runtimeForQtVersion(id, &rt))
......
......@@ -41,11 +41,8 @@
QT_BEGIN_NAMESPACE
class QProcess;
class QString;
QT_END_NAMESPACE
namespace QtSupport { class BaseQtVersion; }
namespace RemoteLinux { class LinuxDeviceConfiguration; }
namespace ProjectExplorer {
class Profile;
class Target;
......@@ -96,8 +93,7 @@ public:
static int applicationIconSize(const ProjectExplorer::Target *target);
static QString remoteSudo(Core::Id deviceType, const QString &uname);
static QString remoteSourceProfilesCommand();
static Utils::PortList freePorts(const QSharedPointer<const RemoteLinux::LinuxDeviceConfiguration> &devConf,
const QtSupport::BaseQtVersion *qtVersion);
static Utils::PortList freePorts(const ProjectExplorer::Profile *profile);
static void addMaddeEnvironment(Utils::Environment &env, const QString &qmakePath);
static void transformMaddeCall(QString &command, QStringList &args, const QString &qmakePath);
......
......@@ -34,10 +34,8 @@
#include "maemopublishingwizardfremantlefree.h"
#include <projectexplorer/target.h>
#include <qt4projectmanager/qmakestep.h>
#include <qt4projectmanager/qt4project.h>
#include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qtsupport/baseqtversion.h>
#include <qtsupport/qtprofileinformation.h>
#include <qtsupport/qtsupportconstants.h>
......
......@@ -50,8 +50,6 @@
#include <projectexplorer/target.h>
#include <qtsupport/qtprofileinformation.h>
#include <qtsupport/qtversionmanager.h>
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <remotelinux/linuxdeviceconfiguration.h>
#include <remotelinux/remotelinuxrunconfiguration.h>
#include <utils/filesystemwatcher.h>
......@@ -68,7 +66,6 @@
#include <limits.h>
using namespace ProjectExplorer;
using namespace Qt4ProjectManager;
using namespace RemoteLinux;
namespace Madde {
......@@ -516,10 +513,8 @@ bool MaemoQemuManager::targetUsesMatchingRuntimeConfig(Target *target,
if (qtVersion)
*qtVersion = version;
const LinuxDeviceConfiguration::ConstPtr &config
= ProjectExplorer::DeviceProfileInformation::device(target->profile())
.dynamicCast<const LinuxDeviceConfiguration>();
return !config.isNull() && config->machineType() == LinuxDeviceConfiguration::Emulator;
const IDevice::ConstPtr config = DeviceProfileInformation::device(target->profile());
return !config.isNull() && config->machineType() == IDevice::Emulator;
}
void MaemoQemuManager::notify(const QList<int> uniqueIds)
......
......@@ -40,8 +40,6 @@
#include <QStringList>
#include <QTextStream>
using namespace RemoteLinux;
namespace Madde {
namespace Internal {
......
......@@ -31,14 +31,14 @@
#include "maemoglobal.h"
#include <remotelinux/linuxdeviceconfiguration.h>
#include <ssh/sshconnection.h>
#include <ssh/sshremoteprocessrunner.h>
#include <QDir>
using namespace RemoteLinux;
using namespace ProjectExplorer;
using namespace QSsh;
using namespace RemoteLinux;
namespace Madde {
namespace Internal {
......@@ -51,7 +51,7 @@ MaemoRemoteCopyFacility::MaemoRemoteCopyFacility(QObject *parent) :
MaemoRemoteCopyFacility::~MaemoRemoteCopyFacility() {}
void MaemoRemoteCopyFacility::copyFiles(SshConnection *connection,
const LinuxDeviceConfiguration::ConstPtr &devConf,
const IDevice::ConstPtr &devConf,
const QList<DeployableFile> &deployables, const QString &mountPoint)
{
Q_ASSERT(connection->state() == SshConnection::Connected);
......
......@@ -32,21 +32,16 @@
#define MAEMOREMOTECOPYFACILITY_H
#include <remotelinux/deployablefile.h>
#include <projectexplorer/devicesupport/idevice.h>
#include <QList>
#include <QObject>
#include <QSharedPointer>
#include <QString>
namespace QSsh {
class SshConnection;
class SshRemoteProcessRunner;
}
namespace RemoteLinux {
class LinuxDeviceConfiguration;
}
namespace Madde {
namespace Internal {