RemoteLinux: Move constants and functions to more suitable locations.

Mostly to facilitate splitting up generic Linux und Maemo-specific
things.

Change-Id: I6072ae7deaea013219e8969d6a5254e6c5c96693
Reviewed-on: http://codereview.qt.nokia.com/2098
Reviewed-by: Christian Kandeler <christian.kandeler@nokia.com>
This commit is contained in:
Christian Kandeler
2011-07-25 11:55:00 +02:00
parent 92d32becfc
commit 76a5b1953c
27 changed files with 131 additions and 132 deletions

View File

@@ -31,8 +31,8 @@
**************************************************************************/
#include "deployablefilesperprofile.h"
#include "linuxdeviceconfiguration.h"
#include "maemoglobal.h"
#include "maemoconstants.h"
#include <coreplugin/icore.h>
#include <coreplugin/filemanager.h>
@@ -265,7 +265,7 @@ bool DeployableFilesPerProFile::addDesktopFile()
const QtSupport::BaseQtVersion * const version = qtVersion();
QTC_ASSERT(version && version->isValid(), return false);
QString remoteDir = QLatin1String("/usr/share/applications");
if (MaemoGlobal::osType(version->qmakeCommand()) == LinuxDeviceConfiguration::Maemo5OsType)
if (MaemoGlobal::osType(version->qmakeCommand()) == QLatin1String(Maemo5OsType))
remoteDir += QLatin1String("/hildon");
const QLatin1String filesLine("desktopfile.files = $${TARGET}.desktop");
const QString pathLine = QLatin1String("desktopfile.path = ") + remoteDir;
@@ -341,11 +341,11 @@ QString DeployableFilesPerProFile::proFileScope() const
const QtSupport::BaseQtVersion *const qv = qtVersion();
QTC_ASSERT(qv && qv->isValid(), return QString());
const QString osType = MaemoGlobal::osType(qv->qmakeCommand());
if (osType == LinuxDeviceConfiguration::Maemo5OsType)
if (osType == QLatin1String(Maemo5OsType))
return QLatin1String("maemo5");
if (osType == LinuxDeviceConfiguration::HarmattanOsType)
if (osType == QLatin1String(HarmattanOsType))
return QLatin1String("contains(MEEGO_EDITION,harmattan)");
if (osType == LinuxDeviceConfiguration::MeeGoOsType)
if (osType == QLatin1String(MeeGoOsType))
return QLatin1String("!isEmpty(MEEGO_VERSION_MAJOR):!contains(MEEGO_EDITION,harmattan)");
return QLatin1String("unix:!symbian:!maemo5:isEmpty(MEEGO_VERSION_MAJOR)");
}

View File

@@ -60,7 +60,7 @@ ILinuxDeviceConfigurationWizard *GenericLinuxDeviceConfigurationFactory::createW
bool GenericLinuxDeviceConfigurationFactory::supportsOsType(const QString &osType) const
{
return osType == LinuxDeviceConfiguration::GenericLinuxOsType;
return osType == QLatin1String(Constants::GenericLinuxOsType);
}
QString GenericLinuxDeviceConfigurationFactory::displayNameForOsType(const QString &osType) const

View File

@@ -33,6 +33,7 @@
#include "genericlinuxdeviceconfigurationwizardpages.h"
#include "linuxdevicetestdialog.h"
#include "linuxdevicetester.h"
#include "remotelinux_constants.h"
using namespace Utils;
@@ -83,7 +84,7 @@ LinuxDeviceConfiguration::Ptr GenericLinuxDeviceConfigurationWizard::deviceConfi
else
sshParams.privateKeyFile = m_d->setupPage.privateKeyFilePath();
LinuxDeviceConfiguration::Ptr devConf = LinuxDeviceConfiguration::create(m_d->setupPage.configurationName(),
LinuxDeviceConfiguration::GenericLinuxOsType, LinuxDeviceConfiguration::Physical,
QLatin1String(Constants::GenericLinuxOsType), LinuxDeviceConfiguration::Physical,
PortList::fromString(QLatin1String("10000-10100")), sshParams);
LinuxDeviceTestDialog dlg(devConf, new GenericLinuxDeviceTester(this), this);
dlg.exec();

View File

@@ -31,6 +31,8 @@
**************************************************************************/
#include "linuxdeviceconfiguration.h"
#include "remotelinux_constants.h"
#include <QtCore/QSettings>
#include <QtGui/QDesktopServices>
@@ -103,10 +105,10 @@ LinuxDeviceConfiguration::LinuxDeviceConfiguration(const QSettings &settings,
if (m_osType.isEmpty()) {
const int oldOsType = settings.value(OldOsVersionKey, -1).toInt();
switch (oldOsType) {
case 0: m_osType = Maemo5OsType; break;
case 1: m_osType = HarmattanOsType; break;
case 2: m_osType = MeeGoOsType; break;
default: m_osType = GenericLinuxOsType;
case 0: m_osType = QLatin1String("Maemo5OsType"); break;
case 1: m_osType = QLatin1String("HarmattanOsType"); break;
case 2: m_osType = QLatin1String("MeeGoOsType"); break;
default: m_osType = QLatin1String(Constants::GenericLinuxOsType);
}
}
@@ -162,8 +164,4 @@ void LinuxDeviceConfiguration::save(QSettings &settings) const
}
const LinuxDeviceConfiguration::Id LinuxDeviceConfiguration::InvalidId = 0;
const QString LinuxDeviceConfiguration::Maemo5OsType = QLatin1String("Maemo5OsType");
const QString LinuxDeviceConfiguration::HarmattanOsType = QLatin1String("HarmattanOsType");
const QString LinuxDeviceConfiguration::MeeGoOsType = QLatin1String("MeeGoOsType");
const QString LinuxDeviceConfiguration::GenericLinuxOsType = QLatin1String("GenericLinuxOsType");
} // namespace RemoteLinux

