summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp7
-rw-r--r--src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h1
-rw-r--r--src/shared/trk/launcher.cpp38
-rw-r--r--src/shared/trk/launcher.h4
4 files changed, 34 insertions, 16 deletions
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp
index b6ab4402e5..ef43573482 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp
+++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.cpp
@@ -628,6 +628,7 @@ void S60DeviceRunControlBase::signsisProcessFinished()
connect(m_launcher, SIGNAL(finished()), this, SLOT(launcherFinished()));
connect(m_launcher, SIGNAL(copyingStarted()), this, SLOT(printCopyingNotice()));
connect(m_launcher, SIGNAL(canNotCreateFile(QString,QString)), this, SLOT(printCreateFileFailed(QString,QString)));
+ connect(m_launcher, SIGNAL(canNotWriteFile(QString,QString)), this, SLOT(printWriteFileFailed(QString,QString)));
connect(m_launcher, SIGNAL(installingStarted()), this, SLOT(printInstallingNotice()));
connect(m_launcher, SIGNAL(copyProgress(int)), this, SLOT(printCopyProgress(int)));
@@ -655,10 +656,14 @@ void S60DeviceRunControlBase::printCreateFileFailed(const QString &filename, con
emit addToOutputWindow(this, tr("Could not create file %1 on device: %2").arg(filename, errorMessage));
}
+void S60DeviceRunControlBase::printWriteFileFailed(const QString &filename, const QString &errorMessage)
+{
+ emit addToOutputWindow(this, tr("Could not write to file %1 on device: %2").arg(filename, errorMessage));
+}
+
void S60DeviceRunControlBase::printCopyingNotice()
{
emit addToOutputWindow(this, tr("Copying install file..."));
- emit addToOutputWindow(this, tr("0% copied."));
}
void S60DeviceRunControlBase::printCopyProgress(int progress)
diff --git a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h
index 274ab6a280..fd67e5431c 100644
--- a/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h
+++ b/src/plugins/qt4projectmanager/qt-s60/s60devicerunconfiguration.h
@@ -172,6 +172,7 @@ private slots:
void signsisProcessFinished();
void printCopyingNotice();
void printCreateFileFailed(const QString &filename, const QString &errorMessage);
+ void printWriteFileFailed(const QString &filename, const QString &errorMessage);
void printCopyProgress(int progress);
void printInstallingNotice();
void launcherFinished();
diff --git a/src/shared/trk/launcher.cpp b/src/shared/trk/launcher.cpp
index cfad2379d9..0c6a76deb3 100644
--- a/src/shared/trk/launcher.cpp
+++ b/src/shared/trk/launcher.cpp
@@ -299,7 +299,7 @@ void Launcher::handleTrkVersion(const TrkResult &result)
void Launcher::handleFileCreation(const TrkResult &result)
{
if (result.errorCode() || result.data.size() < 6) {
- emit canNotCreateFile(d->m_copyState.destinationFileName, errorMessage(result.errorCode()));
+ emit canNotCreateFile(d->m_copyState.destinationFileName, result.errorString());
emit finished();
return;
}
@@ -315,15 +315,19 @@ void Launcher::handleFileCreation(const TrkResult &result)
void Launcher::handleCopy(const TrkResult &result)
{
- Q_UNUSED(result)
-
- continueCopying();
+ if (result.errorCode() || result.data.size() < 4) {
+ closeRemoteFile(true);
+ emit canNotWriteFile(d->m_copyState.destinationFileName, result.errorString());
+ emit finished();
+ } else {
+ continueCopying(extractShort(result.data.data() + 2));
+ }
}
-void Launcher::continueCopying()
+void Launcher::continueCopying(uint lastCopiedBlockSize)
{
- static const int BLOCKSIZE = 1024;
int size = d->m_copyState.data->length();
+ d->m_copyState.position += lastCopiedBlockSize;
if (size == 0)
emit copyProgress(100);
else {
@@ -333,18 +337,24 @@ void Launcher::continueCopying()
if (d->m_copyState.position < size) {
QByteArray ba;
appendInt(&ba, d->m_copyState.copyFileHandle, TargetByteOrder);
- appendString(&ba, d->m_copyState.data->mid(d->m_copyState.position, BLOCKSIZE), TargetByteOrder, false);
- d->m_copyState.position += BLOCKSIZE;
+ appendString(&ba, d->m_copyState.data->mid(d->m_copyState.position, 2048), TargetByteOrder, false);
d->m_device.sendTrkMessage(TrkWriteFile, TrkCallback(this, &Launcher::handleCopy), ba);
} else {
- QByteArray ba;
- appendInt(&ba, d->m_copyState.copyFileHandle, TargetByteOrder);
- appendInt(&ba, QDateTime::currentDateTime().toTime_t(), TargetByteOrder);
- d->m_device.sendTrkMessage(TrkCloseFile, TrkCallback(this, &Launcher::handleFileCopied), ba);
- d->m_copyState.data.reset();
+ closeRemoteFile();
}
}
+void Launcher::closeRemoteFile(bool failed)
+{
+ QByteArray ba;
+ appendInt(&ba, d->m_copyState.copyFileHandle, TargetByteOrder);
+ appendInt(&ba, QDateTime::currentDateTime().toTime_t(), TargetByteOrder);
+ d->m_device.sendTrkMessage(TrkCloseFile,
+ failed ? TrkCallback() : TrkCallback(this, &Launcher::handleFileCopied),
+ ba);
+ d->m_copyState.data.reset();
+}
+
void Launcher::handleFileCopied(const TrkResult &result)
{
Q_UNUSED(result)
@@ -372,7 +382,7 @@ void Launcher::handleCpuType(const TrkResult &result)
void Launcher::handleCreateProcess(const TrkResult &result)
{
if (result.errorCode()) {
- emit canNotRun(errorMessage(result.errorCode()));
+ emit canNotRun(result.errorString());
emit finished();
return;
}
diff --git a/src/shared/trk/launcher.h b/src/shared/trk/launcher.h
index ec1048885c..9a33a57dbf 100644
--- a/src/shared/trk/launcher.h
+++ b/src/shared/trk/launcher.h
@@ -58,6 +58,7 @@ public:
signals:
void copyingStarted();
void canNotCreateFile(const QString &filename, const QString &errorMessage);
+ void canNotWriteFile(const QString &filename, const QString &errorMessage);
void installingStarted();
void startingApplication();
void applicationRunning(uint pid);
@@ -78,7 +79,8 @@ private:
void handleFileCreation(const TrkResult &result);
void handleCopy(const TrkResult &result);
- void continueCopying();
+ void continueCopying(uint lastCopiedBlockSize = 0);
+ void closeRemoteFile(bool failed = false);
void handleFileCopied(const TrkResult &result);
void handleInstallPackageFinished(const TrkResult &result);
void handleCpuType(const TrkResult &result);