Progress bar for Launching for S60 sequence has been changed to behave like for other targets

Reviewed-by: Tobias Hunger
This commit is contained in:
Pawel Polanski
2010-08-13 08:48:02 +02:00
parent f9a69a5eee
commit cd5492eb14
2 changed files with 51 additions and 40 deletions

View File

@@ -660,38 +660,10 @@ bool S60DeviceRunControlBase::isRunning() const
void S60DeviceRunControlBase::startLaunching() void S60DeviceRunControlBase::startLaunching()
{ {
QString errorMessage; QString errorMessage;
bool success = false; if (setupLauncher(errorMessage)) {
do { if (m_deployProgress)
connect(SymbianUtils::SymbianDeviceManager::instance(), SIGNAL(deviceRemoved(const SymbianUtils::SymbianDevice)), m_deployProgress->setProgressValue(PROGRESS_MAX/2);
this, SLOT(deviceRemoved(SymbianUtils::SymbianDevice))); } else {
m_launcher = trk::Launcher::acquireFromDeviceManager(m_serialPortName, 0, &errorMessage);
if (!m_launcher)
break;
connect(m_launcher, SIGNAL(finished()), this, SLOT(launcherFinished()));
connect(m_launcher, SIGNAL(canNotConnect(QString)), this, SLOT(printConnectFailed(QString)));
connect(m_launcher, SIGNAL(stateChanged(int)), this, SLOT(slotLauncherStateChanged(int)));
connect(m_launcher, SIGNAL(processStopped(uint,uint,uint,QString)),
this, SLOT(processStopped(uint,uint,uint,QString)));
if (!m_commandLineArguments.isEmpty())
m_launcher->setCommandLineArgs(m_commandLineArguments);
const QString runFileName = QString::fromLatin1("%1:\\sys\\bin\\%2.exe").arg(m_installationDrive).arg(m_targetName);
initLauncher(runFileName, m_launcher);
const trk::PromptStartCommunicationResult src =
S60RunConfigBluetoothStarter::startCommunication(m_launcher->trkDevice(),
0, &errorMessage);
if (src != trk::PromptStartCommunicationConnected)
break;
if (!m_launcher->startServer(&errorMessage)) {
errorMessage = tr("Could not connect to phone on port '%1': %2\n"
"Check if the phone is connected and App TRK is running.").arg(m_serialPortName, errorMessage);
break;
}
success = true;
} while (false);
if (!success) {
if (!errorMessage.isEmpty()) if (!errorMessage.isEmpty())
appendMessage(this, errorMessage, true); appendMessage(this, errorMessage, true);
stop(); stop();
@@ -699,6 +671,39 @@ void S60DeviceRunControlBase::startLaunching()
} }
} }
bool S60DeviceRunControlBase::setupLauncher(QString &errorMessage)
{
connect(SymbianUtils::SymbianDeviceManager::instance(), SIGNAL(deviceRemoved(const SymbianUtils::SymbianDevice)),
this, SLOT(deviceRemoved(SymbianUtils::SymbianDevice)));
m_launcher = trk::Launcher::acquireFromDeviceManager(m_serialPortName, 0, &errorMessage);
if (!m_launcher)
return false;
connect(m_launcher, SIGNAL(finished()), this, SLOT(launcherFinished()));
connect(m_launcher, SIGNAL(canNotConnect(QString)), this, SLOT(printConnectFailed(QString)));
connect(m_launcher, SIGNAL(stateChanged(int)), this, SLOT(slotLauncherStateChanged(int)));
connect(m_launcher, SIGNAL(processStopped(uint,uint,uint,QString)),
this, SLOT(processStopped(uint,uint,uint,QString)));
if (!m_commandLineArguments.isEmpty())
m_launcher->setCommandLineArgs(m_commandLineArguments);
const QString runFileName = QString::fromLatin1("%1:\\sys\\bin\\%2.exe").arg(m_installationDrive).arg(m_targetName);
initLauncher(runFileName, m_launcher);
const trk::PromptStartCommunicationResult src =
S60RunConfigBluetoothStarter::startCommunication(m_launcher->trkDevice(),
0, &errorMessage);
if (src != trk::PromptStartCommunicationConnected)
return false;
if (!m_launcher->startServer(&errorMessage)) {
errorMessage = tr("Could not connect to phone on port '%1': %2\n"
"Check if the phone is connected and App TRK is running.").arg(m_serialPortName, errorMessage);
return false;
}
return true;
}
void S60DeviceRunControlBase::printConnectFailed(const QString &errorMessage) void S60DeviceRunControlBase::printConnectFailed(const QString &errorMessage)
{ {
emit appendMessage(this, tr("Could not connect to App TRK on device: %1. Restarting App TRK might help.").arg(errorMessage), true); emit appendMessage(this, tr("Could not connect to App TRK on device: %1. Restarting App TRK might help.").arg(errorMessage), true);
@@ -799,8 +804,8 @@ S60DeviceRunControl::S60DeviceRunControl(ProjectExplorer::RunConfiguration *runC
void S60DeviceRunControl::initLauncher(const QString &executable, trk::Launcher *launcher) void S60DeviceRunControl::initLauncher(const QString &executable, trk::Launcher *launcher)
{ {
connect(launcher, SIGNAL(startingApplication()), this, SLOT(printStartingNotice())); connect(launcher, SIGNAL(startingApplication()), this, SLOT(printStartingNotice()));
connect(launcher, SIGNAL(applicationRunning(uint)), this, SLOT(printRunNotice(uint))); connect(launcher, SIGNAL(applicationRunning(uint)), this, SLOT(applicationRunNotice(uint)));
connect(launcher, SIGNAL(canNotRun(QString)), this, SLOT(printRunFailNotice(QString))); connect(launcher, SIGNAL(canNotRun(QString)), this, SLOT(applicationRunFailedNotice(QString)));
connect(launcher, SIGNAL(applicationOutputReceived(QString)), this, SLOT(printApplicationOutput(QString))); connect(launcher, SIGNAL(applicationOutputReceived(QString)), this, SLOT(printApplicationOutput(QString)));
launcher->addStartupActions(trk::Launcher::ActionRun); launcher->addStartupActions(trk::Launcher::ActionRun);
launcher->setFileName(executable); launcher->setFileName(executable);
@@ -817,12 +822,15 @@ void S60DeviceRunControl::printStartingNotice()
emit appendMessage(this, tr("Starting application..."), false); emit appendMessage(this, tr("Starting application..."), false);
} }
void S60DeviceRunControl::printRunNotice(uint pid) void S60DeviceRunControl::applicationRunNotice(uint pid)
{ {
emit appendMessage(this, tr("Application running with pid %1.").arg(pid), false); emit appendMessage(this, tr("Application running with pid %1.").arg(pid), false);
if (m_deployProgress)
m_deployProgress->setProgressValue(PROGRESS_MAX);
} }
void S60DeviceRunControl::printRunFailNotice(const QString &errorMessage) { void S60DeviceRunControl::applicationRunFailedNotice(const QString &errorMessage)
{
emit appendMessage(this, tr("Could not start application: %1").arg(errorMessage), true); emit appendMessage(this, tr("Could not start application: %1").arg(errorMessage), true);
} }

View File

@@ -183,6 +183,7 @@ protected slots:
void printApplicationOutput(const QString &output, bool onStdErr); void printApplicationOutput(const QString &output, bool onStdErr);
void printApplicationOutput(const QString &output); void printApplicationOutput(const QString &output);
void deviceRemoved(const SymbianUtils::SymbianDevice &); void deviceRemoved(const SymbianUtils::SymbianDevice &);
void reportDeployFinished();
private slots: private slots:
void processStopped(uint pc, uint pid, uint tid, const QString& reason); void processStopped(uint pc, uint pid, uint tid, const QString& reason);
@@ -190,10 +191,13 @@ private slots:
void launcherFinished(); void launcherFinished();
void slotLauncherStateChanged(int); void slotLauncherStateChanged(int);
void slotWaitingForTrkClosed(); void slotWaitingForTrkClosed();
void reportDeployFinished();
protected:
QFutureInterface<void> *m_deployProgress;
private: private:
void startLaunching(); void startLaunching();
bool setupLauncher(QString &errorMessage);
ProjectExplorer::ToolChain::ToolChainType m_toolChain; ProjectExplorer::ToolChain::ToolChainType m_toolChain;
QString m_serialPortName; QString m_serialPortName;
@@ -205,7 +209,6 @@ private:
QString m_qtBinPath; QString m_qtBinPath;
bool m_releaseDeviceAfterLauncherFinish; bool m_releaseDeviceAfterLauncherFinish;
bool m_handleDeviceRemoval; bool m_handleDeviceRemoval;
QFutureInterface<void> *m_deployProgress;
trk::Launcher *m_launcher; trk::Launcher *m_launcher;
char m_installationDrive; char m_installationDrive;
}; };
@@ -223,8 +226,8 @@ protected:
private slots: private slots:
void printStartingNotice(); void printStartingNotice();
void printRunNotice(uint pid); void applicationRunNotice(uint pid);
void printRunFailNotice(const QString &errorMessage); void applicationRunFailedNotice(const QString &errorMessage);
private: private:
}; };