forked from qt-creator/qt-creator
Show Symbian deploy progress as real progress indicator.
Task-number: QTCREATORBUG-364
This commit is contained in:
@@ -41,6 +41,7 @@
|
|||||||
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/messagemanager.h>
|
#include <coreplugin/messagemanager.h>
|
||||||
|
#include <coreplugin/progressmanager/progressmanager.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
#include <utils/pathchooser.h>
|
#include <utils/pathchooser.h>
|
||||||
#include <projectexplorer/projectexplorerconstants.h>
|
#include <projectexplorer/projectexplorerconstants.h>
|
||||||
@@ -60,6 +61,13 @@ using namespace Qt4ProjectManager::Internal;
|
|||||||
|
|
||||||
enum { debug = 0 };
|
enum { debug = 0 };
|
||||||
|
|
||||||
|
static const int PROGRESS_PACKAGECREATED = 100;
|
||||||
|
static const int PROGRESS_PACKAGESIGNED = 200;
|
||||||
|
static const int PROGRESS_DEPLOYBASE = 200;
|
||||||
|
static const int PROGRESS_PACKAGEDEPLOYED = 300;
|
||||||
|
static const int PROGRESS_PACKAGEINSTALLED = 400;
|
||||||
|
static const int PROGRESS_MAX = 400;
|
||||||
|
|
||||||
// Format information about a file
|
// Format information about a file
|
||||||
static QString lsFile(const QString &f)
|
static QString lsFile(const QString &f)
|
||||||
{
|
{
|
||||||
@@ -415,6 +423,9 @@ S60DeviceRunControlBase::S60DeviceRunControlBase(RunConfiguration *runConfigurat
|
|||||||
m_signsis(0),
|
m_signsis(0),
|
||||||
m_launcher(0)
|
m_launcher(0)
|
||||||
{
|
{
|
||||||
|
// connect for automatically reporting the "finished deploy" state to the progress manager
|
||||||
|
connect(this, SIGNAL(finished()), this, SLOT(reportDeployFinished()));
|
||||||
|
|
||||||
connect(m_makesis, SIGNAL(readyReadStandardError()),
|
connect(m_makesis, SIGNAL(readyReadStandardError()),
|
||||||
this, SLOT(readStandardError()));
|
this, SLOT(readStandardError()));
|
||||||
connect(m_makesis, SIGNAL(readyReadStandardOutput()),
|
connect(m_makesis, SIGNAL(readyReadStandardOutput()),
|
||||||
@@ -490,6 +501,13 @@ S60DeviceRunControlBase::~S60DeviceRunControlBase()
|
|||||||
|
|
||||||
void S60DeviceRunControlBase::start()
|
void S60DeviceRunControlBase::start()
|
||||||
{
|
{
|
||||||
|
m_deployProgress = new QFutureInterface<void>;
|
||||||
|
Core::ICore::instance()->progressManager()->addTask(m_deployProgress->future(),
|
||||||
|
tr("Deploying"),
|
||||||
|
QLatin1String("Symbian.Deploy"));
|
||||||
|
m_deployProgress->setProgressRange(0, PROGRESS_MAX);
|
||||||
|
m_deployProgress->setProgressValue(0);
|
||||||
|
m_deployProgress->reportStarted();
|
||||||
emit started();
|
emit started();
|
||||||
if (m_serialPortName.isEmpty()) {
|
if (m_serialPortName.isEmpty()) {
|
||||||
error(this, tr("There is no device plugged in."));
|
error(this, tr("There is no device plugged in."));
|
||||||
@@ -609,6 +627,7 @@ void S60DeviceRunControlBase::makesisProcessFinished()
|
|||||||
emit finished();
|
emit finished();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
m_deployProgress->setProgressValue(PROGRESS_PACKAGECREATED);
|
||||||
switch (m_toolChain) {
|
switch (m_toolChain) {
|
||||||
case ProjectExplorer::ToolChain::GCCE_GNUPOC:
|
case ProjectExplorer::ToolChain::GCCE_GNUPOC:
|
||||||
case ProjectExplorer::ToolChain::RVCT_ARMV6_GNUPOC:
|
case ProjectExplorer::ToolChain::RVCT_ARMV6_GNUPOC:
|
||||||
@@ -650,6 +669,7 @@ void S60DeviceRunControlBase::signsisProcessFinished()
|
|||||||
stop();
|
stop();
|
||||||
emit finished();
|
emit finished();
|
||||||
} else {
|
} else {
|
||||||
|
m_deployProgress->setProgressValue(PROGRESS_PACKAGESIGNED);
|
||||||
startDeployment();
|
startDeployment();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -665,6 +685,7 @@ void S60DeviceRunControlBase::startDeployment()
|
|||||||
connect(m_launcher, SIGNAL(canNotCloseFile(QString,QString)), this, SLOT(printCloseFileFailed(QString,QString)));
|
connect(m_launcher, SIGNAL(canNotCloseFile(QString,QString)), this, SLOT(printCloseFileFailed(QString,QString)));
|
||||||
connect(m_launcher, SIGNAL(installingStarted()), this, SLOT(printInstallingNotice()));
|
connect(m_launcher, SIGNAL(installingStarted()), this, SLOT(printInstallingNotice()));
|
||||||
connect(m_launcher, SIGNAL(canNotInstall(QString,QString)), this, SLOT(printInstallFailed(QString,QString)));
|
connect(m_launcher, SIGNAL(canNotInstall(QString,QString)), this, SLOT(printInstallFailed(QString,QString)));
|
||||||
|
connect(m_launcher, SIGNAL(installingFinished()), this, SLOT(printInstallingFinished()));
|
||||||
connect(m_launcher, SIGNAL(copyProgress(int)), this, SLOT(printCopyProgress(int)));
|
connect(m_launcher, SIGNAL(copyProgress(int)), this, SLOT(printCopyProgress(int)));
|
||||||
connect(m_launcher, SIGNAL(stateChanged(int)), this, SLOT(slotLauncherStateChanged(int)));
|
connect(m_launcher, SIGNAL(stateChanged(int)), this, SLOT(slotLauncherStateChanged(int)));
|
||||||
|
|
||||||
@@ -733,14 +754,23 @@ void S60DeviceRunControlBase::printCopyingNotice()
|
|||||||
|
|
||||||
void S60DeviceRunControlBase::printCopyProgress(int progress)
|
void S60DeviceRunControlBase::printCopyProgress(int progress)
|
||||||
{
|
{
|
||||||
emit addToOutputWindow(this, tr("%1% copied.").arg(progress));
|
m_deployProgress->setProgressValue(PROGRESS_DEPLOYBASE + progress);
|
||||||
}
|
}
|
||||||
|
|
||||||
void S60DeviceRunControlBase::printInstallingNotice()
|
void S60DeviceRunControlBase::printInstallingNotice()
|
||||||
{
|
{
|
||||||
|
m_deployProgress->setProgressValue(PROGRESS_PACKAGEDEPLOYED);
|
||||||
emit addToOutputWindow(this, tr("Installing application..."));
|
emit addToOutputWindow(this, tr("Installing application..."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void S60DeviceRunControlBase::printInstallingFinished()
|
||||||
|
{
|
||||||
|
m_deployProgress->setProgressValue(PROGRESS_PACKAGEINSTALLED);
|
||||||
|
m_deployProgress->reportFinished();
|
||||||
|
delete m_deployProgress;
|
||||||
|
m_deployProgress = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void S60DeviceRunControlBase::printInstallFailed(const QString &filename, const QString &errorMessage)
|
void S60DeviceRunControlBase::printInstallFailed(const QString &filename, const QString &errorMessage)
|
||||||
{
|
{
|
||||||
emit addToOutputWindow(this, tr("Could not install from package %1 on device: %2").arg(filename, errorMessage));
|
emit addToOutputWindow(this, tr("Could not install from package %1 on device: %2").arg(filename, errorMessage));
|
||||||
@@ -753,6 +783,15 @@ void S60DeviceRunControlBase::launcherFinished()
|
|||||||
handleLauncherFinished();
|
handleLauncherFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void S60DeviceRunControlBase::reportDeployFinished()
|
||||||
|
{
|
||||||
|
if (m_deployProgress) {
|
||||||
|
m_deployProgress->reportFinished();
|
||||||
|
delete m_deployProgress;
|
||||||
|
m_deployProgress = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QMessageBox *S60DeviceRunControlBase::createTrkWaitingMessageBox(const QString &port, QWidget *parent)
|
QMessageBox *S60DeviceRunControlBase::createTrkWaitingMessageBox(const QString &port, QWidget *parent)
|
||||||
{
|
{
|
||||||
const QString title = QCoreApplication::translate("Qt4ProjectManager::Internal::S60DeviceRunControlBase",
|
const QString title = QCoreApplication::translate("Qt4ProjectManager::Internal::S60DeviceRunControlBase",
|
||||||
|
@@ -36,6 +36,7 @@
|
|||||||
#include <projectexplorer/toolchain.h>
|
#include <projectexplorer/toolchain.h>
|
||||||
|
|
||||||
#include <QtCore/QProcess>
|
#include <QtCore/QProcess>
|
||||||
|
#include <QtCore/QFutureInterface>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QMessageBox;
|
class QMessageBox;
|
||||||
@@ -176,9 +177,11 @@ private slots:
|
|||||||
void printCopyProgress(int progress);
|
void printCopyProgress(int progress);
|
||||||
void printInstallingNotice();
|
void printInstallingNotice();
|
||||||
void printInstallFailed(const QString &filename, const QString &errorMessage);
|
void printInstallFailed(const QString &filename, const QString &errorMessage);
|
||||||
|
void printInstallingFinished();
|
||||||
void launcherFinished();
|
void launcherFinished();
|
||||||
void slotLauncherStateChanged(int);
|
void slotLauncherStateChanged(int);
|
||||||
void slotWaitingForTrkClosed();
|
void slotWaitingForTrkClosed();
|
||||||
|
void reportDeployFinished();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool createPackageFileFromTemplate(QString *errorMessage);
|
bool createPackageFileFromTemplate(QString *errorMessage);
|
||||||
@@ -207,6 +210,7 @@ private:
|
|||||||
QString m_makesisTool;
|
QString m_makesisTool;
|
||||||
QString m_packageFile;
|
QString m_packageFile;
|
||||||
|
|
||||||
|
QFutureInterface<void> *m_deployProgress;
|
||||||
trk::Launcher *m_launcher;
|
trk::Launcher *m_launcher;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -640,7 +640,11 @@ void Launcher::handleInstallPackageFinished(const TrkResult &result)
|
|||||||
if (result.errorCode()) {
|
if (result.errorCode()) {
|
||||||
emit canNotInstall(d->m_installFileName, result.errorString());
|
emit canNotInstall(d->m_installFileName, result.errorString());
|
||||||
disconnectTrk();
|
disconnectTrk();
|
||||||
} else if (d->m_startupActions & ActionRun) {
|
return;
|
||||||
|
} else {
|
||||||
|
emit installingFinished();
|
||||||
|
}
|
||||||
|
if (d->m_startupActions & ActionRun) {
|
||||||
startInferiorIfNeeded();
|
startInferiorIfNeeded();
|
||||||
} else {
|
} else {
|
||||||
disconnectTrk();
|
disconnectTrk();
|
||||||
|
@@ -103,6 +103,7 @@ signals:
|
|||||||
void canNotCloseFile(const QString &filename, const QString &errorMessage);
|
void canNotCloseFile(const QString &filename, const QString &errorMessage);
|
||||||
void installingStarted();
|
void installingStarted();
|
||||||
void canNotInstall(const QString &packageFilename, const QString &errorMessage);
|
void canNotInstall(const QString &packageFilename, const QString &errorMessage);
|
||||||
|
void installingFinished();
|
||||||
void startingApplication();
|
void startingApplication();
|
||||||
void applicationRunning(uint pid);
|
void applicationRunning(uint pid);
|
||||||
void canNotRun(const QString &errorMessage);
|
void canNotRun(const QString &errorMessage);
|
||||||
|
Reference in New Issue
Block a user