Commit 0119dade authored by Christian Kandeler's avatar Christian Kandeler
Browse files

RemoteLinux: Rename some classes and the associated files.

Also make them external.

Change-Id: I21a74c1f7124646b5507ffd2ee0e24c7c60eca97
Reviewed-on: http://codereview.qt.nokia.com/749

Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarChristian Kandeler <christian.kandeler@nokia.com>
parent 90ee1cc1
......@@ -32,6 +32,7 @@
#include "abstractmaemodeploystep.h"
#include "deployablefile.h"
#include "maemoconstants.h"
#include "maemodeploystepwidget.h"
#include "maemoglobal.h"
......@@ -48,6 +49,7 @@
#include <utils/ssh/sshconnectionmanager.h>
#include <QtCore/QDateTime>
#include <QtCore/QEventLoop>
#include <QtCore/QFileInfo>
#include <QtCore/QTimer>
......@@ -177,7 +179,7 @@ void AbstractMaemoDeployStep::getDeployTimesFromMap(const QVariantMap &map)
= qMin(qMin(hostList.size(), fileList.size()),
qMin(remotePathList.size(), timeList.size()));
for (int i = 0; i < elemCount; ++i) {
const MaemoDeployable d(fileList.at(i).toString(),
const DeployableFile d(fileList.at(i).toString(),
remotePathList.at(i).toString());
m_lastDeployed.insert(DeployablePerHost(d, hostList.at(i).toString()),
timeList.at(i).toDateTime());
......@@ -220,7 +222,7 @@ void AbstractMaemoDeployStep::stop()
}
bool AbstractMaemoDeployStep::currentlyNeedsDeployment(const QString &host,
const MaemoDeployable &deployable) const
const DeployableFile &deployable) const
{
const QDateTime &lastDeployed
= m_lastDeployed.value(DeployablePerHost(deployable, host));
......@@ -229,7 +231,7 @@ bool AbstractMaemoDeployStep::currentlyNeedsDeployment(const QString &host,
}
void AbstractMaemoDeployStep::setDeployed(const QString &host,
const MaemoDeployable &deployable)
const DeployableFile &deployable)
{
m_lastDeployed.insert(DeployablePerHost(deployable, host),
QDateTime::currentDateTime());
......
......@@ -34,8 +34,6 @@
#define ABSTRACTMAEMODEPLOYSTEP_H
#include "abstractlinuxdevicedeploystep.h"
#include "maemodeployable.h"
#include "maemodeployables.h"
#include <projectexplorer/buildstep.h>
......@@ -52,6 +50,8 @@ namespace Qt4ProjectManager { class Qt4BuildConfiguration; }
namespace Utils { class SshConnection; }
namespace RemoteLinux {
class DeployableFile;
namespace Internal {
class AbstractMaemoPackageCreationStep;
class Qt4MaemoDeployConfiguration;
......@@ -79,8 +79,8 @@ protected:
BaseState baseState() const { return m_baseState; }
bool currentlyNeedsDeployment(const QString &host,
const MaemoDeployable &deployable) const;
void setDeployed(const QString &host, const MaemoDeployable &deployable);
const DeployableFile &deployable) const;
void setDeployed(const QString &host, const DeployableFile &deployable);
void raiseError(const QString &error);
void writeOutput(const QString &text, OutputFormat format = MessageOutput,
OutputNewlineSetting newlineSetting = DoAppendNewline);
......@@ -118,7 +118,7 @@ private:
void setBaseState(BaseState newState);
QSharedPointer<Utils::SshConnection> m_connection;
typedef QPair<MaemoDeployable, QString> DeployablePerHost;
typedef QPair<DeployableFile, QString> DeployablePerHost;
QHash<DeployablePerHost, QDateTime> m_lastDeployed;
BaseState m_baseState;
bool m_hasError;
......
......@@ -30,24 +30,25 @@
**
**************************************************************************/
#ifndef MAEMODEPLOYABLE_H
#define MAEMODEPLOYABLE_H
#ifndef DEPLOYABLEFILE_H
#define DEPLOYABLEFILE_H
#include "remotelinux_export.h"
#include <QtCore/QHash>
#include <QtCore/QString>
namespace RemoteLinux {
namespace Internal {
class MaemoDeployable
class REMOTELINUX_EXPORT DeployableFile
{
public:
MaemoDeployable() {}
DeployableFile() {}
MaemoDeployable(const QString &localFilePath, const QString &remoteDir)
DeployableFile(const QString &localFilePath, const QString &remoteDir)
: localFilePath(localFilePath), remoteDir(remoteDir) {}
bool operator==(const MaemoDeployable &other) const
bool operator==(const DeployableFile &other) const
{
return localFilePath == other.localFilePath
&& remoteDir == other.remoteDir;
......@@ -57,12 +58,11 @@ public:
QString remoteDir;
};
inline uint qHash(const MaemoDeployable &d)
inline uint qHash(const DeployableFile &d)
{
return qHash(qMakePair(d.localFilePath, d.remoteDir));
}
} // namespace RemoteLinux
} // namespace Internal
#endif // MAEMODEPLOYABLE_H
#endif // DEPLOYABLEFILE_H
......@@ -30,7 +30,7 @@
**
**************************************************************************/
#include "maemodeployablelistmodel.h"
#include "deployablefilesperprofile.h"
#include "maemoglobal.h"
......@@ -55,9 +55,9 @@
using namespace Qt4ProjectManager;
namespace RemoteLinux {
namespace Internal {
using namespace Internal;
MaemoDeployableListModel::MaemoDeployableListModel(const Qt4BaseTarget *target,
DeployableFilesPerProFile::DeployableFilesPerProFile(const Qt4BaseTarget *target,
const Qt4ProFileNode *proFileNode, ProFileUpdateSetting updateSetting, QObject *parent)
: QAbstractTableModel(parent),
m_target(target),
......@@ -75,9 +75,9 @@ MaemoDeployableListModel::MaemoDeployableListModel(const Qt4BaseTarget *target,
buildModel();
}
MaemoDeployableListModel::~MaemoDeployableListModel() {}
DeployableFilesPerProFile::~DeployableFilesPerProFile() {}
bool MaemoDeployableListModel::buildModel()
bool DeployableFilesPerProFile::buildModel()
{
m_deployables.clear();
......@@ -92,40 +92,40 @@ bool MaemoDeployableListModel::buildModel()
<< QLatin1String("INSTALLS += target");
return addLinesToProFile(deployInfo);
} else if (m_projectType == ApplicationTemplate) {
m_deployables.prepend(MaemoDeployable(localExecutableFilePath(),
m_deployables.prepend(DeployableFile(localExecutableFilePath(),
m_installsList.targetPath));
} else if (m_projectType == LibraryTemplate) {
foreach (const QString &filePath, localLibraryFilePaths()) {
m_deployables.prepend(MaemoDeployable(filePath,
m_deployables.prepend(DeployableFile(filePath,
m_installsList.targetPath));
}
}
foreach (const InstallsItem &elem, m_installsList.items) {
foreach (const QString &file, elem.files)
m_deployables << MaemoDeployable(file, elem.path);
m_deployables << DeployableFile(file, elem.path);
}
m_modified = true;
return true;
}
MaemoDeployable MaemoDeployableListModel::deployableAt(int row) const
DeployableFile DeployableFilesPerProFile::deployableAt(int row) const
{
Q_ASSERT(row >= 0 && row < rowCount());
return m_deployables.at(row);
}
int MaemoDeployableListModel::rowCount(const QModelIndex &parent) const
int DeployableFilesPerProFile::rowCount(const QModelIndex &parent) const
{
return parent.isValid() ? 0 : m_deployables.count();
}
int MaemoDeployableListModel::columnCount(const QModelIndex &parent) const
int DeployableFilesPerProFile::columnCount(const QModelIndex &parent) const
{
return parent.isValid() ? 0 : 2;
}
QVariant MaemoDeployableListModel::data(const QModelIndex &index, int role) const
QVariant DeployableFilesPerProFile::data(const QModelIndex &index, int role) const
{
if (!index.isValid() || index.row() >= rowCount())
return QVariant();
......@@ -140,7 +140,7 @@ QVariant MaemoDeployableListModel::data(const QModelIndex &index, int role) cons
}
}
const MaemoDeployable &d = deployableAt(index.row());
const DeployableFile &d = deployableAt(index.row());
if (index.column() == 0 && role == Qt::DisplayRole)
return QDir::toNativeSeparators(d.localFilePath);
if (role == Qt::DisplayRole || role == Qt::EditRole)
......@@ -148,7 +148,7 @@ QVariant MaemoDeployableListModel::data(const QModelIndex &index, int role) cons
return QVariant();
}
Qt::ItemFlags MaemoDeployableListModel::flags(const QModelIndex &index) const
Qt::ItemFlags DeployableFilesPerProFile::flags(const QModelIndex &index) const
{
Qt::ItemFlags parentFlags = QAbstractTableModel::flags(index);
if (isEditable(index))
......@@ -156,7 +156,7 @@ Qt::ItemFlags MaemoDeployableListModel::flags(const QModelIndex &index) const
return parentFlags;
}
bool MaemoDeployableListModel::setData(const QModelIndex &index,
bool DeployableFilesPerProFile::setData(const QModelIndex &index,
const QVariant &value, int role)
{
if (!isEditable(index) || role != Qt::EditRole)
......@@ -171,7 +171,7 @@ bool MaemoDeployableListModel::setData(const QModelIndex &index,
return true;
}
QVariant MaemoDeployableListModel::headerData(int section,
QVariant DeployableFilesPerProFile::headerData(int section,
Qt::Orientation orientation, int role) const
{
if (orientation == Qt::Vertical || role != Qt::DisplayRole)
......@@ -179,14 +179,14 @@ QVariant MaemoDeployableListModel::headerData(int section,
return section == 0 ? tr("Local File Path") : tr("Remote Directory");
}
QString MaemoDeployableListModel::localExecutableFilePath() const
QString DeployableFilesPerProFile::localExecutableFilePath() const
{
if (!m_targetInfo.valid || m_projectType != ApplicationTemplate)
return QString();
return QDir::cleanPath(m_targetInfo.workingDir + '/' + m_targetInfo.target);
}
QStringList MaemoDeployableListModel::localLibraryFilePaths() const
QStringList DeployableFilesPerProFile::localLibraryFilePaths() const
{
if (!m_targetInfo.valid || m_projectType != LibraryTemplate)
return QStringList();
......@@ -206,7 +206,7 @@ QStringList MaemoDeployableListModel::localLibraryFilePaths() const
<< basePath;
}
QString MaemoDeployableListModel::remoteExecutableFilePath() const
QString DeployableFilesPerProFile::remoteExecutableFilePath() const
{
return m_hasTargetPath && m_projectType == ApplicationTemplate
? deployableAt(0).remoteDir + '/'
......@@ -214,37 +214,37 @@ QString MaemoDeployableListModel::remoteExecutableFilePath() const
: QString();
}
QString MaemoDeployableListModel::projectDir() const
QString DeployableFilesPerProFile::projectDir() const
{
return QFileInfo(m_proFilePath).dir().path();
}
void MaemoDeployableListModel::setProFileUpdateSetting(ProFileUpdateSetting updateSetting)
void DeployableFilesPerProFile::setProFileUpdateSetting(ProFileUpdateSetting updateSetting)
{
m_proFileUpdateSetting = updateSetting;
if (updateSetting == UpdateProFile)
buildModel();
}
bool MaemoDeployableListModel::isEditable(const QModelIndex &index) const
bool DeployableFilesPerProFile::isEditable(const QModelIndex &index) const
{
return m_projectType != AuxTemplate
&& index.row() == 0 && index.column() == 1
&& m_deployables.first().remoteDir.isEmpty();
}
QString MaemoDeployableListModel::localDesktopFilePath() const
QString DeployableFilesPerProFile::localDesktopFilePath() const
{
if (m_projectType == LibraryTemplate)
return QString();
foreach (const MaemoDeployable &d, m_deployables) {
foreach (const DeployableFile &d, m_deployables) {
if (QFileInfo(d.localFilePath).fileName() == m_projectName + QLatin1String(".desktop"))
return d.localFilePath;
}
return QString();
}
bool MaemoDeployableListModel::addDesktopFile()
bool DeployableFilesPerProFile::addDesktopFile()
{
if (!canAddDesktopFile())
return true;
......@@ -275,12 +275,12 @@ bool MaemoDeployableListModel::addDesktopFile()
return false;
beginInsertRows(QModelIndex(), rowCount(), rowCount());
m_deployables << MaemoDeployable(desktopFilePath, remoteDir);
m_deployables << DeployableFile(desktopFilePath, remoteDir);
endInsertRows();
return true;
}
bool MaemoDeployableListModel::addIcon(const QString &fileName)
bool DeployableFilesPerProFile::addIcon(const QString &fileName)
{
if (!canAddIcon())
return true;
......@@ -295,17 +295,17 @@ bool MaemoDeployableListModel::addIcon(const QString &fileName)
beginInsertRows(QModelIndex(), rowCount(), rowCount());
const QString filePath = QFileInfo(m_proFilePath).path()
+ QLatin1Char('/') + fileName;
m_deployables << MaemoDeployable(filePath, remoteIconDir());
m_deployables << DeployableFile(filePath, remoteIconDir());
endInsertRows();
return true;
}
QString MaemoDeployableListModel::remoteIconFilePath() const
QString DeployableFilesPerProFile::remoteIconFilePath() const
{
if (m_projectType == LibraryTemplate)
return QString();
const QList<QByteArray> &imageTypes = QImageReader::supportedImageFormats();
foreach (const MaemoDeployable &d, m_deployables) {
foreach (const DeployableFile &d, m_deployables) {
const QByteArray extension
= QFileInfo(d.localFilePath).suffix().toLocal8Bit();
if (d.remoteDir.startsWith(remoteIconDir())
......@@ -316,7 +316,7 @@ QString MaemoDeployableListModel::remoteIconFilePath() const
return QString();
}
bool MaemoDeployableListModel::addLinesToProFile(const QStringList &lines)
bool DeployableFilesPerProFile::addLinesToProFile(const QStringList &lines)
{
Core::FileChangeBlocker update(m_proFilePath);
......@@ -329,14 +329,14 @@ bool MaemoDeployableListModel::addLinesToProFile(const QStringList &lines)
return saver.finalize(Core::ICore::instance()->mainWindow());
}
const QtSupport::BaseQtVersion *MaemoDeployableListModel::qtVersion() const
const QtSupport::BaseQtVersion *DeployableFilesPerProFile::qtVersion() const
{
const Qt4BuildConfiguration *const bc = m_target->activeBuildConfiguration();
QTC_ASSERT(bc, return 0);
return bc->qtVersion();
}
QString MaemoDeployableListModel::proFileScope() const
QString DeployableFilesPerProFile::proFileScope() const
{
const QtSupport::BaseQtVersion *const qv = qtVersion();
QTC_ASSERT(qv, return QString());
......@@ -344,12 +344,12 @@ QString MaemoDeployableListModel::proFileScope() const
? "maemo5" : "unix:!symbian:!maemo5");
}
QString MaemoDeployableListModel::installPrefix() const
QString DeployableFilesPerProFile::installPrefix() const
{
return QLatin1String("/opt/") + m_projectName;
}
QString MaemoDeployableListModel::remoteIconDir() const
QString DeployableFilesPerProFile::remoteIconDir() const
{
const QtSupport::BaseQtVersion *const qv = qtVersion();
QTC_ASSERT(qv, return QString());
......@@ -358,4 +358,3 @@ QString MaemoDeployableListModel::remoteIconDir() const
}
} // namespace RemoteLinux
} // namespace Internal
......@@ -30,10 +30,12 @@
**
**************************************************************************/
#ifndef MAEMOPACKAGECONTENTS_H
#define MAEMOPACKAGECONTENTS_H
#ifndef DEPLOYABLEFILESPERPROFILE_H
#define DEPLOYABLEFILESPERPROFILE_H
#include "maemodeployable.h"
#include "deployablefile.h"
#include "remotelinux_export.h"
#include <qt4projectmanager/qt4nodes.h>
......@@ -51,9 +53,8 @@ class Qt4BaseTarget;
}
namespace RemoteLinux {
namespace Internal {
class MaemoDeployableListModel : public QAbstractTableModel
class REMOTELINUX_EXPORT DeployableFilesPerProFile : public QAbstractTableModel
{
Q_OBJECT
public:
......@@ -61,14 +62,14 @@ public:
UpdateProFile, DontUpdateProFile, AskToUpdateProFile
};
MaemoDeployableListModel(const Qt4ProjectManager::Qt4BaseTarget *target,
DeployableFilesPerProFile(const Qt4ProjectManager::Qt4BaseTarget *target,
const Qt4ProjectManager::Qt4ProFileNode *proFileNode, ProFileUpdateSetting updateSetting,
QObject *parent);
~MaemoDeployableListModel();
~DeployableFilesPerProFile();
virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
MaemoDeployable deployableAt(int row) const;
DeployableFile deployableAt(int row) const;
bool isModified() const { return m_modified; }
void setUnModified() { m_modified = false; }
const QtSupport::BaseQtVersion *qtVersion() const;
......@@ -119,13 +120,12 @@ private:
const Qt4ProjectManager::InstallsList m_installsList;
const Qt4ProjectManager::ProjectVersion m_projectVersion;
const QStringList m_config;
QList<MaemoDeployable> m_deployables;
QList<DeployableFile> m_deployables;
mutable bool m_modified;
ProFileUpdateSetting m_proFileUpdateSetting;
bool m_hasTargetPath;
};
} // namespace RemoteLinux
} // namespace Internal
#endif // MAEMOPACKAGECONTENTS_H
#endif // DEPLOYABLEFILESPERPROFILE_H
......@@ -29,8 +29,9 @@
**
**************************************************************************/
#include "maemodeployables.h"
#include "deploymentinfo.h"
#include "deployablefile.h"
#include "maemoprofilesupdatedialog.h"
#include <projectexplorer/buildstep.h>
......@@ -43,9 +44,9 @@
using namespace Qt4ProjectManager;
namespace RemoteLinux {
namespace Internal {
using namespace Internal;
MaemoDeployables::MaemoDeployables(const Qt4BaseTarget *target)
DeploymentInfo::DeploymentInfo(const Qt4BaseTarget *target)
: m_target(target), m_updateTimer(new QTimer(this))
{
Qt4Project * const pro = m_target->qt4Project();
......@@ -57,16 +58,16 @@ MaemoDeployables::MaemoDeployables(const Qt4BaseTarget *target)
createModels();
}
MaemoDeployables::~MaemoDeployables() {}
DeploymentInfo::~DeploymentInfo() {}
void MaemoDeployables::startTimer(Qt4ProjectManager::Qt4ProFileNode*, bool success, bool parseInProgress)
void DeploymentInfo::startTimer(Qt4ProjectManager::Qt4ProFileNode*, bool success, bool parseInProgress)
{
Q_UNUSED(success)
if (!parseInProgress)
m_updateTimer->start();
}
void MaemoDeployables::createModels()
void DeploymentInfo::createModels()
{
if (m_target->project()->activeTarget() != m_target)
return;
......@@ -82,10 +83,10 @@ void MaemoDeployables::createModels()
qDeleteAll(m_listModels);
m_listModels.clear();
createModels(rootNode);
QList<MaemoDeployableListModel *> modelsWithoutTargetPath;
foreach (MaemoDeployableListModel *const model, m_listModels) {
QList<DeployableFilesPerProFile *> modelsWithoutTargetPath;
foreach (DeployableFilesPerProFile *const model, m_listModels) {
if (!model->hasTargetPath()) {
if (model->proFileUpdateSetting() == MaemoDeployableListModel::AskToUpdateProFile)
if (model->proFileUpdateSetting() == DeployableFilesPerProFile::AskToUpdateProFile)
modelsWithoutTargetPath << model;
}
}
......@@ -96,10 +97,10 @@ void MaemoDeployables::createModels()
const QList<MaemoProFilesUpdateDialog::UpdateSetting> &settings
= dialog.getUpdateSettings();
foreach (const MaemoProFilesUpdateDialog::UpdateSetting &setting, settings) {
const MaemoDeployableListModel::ProFileUpdateSetting updateSetting
const DeployableFilesPerProFile::ProFileUpdateSetting updateSetting
= setting.second
? MaemoDeployableListModel::UpdateProFile
: MaemoDeployableListModel::DontUpdateProFile;
? DeployableFilesPerProFile::UpdateProFile
: DeployableFilesPerProFile::DontUpdateProFile;
m_updateSettings.insert(setting.first->proFilePath(),
updateSetting);
setting.first->setProFileUpdateSetting(updateSetting);
......@@ -112,23 +113,23 @@ void MaemoDeployables::createModels()
this, SLOT(startTimer(Qt4ProjectManager::Qt4ProFileNode*,bool,bool)));
}
void MaemoDeployables::createModels(const Qt4ProFileNode *proFileNode)
void DeploymentInfo::createModels(const Qt4ProFileNode *proFileNode)
{
switch (proFileNode->projectType()) {
case ApplicationTemplate:
case LibraryTemplate:
case AuxTemplate: {
MaemoDeployableListModel::ProFileUpdateSetting updateSetting;
DeployableFilesPerProFile::ProFileUpdateSetting updateSetting;
if (proFileNode->projectType() == AuxTemplate) {
updateSetting = MaemoDeployableListModel::DontUpdateProFile;
updateSetting = DeployableFilesPerProFile::DontUpdateProFile;
} else {
UpdateSettingsMap::ConstIterator it
= m_updateSettings.find(proFileNode->path());
updateSetting = it != m_updateSettings.end()
? it.value() : MaemoDeployableListModel::AskToUpdateProFile;
? it.value() : DeployableFilesPerProFile::AskToUpdateProFile;
}
MaemoDeployableListModel *const newModel
= new MaemoDeployableListModel(m_target, proFileNode, updateSetting, this);
DeployableFilesPerProFile *const newModel
= new DeployableFilesPerProFile(m_target, proFileNode, updateSetting, this);
m_listModels << newModel;
break;
}
......@@ -148,32 +149,32 @@ void MaemoDeployables::createModels(const Qt4ProFileNode *proFileNode)
}
}
void MaemoDeployables::setUnmodified()
void DeploymentInfo::setUnmodified()
{
foreach (MaemoDeployableListModel *model, m_listModels)
foreach (DeployableFilesPerProFile *model, m_listModels)
model->setUnModified();
}
bool MaemoDeployables::isModified() const
bool DeploymentInfo::isModified() const
{
foreach (const MaemoDeployableListModel *model, m_listModels) {
foreach (const DeployableFilesPerProFile *model, m_listModels) {
if (model->isModified())
return true;
}
return false;
}
int MaemoDeployables::deployableCount() const
int DeploymentInfo::deployableCount() const
{
int count = 0;
foreach (const MaemoDeployableListModel *model, m_listModels)
foreach (const DeployableFilesPerProFile *model, m_listModels)
count += model->rowCount();
return count;
}
MaemoDeployable MaemoDeployables::deployableAt(int i) const
DeployableFile DeploymentInfo::deployableAt(int i) const
{
foreach (const MaemoDeployableListModel *model, m_listModels) {
foreach (const DeployableFilesPerProFile *model, m_listModels) {
Q_ASSERT(i >= 0);
if (i < model->rowCount())
return model->deployableAt(i);
......@@ -181,29 +182,29 @@ MaemoDeployable MaemoDeployables::deployableAt(int i) const
}
Q_ASSERT(!"Invalid deployable number");
return MaemoDeployable(QString(), QString());
return DeployableFile(QString(), QString());
}
QString MaemoDeployables::remoteExecutableFilePath(const QString &localExecutableFilePath) const
QString DeploymentInfo::remoteExecutableFilePath(const QString &localExecutableFilePath) const
{