diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployable.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeployable.h new file mode 100644 index 0000000000000000000000000000000000000000..b9324a5aea0d45d7930a6fcfc2e0d5868d54f7da --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeployable.h @@ -0,0 +1,62 @@ +/************************************************************************** +** +** This file is part of Qt Creator +** +** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +** +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** Commercial Usage +** +** Licensees holding valid Qt Commercial licenses may use this file in +** accordance with the Qt Commercial License Agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Nokia. +** +** GNU Lesser General Public License Usage +** +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at http://qt.nokia.com/contact. +** +**************************************************************************/ + +#ifndef MAEMODEPLOYABLE_H +#define MAEMODEPLOYABLE_H + +#include <QtCore/QHash> +#include <QtCore/QString> + +namespace Qt4ProjectManager { +namespace Internal { + +struct MaemoDeployable +{ + MaemoDeployable(const QString &localFilePath, const QString &remoteDir) + : localFilePath(localFilePath), remoteDir(remoteDir) {} + + bool operator==(const MaemoDeployable &other) const + { + return localFilePath == other.localFilePath + && remoteDir == other.remoteDir; + } + + QString localFilePath; + QString remoteDir; +}; + +inline uint qHash(const MaemoDeployable &d) +{ + return qHash(qMakePair(d.localFilePath, d.remoteDir)); +} + +} // namespace Qt4ProjectManager +} // namespace Internal + +#endif // MAEMODEPLOYABLE_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecontents.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp similarity index 67% rename from src/plugins/qt4projectmanager/qt-maemo/maemopackagecontents.cpp rename to src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp index 920a3408e9d511726a1d445c1a93ccf158c0f932..a8a26ae248bf484e3c1ed664aa56dea333de5390 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecontents.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.cpp @@ -27,7 +27,7 @@ ** **************************************************************************/ -#include "maemopackagecontents.h" +#include "maemodeployablelistmodel.h" #include "maemopackagecreationstep.h" #include "maemotoolchain.h" @@ -44,7 +44,7 @@ namespace Qt4ProjectManager { namespace Internal { -MaemoPackageContents::MaemoPackageContents(MaemoPackageCreationStep *packageStep) +MaemoDeployableListModel::MaemoDeployableListModel(MaemoPackageCreationStep *packageStep) : QAbstractTableModel(packageStep), m_packageStep(packageStep), m_modified(false), @@ -52,17 +52,23 @@ MaemoPackageContents::MaemoPackageContents(MaemoPackageCreationStep *packageStep { } -MaemoPackageContents::~MaemoPackageContents() {} +MaemoDeployableListModel::~MaemoDeployableListModel() {} -bool MaemoPackageContents::buildModel() const +bool MaemoDeployableListModel::buildModel() const { if (m_initialized) return true; m_deployables.clear(); - QSharedPointer<ProFileWrapper> proFileWrapper - = m_packageStep->proFileWrapper(); - const ProFileWrapper::InstallsList &installs = proFileWrapper->installs(); + + // TODO: The pro file path comes from the outside. + if (!m_proFileWrapper) { + const Qt4ProFileNode * const proFileNode = m_packageStep + ->qt4BuildConfiguration()->qt4Target()->qt4Project() + ->rootProjectNode(); + m_proFileWrapper.reset(new ProFileWrapper(proFileNode->path())); + } + const ProFileWrapper::InstallsList &installs = m_proFileWrapper->installs(); if (installs.targetPath.isEmpty()) { const Qt4ProFileNode * const proFileNode = m_packageStep->qt4BuildConfiguration()->qt4Target() @@ -70,19 +76,19 @@ bool MaemoPackageContents::buildModel() const const QString remoteDir = proFileNode->projectType() == LibraryTemplate ? QLatin1String("/usr/local/lib") : QLatin1String("/usr/local/bin"); - m_deployables.prepend(MaemoDeployable(m_packageStep->localExecutableFilePath(), + m_deployables.prepend(MaemoDeployable(localExecutableFilePath(), remoteDir)); - if (!proFileWrapper->addInstallsTarget(remoteDir)) { + if (!m_proFileWrapper->addInstallsTarget(remoteDir)) { qWarning("Error updating .pro file."); return false; } } else { - m_deployables.prepend(MaemoDeployable(m_packageStep->localExecutableFilePath(), + m_deployables.prepend(MaemoDeployable(localExecutableFilePath(), installs.targetPath)); } foreach (const ProFileWrapper::InstallsElem &elem, installs.normalElems) { foreach (const QString &file, elem.files) { - m_deployables << MaemoDeployable(proFileWrapper->absFilePath(file), + m_deployables << MaemoDeployable(m_proFileWrapper->absFilePath(file), elem.path); } } @@ -92,13 +98,13 @@ bool MaemoPackageContents::buildModel() const return true; } -MaemoDeployable MaemoPackageContents::deployableAt(int row) const +MaemoDeployable MaemoDeployableListModel::deployableAt(int row) const { Q_ASSERT(row >= 0 && row < rowCount()); return m_deployables.at(row); } -bool MaemoPackageContents::addDeployable(const MaemoDeployable &deployable, +bool MaemoDeployableListModel::addDeployable(const MaemoDeployable &deployable, QString *error) { if (m_deployables.contains(deployable)) { @@ -106,7 +112,7 @@ bool MaemoPackageContents::addDeployable(const MaemoDeployable &deployable, return false; } - if (!m_packageStep->proFileWrapper()->addInstallsElem(deployable.remoteDir, + if (!m_proFileWrapper->addInstallsElem(deployable.remoteDir, deployable.localFilePath)) { *error = tr("Failed to update .pro file."); return false; @@ -118,13 +124,13 @@ bool MaemoPackageContents::addDeployable(const MaemoDeployable &deployable, return true; } -bool MaemoPackageContents::removeDeployableAt(int row, QString *error) +bool MaemoDeployableListModel::removeDeployableAt(int row, QString *error) { Q_ASSERT(row > 0 && row < rowCount()); const MaemoDeployable &deployable = deployableAt(row); - if (!m_packageStep->proFileWrapper() - ->removeInstallsElem(deployable.remoteDir, deployable.localFilePath)) { + if (!m_proFileWrapper->removeInstallsElem(deployable.remoteDir, + deployable.localFilePath)) { *error = tr("Could not update .pro file."); return false; } @@ -135,18 +141,18 @@ bool MaemoPackageContents::removeDeployableAt(int row, QString *error) return true; } -int MaemoPackageContents::rowCount(const QModelIndex &parent) const +int MaemoDeployableListModel::rowCount(const QModelIndex &parent) const { buildModel(); return parent.isValid() ? 0 : m_deployables.count(); } -int MaemoPackageContents::columnCount(const QModelIndex &parent) const +int MaemoDeployableListModel::columnCount(const QModelIndex &parent) const { return parent.isValid() ? 0 : 2; } -QVariant MaemoPackageContents::data(const QModelIndex &index, int role) const +QVariant MaemoDeployableListModel::data(const QModelIndex &index, int role) const { if (!index.isValid() || index.row() >= rowCount()) return QVariant(); @@ -159,7 +165,7 @@ QVariant MaemoPackageContents::data(const QModelIndex &index, int role) const return QVariant(); } -Qt::ItemFlags MaemoPackageContents::flags(const QModelIndex &index) const +Qt::ItemFlags MaemoDeployableListModel::flags(const QModelIndex &index) const { Qt::ItemFlags parentFlags = QAbstractTableModel::flags(index); if (index.column() == 1) @@ -167,7 +173,7 @@ Qt::ItemFlags MaemoPackageContents::flags(const QModelIndex &index) const return parentFlags; } -bool MaemoPackageContents::setData(const QModelIndex &index, +bool MaemoDeployableListModel::setData(const QModelIndex &index, const QVariant &value, int role) { if (!index.isValid() || index.row() >= rowCount() || index.column() != 1 @@ -176,7 +182,7 @@ bool MaemoPackageContents::setData(const QModelIndex &index, MaemoDeployable &deployable = m_deployables[index.row()]; const QString &newRemoteDir = value.toString(); - if (!m_packageStep->proFileWrapper()->replaceInstallPath(deployable.remoteDir, + if (!m_proFileWrapper->replaceInstallPath(deployable.remoteDir, deployable.localFilePath, newRemoteDir)) { qWarning("Error: Could not update .pro file"); return false; @@ -187,7 +193,7 @@ bool MaemoPackageContents::setData(const QModelIndex &index, return true; } -QVariant MaemoPackageContents::headerData(int section, +QVariant MaemoDeployableListModel::headerData(int section, Qt::Orientation orientation, int role) const { if (orientation == Qt::Vertical || role != Qt::DisplayRole) @@ -195,11 +201,29 @@ QVariant MaemoPackageContents::headerData(int section, return section == 0 ? tr("Local File Path") : tr("Remote Directory"); } -QString MaemoPackageContents::remoteExecutableFilePath() const +QString MaemoDeployableListModel::localExecutableFilePath() const +{ + // TODO: This information belongs to this class. + return m_packageStep->localExecutableFilePath(); +} + +QString MaemoDeployableListModel::remoteExecutableFilePath() const { return buildModel() ? deployableAt(0).remoteDir + '/' + m_packageStep->executableFileName() : QString(); } +QString MaemoDeployableListModel::projectName() const +{ + // TODO: This must return our own sub project name. + return m_packageStep->qt4BuildConfiguration()->qt4Target()->qt4Project() + ->rootProjectNode()->displayName(); +} + +QString MaemoDeployableListModel::projectDir() const +{ + return m_proFileWrapper->projectDir(); +} + } // namespace Qt4ProjectManager } // namespace Internal diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecontents.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.h similarity index 80% rename from src/plugins/qt4projectmanager/qt-maemo/maemopackagecontents.h rename to src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.h index c74f4c1fd841c3104a99399935f603206db09173..c441e92a4f253d084a435879b083ea6324cad08d 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecontents.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistmodel.h @@ -30,42 +30,25 @@ #ifndef MAEMOPACKAGECONTENTS_H #define MAEMOPACKAGECONTENTS_H +#include "maemodeployable.h" + #include <QtCore/QAbstractTableModel> #include <QtCore/QHash> #include <QtCore/QList> +#include <QtCore/QScopedPointer> #include <QtCore/QString> namespace Qt4ProjectManager { namespace Internal { - -struct MaemoDeployable -{ - MaemoDeployable(const QString &localFilePath, const QString &remoteDir) - : localFilePath(localFilePath), remoteDir(remoteDir) {} - - bool operator==(const MaemoDeployable &other) const - { - return localFilePath == other.localFilePath - && remoteDir == other.remoteDir; - } - - QString localFilePath; - QString remoteDir; -}; -inline uint qHash(const MaemoDeployable &d) -{ - return qHash(qMakePair(d.localFilePath, d.remoteDir)); -} - class MaemoPackageCreationStep; -class ProFileReader; +class ProFileWrapper; -class MaemoPackageContents : public QAbstractTableModel +class MaemoDeployableListModel : public QAbstractTableModel { Q_OBJECT public: - MaemoPackageContents(MaemoPackageCreationStep *packageStep); - ~MaemoPackageContents(); + MaemoDeployableListModel(MaemoPackageCreationStep *packageStep); + ~MaemoDeployableListModel(); virtual int rowCount(const QModelIndex &parent = QModelIndex()) const; @@ -74,7 +57,10 @@ public: bool removeDeployableAt(int row, QString *error); bool isModified() const { return m_modified; } void setUnModified() { m_modified = false; } + QString localExecutableFilePath() const; QString remoteExecutableFilePath() const; + QString projectName() const; + QString projectDir() const; private: virtual int columnCount(const QModelIndex &parent = QModelIndex()) const; @@ -92,6 +78,7 @@ private: mutable QList<MaemoDeployable> m_deployables; mutable bool m_modified; mutable bool m_initialized; + mutable QScopedPointer<ProFileWrapper> m_proFileWrapper; }; } // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistwidget.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistwidget.cpp new file mode 100644 index 0000000000000000000000000000000000000000..772322774413445915c91da98a57fc52e8eec8be --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistwidget.cpp @@ -0,0 +1,129 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of Qt Creator. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "maemodeployablelistwidget.h" +#include "ui_maemodeployablelistwidget.h" + +#include "maemodeployablelistmodel.h" + +#include <utils/qtcassert.h> + +#include <QtCore/QDir> +#include <QtCore/QFile> +#include <QtCore/QFileInfo> +#include <QtGui/QFileDialog> +#include <QtGui/QMessageBox> + +namespace Qt4ProjectManager { +namespace Internal { + +MaemoDeployableListWidget::MaemoDeployableListWidget(QWidget *parent, + MaemoDeployableListModel *model) + : QWidget(parent), m_ui(new Ui::MaemoDeployableListWidget), m_model(model) +{ + m_ui->setupUi(this); + m_ui->deployablesView->setWordWrap(false); + m_ui->deployablesView->setModel(m_model); + connect(m_model, SIGNAL(dataChanged(QModelIndex,QModelIndex)), + m_ui->deployablesView, SLOT(resizeColumnsToContents())); + connect(m_model, SIGNAL(rowsInserted(QModelIndex, int, int)), + m_ui->deployablesView, SLOT(resizeColumnsToContents())); + connect(m_ui->deployablesView->selectionModel(), + SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, + SLOT(enableOrDisableRemoveButton())); + m_ui->deployablesView->resizeColumnsToContents(); + m_ui->deployablesView->horizontalHeader()->setStretchLastSection(true); + enableOrDisableRemoveButton(); +} + +MaemoDeployableListWidget::~MaemoDeployableListWidget() +{ + delete m_ui; +} + +void MaemoDeployableListWidget::addFile() +{ + // TODO: Make all this stuff subproject-specific. + const QString title = tr("Choose a local file"); + const QString localFile = QFileDialog::getOpenFileName(this, title, m_model->projectDir()); // TODO: Support directories. + if (localFile.isEmpty()) + return; + const MaemoDeployable + deployable(QDir::toNativeSeparators(QFileInfo(localFile).absoluteFilePath()), + "/"); + QString errorString; + if (!m_model->addDeployable(deployable, &errorString)) { + QMessageBox::information(this, tr("Error adding file"), errorString); + } else { + const QModelIndex newIndex + = m_model->index(m_model->rowCount() - 1, 1); + m_ui->deployablesView->selectionModel()->clear(); + m_ui->deployablesView->scrollTo(newIndex); + m_ui->deployablesView->edit(newIndex); + } +} + +void MaemoDeployableListWidget::removeFile() +{ + const QModelIndexList selectedRows + = m_ui->deployablesView->selectionModel()->selectedRows(); + if (selectedRows.isEmpty()) + return; + const int row = selectedRows.first().row(); + if (row != 0) { + QString errorString; + if (!m_model->removeDeployableAt(row, &errorString)) { + QMessageBox::information(this, tr("Error removing file"), + errorString); + } + } +} + +void MaemoDeployableListWidget::enableOrDisableRemoveButton() +{ + const QModelIndexList selectedRows + = m_ui->deployablesView->selectionModel()->selectedRows(); + m_ui->removeFileButton->setEnabled(!selectedRows.isEmpty() + && selectedRows.first().row() != 0); +} + +} // namespace Internal +} // namespace Qt4ProjectManager diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistwidget.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistwidget.h new file mode 100644 index 0000000000000000000000000000000000000000..fcbf75249e5a3803a09c5f4cd4a1d75a999a53d9 --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistwidget.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of Qt Creator. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MAEMODEPLOYABLELISTWIDGET_H +#define MAEMODEPLOYABLELISTWIDGET_H + +#include <QtGui/QWidget> + +QT_BEGIN_NAMESPACE +namespace Ui { + class MaemoDeployableListWidget; +} +QT_END_NAMESPACE + +namespace Qt4ProjectManager { +namespace Internal { +class MaemoDeployableListModel; + +class MaemoDeployableListWidget : public QWidget +{ + Q_OBJECT + +public: + MaemoDeployableListWidget(QWidget *parent, MaemoDeployableListModel *model); + ~MaemoDeployableListWidget(); + +private slots: + void addFile(); + void removeFile(); + void enableOrDisableRemoveButton(); + +private: + Ui::MaemoDeployableListWidget *m_ui; + MaemoDeployableListModel * const m_model; +}; + +} // namespace Internal +} // namespace Qt4ProjectManager + +#endif // MAEMODEPLOYABLELISTWIDGET_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistwidget.ui b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistwidget.ui new file mode 100644 index 0000000000000000000000000000000000000000..412b53bd8a5fd2c0ff9c6cf28e87e883e8ed66dd --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeployablelistwidget.ui @@ -0,0 +1,139 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>MaemoDeployableListWidget</class> + <widget class="QWidget" name="MaemoDeployableListWidget"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>491</width> + <height>289</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QTableView" name="deployablesView"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> + <horstretch>1</horstretch> + <verstretch>1</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>400</width> + <height>200</height> + </size> + </property> + <property name="selectionMode"> + <enum>QAbstractItemView::SingleSelection</enum> + </property> + <property name="selectionBehavior"> + <enum>QAbstractItemView::SelectRows</enum> + </property> + <property name="showGrid"> + <bool>false</bool> + </property> + <attribute name="horizontalHeaderVisible"> + <bool>true</bool> + </attribute> + <attribute name="horizontalHeaderCascadingSectionResizes"> + <bool>false</bool> + </attribute> + <attribute name="verticalHeaderVisible"> + <bool>false</bool> + </attribute> + </widget> + </item> + <item> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <widget class="QToolButton" name="addFileButton"> + <property name="toolTip"> + <string>Add File to Package</string> + </property> + <property name="text"> + <string/> + </property> + <property name="icon"> + <iconset resource="../../coreplugin/core.qrc"> + <normaloff>:/core/images/plus.png</normaloff>:/core/images/plus.png</iconset> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="removeFileButton"> + <property name="toolTip"> + <string>Remove File from Package</string> + </property> + <property name="text"> + <string/> + </property> + <property name="icon"> + <iconset resource="../../coreplugin/core.qrc"> + <normaloff>:/core/images/minus.png</normaloff>:/core/images/minus.png</iconset> + </property> + </widget> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + <resources> + <include location="../../coreplugin/core.qrc"/> + </resources> + <connections> + <connection> + <sender>addFileButton</sender> + <signal>clicked()</signal> + <receiver>MaemoDeployableListWidget</receiver> + <slot>addFile()</slot> + <hints> + <hint type="sourcelabel"> + <x>475</x> + <y>32</y> + </hint> + <hint type="destinationlabel"> + <x>488</x> + <y>242</y> + </hint> + </hints> + </connection> + <connection> + <sender>removeFileButton</sender> + <signal>clicked()</signal> + <receiver>MaemoDeployableListWidget</receiver> + <slot>removeFile()</slot> + <hints> + <hint type="sourcelabel"> + <x>456</x> + <y>66</y> + </hint> + <hint type="destinationlabel"> + <x>490</x> + <y>182</y> + </hint> + </hints> + </connection> + </connections> + <slots> + <slot>addFile()</slot> + <slot>removeFile()</slot> + </slots> +</ui> diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c670c1bb13182387a7c1b75bda2b6656381bbf68 --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.cpp @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of Qt Creator. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "maemodeployables.h" + +#include "maemodeployablelistmodel.h" + +namespace Qt4ProjectManager { +namespace Internal { + +MaemoDeployables::MaemoDeployables(MaemoPackageCreationStep *packagingStep) +{ + // TODO: Enumerate sub projects and create one list model for each app or lib template. + // Their constructurs will then take this object as parent and the + // project node + m_listModels << new MaemoDeployableListModel(packagingStep); +} + +void MaemoDeployables::setUnmodified() +{ + foreach (MaemoDeployableListModel *model, m_listModels) + model->setUnModified(); +} + +bool MaemoDeployables::isModified() const +{ + foreach (const MaemoDeployableListModel *model, m_listModels) { + if (model->isModified()) + return true; + } + return false; +} + +int MaemoDeployables::deployableCount() const +{ + int count = 0; + foreach (const MaemoDeployableListModel *model, m_listModels) + count += model->rowCount(); + return count; +} + +MaemoDeployable MaemoDeployables::deployableAt(int i) const +{ + foreach (const MaemoDeployableListModel *model, m_listModels) { + Q_ASSERT(i >= 0); + if (i < model->rowCount()) + return model->deployableAt(i); + i -= model->rowCount(); + } + + Q_ASSERT(!"Invalid deployable number"); + return MaemoDeployable(QString(), QString()); +} + +QString MaemoDeployables::remoteExecutableFilePath(const QString &localExecutableFilePath) const +{ + foreach (const MaemoDeployableListModel *model, m_listModels) { + if (model->localExecutableFilePath() == localExecutableFilePath) + return model->remoteExecutableFilePath(); + } + Q_ASSERT(!"Invalid local executable!"); + return QString(); +} + +} // namespace Qt4ProjectManager +} // namespace Internal diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.h b/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.h new file mode 100644 index 0000000000000000000000000000000000000000..bc0dc2fe63cd9ee3c4188eb7c8bfc1041a8a0c74 --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-maemo/maemodeployables.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of Qt Creator. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MAEMODEPLOYABLES_H +#define MAEMODEPLOYABLES_H + +#include "maemodeployable.h" + +#include <QtCore/QList> +#include <QtCore/QObject> + +namespace Qt4ProjectManager { +namespace Internal { +class MaemoDeployableListModel; +class MaemoPackageCreationStep; + +class MaemoDeployables : public QObject +{ + Q_OBJECT +public: + MaemoDeployables(MaemoPackageCreationStep *packagingStep); + void setUnmodified(); + bool isModified() const; + int deployableCount() const; + MaemoDeployable deployableAt(int i) const; + QString remoteExecutableFilePath(const QString &localExecutableFilePath) const; + int modelCount() const { return m_listModels.count(); } + MaemoDeployableListModel *modelAt(int i) const { return m_listModels.at(i); } + +private: + QList<MaemoDeployableListModel *> m_listModels; +}; + +} // namespace Qt4ProjectManager +} // namespace Internal + +#endif // MAEMODEPLOYABLES_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp index 69f73c877eb149a3dc98e9387446c0735844ce88..afb4ecf4a48891c2eccbee1ba77dec9149cec536 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.cpp @@ -43,7 +43,7 @@ #include "maemoconstants.h" #include "maemopackagecreationwidget.h" -#include "maemopackagecontents.h" +#include "maemodeployables.h" #include "maemotoolchain.h" #include "profilewrapper.h" @@ -52,9 +52,6 @@ #include <qt4project.h> #include <qt4target.h> -#include <QtCore/QDir> -#include <QtCore/QFile> -#include <QtCore/QFileInfo> #include <QtCore/QProcess> #include <QtCore/QProcessEnvironment> #include <QtCore/QStringBuilder> @@ -76,7 +73,7 @@ namespace Internal { MaemoPackageCreationStep::MaemoPackageCreationStep(BuildConfiguration *buildConfig) : ProjectExplorer::BuildStep(buildConfig, CreatePackageId), - m_packageContents(new MaemoPackageContents(this)), + m_deployables(new MaemoDeployables(this)), m_packagingEnabled(true), m_versionString(DefaultVersionNumber) { @@ -85,13 +82,16 @@ MaemoPackageCreationStep::MaemoPackageCreationStep(BuildConfiguration *buildConf MaemoPackageCreationStep::MaemoPackageCreationStep(BuildConfiguration *buildConfig, MaemoPackageCreationStep *other) : BuildStep(buildConfig, other), - m_packageContents(new MaemoPackageContents(this)), + m_deployables(new MaemoDeployables(this)), m_packagingEnabled(other->m_packagingEnabled), m_versionString(other->m_versionString) { } -MaemoPackageCreationStep::~MaemoPackageCreationStep() {} +MaemoPackageCreationStep::~MaemoPackageCreationStep() +{ + delete m_deployables; +} bool MaemoPackageCreationStep::init() { @@ -245,7 +245,7 @@ bool MaemoPackageCreationStep::createPackage() } emit addOutput(tr("Package created."), textCharFormat); - m_packageContents->setUnModified(); + m_deployables->setUnmodified(); return true; } @@ -346,12 +346,13 @@ QString MaemoPackageCreationStep::targetRoot() const bool MaemoPackageCreationStep::packagingNeeded() const { QFileInfo packageInfo(packageFilePath()); - if (!packageInfo.exists() || m_packageContents->isModified()) + if (!packageInfo.exists() || m_deployables->isModified()) return true; - for (int i = 0; i < m_packageContents->rowCount(); ++i) { + const int deployableCount = m_deployables->deployableCount(); + for (int i = 0; i < deployableCount; ++i) { if (packageInfo.lastModified() - <= QFileInfo(m_packageContents->deployableAt(i).localFilePath) + <= QFileInfo(m_deployables->deployableAt(i).localFilePath) .lastModified()) return true; } @@ -389,18 +390,6 @@ void MaemoPackageCreationStep::raiseError(const QString &shortMsg, TASK_CATEGORY_BUILDSYSTEM)); } -QSharedPointer<ProFileWrapper> MaemoPackageCreationStep::proFileWrapper() const -{ - if (!m_proFileWrapper) { - const Qt4ProFileNode * const proFileNode = qt4BuildConfiguration() - ->qt4Target()->qt4Project()->rootProjectNode(); - m_proFileWrapper = QSharedPointer<ProFileWrapper>( - new ProFileWrapper(proFileNode->path())); - } - - return m_proFileWrapper; -} - const QLatin1String MaemoPackageCreationStep::CreatePackageId("Qt4ProjectManager.MaemoPackageCreationStep"); } // namespace Internal diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.h b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.h index ca588843119e58f78b00ef487deedf9dbeeb7d01..37b32355ef635296782723bd5b930a1518aeef2a 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationstep.h @@ -55,7 +55,7 @@ QT_END_NAMESPACE namespace Qt4ProjectManager { namespace Internal { -class MaemoPackageContents; +class MaemoDeployables; class MaemoToolChain; class ProFileWrapper; class Qt4BuildConfiguration; @@ -71,9 +71,8 @@ public: QString packageFilePath() const; QString localExecutableFilePath() const; QString executableFileName() const; - MaemoPackageContents *packageContents() const { return m_packageContents; } + MaemoDeployables *deployables() const { return m_deployables; } const Qt4BuildConfiguration *qt4BuildConfiguration() const; - QSharedPointer<ProFileWrapper> proFileWrapper() const; bool isPackagingEnabled() const { return m_packagingEnabled; } void setPackagingEnabled(bool enabled) { m_packagingEnabled = enabled; } @@ -108,10 +107,9 @@ private: static const QLatin1String CreatePackageId; - MaemoPackageContents *const m_packageContents; + MaemoDeployables * const m_deployables; bool m_packagingEnabled; QString m_versionString; - mutable QSharedPointer<ProFileWrapper> m_proFileWrapper; QScopedPointer<QProcess> m_buildProc; }; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.cpp index 91fc14a3fc234f910f2155dc6ceee0b16f462785..0e6697ef00114fc4e36ebd744bb073eef759cc67 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.cpp @@ -42,7 +42,9 @@ #include "maemopackagecreationwidget.h" #include "ui_maemopackagecreationwidget.h" -#include "maemopackagecontents.h" +#include "maemodeployablelistmodel.h" +#include "maemodeployablelistwidget.h" +#include "maemodeployables.h" #include "maemopackagecreationstep.h" #include "maemotoolchain.h" @@ -51,10 +53,6 @@ #include <projectexplorer/target.h> #include <qt4projectmanager/qt4buildconfiguration.h> -#include <QtCore/QFileInfo> -#include <QtGui/QFileDialog> -#include <QtGui/QMessageBox> - namespace Qt4ProjectManager { namespace Internal { @@ -64,27 +62,20 @@ MaemoPackageCreationWidget::MaemoPackageCreationWidget(MaemoPackageCreationStep m_ui(new Ui::MaemoPackageCreationWidget) { m_ui->setupUi(this); - m_ui->packageContentsView->setWordWrap(false); m_ui->skipCheckBox->setChecked(!m_step->isPackagingEnabled()); - m_ui->packageContentsView->setModel(step->packageContents()); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); - connect(step->packageContents(), SIGNAL(dataChanged(QModelIndex,QModelIndex)), - m_ui->packageContentsView, SLOT(resizeColumnsToContents())); - connect(step->packageContents(), SIGNAL(rowsInserted(QModelIndex, int, int)), - m_ui->packageContentsView, SLOT(resizeColumnsToContents())); - connect(m_ui->packageContentsView->selectionModel(), - SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, - SLOT(enableOrDisableRemoveButton())); - m_ui->packageContentsView->resizeColumnsToContents(); - m_ui->packageContentsView->horizontalHeader()->setStretchLastSection(true); - enableOrDisableRemoveButton(); - const QStringList list = m_step->versionString().split(QLatin1Char('.'), QString::SkipEmptyParts); m_ui->major->setValue(list.value(0, QLatin1String("0")).toInt()); m_ui->minor->setValue(list.value(1, QLatin1String("0")).toInt()); m_ui->patch->setValue(list.value(2, QLatin1String("0")).toInt()); versionInfoChanged(); // workaround for missing minor and patch update notifications + for (int i = 0; i < step->deployables()->modelCount(); ++i) { + MaemoDeployableListModel * const model + = step->deployables()->modelAt(i); + m_ui->tabWidget->addTab(new MaemoDeployableListWidget(this, model), + model->projectName()); + } } void MaemoPackageCreationWidget::init() @@ -101,56 +92,6 @@ QString MaemoPackageCreationWidget::displayName() const return m_step->displayName(); } -void MaemoPackageCreationWidget::addFile() -{ - const Qt4BuildConfiguration * const bc - = static_cast<Qt4BuildConfiguration *>(m_step->buildConfiguration()); - QTC_ASSERT(bc, return); - const QString title = tr("Choose a local file"); - const QString baseDir = bc->target()->project()->projectDirectory(); - const QString localFile = QFileDialog::getOpenFileName(this, title, baseDir); // TODO: Support directories? - if (localFile.isEmpty()) - return; - const MaemoDeployable - deployable(QDir::toNativeSeparators(QFileInfo(localFile).absoluteFilePath()), - "/"); - MaemoPackageContents * const contents = m_step->packageContents(); - QString errorString; - if (!contents->addDeployable(deployable, &errorString)) { - QMessageBox::information(this, tr("Error adding file"), errorString); - } else { - const QModelIndex newIndex - = contents->index(contents->rowCount() - 1, 1); - m_ui->packageContentsView->selectionModel()->clear(); - m_ui->packageContentsView->scrollTo(newIndex); - m_ui->packageContentsView->edit(newIndex); - } -} - -void MaemoPackageCreationWidget::removeFile() -{ - const QModelIndexList selectedRows - = m_ui->packageContentsView->selectionModel()->selectedRows(); - if (selectedRows.isEmpty()) - return; - const int row = selectedRows.first().row(); - if (row != 0) { - QString errorString; - if (!m_step->packageContents()->removeDeployableAt(row, &errorString)) { - QMessageBox::information(this, tr("Error removing file"), - errorString); - } - } -} - -void MaemoPackageCreationWidget::enableOrDisableRemoveButton() -{ - const QModelIndexList selectedRows - = m_ui->packageContentsView->selectionModel()->selectedRows(); - m_ui->removeFileButton->setEnabled(!selectedRows.isEmpty() - && selectedRows.first().row() != 0); -} - void MaemoPackageCreationWidget::handleSkipButtonToggled(bool checked) { m_step->setPackagingEnabled(!checked); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.h b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.h index a341880517e7e11c889dd41a7a5429e01a50735f..6f01bdeaa76e0616fa1fdb864e6f6478df5e8479 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.h @@ -64,9 +64,6 @@ public: virtual QString displayName() const; private slots: - void addFile(); - void removeFile(); - void enableOrDisableRemoveButton(); void handleSkipButtonToggled(bool checked); void versionInfoChanged(); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.ui b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.ui index 5ac787f6cdea103fa762c6fc2722efdd2a1a03df..8e3b923136e94244255c6dffff87c085c8edce2d 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.ui +++ b/src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>470</width> - <height>325</height> + <width>478</width> + <height>335</height> </rect> </property> <property name="sizePolicy"> @@ -191,142 +191,16 @@ </widget> </item> <item> - <layout class="QHBoxLayout" name="horizontalLayout"> - <item> - <spacer name="horizontalSpacer_3"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeType"> - <enum>QSizePolicy::Fixed</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>13</width> - <height>13</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QTableView" name="packageContentsView"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Expanding"> - <horstretch>1</horstretch> - <verstretch>1</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>400</width> - <height>200</height> - </size> - </property> - <property name="selectionMode"> - <enum>QAbstractItemView::SingleSelection</enum> - </property> - <property name="selectionBehavior"> - <enum>QAbstractItemView::SelectRows</enum> - </property> - <property name="showGrid"> - <bool>false</bool> - </property> - <attribute name="horizontalHeaderVisible"> - <bool>true</bool> - </attribute> - <attribute name="horizontalHeaderCascadingSectionResizes"> - <bool>false</bool> - </attribute> - <attribute name="verticalHeaderVisible"> - <bool>false</bool> - </attribute> - </widget> - </item> - <item> - <layout class="QVBoxLayout" name="verticalLayout"> - <item> - <widget class="QToolButton" name="addFileButton"> - <property name="toolTip"> - <string>Add File to Package</string> - </property> - <property name="text"> - <string/> - </property> - <property name="icon"> - <iconset resource="../../coreplugin/core.qrc"> - <normaloff>:/core/images/plus.png</normaloff>:/core/images/plus.png</iconset> - </property> - </widget> - </item> - <item> - <widget class="QToolButton" name="removeFileButton"> - <property name="toolTip"> - <string>Remove File from Package</string> - </property> - <property name="text"> - <string/> - </property> - <property name="icon"> - <iconset resource="../../coreplugin/core.qrc"> - <normaloff>:/core/images/minus.png</normaloff>:/core/images/minus.png</iconset> - </property> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </item> - </layout> + <widget class="QTabWidget" name="tabWidget"> + <property name="currentIndex"> + <number>-1</number> + </property> + </widget> </item> </layout> </widget> - <resources> - <include location="../../coreplugin/core.qrc"/> - </resources> + <resources/> <connections> - <connection> - <sender>addFileButton</sender> - <signal>clicked()</signal> - <receiver>MaemoPackageCreationWidget</receiver> - <slot>addFile()</slot> - <hints> - <hint type="sourcelabel"> - <x>458</x> - <y>134</y> - </hint> - <hint type="destinationlabel"> - <x>732</x> - <y>525</y> - </hint> - </hints> - </connection> - <connection> - <sender>removeFileButton</sender> - <signal>clicked()</signal> - <receiver>MaemoPackageCreationWidget</receiver> - <slot>removeFile()</slot> - <hints> - <hint type="sourcelabel"> - <x>458</x> - <y>162</y> - </hint> - <hint type="destinationlabel"> - <x>735</x> - <y>145</y> - </hint> - </hints> - </connection> <connection> <sender>skipCheckBox</sender> <signal>clicked(bool)</signal> @@ -366,8 +240,8 @@ <slot>versionInfoChanged()</slot> <hints> <hint type="sourcelabel"> - <x>154</x> - <y>68</y> + <x>233</x> + <y>94</y> </hint> <hint type="destinationlabel"> <x>5</x> @@ -382,12 +256,12 @@ <slot>versionInfoChanged()</slot> <hints> <hint type="sourcelabel"> - <x>249</x> - <y>68</y> + <x>339</x> + <y>94</y> </hint> <hint type="destinationlabel"> <x>466</x> - <y>-7</y> + <y>0</y> </hint> </hints> </connection> diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h index 0a42d5265064d3dd8234b0abe25f9a182d888a22..04b9f1cc3c3a7604ddb3c73f32124c0f5948f05f 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemorunconfiguration.h @@ -32,7 +32,7 @@ #include "maemoconstants.h" #include "maemodeviceconfigurations.h" -#include "maemopackagecontents.h" +#include "maemodeployable.h" #include <projectexplorer/runconfiguration.h> diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp index 5541eccd7c7e3fbfefa5b633bbc60ef3b00554e5..7b622f50963a3e668853e891f99028654011ce6f 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.cpp @@ -34,9 +34,9 @@ #include "maemoruncontrol.h" +#include "maemodeployables.h" #include "maemopackagecreationstep.h" #include "maemorunconfiguration.h" -#include "maemopackagecontents.h" #include <coreplugin/icore.h> #include <coreplugin/progressmanager/progressmanager.h> @@ -139,10 +139,11 @@ void AbstractMaemoRunControl::startDeployment(bool forDebugging) const MaemoDeployable d(packageFilePath(), uploadDir()); m_needsInstall = addDeployableIfNeeded(d); } else { - const MaemoPackageContents * const packageContents - = packageStep->packageContents(); - for (int i = 0; i < packageContents->rowCount(); ++i) { - const MaemoDeployable &d = packageContents->deployableAt(i); + const MaemoDeployables * const deployables + = packageStep->deployables(); + const int deployableCount = deployables->deployableCount(); + for (int i = 0; i < deployableCount; ++i) { + const MaemoDeployable &d = deployables->deployableAt(i); if (addDeployableIfNeeded(d)) m_needsInstall = true; } @@ -237,7 +238,10 @@ QString AbstractMaemoRunControl::packageFilePath() const QString AbstractMaemoRunControl::executableFilePathOnTarget() const { - return m_runConfig->packageStep()->packageContents()->remoteExecutableFilePath(); + // TODO: The local executable is known directly by us (from RunConfiguration::target(), + // so we must not rely on the packaging step for this information (which will + // no longer provide it, anyway)/ + return m_runConfig->packageStep()->deployables()->remoteExecutableFilePath(m_runConfig->packageStep()->localExecutableFilePath()); } bool AbstractMaemoRunControl::isCleaning() const diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h index 2cf68b105c860bcdc4233601c4807a7c05a037ad..5965b0e8a17288c26a76d82bec972b2ddaad385c 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoruncontrol.h @@ -36,7 +36,7 @@ #define MAEMORUNCONTROL_H #include "maemodeviceconfigurations.h" -#include "maemopackagecontents.h" +#include "maemodeployable.h" #include "maemosshthread.h" #include <projectexplorer/runconfiguration.h> diff --git a/src/plugins/qt4projectmanager/qt-maemo/profilewrapper.h b/src/plugins/qt4projectmanager/qt-maemo/profilewrapper.h index e82c03c2231762d91a7924bd79f8f8ebb8d7bb7a..7f2d4512143970c131d6a60ab55080f633c89f80 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/profilewrapper.h +++ b/src/plugins/qt4projectmanager/qt-maemo/profilewrapper.h @@ -53,6 +53,7 @@ public: const QString &newValue); QString absFilePath(const QString &relFilePath) const; + QString projectDir() const { return m_proDir.path(); } private: enum ParseType { ParseFromFile, ParseFromLines }; diff --git a/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.pri b/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.pri index 2a0d8e02f178df3589aca17a968fc6517abb7748..346c1b8a06239484b8fed783e654460bb5a02f0d 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.pri +++ b/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.pri @@ -15,9 +15,12 @@ HEADERS += \ $$PWD/maemopackagecreationstep.h \ $$PWD/maemopackagecreationfactory.h \ $$PWD/maemopackagecreationwidget.h \ - $$PWD/maemopackagecontents.h \ + $$PWD/maemodeployablelistmodel.h \ $$PWD/qemuruntimemanager.h \ - $$PWD/profilewrapper.h + $$PWD/profilewrapper.h \ + $$PWD/maemodeployables.h \ + $$PWD/maemodeployable.h \ + $$PWD/maemodeployablelistwidget.h SOURCES += \ $$PWD/maemoconfigtestdialog.cpp \ @@ -35,14 +38,17 @@ SOURCES += \ $$PWD/maemopackagecreationstep.cpp \ $$PWD/maemopackagecreationfactory.cpp \ $$PWD/maemopackagecreationwidget.cpp \ - $$PWD/maemopackagecontents.cpp \ + $$PWD/maemodeployablelistmodel.cpp \ $$PWD/qemuruntimemanager.cpp \ - $$PWD/profilewrapper.cpp + $$PWD/profilewrapper.cpp \ + $$PWD/maemodeployables.cpp \ + $$PWD/maemodeployablelistwidget.cpp FORMS += \ $$PWD/maemoconfigtestdialog.ui \ $$PWD/maemosettingswidget.ui \ $$PWD/maemosshconfigdialog.ui \ - $$PWD/maemopackagecreationwidget.ui + $$PWD/maemopackagecreationwidget.ui \ + $$PWD/maemodeployablelistwidget.ui RESOURCES += $$PWD/qt-maemo.qrc