diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp index 668f96ffc5a..8af100e278d 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp @@ -31,8 +31,6 @@ #include "maemoprofilewrapper.h" -#include - #include #include #include @@ -44,11 +42,15 @@ MaemoDeployableListModel::MaemoDeployableListModel(const Qt4ProFileNode *proFile const QSharedPointer &proFileOption, ProFileUpdateSetting updateSetting, QObject *parent) : QAbstractTableModel(parent), - m_proFileNode(proFileNode), + m_projectType(proFileNode->projectType()), + m_proFilePath(proFileNode->path()), + m_projectName(proFileNode->displayName()), + m_targetInfo(proFileNode->targetInformation()), m_modified(false), - m_proFileWrapper(new MaemoProFileWrapper(m_proFileNode->path(), - m_proFileNode->buildDir(), proFileOption)), - m_proFileUpdateSetting(updateSetting), m_hasTargetPath(false) + m_proFileWrapper(new MaemoProFileWrapper(m_proFilePath, + proFileNode->buildDir(), proFileOption)), + m_proFileUpdateSetting(updateSetting), + m_hasTargetPath(false) { buildModel(); } @@ -63,7 +65,7 @@ bool MaemoDeployableListModel::buildModel() m_hasTargetPath = !installs.targetPath.isEmpty(); if (!m_hasTargetPath && m_proFileUpdateSetting == UpdateProFile) { const QString remoteDirSuffix - = QLatin1String(m_proFileNode->projectType() == LibraryTemplate + = QLatin1String(m_projectType == LibraryTemplate ? "/lib" : "/bin"); const QString remoteDirMaemo5 = QLatin1String("/opt/usr") + remoteDirSuffix; @@ -71,7 +73,7 @@ bool MaemoDeployableListModel::buildModel() = QLatin1String("/usr/local") + remoteDirSuffix; m_deployables.prepend(MaemoDeployable(localExecutableFilePath(), remoteDirMaemo5)); - QFile projectFile(m_proFileNode->path()); + QFile projectFile(m_proFilePath); if (!projectFile.open(QIODevice::WriteOnly | QIODevice::Append)) { qWarning("Error updating .pro file."); return false; @@ -203,11 +205,10 @@ QVariant MaemoDeployableListModel::headerData(int section, QString MaemoDeployableListModel::localExecutableFilePath() const { - const TargetInformation &ti = m_proFileNode->targetInformation(); - if (!ti.valid) + if (!m_targetInfo.valid) return QString(); - const bool isLib = m_proFileNode->projectType() == LibraryTemplate; + const bool isLib = m_projectType == LibraryTemplate; bool isStatic = false; // Nonsense init for stupid compilers. QString fileName; if (isLib) { @@ -218,10 +219,10 @@ QString MaemoDeployableListModel::localExecutableFilePath() const || config.contains(QLatin1String("staticlib")) || config.contains(QLatin1String("plugin")); } - fileName += ti.target; + fileName += m_targetInfo.target; if (isLib) fileName += QLatin1String(isStatic ? ".a" : ".so"); - return QDir::cleanPath(ti.workingDir + '/' + fileName); + return QDir::cleanPath(m_targetInfo.workingDir + '/' + fileName); } QString MaemoDeployableListModel::remoteExecutableFilePath() const @@ -232,14 +233,9 @@ QString MaemoDeployableListModel::remoteExecutableFilePath() const : QString(); } -QString MaemoDeployableListModel::projectName() const -{ - return m_proFileNode->displayName(); -} - QString MaemoDeployableListModel::projectDir() const { - return QFileInfo(m_proFileNode->path()).dir().path(); + return QFileInfo(m_proFilePath).dir().path(); } void MaemoDeployableListModel::setProFileUpdateSetting(ProFileUpdateSetting updateSetting) diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.h index 1da79c411f3..9d9022e0afa 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.h @@ -32,6 +32,8 @@ #include "maemodeployable.h" +#include + #include #include #include @@ -46,7 +48,6 @@ QT_END_NAMESPACE namespace Qt4ProjectManager { namespace Internal { class MaemoProFileWrapper; -class Qt4ProFileNode; class MaemoDeployableListModel : public QAbstractTableModel { @@ -70,9 +71,9 @@ public: void setUnModified() { m_modified = false; } QString localExecutableFilePath() const; QString remoteExecutableFilePath() const; - QString projectName() const; + QString projectName() const { return m_projectName; } QString projectDir() const; - const Qt4ProFileNode *proFileNode() const { return m_proFileNode; } + QString proFilePath() const { return m_proFilePath; } bool hasTargetPath() const { return m_hasTargetPath; } ProFileUpdateSetting proFileUpdateSetting() const { return m_proFileUpdateSetting; @@ -91,7 +92,10 @@ private: bool buildModel(); - const Qt4ProFileNode * const m_proFileNode; + const Qt4ProjectType m_projectType; + const QString m_proFilePath; + const QString m_projectName; + const TargetInformation m_targetInfo; QList m_deployables; mutable bool m_modified; const QScopedPointer m_proFileWrapper; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.cpp index 7549386d705..e297450cf9f 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.cpp @@ -112,7 +112,7 @@ void MaemoDeployables::createModels() = setting.second ? MaemoDeployableListModel::UpdateProFile : MaemoDeployableListModel::DontUpdateProFile; - m_updateSettings.insert(setting.first->proFileNode()->path(), + m_updateSettings.insert(setting.first->proFilePath(), updateSetting); setting.first->setProFileUpdateSetting(updateSetting); } diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoprofilesupdatedialog.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoprofilesupdatedialog.cpp index 1aba79772a3..fe1022ac096 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoprofilesupdatedialog.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoprofilesupdatedialog.cpp @@ -50,7 +50,7 @@ MaemoProFilesUpdateDialog::MaemoProFilesUpdateDialog(const QListproFileNode()->path()); + = new QTableWidgetItem(models.at(row)->proFilePath()); item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); item->setCheckState(Qt::Unchecked); ui->tableWidget->setItem(row, 0, item); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.cpp index f5e809a6eeb..2c33f674264 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemotemplatesmanager.cpp @@ -327,7 +327,7 @@ bool MaemoTemplatesManager::updateDesktopFile(const Qt4Target *target, ->deployables(); for (int i = 0; i < deployables->modelCount(); ++i) { const MaemoDeployableListModel * const model = deployables->modelAt(i); - if (model->proFileNode() == proFileNode) { + if (model->proFilePath() == proFileNode->path()) { executable = model->remoteExecutableFilePath(); break; }