forked from qt-creator/qt-creator
Maemo: Fix ProFileOption settings, write INSTALLS in maemo scope.
Task-number: QTCREATORBUG-1951 Reviewed-by: kh1
This commit is contained in:
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user