Maemo: Use qmake configuration from sysroot.

Also allow absolute file paths for deployables.

Reviewed-by: kh1
This commit is contained in:
ck
2010-07-07 16:49:39 +02:00
parent b87f3fbcc8
commit 68beb601f3
6 changed files with 22 additions and 12 deletions

View File

@@ -40,8 +40,11 @@ namespace Qt4ProjectManager {
namespace Internal { namespace Internal {
MaemoDeployableListModel::MaemoDeployableListModel(const Qt4ProFileNode *proFileNode, MaemoDeployableListModel::MaemoDeployableListModel(const Qt4ProFileNode *proFileNode,
QObject *parent) const QString &qConfigFile, QObject *parent)
: QAbstractTableModel(parent), m_proFileNode(proFileNode), m_modified(false) : QAbstractTableModel(parent),
m_proFileNode(proFileNode),
m_modified(false),
m_proFileWrapper(new ProFileWrapper(m_proFileNode->path(), qConfigFile))
{ {
buildModel(); buildModel();
} }
@@ -52,7 +55,6 @@ bool MaemoDeployableListModel::buildModel()
{ {
m_deployables.clear(); m_deployables.clear();
m_proFileWrapper.reset(new ProFileWrapper(m_proFileNode->path()));
const ProFileWrapper::InstallsList &installs = m_proFileWrapper->installs(); const ProFileWrapper::InstallsList &installs = m_proFileWrapper->installs();
if (installs.targetPath.isEmpty()) { if (installs.targetPath.isEmpty()) {
const QString remoteDir = m_proFileNode->projectType() == LibraryTemplate const QString remoteDir = m_proFileNode->projectType() == LibraryTemplate

View File

@@ -48,7 +48,7 @@ class MaemoDeployableListModel : public QAbstractTableModel
Q_OBJECT Q_OBJECT
public: public:
MaemoDeployableListModel(const Qt4ProFileNode *proFileNode, MaemoDeployableListModel(const Qt4ProFileNode *proFileNode,
QObject *parent); const QString &qConfigFile, QObject *parent);
~MaemoDeployableListModel(); ~MaemoDeployableListModel();
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
@@ -78,7 +78,7 @@ private:
const Qt4ProFileNode * const m_proFileNode; const Qt4ProFileNode * const m_proFileNode;
QList<MaemoDeployable> m_deployables; QList<MaemoDeployable> m_deployables;
mutable bool m_modified; mutable bool m_modified;
QScopedPointer<ProFileWrapper> m_proFileWrapper; const QScopedPointer<ProFileWrapper> m_proFileWrapper;
}; };
} // namespace Qt4ProjectManager } // namespace Qt4ProjectManager

View File

@@ -43,6 +43,7 @@
#include "maemodeployablelistmodel.h" #include "maemodeployablelistmodel.h"
#include "maemopackagecreationstep.h" #include "maemopackagecreationstep.h"
#include "maemotoolchain.h"
#include <qt4projectmanager/qt4buildconfiguration.h> #include <qt4projectmanager/qt4buildconfiguration.h>
#include <qt4projectmanager/qt4nodes.h> #include <qt4projectmanager/qt4nodes.h>
@@ -74,9 +75,12 @@ void MaemoDeployables::createModels(const Qt4ProFileNode *proFileNode)
switch (type) { switch (type) {
case ApplicationTemplate: case ApplicationTemplate:
case LibraryTemplate: case LibraryTemplate:
case ScriptTemplate: case ScriptTemplate: {
m_listModels << new MaemoDeployableListModel(proFileNode, this); const QString qConfigFile = m_packagingStep->maemoToolChain()->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();

View File

@@ -71,6 +71,7 @@ public:
QString packageFilePath() const; QString packageFilePath() const;
MaemoDeployables *deployables() const { return m_deployables; } MaemoDeployables *deployables() const { return m_deployables; }
const Qt4BuildConfiguration *qt4BuildConfiguration() const; const Qt4BuildConfiguration *qt4BuildConfiguration() const;
const MaemoToolChain *maemoToolChain() const;
bool isPackagingEnabled() const { return m_packagingEnabled; } bool isPackagingEnabled() const { return m_packagingEnabled; }
void setPackagingEnabled(bool enabled) { m_packagingEnabled = enabled; } void setPackagingEnabled(bool enabled) { m_packagingEnabled = enabled; }
@@ -94,7 +95,6 @@ private:
bool createPackage(); bool createPackage();
bool runCommand(const QString &command); bool runCommand(const QString &command);
const MaemoToolChain *maemoToolChain() const;
QString maddeRoot() const; QString maddeRoot() const;
QString targetRoot() const; QString targetRoot() const;
QString nativePath(const QFile &file) const; QString nativePath(const QFile &file) const;

View File

@@ -26,10 +26,12 @@ namespace {
} }
ProFileWrapper::ProFileWrapper(const QString &proFileName) ProFileWrapper::ProFileWrapper(const QString &proFileName,
const QString &qConfigFile)
: m_proFileName(proFileName), m_proDir(QFileInfo(m_proFileName).dir()), : m_proFileName(proFileName), m_proDir(QFileInfo(m_proFileName).dir()),
m_proFileOption(new ProFileOption) m_proFileOption(new ProFileOption)
{ {
m_proFileOption->cachefile = qConfigFile;
parseProFile(ParseFromFile); parseProFile(ParseFromFile);
} }
@@ -210,7 +212,9 @@ QString ProFileWrapper::absFilePath(const QString &relFilePath) const
{ {
// I'd rather use QDir::cleanPath(), but that doesn't work well // I'd rather use QDir::cleanPath(), but that doesn't work well
// enough for redundant ".." dirs. // enough for redundant ".." dirs.
return QFileInfo(m_proFile->directoryName() + '/' + relFilePath) QFileInfo fi(relFilePath);
return fi.isAbsolute() ? fi.canonicalFilePath()
: QFileInfo(m_proFile->directoryName() + '/' + relFilePath)
.canonicalFilePath(); .canonicalFilePath();
} }

View File

@@ -18,7 +18,7 @@ class ProFileReader;
class ProFileWrapper class ProFileWrapper
{ {
public: public:
ProFileWrapper(const QString &proFileName); ProFileWrapper(const QString &proFileName, const QString &qConfigFile);
~ProFileWrapper(); ~ProFileWrapper();
struct InstallsElem { struct InstallsElem {
@@ -65,7 +65,7 @@ private:
const QString m_proFileName; const QString m_proFileName;
const QDir m_proDir; const QDir m_proDir;
mutable QStringList m_proFileContents; mutable QStringList m_proFileContents;
QScopedPointer<ProFileOption> m_proFileOption; const QScopedPointer<ProFileOption> m_proFileOption;
mutable QScopedPointer<ProFileReader> m_proFileReader; mutable QScopedPointer<ProFileReader> m_proFileReader;
mutable ProFile *m_proFile; mutable ProFile *m_proFile;
}; };