View File

@@ -62,11 +62,6 @@ public:
typedef quint64 Id;
static const QString Maemo5OsType;
static const QString HarmattanOsType;
static const QString MeeGoOsType;
static const QString GenericLinuxOsType;
enum DeviceType { Physical, Emulator };
~LinuxDeviceConfiguration();

View File

@@ -29,9 +29,11 @@
** Nokia at info@qt.nokia.com.
**
**************************************************************************/
#include "linuxdeviceconfigurations.h"
#include "maemoglobal.h"
#include "maemoconstants.h"
#include "remotelinux_constants.h"
#include <coreplugin/icore.h>
@@ -224,10 +226,10 @@ void LinuxDeviceConfigurations::load()
}
settings->endArray();
settings->endGroup();
ensureDefaultExists(LinuxDeviceConfiguration::Maemo5OsType);
ensureDefaultExists(LinuxDeviceConfiguration::HarmattanOsType);
ensureDefaultExists(LinuxDeviceConfiguration::MeeGoOsType);
ensureDefaultExists(LinuxDeviceConfiguration::GenericLinuxOsType);
ensureDefaultExists(QLatin1String(Maemo5OsType));
ensureDefaultExists(QLatin1String(HarmattanOsType));
ensureDefaultExists(QLatin1String(MeeGoOsType));
ensureDefaultExists(QLatin1String(Constants::GenericLinuxOsType));
}
LinuxDeviceConfiguration::ConstPtr LinuxDeviceConfigurations::deviceAt(int idx) const

View File

