diff options
author | Christian Kandeler <[email protected]> | 2012-08-22 16:52:38 +0200 |
---|---|---|
committer | Christian Kandeler <[email protected]> | 2012-08-24 15:44:03 +0200 |
commit | c7ebfd47a49c8cc2cfb8cb34ada73e32a8611bb0 (patch) | |
tree | 6045564559d9cb0a485016997616bd1a1ba14e0f /src/plugins/remotelinux/genericdirectuploadservice.cpp | |
parent | b80205c592cd3ecc768baba246b5e8df9a34c995 (diff) |
RemoteLinux: Remove dependency on Qt4ProjectManager.
Instead use the newly added abstractions from ProjectExplorer.
This makes the plugin qmake-independent in principle; any build system
can be used as long as the respective QtCreator plugin provides a way to
set up the required deployment information.
As a side effect of this patch, two features are lost:
(1) The ability to add a remote directory automatically for a
RemoteLinux based target. This was rarely ever useful, because any non-
trivial project requires more files to be deployed than just one binary.
(2) The ability to add Desktop files and icons for Fremantle and
Harmattan projects. Similar points as above apply here as well; such
projects should be set up via QtCreator's wizards or manually by users
who know what they are doing.
Change-Id: I2d7e621256f01143aafe3b191b04a120f053e672
Reviewed-by: Tobias Hunger <[email protected]>
Diffstat (limited to 'src/plugins/remotelinux/genericdirectuploadservice.cpp')
-rw-r--r-- | src/plugins/remotelinux/genericdirectuploadservice.cpp | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/src/plugins/remotelinux/genericdirectuploadservice.cpp b/src/plugins/remotelinux/genericdirectuploadservice.cpp index 1024d191914..01c9a2efd0a 100644 --- a/src/plugins/remotelinux/genericdirectuploadservice.cpp +++ b/src/plugins/remotelinux/genericdirectuploadservice.cpp @@ -29,8 +29,7 @@ **************************************************************************/ #include "genericdirectuploadservice.h" -#include "deployablefile.h" - +#include <projectexplorer/deployablefile.h> #include <utils/qtcassert.h> #include <ssh/sftpchannel.h> #include <ssh/sshconnection.h> @@ -41,6 +40,7 @@ #include <QList> #include <QString> +using namespace ProjectExplorer; using namespace QSsh; namespace RemoteLinux { @@ -163,8 +163,9 @@ void GenericDirectUploadService::handleUploadFinished(QSsh::SftpJobId jobId, con const DeployableFile df = d->filesToUpload.takeFirst(); if (!errorMsg.isEmpty()) { QString errorString = tr("Upload of file '%1' failed. The server said: '%2'.") - .arg(QDir::toNativeSeparators(df.localFilePath), errorMsg); - if (errorMsg == QLatin1String("Failure") && df.remoteDir.contains(QLatin1String("/bin"))) { + .arg(df.localFilePath().toUserOutput(), errorMsg); + if (errorMsg == QLatin1String("Failure") + && df.remoteDirectory().contains(QLatin1String("/bin"))) { errorString += QLatin1Char(' ') + tr("If '%1' is currently running " "on the remote host, you might need to stop it first.").arg(df.remoteFilePath()); } @@ -175,7 +176,7 @@ void GenericDirectUploadService::handleUploadFinished(QSsh::SftpJobId jobId, con saveDeploymentTimeStamp(df); // Terrible hack for Windows. - if (df.remoteDir.contains(QLatin1String("bin"))) { + if (df.remoteDirectory().contains(QLatin1String("bin"))) { const QString command = QLatin1String("chmod a+x ") + df.remoteFilePath(); connection()->createRemoteProcess(command.toUtf8())->start(); } @@ -194,7 +195,7 @@ void GenericDirectUploadService::handleLnFinished(int exitStatus) } const DeployableFile df = d->filesToUpload.takeFirst(); - const QString nativePath = QDir::toNativeSeparators(df.localFilePath); + const QString nativePath = df.localFilePath().toUserOutput(); if (exitStatus != SshRemoteProcess::NormalExit || d->lnProc->exitCode() != 0) { emit errorMessage(tr("Failed to upload file '%1'.").arg(nativePath)); setFinished(); @@ -216,8 +217,8 @@ void GenericDirectUploadService::handleMkdirFinished(int exitStatus) } const DeployableFile &df = d->filesToUpload.first(); - QFileInfo fi(df.localFilePath); - const QString nativePath = QDir::toNativeSeparators(df.localFilePath); + QFileInfo fi = df.localFilePath().toFileInfo(); + const QString nativePath = df.localFilePath().toUserOutput(); if (exitStatus != SshRemoteProcess::NormalExit || d->mkdirProc->exitCode() != 0) { emit errorMessage(tr("Failed to upload file '%1'.").arg(nativePath)); setFinished(); @@ -227,7 +228,7 @@ void GenericDirectUploadService::handleMkdirFinished(int exitStatus) d->filesToUpload.removeFirst(); uploadNextFile(); } else { - const QString remoteFilePath = df.remoteDir + QLatin1Char('/') + fi.fileName(); + const QString remoteFilePath = df.remoteDirectory() + QLatin1Char('/') + fi.fileName(); if (fi.isSymLink()) { const QString target = fi.dir().relativeFilePath(fi.symLinkTarget()); // see QTBUG-5817. const QString command = QLatin1String("ln -sf ") + target + QLatin1Char(' ') @@ -240,8 +241,8 @@ void GenericDirectUploadService::handleMkdirFinished(int exitStatus) connect(d->lnProc.data(), SIGNAL(readyReadStandardError()), SLOT(handleStdErrData())); d->lnProc->start(); } else { - const SftpJobId job = d->uploader->uploadFile(df.localFilePath, remoteFilePath, - SftpOverwriteExisting); + const SftpJobId job = d->uploader->uploadFile(df.localFilePath().toString(), + remoteFilePath, SftpOverwriteExisting); if (job == SftpInvalidJob) { emit errorMessage(tr("Failed to upload file '%1': " "Could not open for reading.").arg(nativePath)); @@ -276,16 +277,16 @@ void GenericDirectUploadService::stopDeployment() void GenericDirectUploadService::checkDeploymentNeeded(const DeployableFile &deployable) const { - QFileInfo fileInfo(deployable.localFilePath); + QFileInfo fileInfo = deployable.localFilePath().toFileInfo(); if (fileInfo.isDir()) { - const QStringList files = QDir(deployable.localFilePath) + const QStringList files = QDir(deployable.localFilePath().toString()) .entryList(QDir::Files | QDir::Dirs | QDir::NoDotAndDotDot); if (files.isEmpty() && (!d->incremental || hasChangedSinceLastDeployment(deployable))) d->filesToUpload << deployable; foreach (const QString &fileName, files) { - const QString localFilePath = deployable.localFilePath + const QString localFilePath = deployable.localFilePath().toString() + QLatin1Char('/') + fileName; - const QString remoteDir = deployable.remoteDir + QLatin1Char('/') + const QString remoteDir = deployable.remoteDirectory() + QLatin1Char('/') + fileInfo.fileName(); checkDeploymentNeeded(DeployableFile(localFilePath, remoteDir)); } @@ -318,16 +319,16 @@ void GenericDirectUploadService::uploadNextFile() } const DeployableFile &df = d->filesToUpload.first(); - QString dirToCreate = df.remoteDir; + QString dirToCreate = df.remoteDirectory(); if (dirToCreate.isEmpty()) { emit warningMessage(tr("Warning: No remote path set for local file '%1'. Skipping upload.") - .arg(QDir::toNativeSeparators(df.localFilePath))); + .arg(df.localFilePath().toUserOutput())); d->filesToUpload.takeFirst(); uploadNextFile(); return; } - QFileInfo fi(df.localFilePath); + QFileInfo fi = df.localFilePath().toFileInfo(); if (fi.isDir()) dirToCreate += QLatin1Char('/') + fi.fileName(); const QString command = QLatin1String("mkdir -p ") + dirToCreate; @@ -336,7 +337,7 @@ void GenericDirectUploadService::uploadNextFile() connect(d->mkdirProc.data(), SIGNAL(readyReadStandardOutput()), SLOT(handleStdOutData())); connect(d->mkdirProc.data(), SIGNAL(readyReadStandardError()), SLOT(handleStdErrData())); emit progressMessage(tr("Uploading file '%1'...") - .arg(QDir::toNativeSeparators(df.localFilePath))); + .arg(df.localFilePath().toUserOutput())); d->mkdirProc->start(); } |