diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp index 2d1be63adf431a855d64f114d1575c2301795414..79bb7a101d4164303d42122fbb84b2d523fb6556 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp @@ -34,17 +34,18 @@ #include <qt4projectmanager/qt4nodes.h> #include <QtCore/QCryptographicHash> +#include <QtCore/QFile> #include <QtCore/QFileInfo> namespace Qt4ProjectManager { namespace Internal { MaemoDeployableListModel::MaemoDeployableListModel(const Qt4ProFileNode *proFileNode, - const QString &qConfigFile, QObject *parent) + const QSharedPointer<ProFileOption> &proFileOption, QObject *parent) : QAbstractTableModel(parent), m_proFileNode(proFileNode), m_modified(false), - m_proFileWrapper(new ProFileWrapper(m_proFileNode->path(), qConfigFile)) + m_proFileWrapper(new ProFileWrapper(m_proFileNode->path(), proFileOption)) { buildModel(); } @@ -62,8 +63,18 @@ bool MaemoDeployableListModel::buildModel() : QLatin1String("/usr/local/bin"); m_deployables.prepend(MaemoDeployable(localExecutableFilePath(), remoteDir)); - if (!m_proFileWrapper->addInstallsTarget(remoteDir)) + QFile projectFile(m_proFileNode->path()); + if (!projectFile.open(QIODevice::WriteOnly | QIODevice::Append)) { qWarning("Error updating .pro file."); + return false; + } + QString installsString + = QLatin1String("maemo5|maemo6 {\n target.path = ") + + remoteDir + QLatin1String("\n INSTALLS += target\n}\n"); + if (!projectFile.write(installsString.toLocal8Bit())) { + qWarning("Error updating .pro file."); + return false; + } } else { m_deployables.prepend(MaemoDeployable(localExecutableFilePath(), installs.targetPath)); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.h index a7354e0960b9118ea5813cec2c006f7f37e41002..3a994c81f10e7b3c7b01805802d14118186ea19e 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.h @@ -36,8 +36,13 @@ #include <QtCore/QHash> #include <QtCore/QList> #include <QtCore/QScopedPointer> +#include <QtCore/QSharedPointer> #include <QtCore/QString> +QT_BEGIN_NAMESPACE +class ProFileOption; +QT_END_NAMESPACE + namespace Qt4ProjectManager { namespace Internal { class ProFileWrapper; @@ -48,7 +53,7 @@ class MaemoDeployableListModel : public QAbstractTableModel Q_OBJECT public: MaemoDeployableListModel(const Qt4ProFileNode *proFileNode, - const QString &qConfigFile, QObject *parent); + const QSharedPointer<ProFileOption> &proFileOption, QObject *parent); ~MaemoDeployableListModel(); virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.cpp index 9f8d878afef6ef799448ed64c3115cd1a7a5ce67..85b96f6e94e21dbbe837f1f07f02a31666d0e136 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.cpp @@ -42,8 +42,8 @@ #include "maemodeployables.h" #include "maemodeployablelistmodel.h" -#include "maemotoolchain.h" +#include <profileevaluator.h> #include <projectexplorer/buildstep.h> #include <qt4projectmanager/qt4buildconfiguration.h> #include <qt4projectmanager/qt4project.h> @@ -55,13 +55,17 @@ namespace Qt4ProjectManager { namespace Internal { MaemoDeployables::MaemoDeployables(const ProjectExplorer::BuildStep *buildStep) - : m_buildStep(buildStep) + : m_proFileOption(new ProFileOption), m_buildStep(buildStep) { QTimer::singleShot(0, this, SLOT(init())); } +MaemoDeployables::~MaemoDeployables() {} + void MaemoDeployables::init() { + m_proFileOption->properties + = qt4BuildConfiguration()->qtVersion()->versionInfo(); createModels(); connect(qt4BuildConfiguration()->qt4Target()->qt4Project(), SIGNAL(proFileUpdated(Qt4ProjectManager::Internal::Qt4ProFileNode*)), @@ -82,15 +86,10 @@ void MaemoDeployables::createModels(const Qt4ProFileNode *proFileNode) switch (type) { case ApplicationTemplate: case LibraryTemplate: - case ScriptTemplate: { - const MaemoToolChain * const tc - = dynamic_cast<MaemoToolChain *>(qt4BuildConfiguration()->toolChain()); - Q_ASSERT(tc); - const QString qConfigFile = tc->sysrootRoot() - + QLatin1String("/usr/share/qt/mkspecs/qconfig.pri"); - m_listModels << new MaemoDeployableListModel(proFileNode, qConfigFile, this); + case ScriptTemplate: + m_listModels + << new MaemoDeployableListModel(proFileNode, m_proFileOption, this); break; - } case SubDirsTemplate: { const QList<ProjectExplorer::ProjectNode *> &subProjects = proFileNode->subProjectNodes(); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.h index 9e4351f1d0455fc3b8c5cfdf7006219f991d6d40..46540b533a7e3a185740a1f5a16fcd4c02c70382 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.h @@ -46,6 +46,11 @@ #include <QtCore/QList> #include <QtCore/QObject> +#include <QtCore/QSharedPointer> + +QT_BEGIN_NAMESPACE +class ProFileOption; +QT_END_NAMESPACE namespace ProjectExplorer { class BuildStep; } @@ -61,6 +66,7 @@ class MaemoDeployables : public QObject Q_OBJECT public: MaemoDeployables(const ProjectExplorer::BuildStep *buildStep); + ~MaemoDeployables(); void setUnmodified(); bool isModified() const; int deployableCount() const; @@ -79,6 +85,7 @@ private: const Qt4BuildConfiguration *qt4BuildConfiguration() const; QList<MaemoDeployableListModel *> m_listModels; + const QSharedPointer<ProFileOption> m_proFileOption; const ProjectExplorer::BuildStep * const m_buildStep; }; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp index 5ab95cc117b5d1edd97016e16660993d78f85b70..bf6f99da4688424d7f54332cb7e704d16f301f0c 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp @@ -79,7 +79,7 @@ void MaemoSshRunner::start() { m_stop = false; if (m_connection) - disconnect(m_connection.data(), 0, this, 0); + disconnect(m_connection.data(), 0, this, 0); const bool reUse = m_connection && m_connection->state() == SshConnection::Connected && m_connection->connectionParameters() == m_devConfig.server; diff --git a/src/plugins/qt4projectmanager/qt-maemo/profilewrapper.cpp b/src/plugins/qt4projectmanager/qt-maemo/profilewrapper.cpp index 58b5be01ffea13b93f65eb3e41f29d3de1cafac8..c33c4cacc569ee98b2e6ac4ded6306d329938475 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/profilewrapper.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/profilewrapper.cpp @@ -27,11 +27,10 @@ namespace { ProFileWrapper::ProFileWrapper(const QString &proFileName, - const QString &qConfigFile) + const QSharedPointer<ProFileOption> &proFileOption) : m_proFileName(proFileName), m_proDir(QFileInfo(m_proFileName).dir()), - m_proFileOption(new ProFileOption) + m_proFileOption(proFileOption) { - m_proFileOption->cachefile = qConfigFile; parseProFile(ParseFromFile); } @@ -226,6 +225,7 @@ void ProFileWrapper::parseProFile(ParseType type) const { m_proFileReader.reset(new ProFileReader(m_proFileOption.data())); m_proFileReader->setCumulative(false); + // TODO: Set output dir to build dir? if (type == ParseFromLines) { m_proFile = m_proFileReader->parsedProFile(m_proFileName, false, m_proFileContents.join("\n")); diff --git a/src/plugins/qt4projectmanager/qt-maemo/profilewrapper.h b/src/plugins/qt4projectmanager/qt-maemo/profilewrapper.h index d6455d39bf1f4e8302af8fa61a22b2aaedfba5f5..7c65e1050cba6de0fe4593a7e7bf94c3c6fb7839 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/profilewrapper.h +++ b/src/plugins/qt4projectmanager/qt-maemo/profilewrapper.h @@ -3,6 +3,7 @@ #include <QtCore/QDir> #include <QtCore/QScopedPointer> +#include <QtCore/QSharedPointer> #include <QtCore/QString> #include <QtCore/QString> @@ -18,7 +19,8 @@ class ProFileReader; class ProFileWrapper { public: - ProFileWrapper(const QString &proFileName, const QString &qConfigFile); + ProFileWrapper(const QString &proFileName, + const QSharedPointer<ProFileOption> &proFileOption); ~ProFileWrapper(); void reload(); @@ -66,8 +68,8 @@ private: const QString m_proFileName; const QDir m_proDir; + const QSharedPointer<ProFileOption> m_proFileOption; mutable QStringList m_proFileContents; - const QScopedPointer<ProFileOption> m_proFileOption; mutable QScopedPointer<ProFileReader> m_proFileReader; mutable ProFile *m_proFile; };