maemo: use less direct accesses to debugger plugin code

This commit is contained in:
hjk
2011-01-06 19:26:57 +01:00
parent acab27448c
commit 747451dcc5
2 changed files with 14 additions and 9 deletions

View File

@@ -132,12 +132,18 @@ MaemoDebugSupport::~MaemoDebugSupport()
setState(Inactive); setState(Inactive);
} }
void MaemoDebugSupport::showMessage(const QString &msg, int channel)
{
if (m_runControl)
m_runControl->engine()->showMessage(msg, channel);
}
void MaemoDebugSupport::handleAdapterSetupRequested() void MaemoDebugSupport::handleAdapterSetupRequested()
{ {
ASSERT_STATE(Inactive); ASSERT_STATE(Inactive);
setState(StartingRunner); setState(StartingRunner);
m_runControl->showMessage(tr("Preparing remote side ..."), AppStuff); showMessage(tr("Preparing remote side ..."), AppStuff);
disconnect(m_runner, 0, this, 0); disconnect(m_runner, 0, this, 0);
connect(m_runner, SIGNAL(error(QString)), this, connect(m_runner, SIGNAL(error(QString)), this,
SLOT(handleSshError(QString))); SLOT(handleSshError(QString)));
@@ -151,7 +157,7 @@ void MaemoDebugSupport::handleAdapterSetupRequested()
void MaemoDebugSupport::handleSshError(const QString &error) void MaemoDebugSupport::handleSshError(const QString &error)
{ {
if (m_state == Debugging) { if (m_state == Debugging) {
m_runControl->showMessage(tr("SSH connection error: %1").arg(error), showMessage(tr("SSH connection error: %1").arg(error),
AppError); AppError);
} else if (m_state != Inactive) { } else if (m_state != Inactive) {
handleAdapterSetupFailed(error); handleAdapterSetupFailed(error);
@@ -211,7 +217,7 @@ void MaemoDebugSupport::handleSftpChannelInitialized()
.arg(m_dumperLib)); .arg(m_dumperLib));
} else { } else {
setState(UploadingDumpers); setState(UploadingDumpers);
m_runControl->showMessage(tr("Started uploading debugging helpers ('%1').") showMessage(tr("Started uploading debugging helpers ('%1').")
.arg(m_dumperLib), AppStuff); .arg(m_dumperLib), AppStuff);
} }
} }
@@ -246,7 +252,7 @@ void MaemoDebugSupport::handleSftpJobFinished(Core::SftpJobId job,
m_runConfig->deployStep()->setDeployed(m_runner->deviceConfig().server.host, m_runConfig->deployStep()->setDeployed(m_runner->deviceConfig().server.host,
MaemoDeployable(m_dumperLib, uploadDir(m_runner->deviceConfig()))); MaemoDeployable(m_dumperLib, uploadDir(m_runner->deviceConfig())));
} }
m_runControl->showMessage(tr("Finished uploading debugging helpers."), AppStuff); showMessage(tr("Finished uploading debugging helpers."), AppStuff);
startDebugging(); startDebugging();
} }
m_uploadJob = SftpInvalidJob; m_uploadJob = SftpInvalidJob;
@@ -289,8 +295,7 @@ void MaemoDebugSupport::handleDebuggingFinished()
void MaemoDebugSupport::handleRemoteOutput(const QByteArray &output) void MaemoDebugSupport::handleRemoteOutput(const QByteArray &output)
{ {
ASSERT_STATE(QList<State>() << Inactive << Debugging); ASSERT_STATE(QList<State>() << Inactive << Debugging);
if (m_runControl) showMessage(QString::fromUtf8(output), AppOutput);
m_runControl->showMessage(QString::fromUtf8(output), AppOutput);
} }
void MaemoDebugSupport::handleRemoteErrorOutput(const QByteArray &output) void MaemoDebugSupport::handleRemoteErrorOutput(const QByteArray &output)
@@ -300,7 +305,7 @@ void MaemoDebugSupport::handleRemoteErrorOutput(const QByteArray &output)
if (!m_runControl) if (!m_runControl)
return; return;
m_runControl->showMessage(QString::fromUtf8(output), AppOutput); showMessage(QString::fromUtf8(output), AppOutput);
if (m_state == StartingRemoteProcess if (m_state == StartingRemoteProcess
&& m_debuggingType != MaemoRunConfiguration::DebugQmlOnly) { && m_debuggingType != MaemoRunConfiguration::DebugQmlOnly) {
m_gdbserverOutput += output; m_gdbserverOutput += output;
@@ -313,8 +318,7 @@ void MaemoDebugSupport::handleRemoteErrorOutput(const QByteArray &output)
void MaemoDebugSupport::handleProgressReport(const QString &progressOutput) void MaemoDebugSupport::handleProgressReport(const QString &progressOutput)
{ {
if (m_runControl) showMessage(progressOutput, AppStuff);
m_runControl->showMessage(progressOutput, AppStuff);
} }
void MaemoDebugSupport::handleAdapterSetupFailed(const QString &error) void MaemoDebugSupport::handleAdapterSetupFailed(const QString &error)

View File

@@ -98,6 +98,7 @@ private:
void setState(State newState); void setState(State newState);
bool setPort(int &port); bool setPort(int &port);
void showMessage(const QString &msg, int channel);
const QPointer<Debugger::DebuggerRunControl> m_runControl; const QPointer<Debugger::DebuggerRunControl> m_runControl;
const QPointer<MaemoRunConfiguration> m_runConfig; const QPointer<MaemoRunConfiguration> m_runConfig;
MaemoSshRunner * const m_runner; MaemoSshRunner * const m_runner;