Commit 11d09519 authored by ck's avatar ck
Browse files

Maemo: Fix ProFileOption settings, write INSTALLS in maemo scope.

Task-number: QTCREATORBUG-1951
Reviewed-by: kh1
parent 3bc473c0
......@@ -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));
......
......@@ -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;
......
......@@ -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();
......
......@@ -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;
};
......
......@@ -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;
......
......@@ -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"));
......
......@@ -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;
};
......
Markdown is supported
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