@@ -32,6 +32,7 @@
#include "maddedeviceconfigurationfactory.h"
#include "maddedevicetester.h"
#include "maemoconstants.h"
#include "maemodeviceconfigwizard.h"
#include "publickeydeploymentdialog.h"
#include "madderemoteprocesslist.h"
@@ -65,17 +66,16 @@ ILinuxDeviceConfigurationWizard *MaddeDeviceConfigurationFactory::createWizard(Q
bool MaddeDeviceConfigurationFactory::supportsOsType(const QString &osType) const
{
return osType == LinuxDeviceConfiguration::Maemo5OsType
|| osType == LinuxDeviceConfiguration::HarmattanOsType
|| osType == LinuxDeviceConfiguration::MeeGoOsType;
return osType == QLatin1String(Maemo5OsType) || osType == QLatin1String(HarmattanOsType)
|| osType == QLatin1String(MeeGoOsType);
}
QString MaddeDeviceConfigurationFactory::displayNameForOsType(const QString &osType) const
{
QTC_ASSERT(supportsOsType(osType), return QString());
if (osType == LinuxDeviceConfiguration::Maemo5OsType)
if (osType == QLatin1String(Maemo5OsType))
return tr("Maemo5/Fremantle");
if (osType == LinuxDeviceConfiguration::HarmattanOsType)
if (osType == QLatin1String(HarmattanOsType))
return tr("MeeGo 1.2 Harmattan");
return tr("Other MeeGo OS");
}

View File

@@ -31,6 +31,7 @@
**************************************************************************/
#include "maddedevicetester.h"
#include "maemoconstants.h"
#include "maemoglobal.h"
#include <remotelinux/linuxdeviceconfiguration.h>
@@ -114,7 +115,7 @@ void MaddeDeviceTester::handleGenericTestFinished(TestResult result)
connect(m_processRunner.data(), SIGNAL(processClosed(int)), SLOT(handleProcessFinished(int)));
QString qtInfoCmd;
if (m_deviceConfiguration->osType() == LinuxDeviceConfiguration::MeeGoOsType) {
if (m_deviceConfiguration->osType() == QLatin1String(MeeGoOsType)) {
qtInfoCmd = QLatin1String("rpm -qa 'libqt*' --queryformat '%{NAME} %{VERSION}\\n'");
} else {
qtInfoCmd = QLatin1String("dpkg-query -W -f "
@@ -208,7 +209,7 @@ void MaddeDeviceTester::handleMadDeveloperTestFinished(int exitStatus)
} else if (m_processRunner->process()->exitCode() != 0) {
QString message = tr("Connectivity tool not installed on device. "
"Deployment will not be possible.");
if (m_deviceConfiguration->osType() == LinuxDeviceConfiguration::HarmattanOsType) {
if (m_deviceConfiguration->osType() == QLatin1String(HarmattanOsType)) {
message += tr("Please switch the device to developer mode "
"via Settings -> Security.\n");
}
@@ -218,7 +219,7 @@ void MaddeDeviceTester::handleMadDeveloperTestFinished(int exitStatus)
emit progressMessage(tr("Connectivity tool present.\n"));
}
if (m_deviceConfiguration->osType() != LinuxDeviceConfiguration::HarmattanOsType) {
if (m_deviceConfiguration->osType() != QLatin1String(HarmattanOsType)) {
setFinished();
return;
}
@@ -258,7 +259,7 @@ QString MaddeDeviceTester::processedQtLibsList()
QString unfilteredLibs = QString::fromUtf8(m_stdout);
QString filteredLibs;
QString patternString;
if (m_deviceConfiguration->osType() == LinuxDeviceConfiguration::MeeGoOsType)
if (m_deviceConfiguration->osType() == QLatin1String(MeeGoOsType))
patternString = QLatin1String("(libqt\\S+) ((\\d+)\\.(\\d+)\\.(\\d+))");
else
patternString = QLatin1String("(\\S+) (\\S*(\\d+)\\.(\\d+)\\.(\\d+)\\S*) \\S+ \\S+ \\S+");

View File

@@ -30,6 +30,8 @@
**************************************************************************/
#include "madderemoteprocesslist.h"
#include "maemoconstants.h"
#include <remotelinux/linuxdeviceconfiguration.h>
#include <QtCore/QString>
@@ -52,7 +54,7 @@ QString MaddeRemoteProcessList::listProcessesCommandLine() const
{
// The ps command on Fremantle ignores all command line options, so
// we have to collect the information in /proc manually.
if (deviceConfiguration()->osType() == LinuxDeviceConfiguration::Maemo5OsType) {
if (deviceConfiguration()->osType() == QLatin1String(Maemo5OsType)) {
return QLatin1String("sep1=") + QLatin1String(FremantleLineSeparator1) + QLatin1Char(';')
+ QLatin1String("sep2=") + QLatin1String(FremantleLineSeparator2) + QLatin1Char(';')
+ QLatin1String("pidlist=`ls /proc |grep -E '^[[:digit:]]+$' |sort -n`; "
@@ -70,7 +72,7 @@ QString MaddeRemoteProcessList::listProcessesCommandLine() const
QList<AbstractRemoteLinuxProcessList::RemoteProcess> MaddeRemoteProcessList::buildProcessList(const QString &listProcessesReply) const
{
QString adaptedReply = listProcessesReply;
if (deviceConfiguration()->osType() == LinuxDeviceConfiguration::Maemo5OsType) {
if (deviceConfiguration()->osType() == QLatin1String(Maemo5OsType)) {
adaptedReply.replace(QLatin1String(FremantleLineSeparator1)
+ QLatin1String(FremantleLineSeparator2), QLatin1String("\n"));
adaptedReply.prepend(QLatin1String("dummy\n"));

View File

@@ -31,7 +31,6 @@
**************************************************************************/
#include "maddeuploadandinstallpackagesteps.h"
#include "maemoglobal.h"
#include "maemopackagecreationstep.h"
#include "maemopackageinstaller.h"
#include "maemoqemumanager.h"
@@ -146,7 +145,7 @@ AbstractRemoteLinuxDeployService *MaemoUploadAndInstallPackageStep::deployServic
bool MaemoUploadAndInstallPackageStep::isDeploymentPossible(QString *whyNot) const
{
const AbstractMaemoPackageCreationStep * const pStep
= MaemoGlobal::earlierBuildStep<MaemoDebianPackageCreationStep>(deployConfiguration(), this);
= deployConfiguration()->earlierBuildStep<MaemoDebianPackageCreationStep>(this);
if (!pStep) {
if (whyNot)
*whyNot = tr("No Debian package creation step found.");
@@ -193,7 +192,7 @@ AbstractRemoteLinuxDeployService *MeegoUploadAndInstallPackageStep::deployServic
bool MeegoUploadAndInstallPackageStep::isDeploymentPossible(QString *whyNot) const
{
const AbstractMaemoPackageCreationStep * const pStep
= MaemoGlobal::earlierBuildStep<MaemoRpmPackageCreationStep>(deployConfiguration(), this);
= deployConfiguration()->earlierBuildStep<MaemoRpmPackageCreationStep>(this);
if (!pStep) {
if (whyNot)
*whyNot = tr("No RPM package creation step found.");

View File

@@ -37,6 +37,10 @@
namespace RemoteLinux {
namespace Internal {
const char Maemo5OsType[] = "Maemo5OsType";
const char HarmattanOsType[] = "HarmattanOsType";
const char MeeGoOsType[] = "MeeGoOsType";
#define PREFIX "Qt4ProjectManager.MaemoRunConfiguration"
#ifdef Q_OS_WIN32

View File

@@ -422,7 +422,7 @@ AbstractRemoteLinuxDeployService *MaemoInstallPackageViaMountStep::deployService
bool MaemoInstallPackageViaMountStep::isDeploymentPossible(QString *whyNot) const
{
const AbstractMaemoPackageCreationStep * const pStep
= MaemoGlobal::earlierBuildStep<MaemoDebianPackageCreationStep>(deployConfiguration(), this);
= deployConfiguration()->earlierBuildStep<MaemoDebianPackageCreationStep>(this);
if (!pStep) {
if (whyNot)
*whyNot = tr("No Debian package creation step found.");

View File

@@ -37,6 +37,7 @@
#include "ui_maemodeviceconfigwizardstartpage.h"
#include "maddedevicetester.h"
#include "maemoconstants.h"
#include "maemoglobal.h"
#include <remotelinux/genericlinuxdeviceconfigurationwizardpages.h>
@@ -60,7 +61,7 @@ namespace {
QString defaultUser(const QString &osType)
{
if (osType == LinuxDeviceConfiguration::MeeGoOsType)
if (osType == QLatin1String(MeeGoOsType))
return QLatin1String("meego");
return QLatin1String("developer");
}
@@ -100,12 +101,12 @@ public:
setTitle(tr("General Information"));
setSubTitle(QLatin1String(" ")); // For Qt bug (background color)
m_ui->osTypeComboBox->addItem(MaemoGlobal::osTypeToString(LinuxDeviceConfiguration::Maemo5OsType),
LinuxDeviceConfiguration::Maemo5OsType);
m_ui->osTypeComboBox->addItem(MaemoGlobal::osTypeToString(LinuxDeviceConfiguration::HarmattanOsType),
LinuxDeviceConfiguration::HarmattanOsType);
m_ui->osTypeComboBox->addItem(MaemoGlobal::osTypeToString(LinuxDeviceConfiguration::MeeGoOsType),
LinuxDeviceConfiguration::MeeGoOsType);
m_ui->osTypeComboBox->addItem(MaemoGlobal::osTypeToString(QLatin1String(Maemo5OsType)),
QLatin1String(Maemo5OsType));
m_ui->osTypeComboBox->addItem(MaemoGlobal::osTypeToString(QLatin1String(HarmattanOsType)),
QLatin1String(HarmattanOsType));
m_ui->osTypeComboBox->addItem(MaemoGlobal::osTypeToString(QLatin1String(MeeGoOsType)),
QLatin1String(MeeGoOsType));
QButtonGroup *buttonGroup = new QButtonGroup(this);
buttonGroup->setExclusive(true);
@@ -115,7 +116,7 @@ public:
SLOT(handleDeviceTypeChanged()));
m_ui->nameLineEdit->setText(QLatin1String("(New Configuration)"));
m_ui->osTypeComboBox->setCurrentIndex(m_ui->osTypeComboBox->findData(LinuxDeviceConfiguration::HarmattanOsType));
m_ui->osTypeComboBox->setCurrentIndex(m_ui->osTypeComboBox->findData(QLatin1String(HarmattanOsType)));
m_ui->hwButton->setChecked(true);
handleDeviceTypeChanged();
m_ui->hostNameLineEdit->setText(defaultHost(deviceType()));
@@ -559,7 +560,7 @@ LinuxDeviceConfiguration::Ptr MaemoDeviceConfigWizard::deviceConfiguration()
sshParams.port = d->wizardData.sshPort;
if (d->wizardData.deviceType == LinuxDeviceConfiguration::Emulator) {
sshParams.authenticationType = Utils::SshConnectionParameters::AuthenticationByPassword;
sshParams.password = d->wizardData.osType == LinuxDeviceConfiguration::MeeGoOsType
sshParams.password = d->wizardData.osType == QLatin1String(MeeGoOsType)
? QLatin1String("meego") : QString();
sshParams.timeout = 30;
freePortsSpec = QLatin1String("13219,14168");

View File

@@ -31,7 +31,6 @@
**************************************************************************/
#include "maemoglobal.h"
#include "linuxdeviceconfiguration.h"
#include "maemoconstants.h"
#include "maemoqemumanager.h"
@@ -42,6 +41,8 @@
#include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <qtsupport/qtversionmanager.h>
#include <qt4projectmanager/qt4target.h>
#include <remotelinux/linuxdeviceconfiguration.h>
#include <remotelinux/remotelinux_constants.h>
#include <utils/environment.h>
#include <QtCore/QDir>
@@ -82,17 +83,17 @@ bool MaemoGlobal::isMeegoTargetId(const QString &id)
bool MaemoGlobal::isValidMaemo5QtVersion(const QString &qmakePath)
{
return isValidMaemoQtVersion(qmakePath, LinuxDeviceConfiguration::Maemo5OsType);
return isValidMaemoQtVersion(qmakePath, QLatin1String(Maemo5OsType));
}
bool MaemoGlobal::isValidHarmattanQtVersion(const QString &qmakePath)
{
return isValidMaemoQtVersion(qmakePath, LinuxDeviceConfiguration::HarmattanOsType);
return isValidMaemoQtVersion(qmakePath, QLatin1String(HarmattanOsType));
}
bool MaemoGlobal::isValidMeegoQtVersion(const QString &qmakePath)
{
return isValidMaemoQtVersion(qmakePath, LinuxDeviceConfiguration::MeeGoOsType);
return isValidMaemoQtVersion(qmakePath, QLatin1String(MeeGoOsType));
}
bool MaemoGlobal::isLinuxQt(const QtSupport::BaseQtVersion *qtVersion)
@@ -155,16 +156,15 @@ QString MaemoGlobal::devrootshPath()
int MaemoGlobal::applicationIconSize(const QString &osType)
{
return osType == LinuxDeviceConfiguration::HarmattanOsType ? 80 : 64;
return osType == QLatin1String(HarmattanOsType) ? 80 : 64;
}
QString MaemoGlobal::remoteSudo(const QString &osType, const QString &uname)
{
if (uname == QLatin1String("root"))
return QString();
if (osType == LinuxDeviceConfiguration::Maemo5OsType
|| osType == LinuxDeviceConfiguration::HarmattanOsType
|| osType == LinuxDeviceConfiguration::MeeGoOsType) {
if (osType == QLatin1String(Maemo5OsType) || osType == QLatin1String(HarmattanOsType)
|| osType == QLatin1String(MeeGoOsType)) {
return devrootshPath();
}
return QString(); // Using sudo would open a can of worms.
@@ -173,8 +173,8 @@ QString MaemoGlobal::remoteSudo(const QString &osType, const QString &uname)
QString MaemoGlobal::remoteCommandPrefix(const QString &osType)
{
QString prefix = QString::fromLocal8Bit("%1; ").arg(remoteSourceProfilesCommand());
if (osType != LinuxDeviceConfiguration::Maemo5OsType
&& osType != LinuxDeviceConfiguration::HarmattanOsType) {
if (osType != QLatin1String(Maemo5OsType)
&& osType != QLatin1String(HarmattanOsType)) {
prefix += QLatin1String("DISPLAY=:0.0 ");
}
return prefix;
@@ -238,7 +238,7 @@ QString MaemoGlobal::madCommand(const QString &qmakePath)
QString MaemoGlobal::madDeveloperUiName(const QString &osType)
{
return osType == LinuxDeviceConfiguration::HarmattanOsType
return osType == QLatin1String(HarmattanOsType)
? tr("SDK Connectivity") : tr("Mad Developer");
}
@@ -246,12 +246,12 @@ QString MaemoGlobal::osType(const QString &qmakePath)
{
const QString &name = targetName(qmakePath);
if (name.startsWith(QLatin1String("fremantle")))
return LinuxDeviceConfiguration::Maemo5OsType;
return QLatin1String(Maemo5OsType);
if (name.startsWith(QLatin1String("harmattan")))
return LinuxDeviceConfiguration::HarmattanOsType;
return QLatin1String(HarmattanOsType);
if (name.startsWith(QLatin1String("meego")))
return LinuxDeviceConfiguration::MeeGoOsType;
return LinuxDeviceConfiguration::GenericLinuxOsType;
return QLatin1String(MeeGoOsType);
return QLatin1String(Constants::GenericLinuxOsType);
}
QString MaemoGlobal::architecture(const QString &qmakePath)
@@ -346,16 +346,5 @@ QString MaemoGlobal::osTypeToString(const QString &osType)
return tr("Unknown OS");
}
MaemoGlobal::PackagingSystem MaemoGlobal::packagingSystem(const QString &osType)
{
if (osType == LinuxDeviceConfiguration::Maemo5OsType
|| osType == LinuxDeviceConfiguration::HarmattanOsType) {
return Dpkg;
}
if (osType == LinuxDeviceConfiguration::MeeGoOsType)
return Rpm;
return Tar;
}
} // namespace Internal
} // namespace RemoteLinux

View File

@@ -38,20 +38,21 @@
#include <coreplugin/ifile.h>
#include <utils/environment.h>
#include <projectexplorer/buildstep.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/deployconfiguration.h>
#include <QtCore/QList>
#include <QtCore/QSharedPointer>
#include <QtCore/QCoreApplication>
#include <QtCore/QSharedPointer>
QT_BEGIN_NAMESPACE
class QProcess;
class QString;
QT_END_NAMESPACE
namespace QtSupport { class BaseQtVersion; }
namespace ProjectExplorer {
class Target;
}
namespace QtSupport {
class BaseQtVersion;
}
namespace RemoteLinux {
class LinuxDeviceConfiguration;
@@ -130,24 +131,6 @@ public:
static QString osTypeToString(const QString &osType);
static PackagingSystem packagingSystem(const QString &osType);
template<class T> static T *earlierBuildStep(const ProjectExplorer::DeployConfiguration *dc,
const ProjectExplorer::BuildStep *laterBuildStep)
{
if (!dc)
return 0;
const ProjectExplorer::BuildStepList * const bsl = dc->stepList();
const QList<ProjectExplorer::BuildStep *> &buildSteps = bsl->steps();
for (int i = 0; i < buildSteps.count(); ++i) {
if (buildSteps.at(i) == laterBuildStep)
return 0;
if (T * const step = dynamic_cast<T *>(buildSteps.at(i)))
return step;
}
return 0;
}
static bool isValidMaemoQtVersion(const QString &qmakePath, const QString &osType);
private:
static QString madAdminCommand(const QString &qmakePath);

View File

@@ -71,7 +71,7 @@ public:
virtual QString summaryText() const
{
if (!MaemoGlobal::earlierBuildStep<AbstractMaemoPackageCreationStep>(m_step->deployConfiguration(), m_step)) {
if (!m_step->deployConfiguration()->earlierBuildStep<AbstractMaemoPackageCreationStep>(m_step)) {
return QLatin1String("<font color=\"red\">")
+ tr("Cannot deploy to sysroot: No packaging step found.")
+ QLatin1String("</font>");
@@ -146,6 +146,12 @@ AbstractMaemoInstallPackageToSysrootStep::AbstractMaemoInstallPackageToSysrootSt
{
}
RemoteLinuxDeployConfiguration *AbstractMaemoInstallPackageToSysrootStep::deployConfiguration() const
{
return qobject_cast<RemoteLinuxDeployConfiguration *>(BuildStep::deployConfiguration());
}
void AbstractMaemoInstallPackageToSysrootStep::run(QFutureInterface<bool> &fi)
{
const Qt4BuildConfiguration * const bc
@@ -158,7 +164,7 @@ void AbstractMaemoInstallPackageToSysrootStep::run(QFutureInterface<bool> &fi)
}
const AbstractMaemoPackageCreationStep * const pStep
= MaemoGlobal::earlierBuildStep<AbstractMaemoPackageCreationStep>(deployConfiguration(), this);
= deployConfiguration()->earlierBuildStep<AbstractMaemoPackageCreationStep>(this);
if (!pStep) {
addOutput(tr("Cannot install package to sysroot without packaging step."),
ErrorMessageOutput);

View File

@@ -41,6 +41,8 @@
QT_FORWARD_DECLARE_CLASS(QProcess)
namespace RemoteLinux {
class RemoteLinuxDeployConfiguration;
namespace Internal {
class AbstractMaemoInstallPackageToSysrootStep : public ProjectExplorer::BuildStep
@@ -50,6 +52,8 @@ public:
virtual bool init() { return true; }
virtual void run(QFutureInterface<bool> &fi);
RemoteLinuxDeployConfiguration *deployConfiguration() const;
protected:
AbstractMaemoInstallPackageToSysrootStep(ProjectExplorer::BuildStepList *bsl,
const QString &id);

View File

@@ -32,6 +32,7 @@
#include "maemopublishingbuildsettingspagefremantlefree.h"
#include "ui_maemopublishingbuildsettingspagefremantlefree.h"
#include "maemoconstants.h"
#include "maemoglobal.h"
#include "maemopublisherfremantlefree.h"
@@ -40,7 +41,6 @@
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <qtsupport/baseqtversion.h>
#include <remotelinux/linuxdeviceconfiguration.h>
#include <utils/qtcassert.h>
using namespace ProjectExplorer;
@@ -86,7 +86,7 @@ void MaemoPublishingBuildSettingsPageFremantleFree::collectBuildConfigurations(c
QtSupport::BaseQtVersion *lqt = qt4Bc->qtVersion();
if (!lqt)
continue;
if (MaemoGlobal::osType(lqt->qmakeCommand()) == LinuxDeviceConfiguration::Maemo5OsType)
if (MaemoGlobal::osType(lqt->qmakeCommand()) == QLatin1String(Maemo5OsType))
m_buildConfigs << qt4Bc;
}
break;

View File

@@ -31,6 +31,7 @@
**************************************************************************/
#include "maemopublishingwizardfactories.h"
#include "maemoconstants.h"
#include "maemoglobal.h"
#include "maemopublishingwizardfremantlefree.h"
@@ -39,7 +40,6 @@
#include <qt4projectmanager/qt4project.h>
#include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <qtsupport/baseqtversion.h>
#include "remotelinux/linuxdeviceconfiguration.h"
using namespace ProjectExplorer;
using namespace Qt4ProjectManager;
@@ -83,7 +83,7 @@ bool MaemoPublishingWizardFactoryFremantleFree::canCreateWizard(const Project *p
QtSupport::BaseQtVersion *qt = qt4Bc->qtVersion();
if (!qt)
continue;
if (MaemoGlobal::osType(qt->qmakeCommand()) == LinuxDeviceConfiguration::Maemo5OsType)
if (MaemoGlobal::osType(qt->qmakeCommand()) == QLatin1String(Maemo5OsType))
return true;
}
break;

View File

@@ -31,11 +31,11 @@
**************************************************************************/
#include "maemoqtversion.h"
#include "maemoconstants.h"
#include "maemoglobal.h"
#include <qt4projectmanager/qt4projectmanagerconstants.h>
#include <qtsupport/qtsupportconstants.h>
#include <remotelinux/linuxdeviceconfiguration.h>
#include <QtCore/QCoreApplication>
#include <QtCore/QFile>
@@ -114,16 +114,16 @@ QList<ProjectExplorer::Abi> MaemoQtVersion::qtAbis() const
QList<ProjectExplorer::Abi> result;
if (!m_isvalidVersion)
return result;
if (m_osType == LinuxDeviceConfiguration::Maemo5OsType) {
if (m_osType == QLatin1String(Maemo5OsType)) {
result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS,
ProjectExplorer::Abi::MaemoLinuxFlavor, ProjectExplorer::Abi::ElfFormat,
32));
} else if (m_osType == LinuxDeviceConfiguration::HarmattanOsType) {
} else if (m_osType == QLatin1String(HarmattanOsType)) {
result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS,
ProjectExplorer::Abi::HarmattanLinuxFlavor,
ProjectExplorer::Abi::ElfFormat,
32));
} else if (m_osType == LinuxDeviceConfiguration::MeeGoOsType) {
} else if (m_osType == QLatin1String(MeeGoOsType)) {
result.append(ProjectExplorer::Abi(ProjectExplorer::Abi::ArmArchitecture, ProjectExplorer::Abi::LinuxOS,
ProjectExplorer::Abi::MeegoLinuxFlavor,
ProjectExplorer::Abi::ElfFormat, 32));
@@ -141,11 +141,11 @@ QSet<QString> MaemoQtVersion::supportedTargetIds() const
QSet<QString> result;
if (!m_isvalidVersion)
return result;
if (m_osType == LinuxDeviceConfiguration::Maemo5OsType) {
if (m_osType == QLatin1String(Maemo5OsType)) {
result.insert(QLatin1String(Constants::MAEMO5_DEVICE_TARGET_ID));
} else if (m_osType == LinuxDeviceConfiguration::HarmattanOsType) {
} else if (m_osType == QLatin1String(HarmattanOsType)) {
result.insert(QLatin1String(Constants::HARMATTAN_DEVICE_TARGET_ID));
} else if (m_osType == LinuxDeviceConfiguration::MeeGoOsType) {
} else if (m_osType == QLatin1String(MeeGoOsType)) {
result.insert(QLatin1String(Constants::MEEGO_DEVICE_TARGET_ID));
}
return result;
@@ -153,11 +153,11 @@ QSet<QString> MaemoQtVersion::supportedTargetIds() const
QString MaemoQtVersion::description() const
{
if (m_osType == LinuxDeviceConfiguration::Maemo5OsType)
if (m_osType == QLatin1String(Maemo5OsType))
return QCoreApplication::translate("QtVersion", "Maemo", "Qt Version is meant for Maemo5");
else if (m_osType == LinuxDeviceConfiguration::HarmattanOsType)
else if (m_osType == QLatin1String(HarmattanOsType))
return QCoreApplication::translate("QtVersion", "Harmattan ", "Qt Version is meant for Harmattan");
else if (m_osType == LinuxDeviceConfiguration::MeeGoOsType)
else if (m_osType == QLatin1String(MeeGoOsType))
return QCoreApplication::translate("QtVersion", "Meego", "Qt Version is meant for Meego");
return QString();
}

View File

@@ -220,7 +220,7 @@ QString MaemoSshRunner::killApplicationCommandLine() const
// Fremantle's busybox configuration is strange.
const char *killTemplate;
if (devConfig()->osType() == LinuxDeviceConfiguration::Maemo5OsType)
if (devConfig()->osType() == QLatin1String(Maemo5OsType))
killTemplate = "pkill -f -%2 %1";
else
killTemplate = "pkill -%2 -f %1";

View File

@@ -33,6 +33,7 @@
#include "qt4maemodeployconfiguration.h"
#include "maddeuploadandinstallpackagesteps.h"
#include "maemoconstants.h"
#include "maemodeploybymountsteps.h"
#include "maemoinstalltosysrootstep.h"
#include "maemopackagecreationstep.h"
@@ -118,25 +119,22 @@ DeployConfiguration *Qt4MaemoDeployConfigurationFactory::create(Target *parent,
DeployConfiguration *dc = 0;
const QString displayName = displayNameForId(id);
if (id == Qt4MaemoDeployConfiguration::FremantleWithoutPackagingId) {
dc = new Qt4MaemoDeployConfiguration(parent, id, displayName,
LinuxDeviceConfiguration::Maemo5OsType);
dc = new Qt4MaemoDeployConfiguration(parent, id, displayName, QLatin1String(Maemo5OsType));
dc->stepList()->insertStep(0, new MaemoMakeInstallToSysrootStep(dc->stepList()));
dc->stepList()->insertStep(1, new MaemoCopyFilesViaMountStep(dc->stepList()));
} else if (id == Qt4MaemoDeployConfiguration::FremantleWithPackagingId) {
dc = new Qt4MaemoDeployConfiguration(parent, id, displayName,
LinuxDeviceConfiguration::Maemo5OsType);
dc = new Qt4MaemoDeployConfiguration(parent, id, displayName, QLatin1String(Maemo5OsType));
dc->stepList()->insertStep(0, new MaemoDebianPackageCreationStep(dc->stepList()));
dc->stepList()->insertStep(1, new MaemoInstallDebianPackageToSysrootStep(dc->stepList()));
dc->stepList()->insertStep(2, new MaemoInstallPackageViaMountStep(dc->stepList()));
} else if (id == Qt4MaemoDeployConfiguration::HarmattanId) {
dc = new Qt4MaemoDeployConfiguration(parent, id, displayName,
LinuxDeviceConfiguration::HarmattanOsType);
QLatin1String(HarmattanOsType));
dc->stepList()->insertStep(0, new MaemoDebianPackageCreationStep(dc->stepList()));
dc->stepList()->insertStep(1, new MaemoInstallDebianPackageToSysrootStep(dc->stepList()));
dc->stepList()->insertStep(2, new MaemoUploadAndInstallPackageStep(dc->stepList()));
} else if (id == Qt4MaemoDeployConfiguration::MeegoId) {
dc = new Qt4MaemoDeployConfiguration(parent, id, displayName,
LinuxDeviceConfiguration::MeeGoOsType);
dc = new Qt4MaemoDeployConfiguration(parent, id, displayName, QLatin1String(MeeGoOsType));
dc->stepList()->insertStep(0, new MaemoRpmPackageCreationStep(dc->stepList()));
dc->stepList()->insertStep(1, new MaemoInstallRpmPackageToSysrootStep(dc->stepList()));
dc->stepList()->insertStep(2, new MeegoUploadAndInstallPackageStep(dc->stepList()));

View File

@@ -4,6 +4,8 @@
namespace RemoteLinux {
namespace Constants {
const char GenericLinuxOsType[] = "GenericLinuxOsType";
const char RemoteLinuxSettingsCategory[] = "X.RemoteLinux";
const char GenericTestDeviceActionId[] = "RemoteLinux.GenericTestDeviceAction";

View File

@@ -35,6 +35,8 @@
#include "linuxdeviceconfiguration.h"
#include "remotelinux_export.h"
#include <projectexplorer/buildstep.h>
#include <projectexplorer/buildsteplist.h>
#include <projectexplorer/deployconfiguration.h>
#include <QtCore/QSharedPointer>
@@ -66,6 +68,18 @@ public:
QSharedPointer<Internal::TypeSpecificDeviceConfigurationListModel> deviceConfigModel() const;
QSharedPointer<const LinuxDeviceConfiguration> deviceConfiguration() const;
template<class T> T *earlierBuildStep(const ProjectExplorer::BuildStep *laterBuildStep)
{
const QList<ProjectExplorer::BuildStep *> &buildSteps = stepList()->steps();
for (int i = 0; i < buildSteps.count(); ++i) {
if (buildSteps.at(i) == laterBuildStep)
return 0;
if (T * const step = dynamic_cast<T *>(buildSteps.at(i)))
return step;
}
return 0;
}
signals:
void deviceConfigurationListChanged();
void currentDeviceConfigurationChanged();

View File

@@ -31,9 +31,9 @@
**************************************************************************/
#include "remotelinuxdeployconfigurationfactory.h"
#include "linuxdeviceconfiguration.h"
#include "maemoglobal.h"
#include "remotelinuxdeployconfiguration.h"
#include "remotelinux_constants.h"
#include "tarpackagecreationstep.h"
#include "uploadandinstalltarpackagestep.h"
@@ -77,7 +77,7 @@ DeployConfiguration *RemoteLinuxDeployConfigurationFactory::create(Target *paren
Q_ASSERT(canCreate(parent, id));
DeployConfiguration * const dc = new RemoteLinuxDeployConfiguration(parent, id,
genericLinuxDisplayName(), LinuxDeviceConfiguration::GenericLinuxOsType);
genericLinuxDisplayName(), QLatin1String(Constants::GenericLinuxOsType));
dc->stepList()->insertStep(0, new TarPackageCreationStep(dc->stepList()));
dc->stepList()->insertStep(1, new UploadAndInstallTarPackageStep(dc->stepList()));
return dc;
@@ -95,7 +95,7 @@ DeployConfiguration *RemoteLinuxDeployConfigurationFactory::restore(Target *pare
return 0;
QString id = idFromMap(map);
RemoteLinuxDeployConfiguration * const dc = new RemoteLinuxDeployConfiguration(parent, id,
genericLinuxDisplayName(), LinuxDeviceConfiguration::GenericLinuxOsType);
genericLinuxDisplayName(), QLatin1String(Constants::GenericLinuxOsType));
if (!dc->fromMap(map)) {
delete dc;
return 0;

View File

@@ -32,6 +32,7 @@
#include "typespecificdeviceconfigurationlistmodel.h"
#include "linuxdeviceconfigurations.h"
#include "remotelinux_constants.h"
namespace RemoteLinux {
namespace Internal {
@@ -57,7 +58,7 @@ int TypeSpecificDeviceConfigurationListModel::rowCount(const QModelIndex &parent
const LinuxDeviceConfigurations * const devConfs
= LinuxDeviceConfigurations::instance();
const int devConfsCount = devConfs->rowCount();
if (m_targetOsType == LinuxDeviceConfiguration::GenericLinuxOsType)
if (m_targetOsType == QLatin1String(Constants::GenericLinuxOsType))
return devConfsCount;
for (int i = 0; i < devConfsCount; ++i) {
if (devConfs->deviceAt(i)->osType() == m_targetOsType)
@@ -84,7 +85,7 @@ LinuxDeviceConfiguration::ConstPtr TypeSpecificDeviceConfigurationListModel::dev
int currentRow = -1;
const LinuxDeviceConfigurations * const devConfs
= LinuxDeviceConfigurations::instance();
if (m_targetOsType == LinuxDeviceConfiguration::GenericLinuxOsType)
if (m_targetOsType == QLatin1String(Constants::GenericLinuxOsType))
return devConfs->deviceAt(idx);
const int devConfsCount = devConfs->rowCount();
for (int i = 0; i < devConfsCount; ++i) {
@@ -107,7 +108,7 @@ LinuxDeviceConfiguration::ConstPtr TypeSpecificDeviceConfigurationListModel::fin
const LinuxDeviceConfiguration::ConstPtr &devConf
= LinuxDeviceConfigurations::instance()->find(id);
return devConf && (devConf->osType() == m_targetOsType
|| m_targetOsType == LinuxDeviceConfiguration::GenericLinuxOsType)
|| m_targetOsType == QLatin1String(Constants::GenericLinuxOsType))
? devConf : defaultDeviceConfig();
}

View File

@@ -31,7 +31,6 @@
**************************************************************************/
#include "uploadandinstalltarpackagestep.h"
#include "maemoglobal.h"
#include "remotelinuxdeployconfiguration.h"
#include "remotelinuxpackageinstaller.h"
#include "tarpackagecreationstep.h"
@@ -93,7 +92,7 @@ void UploadAndInstallTarPackageStep::ctor()
bool UploadAndInstallTarPackageStep::isDeploymentPossible(QString *whyNot) const
{
const TarPackageCreationStep * const pStep
= MaemoGlobal::earlierBuildStep<TarPackageCreationStep>(deployConfiguration(), this);
= deployConfiguration()->earlierBuildStep<TarPackageCreationStep>(this);
if (!pStep) {
if (whyNot)
*whyNot = tr("No tarball creation step found.");