Commit 68beb601 authored by ck's avatar ck
Browse files

Maemo: Use qmake configuration from sysroot.

Also allow absolute file paths for deployables.

Reviewed-by: kh1
parent b87f3fbc
......@@ -40,8 +40,11 @@ namespace Qt4ProjectManager {
namespace Internal {
MaemoDeployableListModel::MaemoDeployableListModel(const Qt4ProFileNode *proFileNode,
QObject *parent)
: QAbstractTableModel(parent), m_proFileNode(proFileNode), m_modified(false)
const QString &qConfigFile, QObject *parent)
: QAbstractTableModel(parent),
m_proFileNode(proFileNode),
m_modified(false),
m_proFileWrapper(new ProFileWrapper(m_proFileNode->path(), qConfigFile))
{
buildModel();
}
......@@ -52,7 +55,6 @@ bool MaemoDeployableListModel::buildModel()
{
m_deployables.clear();
m_proFileWrapper.reset(new ProFileWrapper(m_proFileNode->path()));
const ProFileWrapper::InstallsList &installs = m_proFileWrapper->installs();
if (installs.targetPath.isEmpty()) {
const QString remoteDir = m_proFileNode->projectType() == LibraryTemplate
......
......@@ -48,7 +48,7 @@ class MaemoDeployableListModel : public QAbstractTableModel
Q_OBJECT
public:
MaemoDeployableListModel(const Qt4ProFileNode *proFileNode,
QObject *parent);
const QString &qConfigFile, QObject *parent);
~MaemoDeployableListModel();
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
......@@ -78,7 +78,7 @@ private:
const Qt4ProFileNode * const m_proFileNode;
QList<MaemoDeployable> m_deployables;
mutable bool m_modified;
QScopedPointer<ProFileWrapper> m_proFileWrapper;
const QScopedPointer<ProFileWrapper> m_proFileWrapper;
};
} // namespace Qt4ProjectManager
......
......@@ -43,6 +43,7 @@
#include "maemodeployablelistmodel.h"
#include "maemopackagecreationstep.h"
#include "maemotoolchain.h"
#include <qt4projectmanager/qt4buildconfiguration.h>
#include <qt4projectmanager/qt4nodes.h>
......@@ -74,9 +75,12 @@ void MaemoDeployables::createModels(const Qt4ProFileNode *proFileNode)
switch (type) {
case ApplicationTemplate:
case LibraryTemplate:
case ScriptTemplate:
m_listModels << new MaemoDeployableListModel(proFileNode, this);
case ScriptTemplate: {
const QString qConfigFile = m_packagingStep->maemoToolChain()->sysrootRoot()
+ QLatin1String("/usr/share/qt/mkspecs/qconfig.pri");
m_listModels << new MaemoDeployableListModel(proFileNode, qConfigFile, this);
break;
}
case SubDirsTemplate: {
const QList<ProjectExplorer::ProjectNode *> &subProjects
= proFileNode->subProjectNodes();
......
......@@ -71,6 +71,7 @@ public:
QString packageFilePath() const;
MaemoDeployables *deployables() const { return m_deployables; }
const Qt4BuildConfiguration *qt4BuildConfiguration() const;
const MaemoToolChain *maemoToolChain() const;
bool isPackagingEnabled() const { return m_packagingEnabled; }
void setPackagingEnabled(bool enabled) { m_packagingEnabled = enabled; }
......@@ -94,7 +95,6 @@ private:
bool createPackage();
bool runCommand(const QString &command);
const MaemoToolChain *maemoToolChain() const;
QString maddeRoot() const;
QString targetRoot() const;
QString nativePath(const QFile &file) const;
......
......@@ -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_proFileOption(new ProFileOption)
{
m_proFileOption->cachefile = qConfigFile;
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
// enough for redundant ".." dirs.
return QFileInfo(m_proFile->directoryName() + '/' + relFilePath)
QFileInfo fi(relFilePath);
return fi.isAbsolute() ? fi.canonicalFilePath()
: QFileInfo(m_proFile->directoryName() + '/' + relFilePath)
.canonicalFilePath();
}
......
......@@ -18,7 +18,7 @@ class ProFileReader;
class ProFileWrapper
{
public:
ProFileWrapper(const QString &proFileName);
ProFileWrapper(const QString &proFileName, const QString &qConfigFile);
~ProFileWrapper();
struct InstallsElem {
......@@ -65,7 +65,7 @@ private:
const QString m_proFileName;
const QDir m_proDir;
mutable QStringList m_proFileContents;
QScopedPointer<ProFileOption> m_proFileOption;
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