Maemo: Move more functionality into the new target classes.

This commit is contained in:
Christian Kandeler
2011-01-19 11:06:43 +01:00
parent 2ec85cc67a
commit 3a87fdd5f1
10 changed files with 34 additions and 27 deletions

View File

@@ -482,15 +482,12 @@ void MaemoDeployStep::handleUnmounted()
m_mounter->resetMountSpecifications(); m_mounter->resetMountSpecifications();
setState(Inactive); setState(Inactive);
break; break;
case UnmountingOldDirs: { case UnmountingOldDirs:
const Qt4BuildConfiguration * const bc if (maemotarget()->allowsRemoteMounts())
= static_cast<Qt4BuildConfiguration *>(buildConfiguration());
if (MaemoGlobal::allowsRemoteMounts(bc->qtVersion()))
setupMount(); setupMount();
else else
prepareSftpConnection(); prepareSftpConnection();
break; break;
}
case UnmountingCurrentDirs: case UnmountingCurrentDirs:
setState(GatheringPorts); setState(GatheringPorts);
m_portsGatherer->start(m_connection, m_cachedDeviceConfig->freePorts()); m_portsGatherer->start(m_connection, m_cachedDeviceConfig->freePorts());
@@ -827,6 +824,13 @@ const AbstractMaemoToolChain *MaemoDeployStep::toolChain() const
return static_cast<AbstractMaemoToolChain *>(bc->toolChain()); return static_cast<AbstractMaemoToolChain *>(bc->toolChain());
} }
const AbstractQt4MaemoTarget *MaemoDeployStep::maemotarget() const
{
const Qt4BuildConfiguration * const bc
= static_cast<Qt4BuildConfiguration *>(buildConfiguration());
return static_cast<AbstractQt4MaemoTarget *>(bc->target());
}
void MaemoDeployStep::handleSysrootInstallerOutput() void MaemoDeployStep::handleSysrootInstallerOutput()
{ {
ASSERT_STATE(QList<State>() << InstallingToSysroot << StopRequested); ASSERT_STATE(QList<State>() << InstallingToSysroot << StopRequested);

View File

@@ -143,6 +143,7 @@ private:
const MaemoPackageCreationStep *packagingStep() const; const MaemoPackageCreationStep *packagingStep() const;
QString deployMountPoint() const; QString deployMountPoint() const;
const AbstractMaemoToolChain *toolChain() const; const AbstractMaemoToolChain *toolChain() const;
const AbstractQt4MaemoTarget *maemotarget() const;
void copyNextFileToDevice(); void copyNextFileToDevice();
void installToSysroot(); void installToSysroot();
QString uploadDir() const; QString uploadDir() const;

View File

@@ -89,9 +89,6 @@ public:
static QString targetName(const QtVersion *qtVersion); static QString targetName(const QtVersion *qtVersion);
static QString madCommand(const QtVersion *qtVersion); static QString madCommand(const QtVersion *qtVersion);
static MaemoVersion version(const QtVersion *qtVersion); static MaemoVersion version(const QtVersion *qtVersion);
static bool allowsRemoteMounts(const QtVersion *qtVersion) { return version(qtVersion) == Maemo5; }
static bool allowsPackagingDisabling(const QtVersion *qtVersion) { return version(qtVersion) == Maemo5; }
static bool allowsQmlDebugging(const QtVersion *qtVersion) { return version(qtVersion) == Maemo6; }
static bool callMad(QProcess &proc, const QStringList &args, static bool callMad(QProcess &proc, const QStringList &args,
const QtVersion *qtVersion); const QtVersion *qtVersion);

View File

@@ -413,8 +413,7 @@ QString MaemoPackageCreationStep::packageFilePath() const
bool MaemoPackageCreationStep::isPackagingEnabled() const bool MaemoPackageCreationStep::isPackagingEnabled() const
{ {
return m_packagingEnabled return m_packagingEnabled || !maemoTarget()->allowsPackagingDisabling();
|| !MaemoGlobal::allowsPackagingDisabling(qt4BuildConfiguration()->qtVersion());
} }
QString MaemoPackageCreationStep::versionString(QString *error) const QString MaemoPackageCreationStep::versionString(QString *error) const

View File

@@ -86,8 +86,7 @@ void MaemoPackageCreationWidget::initGui()
{ {
const Qt4BuildConfiguration * const bc = m_step->qt4BuildConfiguration(); const Qt4BuildConfiguration * const bc = m_step->qt4BuildConfiguration();
if (bc) { if (bc) {
m_ui->skipCheckBox->setVisible(MaemoGlobal::allowsPackagingDisabling( m_ui->skipCheckBox->setVisible(m_step->maemoTarget()->allowsPackagingDisabling());
bc->qtVersion()));
m_ui->skipCheckBox->setChecked(!m_step->isPackagingEnabled()); m_ui->skipCheckBox->setChecked(!m_step->isPackagingEnabled());
} }

View File

@@ -35,6 +35,7 @@
#include "maemoglobal.h" #include "maemoglobal.h"
#include "maemousedportsgatherer.h" #include "maemousedportsgatherer.h"
#include "qt4maemotarget.h"
#include <coreplugin/ssh/sftpchannel.h> #include <coreplugin/ssh/sftpchannel.h>
#include <coreplugin/ssh/sshconnection.h> #include <coreplugin/ssh/sshconnection.h>
@@ -75,7 +76,8 @@ void MaemoRemoteMounter::setBuildConfiguration(const Qt4BuildConfiguration *bc)
{ {
ASSERT_STATE(Inactive); ASSERT_STATE(Inactive);
const QtVersion * const qtVersion = bc->qtVersion(); const QtVersion * const qtVersion = bc->qtVersion();
m_remoteMountsAllowed = MaemoGlobal::allowsRemoteMounts(qtVersion); m_remoteMountsAllowed
= qobject_cast<AbstractQt4MaemoTarget *>(bc->target())->allowsRemoteMounts();
m_maddeRoot = MaemoGlobal::maddeRoot(qtVersion); m_maddeRoot = MaemoGlobal::maddeRoot(qtVersion);
} }

View File

@@ -321,8 +321,7 @@ MaemoPortList MaemoRunConfiguration::freePorts() const
bool MaemoRunConfiguration::useRemoteGdb() const bool MaemoRunConfiguration::useRemoteGdb() const
{ {
return m_useRemoteGdb return m_useRemoteGdb && maemoTarget()->allowsRemoteMounts();
&& MaemoGlobal::allowsRemoteMounts(activeQt4BuildConfiguration()->qtVersion());
} }
void MaemoRunConfiguration::setArguments(const QString &args) void MaemoRunConfiguration::setArguments(const QString &args)
@@ -332,7 +331,7 @@ void MaemoRunConfiguration::setArguments(const QString &args)
MaemoRunConfiguration::DebuggingType MaemoRunConfiguration::debuggingType() const MaemoRunConfiguration::DebuggingType MaemoRunConfiguration::debuggingType() const
{ {
if (!MaemoGlobal::allowsQmlDebugging(activeQt4BuildConfiguration()->qtVersion())) if (!maemoTarget()->allowsQmlDebugging())
return DebugCppOnly; return DebugCppOnly;
if (useCppDebugger()) { if (useCppDebugger()) {
if (useQmlDebugger()) if (useQmlDebugger())

View File

@@ -342,16 +342,13 @@ void MaemoRunConfigurationWidget::handleBuildConfigChanged()
void MaemoRunConfigurationWidget::handleToolchainChanged() void MaemoRunConfigurationWidget::handleToolchainChanged()
{ {
const Qt4BuildConfiguration * const bc const AbstractQt4MaemoTarget * const maemoTarget
= m_runConfiguration->activeQt4BuildConfiguration(); = m_runConfiguration->maemoTarget();
if (bc) { if (maemoTarget) {
const QtVersion * const qtVersion = bc->qtVersion(); const bool remoteMountsAvailable = maemoTarget->allowsRemoteMounts();
const bool remoteMountsAvailable
= MaemoGlobal::allowsRemoteMounts(qtVersion);
m_debugDetailsContainer->setVisible(remoteMountsAvailable); m_debugDetailsContainer->setVisible(remoteMountsAvailable);
m_mountDetailsContainer->setVisible(remoteMountsAvailable); m_mountDetailsContainer->setVisible(remoteMountsAvailable);
const bool qmlDebuggingAvailable const bool qmlDebuggingAvailable = maemoTarget->allowsQmlDebugging();
= MaemoGlobal::allowsQmlDebugging(qtVersion);
m_debuggingLanguagesLabel->setVisible(qmlDebuggingAvailable); m_debuggingLanguagesLabel->setVisible(qmlDebuggingAvailable);
m_debugCppOnlyButton->setVisible(qmlDebuggingAvailable); m_debugCppOnlyButton->setVisible(qmlDebuggingAvailable);
m_debugQmlOnlyButton->setVisible(qmlDebuggingAvailable); m_debugQmlOnlyButton->setVisible(qmlDebuggingAvailable);

View File

@@ -169,9 +169,8 @@ bool MaemoRunControlFactory::canRun(RunConfiguration *runConfiguration,
return false; return false;
const int freePortCount = maemoRunConfig->freePorts().count(); const int freePortCount = maemoRunConfig->freePorts().count();
const QtVersion * const qtVersion const bool remoteMountsAllowed
= maemoRunConfig->activeQt4BuildConfiguration()->qtVersion(); = maemoRunConfig->maemoTarget()->allowsRemoteMounts();
const bool remoteMountsAllowed = MaemoGlobal::allowsRemoteMounts(qtVersion);
if (remoteMountsAllowed && freePortCount == 0) if (remoteMountsAllowed && freePortCount == 0)
return false; return false;
const int mountDirCount const int mountDirCount

View File

@@ -72,6 +72,10 @@ public:
QString shortDescription() const; QString shortDescription() const;
bool setShortDescription(const QString &description); bool setShortDescription(const QString &description);
virtual bool allowsRemoteMounts() const=0;
virtual bool allowsPackagingDisabling() const=0;
virtual bool allowsQmlDebugging() const=0;
signals: signals:
void debianDirContentsChanged(); void debianDirContentsChanged();
void changeLogChanged(); void changeLogChanged();
@@ -124,6 +128,9 @@ public:
private: private:
virtual QString debianDirName() const; virtual QString debianDirName() const;
virtual bool allowsRemoteMounts() const { return true; }
virtual bool allowsPackagingDisabling() const { return true; }
virtual bool allowsQmlDebugging() const { return false; }
}; };
class Qt4HarmattanTarget : public AbstractQt4MaemoTarget class Qt4HarmattanTarget : public AbstractQt4MaemoTarget
@@ -137,6 +144,9 @@ public:
private: private:
virtual QString debianDirName() const; virtual QString debianDirName() const;
virtual bool allowsRemoteMounts() const { return false; }
virtual bool allowsPackagingDisabling() const { return false; }
virtual bool allowsQmlDebugging() const { return true; }
}; };
} // namespace Internal } // namespace Internal