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