diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemomountspecification.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemomountspecification.cpp new file mode 100644 index 0000000000000000000000000000000000000000..6ed38689e620565534565c2b1322623d2ecef65c --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-maemo/maemomountspecification.cpp @@ -0,0 +1,45 @@ +/************************************************************************** +** +** 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. +** +**************************************************************************/ + +#include "maemomountspecification.h" + +namespace Qt4ProjectManager { +namespace Internal { + +const QLatin1String MaemoMountSpecification::InvalidMountPoint("/"); + +MaemoMountSpecification::MaemoMountSpecification(const QString &localDir, + const QString &remoteDir, int remotePort) + : localDir(localDir), remoteMountPoint(remoteDir), remotePort(remotePort) +{ +} + +} // namespace Internal +} // namespace Qt4ProjectManager + diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemomountspecification.h b/src/plugins/qt4projectmanager/qt-maemo/maemomountspecification.h new file mode 100644 index 0000000000000000000000000000000000000000..d1700eb9b77df04c598941d1a096617db5a26ef3 --- /dev/null +++ b/src/plugins/qt4projectmanager/qt-maemo/maemomountspecification.h @@ -0,0 +1,54 @@ +/************************************************************************** +** +** 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 MAEMOMOUNTSPECIFICATION_H +#define MAEMOMOUNTSPECIFICATION_H + +#include <QtCore/QLatin1String> + +namespace Qt4ProjectManager { +namespace Internal { + +struct MaemoMountSpecification { + MaemoMountSpecification(const QString &localDir, const QString &remoteDir, + int remotePort); + + bool isValid() const { return remoteMountPoint != InvalidMountPoint; } + + static const QLatin1String InvalidMountPoint; + + QString localDir; + QString remoteMountPoint; + int remotePort; +}; + +} // namespace Internal +} // namespace Qt4ProjectManager + +#endif // MAEMOMOUNTSPECIFICATION_H diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoremotemountsmodel.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemoremotemountsmodel.cpp index 4016ed0abdd82d6eee5dce610f4da62c4389aa5e..d755b44c13872cf1b16f7460097674055915e73b 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoremotemountsmodel.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoremotemountsmodel.cpp @@ -34,19 +34,6 @@ namespace Qt4ProjectManager { namespace Internal { -namespace { -const QLatin1String InvalidMountPoint("/"); -} // anonymous namespace - -MaemoRemoteMountsModel::MountSpecification::MountSpecification(const QString &l, - const QString &r, int p) : localDir(l), remoteMountPoint(r), remotePort(p) {} - -bool MaemoRemoteMountsModel::MountSpecification::isValid() const -{ - return remoteMountPoint != InvalidMountPoint; -} - - MaemoRemoteMountsModel::MaemoRemoteMountsModel(QObject *parent) : QAbstractTableModel(parent) { @@ -66,7 +53,8 @@ void MaemoRemoteMountsModel::addMountSpecification(const QString &localDir) } beginInsertRows(QModelIndex(), rowCount(), rowCount()); - m_mountSpecs << MountSpecification(localDir, InvalidMountPoint, port); + m_mountSpecs << MaemoMountSpecification(localDir, + MaemoMountSpecification::InvalidMountPoint, port); endInsertRows(); } @@ -89,7 +77,7 @@ void MaemoRemoteMountsModel::setLocalDir(int pos, const QString &localDir) int MaemoRemoteMountsModel::validMountSpecificationCount() const { int count = 0; - foreach (const MountSpecification &m, m_mountSpecs) { + foreach (const MaemoMountSpecification &m, m_mountSpecs) { if (m.isValid()) ++count; } @@ -98,7 +86,7 @@ int MaemoRemoteMountsModel::validMountSpecificationCount() const bool MaemoRemoteMountsModel::hasValidMountSpecifications() const { - foreach (const MountSpecification &m, m_mountSpecs) { + foreach (const MaemoMountSpecification &m, m_mountSpecs) { if (m.isValid()) return true; } @@ -111,7 +99,7 @@ QVariantMap MaemoRemoteMountsModel::toMap() const QVariantList localDirsList; QVariantList remoteMountPointsList; QVariantList mountPortsList; - foreach (const MountSpecification &mountSpec, m_mountSpecs) { + foreach (const MaemoMountSpecification &mountSpec, m_mountSpecs) { localDirsList << mountSpec.localDir; remoteMountPointsList << mountSpec.remoteMountPoint; mountPortsList << mountSpec.remotePort; @@ -136,7 +124,7 @@ void MaemoRemoteMountsModel::fromMap(const QVariantMap &map) const QString &remoteMountPoint = remoteMountPointsList.at(i).toString(); const int port = mountPortsList.at(i).toInt(); - m_mountSpecs << MountSpecification(localDir, remoteMountPoint, port); + m_mountSpecs << MaemoMountSpecification(localDir, remoteMountPoint, port); } } @@ -167,7 +155,7 @@ QVariant MaemoRemoteMountsModel::data(const QModelIndex &index, int role) const if (!index.isValid() || index.row() >= rowCount()) return QVariant(); - const MountSpecification &mountSpec = mountSpecificationAt(index.row()); + const MaemoMountSpecification &mountSpec = mountSpecificationAt(index.row()); switch (index.column()) { case LocalDirRow: if (role == Qt::DisplayRole) @@ -196,7 +184,7 @@ bool MaemoRemoteMountsModel::setData(const QModelIndex &index, case RemoteMountPointRow: { const QString &newRemoteMountPoint = value.toString(); for (int i = 0; i < m_mountSpecs.count(); ++i) { - const MountSpecification &mountSpec = m_mountSpecs.at(i); + const MaemoMountSpecification &mountSpec = m_mountSpecs.at(i); if (i != index.row() && mountSpec.isValid() && mountSpec.remoteMountPoint == newRemoteMountPoint) return false; diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemoremotemountsmodel.h b/src/plugins/qt4projectmanager/qt-maemo/maemoremotemountsmodel.h index eb64227e152feab243322360f74f50efe7c53da9..04b4d7b1f3f1b99a1d17cdbb46c3217f8cac642f 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemoremotemountsmodel.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemoremotemountsmodel.h @@ -30,6 +30,8 @@ #ifndef MAEMOREMOTEMOUNTSMODEL_H #define MAEMOREMOTEMOUNTSMODEL_H +#include "maemomountspecification.h" + #include <QtCore/QAbstractTableModel> #include <QtCore/QList> #include <QtCore/QString> @@ -42,19 +44,10 @@ class MaemoRemoteMountsModel : public QAbstractTableModel { Q_OBJECT public: - struct MountSpecification { - MountSpecification(const QString &l, const QString &r, int p); - bool isValid() const; - - QString localDir; - QString remoteMountPoint; - int remotePort; - }; - explicit MaemoRemoteMountsModel(QObject *parent = 0); int mountSpecificationCount() const { return m_mountSpecs.count(); } int validMountSpecificationCount() const; - MountSpecification mountSpecificationAt(int pos) const { return m_mountSpecs.at(pos); } + MaemoMountSpecification mountSpecificationAt(int pos) const { return m_mountSpecs.at(pos); } bool hasValidMountSpecifications() const; void addMountSpecification(const QString &localDir); @@ -79,7 +72,7 @@ private: virtual bool setData(const QModelIndex &index, const QVariant &value, int role); - QList<MountSpecification> m_mountSpecs; + QList<MaemoMountSpecification> m_mountSpecs; }; inline int MaemoRemoteMountsModel::columnCount(const QModelIndex &) const diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp b/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp index 935ff4595c09e4ae49a5910b87db2542c8b10880..7f4870a25afd85c491199e6a50127e69c851467e 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp +++ b/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.cpp @@ -78,13 +78,13 @@ void MaemoSshRunner::start() const MaemoRemoteMountsModel * const remoteMounts = m_runConfig->remoteMounts(); for (int i = 0; i < remoteMounts->mountSpecificationCount(); ++i) { - const MaemoRemoteMountsModel::MountSpecification &mountSpec + const MaemoMountSpecification &mountSpec = remoteMounts->mountSpecificationAt(i); if (mountSpec.isValid()) m_mountSpecs << mountSpec; } if (m_debugging && m_runConfig->useRemoteGdb()) { - m_mountSpecs << MaemoRemoteMountsModel::MountSpecification( + m_mountSpecs << MaemoMountSpecification( m_runConfig->localDirToMountForRemoteGdb(), MaemoGlobal::remoteProjectSourcesMountPoint(), m_devConfig.debuggingPort); @@ -264,8 +264,7 @@ void MaemoSshRunner::startUtfsClients() const QLatin1String andOp(" && "); QString remoteCall = chmodFuse + andOp + chmodUtfsClient; for (int i = 0; i < m_mountSpecs.count(); ++i) { - const MaemoRemoteMountsModel::MountSpecification &mountSpec - = m_mountSpecs.at(i); + const MaemoMountSpecification &mountSpec = m_mountSpecs.at(i); const QString port = QString::number(mountSpec.remotePort); const QString mkdir = QString::fromLocal8Bit("%1 mkdir -p %2") .arg(MaemoGlobal::remoteSudo(), mountSpec.remoteMountPoint); @@ -319,8 +318,7 @@ void MaemoSshRunner::handleUtfsClientsFinished(int exitStatus) void MaemoSshRunner::startUtfsServers() { for (int i = 0; i < m_mountSpecs.count(); ++i) { - const MaemoRemoteMountsModel::MountSpecification &mountSpec - = m_mountSpecs.at(i); + const MaemoMountSpecification &mountSpec = m_mountSpecs.at(i); QProcess * const utfsServerProc = new QProcess(this); connect(utfsServerProc, SIGNAL(readyReadStandardError()), this, SLOT(handleUtfsServerErrorOutput())); diff --git a/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.h b/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.h index 29c520979d79309cf5e2cb0705a89d0368049a05..ff045b278669047aa40228d3a5e57945356e9e88 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.h +++ b/src/plugins/qt4projectmanager/qt-maemo/maemosshrunner.h @@ -112,7 +112,7 @@ private: QSharedPointer<Core::SftpChannel> m_utfsClientUploader; QStringList m_procsToKill; QList<QProcess *> m_utfsServers; - QList<MaemoRemoteMountsModel::MountSpecification> m_mountSpecs; + QList<MaemoMountSpecification> m_mountSpecs; Core::SftpJobId m_uploadJobId; bool m_stop; diff --git a/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.pri b/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.pri index 53b7fc4c835f30de612a0153530d9cca116523ad..dc5c331ba7fd6ed510c0ec4f3f9b270f8dda9612 100644 --- a/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.pri +++ b/src/plugins/qt4projectmanager/qt-maemo/qt-maemo.pri @@ -29,7 +29,8 @@ HEADERS += \ $$PWD/maemodeviceconfiglistmodel.h \ $$PWD/maemoremotemountsmodel.h \ $$PWD/maemodeviceenvreader.h \ - $$PWD/maemotemplatesmanager.h + $$PWD/maemotemplatesmanager.h \ + $$PWD/maemomountspecification.h SOURCES += \ $$PWD/maemoconfigtestdialog.cpp \ @@ -60,7 +61,8 @@ SOURCES += \ $$PWD/maemodeviceconfiglistmodel.cpp \ $$PWD/maemoremotemountsmodel.cpp \ $$PWD/maemodeviceenvreader.cpp \ - $$PWD/maemotemplatesmanager.cpp + $$PWD/maemotemplatesmanager.cpp \ + $$PWD/maemomountspecification.cpp FORMS += \ $$PWD/maemoconfigtestdialog.ui \