Commit a6cc0641 authored by Christian Kandeler's avatar Christian Kandeler
Browse files

RemoteLinux: Rename MaemoPackageUploader.

There is no Maemo dependency in this class.
Also use better assertions.

Change-Id: I28f055e35f17ed41535fd76a45fe1a06b9567953
Reviewed-on: http://codereview.qt.nokia.com/1868

Reviewed-by: default avatarChristian Kandeler <christian.kandeler@nokia.com>
parent b7786925
......@@ -33,7 +33,7 @@
#include "deployablefile.h"
#include "linuxdeviceconfiguration.h"
#include "maemopackageuploader.h"
#include "packageuploader.h"
#include "remotelinuxpackageinstaller.h"
#include <utils/qtcassert.h>
......@@ -52,13 +52,13 @@ class AbstractUploadAndInstallPackageServicePrivate
{
public:
AbstractUploadAndInstallPackageServicePrivate()
: state(Inactive), uploader(new MaemoPackageUploader)
: state(Inactive), uploader(new PackageUploader)
{
}
~AbstractUploadAndInstallPackageServicePrivate() { delete uploader; }
State state;
MaemoPackageUploader * const uploader;
PackageUploader * const uploader;
QString packageFilePath;
};
......
......@@ -30,33 +30,31 @@
**
**************************************************************************/
#include "maemopackageuploader.h"
#include "maemoglobal.h"
#include "packageuploader.h"
#include <utils/qtcassert.h>
#include <utils/ssh/sftpchannel.h>
#include <utils/ssh/sshconnection.h>
#define ASSERT_STATE(state) ASSERT_STATE_GENERIC(State, state, m_state)
using namespace Utils;
namespace RemoteLinux {
namespace Internal {
MaemoPackageUploader::MaemoPackageUploader(QObject *parent) :
PackageUploader::PackageUploader(QObject *parent) :
QObject(parent), m_state(Inactive)
{
}
MaemoPackageUploader::~MaemoPackageUploader()
PackageUploader::~PackageUploader()
{
}
void MaemoPackageUploader::uploadPackage(const SshConnection::Ptr &connection,
void PackageUploader::uploadPackage(const SshConnection::Ptr &connection,
const QString &localFilePath, const QString &remoteFilePath)
{
ASSERT_STATE(Inactive);
QTC_ASSERT(m_state == Inactive, return);
setState(InitializingSftp);
emit progress(tr("Preparing SFTP connection..."));
......@@ -75,14 +73,14 @@ void MaemoPackageUploader::uploadPackage(const SshConnection::Ptr &connection,
m_uploader->initialize();
}
void MaemoPackageUploader::cancelUpload()
void PackageUploader::cancelUpload()
{
ASSERT_STATE(QList<State>() << InitializingSftp << Uploading);
QTC_ASSERT(m_state == InitializingSftp || m_state == Uploading, return);
cleanup();
}
void MaemoPackageUploader::handleConnectionFailure()
void PackageUploader::handleConnectionFailure()
{
if (m_state == Inactive)
return;
......@@ -92,9 +90,10 @@ void MaemoPackageUploader::handleConnectionFailure()
emit uploadFinished(tr("Connection failed: %1").arg(errorMsg));
}
void MaemoPackageUploader::handleSftpChannelInitializationFailed(const QString &errorMsg)
void PackageUploader::handleSftpChannelInitializationFailed(const QString &errorMsg)
{
ASSERT_STATE(QList<State>() << InitializingSftp << Inactive);
QTC_ASSERT(m_state == InitializingSftp || m_state == Inactive, return);
if (m_state == Inactive)
return;
......@@ -102,9 +101,10 @@ void MaemoPackageUploader::handleSftpChannelInitializationFailed(const QString &
emit uploadFinished(tr("SFTP error: %1").arg(errorMsg));
}
void MaemoPackageUploader::handleSftpChannelInitialized()
void PackageUploader::handleSftpChannelInitialized()
{
ASSERT_STATE(QList<State>() << InitializingSftp << Inactive);
QTC_ASSERT(m_state == InitializingSftp || m_state == Inactive, return);
if (m_state == Inactive)
return;
......@@ -119,9 +119,10 @@ void MaemoPackageUploader::handleSftpChannelInitialized()
}
}
void MaemoPackageUploader::handleSftpJobFinished(SftpJobId, const QString &errorMsg)
void PackageUploader::handleSftpJobFinished(SftpJobId, const QString &errorMsg)
{
ASSERT_STATE(QList<State>() << Uploading << Inactive);
QTC_ASSERT(m_state == Uploading || m_state == Inactive, return);
if (m_state == Inactive)
return;
......@@ -132,13 +133,13 @@ void MaemoPackageUploader::handleSftpJobFinished(SftpJobId, const QString &error
cleanup();
}
void MaemoPackageUploader::cleanup()
void PackageUploader::cleanup()
{
m_uploader->closeChannel();
setState(Inactive);
}
void MaemoPackageUploader::setState(State newState)
void PackageUploader::setState(State newState)
{
if (m_state == newState)
return;
......
......@@ -30,8 +30,8 @@
**
**************************************************************************/
#ifndef MAEMOPACKAGEUPLOADER_H
#define MAEMOPACKAGEUPLOADER_H
#ifndef PACKAGEUPLOADER_H
#define PACKAGEUPLOADER_H
#include <QtCore/QObject>
#include <QtCore/QSharedPointer>
......@@ -47,12 +47,12 @@ class SshConnection;
namespace RemoteLinux {
namespace Internal {
class MaemoPackageUploader : public QObject
class PackageUploader : public QObject
{
Q_OBJECT
public:
explicit MaemoPackageUploader(QObject *parent = 0);
~MaemoPackageUploader();
explicit PackageUploader(QObject *parent = 0);
~PackageUploader();
// Connection has to be established already.
void uploadPackage(const QSharedPointer<Utils::SshConnection> &connection,
......@@ -85,4 +85,4 @@ private:
} // namespace Internal
} // namespace RemoteLinux
#endif // MAEMOPACKAGEUPLOADER_H
#endif // PACKAGEUPLOADER_H
......@@ -54,7 +54,6 @@ HEADERS += \
maemodeployconfigurationwidget.h \
maemoinstalltosysrootstep.h \
maemodeploymentmounter.h \
maemopackageuploader.h \
maemopackageinstaller.h \
maemoremotecopyfacility.h \
maemoqtversionfactory.h \
......@@ -92,7 +91,8 @@ HEADERS += \
genericremotelinuxdeploystepfactory.h \
abstractpackagingstep.h \
tarpackagecreationstep.h \
remotelinuxpackageinstaller.h
remotelinuxpackageinstaller.h \
packageuploader.h
SOURCES += \
remotelinuxplugin.cpp \
......@@ -141,7 +141,6 @@ SOURCES += \
maemodeployconfigurationwidget.cpp \
maemoinstalltosysrootstep.cpp \
maemodeploymentmounter.cpp \
maemopackageuploader.cpp \
maemopackageinstaller.cpp \
maemoremotecopyfacility.cpp \
maemoqtversionfactory.cpp \
......@@ -178,7 +177,8 @@ SOURCES += \
genericremotelinuxdeploystepfactory.cpp \
abstractpackagingstep.cpp \
tarpackagecreationstep.cpp \
remotelinuxpackageinstaller.cpp
remotelinuxpackageinstaller.cpp \
packageuploader.cpp
FORMS += \
maemoconfigtestdialog.ui \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment