Commit fb982271 authored by Christian Kandeler's avatar Christian Kandeler
Browse files

Madde: Move deploy info assistant to target class.



Can finally be moved out of the deploy configuration, now that the OS
type is in the target class.

Change-Id: Ifaecdf2e3de114b91d80722d5076af5799095af7
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent 0d24e842
......@@ -132,7 +132,9 @@ void MaemoDeployConfigurationWidget::addDesktopFile()
if (qobject_cast<Qt4Maemo5Target *>(deployConfiguration()->target()))
d.remoteDir += QLatin1String("/hildon");
d.localFilePath = desktopFilePath;
if (!deployConfiguration()->deploymentSettingsAssistant()->addDeployableToProFile(proFileInfo,
const AbstractQt4MaemoTarget * const target
= qobject_cast<AbstractQt4MaemoTarget *>(deployConfiguration()->target());
if (!target->deploymentSettingsAssistant()->addDeployableToProFile(proFileInfo,
QLatin1String("desktopfile"), d)) {
QMessageBox::critical(this, tr("Project File Update Failed"),
tr("Could not update the project file."));
......@@ -169,7 +171,9 @@ void MaemoDeployConfigurationWidget::addIcon()
return;
}
if (!deployConfiguration()->deploymentSettingsAssistant()->addDeployableToProFile(proFileInfo,
const AbstractQt4MaemoTarget * const target
= qobject_cast<AbstractQt4MaemoTarget *>(deployConfiguration()->target());
if (!target->deploymentSettingsAssistant()->addDeployableToProFile(proFileInfo,
QLatin1String("icon"), DeployableFile(newFilePath, remoteIconDir()))) {
QMessageBox::critical(this, tr("Project File Update Failed"),
tr("Could not update the project file."));
......
......@@ -44,7 +44,6 @@
#include <remotelinux/deployablefile.h>
#include <remotelinux/deployablefilesperprofile.h>
#include <remotelinux/deploymentinfo.h>
#include <remotelinux/deploymentsettingsassistant.h>
#include <utils/qtcassert.h>
#include <QtCore/QFileInfo>
......@@ -64,41 +63,12 @@ Qt4MaemoDeployConfiguration::Qt4MaemoDeployConfiguration(ProjectExplorer::Target
const QString &id, const QString &displayName)
: RemoteLinuxDeployConfiguration(target, id, displayName)
{
const QList<DeployConfiguration *> &deployConfigs = target->deployConfigurations();
foreach (const DeployConfiguration * const dc, deployConfigs) {
const Qt4MaemoDeployConfiguration * const mdc
= qobject_cast<const Qt4MaemoDeployConfiguration *>(dc);
if (mdc) {
m_deploymentSettingsAssistant = mdc->deploymentSettingsAssistant();
break;
}
}
if (!m_deploymentSettingsAssistant) {
QString qmakeScope;
const QString supportedOsType = this->target()->supportedOsType();
if (supportedOsType == QLatin1String(Maemo5OsType))
qmakeScope = QLatin1String("maemo5");
else if (supportedOsType == QLatin1String(HarmattanOsType))
qmakeScope = QLatin1String("contains(MEEGO_EDITION,harmattan)");
else if (supportedOsType == QLatin1String(MeeGoOsType))
qmakeScope = QLatin1String("!isEmpty(MEEGO_VERSION_MAJOR):!contains(MEEGO_EDITION,harmattan)");
else
qDebug("%s: Unexpected OS type %s", Q_FUNC_INFO, qPrintable(supportedOsType));
m_deploymentSettingsAssistant = QSharedPointer<DeploymentSettingsAssistant>
(new DeploymentSettingsAssistant(qmakeScope, QLatin1String("/opt"), deploymentInfo()));
}
}
Qt4MaemoDeployConfiguration::Qt4MaemoDeployConfiguration(ProjectExplorer::Target *target,
Qt4MaemoDeployConfiguration *source)
: RemoteLinuxDeployConfiguration(target, source)
{
m_deploymentSettingsAssistant = source->deploymentSettingsAssistant();
}
QSharedPointer<DeploymentSettingsAssistant> Qt4MaemoDeployConfiguration::deploymentSettingsAssistant() const
{
return m_deploymentSettingsAssistant;
}
QString Qt4MaemoDeployConfiguration::localDesktopFilePath(const DeployableFilesPerProFile *proFileInfo) const
......
......@@ -71,7 +71,6 @@ public:
ProjectExplorer::DeployConfigurationWidget *configurationWidget() const;
QSharedPointer<RemoteLinux::DeploymentSettingsAssistant> deploymentSettingsAssistant() const;
QString localDesktopFilePath(const RemoteLinux::DeployableFilesPerProFile *proFileInfo) const;
static QString fremantleWithPackagingId();
......@@ -86,8 +85,6 @@ private:
const QString &displayName);
Qt4MaemoDeployConfiguration(ProjectExplorer::Target *target,
Qt4MaemoDeployConfiguration *source);
QSharedPointer<RemoteLinux::DeploymentSettingsAssistant> m_deploymentSettingsAssistant;
};
} // namespace Internal
......
......@@ -52,6 +52,7 @@
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qt4projectmanager/qt4nodes.h>
#include <qtsupport/baseqtversion.h>
#include <remotelinux/deploymentsettingsassistant.h>
#include <utils/fileutils.h>
#include <utils/filesystemwatcher.h>
#include <utils/qtcassert.h>
......@@ -73,6 +74,7 @@
#include <cctype>
using namespace Qt4ProjectManager;
using namespace RemoteLinux;
namespace Madde {
namespace Internal {
......@@ -120,9 +122,11 @@ bool adaptTagValue(QByteArray &document, const QByteArray &fieldName,
AbstractQt4MaemoTarget::AbstractQt4MaemoTarget(Qt4Project *parent, const QString &id,
const QString &supportedOsType) :
const QString &supportedOsType, const QString &qmakeScope) :
AbstractEmbeddedLinuxTarget(parent, id, supportedOsType),
m_filesWatcher(new Utils::FileSystemWatcher(this)),
m_deploymentSettingsAssistant(new DeploymentSettingsAssistant(qmakeScope,
QLatin1String("/opt"), deploymentInfo())),
m_isInitialized(false)
{
m_filesWatcher->setObjectName(QLatin1String("Qt4MaemoTarget"));
......@@ -371,8 +375,8 @@ void AbstractQt4MaemoTarget::raiseError(const QString &reason)
}
AbstractDebBasedQt4MaemoTarget::AbstractDebBasedQt4MaemoTarget(Qt4Project *parent,
const QString &id, const QString &supportedOsType)
: AbstractQt4MaemoTarget(parent, id, supportedOsType)
const QString &id, const QString &supportedOsType, const QString &qmakeScope)
: AbstractQt4MaemoTarget(parent, id, supportedOsType, qmakeScope)
{
}
......@@ -954,8 +958,8 @@ QString AbstractDebBasedQt4MaemoTarget::shortDayOfWeekName(const QDateTime &dt)
AbstractRpmBasedQt4MaemoTarget::AbstractRpmBasedQt4MaemoTarget(Qt4Project *parent,
const QString &id, const QString &supportedOsType)
: AbstractQt4MaemoTarget(parent, id, supportedOsType)
const QString &id, const QString &supportedOsType, const QString &qmakeScope)
: AbstractQt4MaemoTarget(parent, id, supportedOsType, qmakeScope)
{
}
......@@ -1120,7 +1124,8 @@ bool AbstractRpmBasedQt4MaemoTarget::setValueForTag(const QByteArray &tag,
}
Qt4Maemo5Target::Qt4Maemo5Target(Qt4Project *parent, const QString &id)
: AbstractDebBasedQt4MaemoTarget(parent, id, QLatin1String(Maemo5OsType))
: AbstractDebBasedQt4MaemoTarget(parent, id, QLatin1String(Maemo5OsType),
QLatin1String("maemo5"))
{
setDisplayName(defaultDisplayName());
}
......@@ -1159,7 +1164,8 @@ QByteArray Qt4Maemo5Target::defaultSection() const
}
Qt4HarmattanTarget::Qt4HarmattanTarget(Qt4Project *parent, const QString &id)
: AbstractDebBasedQt4MaemoTarget(parent, id, QLatin1String(HarmattanOsType))
: AbstractDebBasedQt4MaemoTarget(parent, id, QLatin1String(HarmattanOsType),
QLatin1String("contains(MEEGO_EDITION,harmattan)"))
{
setDisplayName(defaultDisplayName());
}
......@@ -1227,7 +1233,8 @@ QByteArray Qt4HarmattanTarget::defaultSection() const
Qt4MeegoTarget::Qt4MeegoTarget(Qt4Project *parent, const QString &id)
: AbstractRpmBasedQt4MaemoTarget(parent, id, QLatin1String(MeeGoOsType))
: AbstractRpmBasedQt4MaemoTarget(parent, id, QLatin1String(MeeGoOsType),
QLatin1String("!isEmpty(MEEGO_VERSION_MAJOR):!contains(MEEGO_EDITION,harmattan)"))
{
setDisplayName(defaultDisplayName());
}
......
......@@ -42,10 +42,8 @@
QT_FORWARD_DECLARE_CLASS(QDateTime)
QT_FORWARD_DECLARE_CLASS(QFile)
namespace Qt4ProjectManager {
class Qt4Project;
class Qt4BuildConfigurationFactory;
}
namespace Qt4ProjectManager { class Qt4Project; }
namespace RemoteLinux { class DeploymentSettingsAssistant; }
namespace Utils { class FileSystemWatcher; }
namespace Madde {
......@@ -59,7 +57,7 @@ class AbstractQt4MaemoTarget : public RemoteLinux::AbstractEmbeddedLinuxTarget
Q_OBJECT
public:
explicit AbstractQt4MaemoTarget(Qt4ProjectManager::Qt4Project *parent, const QString &id,
const QString &supportedOsType);
const QString &supportedOsType, const QString &qmakeScope);
virtual ~AbstractQt4MaemoTarget();
void createApplicationProFiles(bool reparse);
......@@ -79,6 +77,10 @@ public:
bool setPackageName(const QString &packageName);
bool setShortDescription(const QString &description);
RemoteLinux::DeploymentSettingsAssistant *deploymentSettingsAssistant() const {
return m_deploymentSettingsAssistant;
}
protected:
enum ActionStatus { NoActionRequired, ActionSuccessful, ActionFailed };
......@@ -108,6 +110,7 @@ private:
bool initPackagingSettingsFromOtherTarget();
virtual bool initAdditionalPackagingSettingsFromOtherTarget() = 0;
RemoteLinux::DeploymentSettingsAssistant * const m_deploymentSettingsAssistant;
bool m_isInitialized;
};
......@@ -117,7 +120,7 @@ class AbstractDebBasedQt4MaemoTarget : public AbstractQt4MaemoTarget
Q_OBJECT
public:
AbstractDebBasedQt4MaemoTarget(Qt4ProjectManager::Qt4Project *parent, const QString &id,
const QString &supportedOsType);
const QString &supportedOsType, const QString &qmakeScope);
~AbstractDebBasedQt4MaemoTarget();
QString debianDirPath() const;
......@@ -190,7 +193,7 @@ class AbstractRpmBasedQt4MaemoTarget : public AbstractQt4MaemoTarget
Q_OBJECT
public:
AbstractRpmBasedQt4MaemoTarget(Qt4ProjectManager::Qt4Project *parent, const QString &id,
const QString &supportedOsType);
const QString &supportedOsType, const QString &qmakeScope);
~AbstractRpmBasedQt4MaemoTarget();
virtual bool allowsRemoteMounts() const { return false; }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment