forked from qt-creator/qt-creator
Maemo: Prepare infrastructure for proper subdirs support.
No difference in functionality yet. Reviewed-by: kh1
This commit is contained in:
62
src/plugins/qt4projectmanager/qt-maemo/maemodeployable.h
Normal file
62
src/plugins/qt4projectmanager/qt-maemo/maemodeployable.h
Normal file
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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>
|
||||
104
src/plugins/qt4projectmanager/qt-maemo/maemodeployables.cpp
Normal file
104
src/plugins/qt4projectmanager/qt-maemo/maemodeployables.cpp
Normal file
@@ -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
|
||||
75
src/plugins/qt4projectmanager/qt-maemo/maemodeployables.h
Normal file
75
src/plugins/qt4projectmanager/qt-maemo/maemodeployables.h
Normal file
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
};
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -64,9 +64,6 @@ public:
|
||||
virtual QString displayName() const;
|
||||
|
||||
private slots:
|
||||
void addFile();
|
||||
void removeFile();
|
||||
void enableOrDisableRemoveButton();
|
||||
void handleSkipButtonToggled(bool checked);
|
||||
void versionInfoChanged();
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
#include "maemoconstants.h"
|
||||
#include "maemodeviceconfigurations.h"
|
||||
#include "maemopackagecontents.h"
|
||||
#include "maemodeployable.h"
|
||||
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
#define MAEMORUNCONTROL_H
|
||||
|
||||
#include "maemodeviceconfigurations.h"
|
||||
#include "maemopackagecontents.h"
|
||||
#include "maemodeployable.h"
|
||||
#include "maemosshthread.h"
|
||||
|
||||
#include <projectexplorer/runconfiguration.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 };
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user