Fixing tons of application output

Master fixed a bug where a newline was almost always prepended to any
output. As a side effect of that a lot of messages which outputed no
newline broke. This commit fixes the obvious ones, probably missing a
few.
This commit is contained in:
dt
2011-04-12 19:42:25 +02:00
parent 82f3e788f6
commit 880813a3bc
10 changed files with 37 additions and 55 deletions

View File

@@ -248,12 +248,12 @@ void DebuggerRunControl::start()
d->m_engine->startDebugger(this); d->m_engine->startDebugger(this);
if (d->m_running) if (d->m_running)
appendMessage(tr("Debugging starts"), NormalMessageFormat); appendMessage(tr("Debugging starts\n"), NormalMessageFormat);
} }
void DebuggerRunControl::startFailed() void DebuggerRunControl::startFailed()
{ {
appendMessage(tr("Debugging has failed"), NormalMessageFormat); appendMessage(tr("Debugging has failed\n"), NormalMessageFormat);
d->m_running = false; d->m_running = false;
emit finished(); emit finished();
d->m_engine->handleStartFailed(); d->m_engine->handleStartFailed();
@@ -261,7 +261,7 @@ void DebuggerRunControl::startFailed()
void DebuggerRunControl::handleFinished() void DebuggerRunControl::handleFinished()
{ {
appendMessage(tr("Debugging has finished"), NormalMessageFormat); appendMessage(tr("Debugging has finished\n"), NormalMessageFormat);
if (d->m_engine) if (d->m_engine)
d->m_engine->handleFinished(); d->m_engine->handleFinished();
debuggerCore()->runControlFinished(d->m_engine); debuggerCore()->runControlFinished(d->m_engine);

View File

@@ -107,7 +107,7 @@ void LocalApplicationRunControl::start()
m_applicationLauncher.start(m_runMode, m_executable, m_commandLineArguments); m_applicationLauncher.start(m_runMode, m_executable, m_commandLineArguments);
emit started(); emit started();
QString msg = tr("Starting %1...").arg(QDir::toNativeSeparators(m_executable)); QString msg = tr("Starting %1...\n").arg(QDir::toNativeSeparators(m_executable));
appendMessage(msg, NormalMessageFormat); appendMessage(msg, NormalMessageFormat);
} }
@@ -135,7 +135,7 @@ void LocalApplicationRunControl::slotAppendMessage(const QString &err,
void LocalApplicationRunControl::processExited(int exitCode) void LocalApplicationRunControl::processExited(int exitCode)
{ {
QString msg = tr("%1 exited with code %2") QString msg = tr("%1 exited with code %2\n")
.arg(QDir::toNativeSeparators(m_executable)).arg(exitCode); .arg(QDir::toNativeSeparators(m_executable)).arg(exitCode);
appendMessage(msg, NormalMessageFormat); appendMessage(msg, NormalMessageFormat);
emit finished(); emit finished();

View File

@@ -97,7 +97,7 @@ void QmlRunControl::start()
m_commandLineArguments); m_commandLineArguments);
emit started(); emit started();
QString msg = tr("Starting %1 %2") QString msg = tr("Starting %1 %2\n")
.arg(QDir::toNativeSeparators(m_executable), m_commandLineArguments); .arg(QDir::toNativeSeparators(m_executable), m_commandLineArguments);
appendMessage(msg, NormalMessageFormat); appendMessage(msg, NormalMessageFormat);
} }
@@ -130,7 +130,7 @@ void QmlRunControl::slotAppendMessage(const QString &line, OutputFormat format)
void QmlRunControl::processExited(int exitCode) void QmlRunControl::processExited(int exitCode)
{ {
QString msg = tr("%1 exited with code %2") QString msg = tr("%1 exited with code %2\n")
.arg(QDir::toNativeSeparators(m_executable)).arg(exitCode); .arg(QDir::toNativeSeparators(m_executable)).arg(exitCode);
appendMessage(msg, exitCode ? ErrorMessageFormat : NormalMessageFormat); appendMessage(msg, exitCode ? ErrorMessageFormat : NormalMessageFormat);
emit finished(); emit finished();

View File

@@ -97,11 +97,11 @@ bool CodaRunControl::doStart()
{ {
if (m_address.isEmpty() && m_serialPort.isEmpty()) { if (m_address.isEmpty() && m_serialPort.isEmpty()) {
cancelProgress(); cancelProgress();
QString msg = tr("No device is connected. Please connect a device and try again."); QString msg = tr("No device is connected. Please connect a device and try again.\n");
appendMessage(msg, NormalMessageFormat); appendMessage(msg, NormalMessageFormat);
return false; return false;
} }
appendMessage(tr("Executable file: %1").arg(msgListFile(executableFileName())), appendMessage(tr("Executable file: %1\n").arg(msgListFile(executableFileName())),
NormalMessageFormat); NormalMessageFormat);
return true; return true;
} }
@@ -122,14 +122,14 @@ bool CodaRunControl::setupLauncher()
if (m_serialPort.length()) { if (m_serialPort.length()) {
// We get the port from SymbianDeviceManager // We get the port from SymbianDeviceManager
appendMessage(tr("Connecting to '%1'...").arg(m_serialPort), NormalMessageFormat); appendMessage(tr("Connecting to '%1'...\n").arg(m_serialPort), NormalMessageFormat);
m_codaDevice = SymbianUtils::SymbianDeviceManager::instance()->getCodaDevice(m_serialPort); m_codaDevice = SymbianUtils::SymbianDeviceManager::instance()->getCodaDevice(m_serialPort);
if (m_codaDevice.isNull()) { if (m_codaDevice.isNull()) {
appendMessage(tr("Unable to create CODA connection. Please try again."), ErrorMessageFormat); appendMessage(tr("Unable to create CODA connection. Please try again.\n"), ErrorMessageFormat);
return false; return false;
} }
if (!m_codaDevice->device()->isOpen()) { if (!m_codaDevice->device()->isOpen()) {
appendMessage(tr("Could not open serial device: %1").arg(m_codaDevice->device()->errorString()), ErrorMessageFormat); appendMessage(tr("Could not open serial device: %1\n").arg(m_codaDevice->device()->errorString()), ErrorMessageFormat);
return false; return false;
} }
connect(SymbianUtils::SymbianDeviceManager::instance(), SIGNAL(deviceRemoved(const SymbianUtils::SymbianDevice)), connect(SymbianUtils::SymbianDeviceManager::instance(), SIGNAL(deviceRemoved(const SymbianUtils::SymbianDevice)),
@@ -151,7 +151,7 @@ bool CodaRunControl::setupLauncher()
m_codaDevice->setDevice(codaSocket); m_codaDevice->setDevice(codaSocket);
codaSocket->connectToHost(m_address, m_port); codaSocket->connectToHost(m_address, m_port);
m_state = StateConnecting; m_state = StateConnecting;
appendMessage(tr("Connecting to %1:%2...").arg(m_address).arg(m_port), NormalMessageFormat); appendMessage(tr("Connecting to %1:%2...\n").arg(m_address).arg(m_port), NormalMessageFormat);
} }
QTimer::singleShot(5000, this, SLOT(checkForTimeout())); QTimer::singleShot(5000, this, SLOT(checkForTimeout()));
if (debug) if (debug)
@@ -178,7 +178,7 @@ void CodaRunControl::doStop()
void CodaRunControl::slotError(const QString &error) void CodaRunControl::slotError(const QString &error)
{ {
appendMessage(tr("Error: %1").arg(error), ErrorMessageFormat); appendMessage(tr("Error: %1\n").arg(error), ErrorMessageFormat);
finishRunControl(); finishRunControl();
} }
@@ -238,7 +238,7 @@ void CodaRunControl::handleConnected()
if (m_state >= StateConnected) if (m_state >= StateConnected)
return; return;
m_state = StateConnected; m_state = StateConnected;
appendMessage(tr("Connected."), NormalMessageFormat); appendMessage(tr("Connected.\n"), NormalMessageFormat);
setProgress(maxProgress()*0.80); setProgress(maxProgress()*0.80);
initCommunication(); initCommunication();
} }
@@ -249,7 +249,7 @@ void CodaRunControl::handleContextRemoved(const CodaEvent &event)
= static_cast<const CodaRunControlContextRemovedEvent &>(event).ids(); = static_cast<const CodaRunControlContextRemovedEvent &>(event).ids();
if (!m_runningProcessId.isEmpty() if (!m_runningProcessId.isEmpty()
&& removedItems.contains(m_runningProcessId.toAscii())) { && removedItems.contains(m_runningProcessId.toAscii())) {
appendMessage(tr("Process has finished."), NormalMessageFormat); appendMessage(tr("Process has finished.\n"), NormalMessageFormat);
finishRunControl(); finishRunControl();
} }
} }
@@ -274,7 +274,7 @@ void CodaRunControl::handleContextSuspended(const CodaEvent &event)
switch (me.reason()) { switch (me.reason()) {
case TcfSuspendEvent::Other: case TcfSuspendEvent::Other:
case TcfSuspendEvent::Crash: case TcfSuspendEvent::Crash:
appendMessage(tr("Thread has crashed: %1").arg(QString::fromLatin1(me.message())), ErrorMessageFormat); appendMessage(tr("Thread has crashed: %1\n").arg(QString::fromLatin1(me.message())), ErrorMessageFormat);
if (me.reason() == TcfSuspendEvent::Crash) if (me.reason() == TcfSuspendEvent::Crash)
stop(); stop();
@@ -316,7 +316,7 @@ void CodaRunControl::handleFindProcesses(const CodaCommandResult &result)
{ {
if (result.values.size() && result.values.at(0).type() == JsonValue::Array && result.values.at(0).children().count()) { if (result.values.size() && result.values.at(0).type() == JsonValue::Array && result.values.at(0).children().count()) {
//there are processes running. Cannot run mine //there are processes running. Cannot run mine
appendMessage(tr("The process is already running on the device. Please first close it."), ErrorMessageFormat); appendMessage(tr("The process is already running on the device. Please first close it.\n"), ErrorMessageFormat);
finishRunControl(); finishRunControl();
} else { } else {
setProgress(maxProgress()*0.90); setProgress(maxProgress()*0.90);
@@ -326,7 +326,7 @@ void CodaRunControl::handleFindProcesses(const CodaCommandResult &result)
commandLineArguments().split(' '), commandLineArguments().split(' '),
QString(), QString(),
true); true);
appendMessage(tr("Launching: %1").arg(executableName()), NormalMessageFormat); appendMessage(tr("Launching: %1\n").arg(executableName()), NormalMessageFormat);
} }
} }
@@ -335,9 +335,9 @@ void CodaRunControl::handleCreateProcess(const CodaCommandResult &result)
const bool ok = result.type == CodaCommandResult::SuccessReply; const bool ok = result.type == CodaCommandResult::SuccessReply;
if (ok) { if (ok) {
setProgress(maxProgress()); setProgress(maxProgress());
appendMessage(tr("Launched."), NormalMessageFormat); appendMessage(tr("Launched.\n"), NormalMessageFormat);
} else { } else {
appendMessage(tr("Launch failed: %1").arg(result.toString()), ErrorMessageFormat); appendMessage(tr("Launch failed: %1\n").arg(result.toString()), ErrorMessageFormat);
finishRunControl(); finishRunControl();
} }
} }
@@ -381,14 +381,14 @@ void CodaRunControl::cancelConnection()
return; return;
stop(); stop();
appendMessage(tr("Canceled."), ErrorMessageFormat); appendMessage(tr("Canceled.\n"), ErrorMessageFormat);
emit finished(); emit finished();
} }
void CodaRunControl::deviceRemoved(const SymbianUtils::SymbianDevice &device) void CodaRunControl::deviceRemoved(const SymbianUtils::SymbianDevice &device)
{ {
if (m_codaDevice && device.portName() == m_serialPort) { if (m_codaDevice && device.portName() == m_serialPort) {
QString msg = tr("The device '%1' has been disconnected").arg(device.friendlyName()); QString msg = tr("The device '%1' has been disconnected.\n").arg(device.friendlyName());
appendMessage(msg, ErrorMessageFormat); appendMessage(msg, ErrorMessageFormat);
finishRunControl(); finishRunControl();
} }

View File

@@ -498,7 +498,7 @@ S60DeviceDebugRunControl::S60DeviceDebugRunControl(S60DeviceRunConfiguration *rc
Debugger::DebuggerRunControl(rc, sp, masterSlaveEngineTypes) Debugger::DebuggerRunControl(rc, sp, masterSlaveEngineTypes)
{ {
if (startParameters().symbolFileName.isEmpty()) { if (startParameters().symbolFileName.isEmpty()) {
const QString msg = tr("Warning: Cannot locate the symbol file belonging to %1."). const QString msg = tr("Warning: Cannot locate the symbol file belonging to %1.\n").
arg(rc->localExecutableFileName()); arg(rc->localExecutableFileName());
appendMessage(msg, ErrorMessageFormat); appendMessage(msg, ErrorMessageFormat);
} }
@@ -506,7 +506,7 @@ S60DeviceDebugRunControl::S60DeviceDebugRunControl(S60DeviceRunConfiguration *rc
void S60DeviceDebugRunControl::start() void S60DeviceDebugRunControl::start()
{ {
appendMessage(tr("Launching debugger..."), NormalMessageFormat); appendMessage(tr("Launching debugger...\n"), NormalMessageFormat);
Debugger::DebuggerRunControl::start(); Debugger::DebuggerRunControl::start();
} }
@@ -516,14 +516,6 @@ bool S60DeviceDebugRunControl::promptToStop(bool *) const
return Debugger::DebuggerRunControl::promptToStop(0); return Debugger::DebuggerRunControl::promptToStop(0);
} }
void S60DeviceDebugRunControl::appendMessage(const QString &msg, ProjectExplorer::OutputFormat format, bool addNewLine)
{
if (addNewLine)
RunControl::appendMessage(msg + '\n', format);
else
RunControl::appendMessage(msg, format);
}
S60DeviceDebugRunControlFactory::S60DeviceDebugRunControlFactory(QObject *parent) : S60DeviceDebugRunControlFactory::S60DeviceDebugRunControlFactory(QObject *parent) :
IRunControlFactory(parent) IRunControlFactory(parent)
{ {

View File

@@ -140,7 +140,6 @@ public:
const QPair<Debugger::DebuggerEngineType, Debugger::DebuggerEngineType> &masterSlaveEngineTypes); const QPair<Debugger::DebuggerEngineType, Debugger::DebuggerEngineType> &masterSlaveEngineTypes);
virtual void start(); virtual void start();
virtual bool promptToStop(bool *optionalPrompt = 0) const; virtual bool promptToStop(bool *optionalPrompt = 0) const;
virtual void appendMessage(const QString &msg, ProjectExplorer::OutputFormat format, bool addNewLine=true);
}; };
class S60DeviceDebugRunControlFactory : public ProjectExplorer::IRunControlFactory class S60DeviceDebugRunControlFactory : public ProjectExplorer::IRunControlFactory

View File

@@ -356,7 +356,7 @@ void S60EmulatorRunControl::start()
m_applicationLauncher.start(ApplicationLauncher::Gui, m_executable, QString()); m_applicationLauncher.start(ApplicationLauncher::Gui, m_executable, QString());
emit started(); emit started();
QString msg = tr("Starting %1...").arg(QDir::toNativeSeparators(m_executable)); QString msg = tr("Starting %1...\n").arg(QDir::toNativeSeparators(m_executable));
appendMessage(msg, NormalMessageFormat); appendMessage(msg, NormalMessageFormat);
} }
@@ -393,7 +393,7 @@ void S60EmulatorRunControl::slotAppendMessage(const QString &line, OutputFormat
void S60EmulatorRunControl::processExited(int exitCode) void S60EmulatorRunControl::processExited(int exitCode)
{ {
QString msg = tr("%1 exited with code %2"); QString msg = tr("%1 exited with code %2\n");
appendMessage(msg, exitCode ? ErrorMessageFormat : NormalMessageFormat); appendMessage(msg, exitCode ? ErrorMessageFormat : NormalMessageFormat);
emit finished(); emit finished();
} }

View File

@@ -115,7 +115,7 @@ void S60RunControlBase::start()
if (m_runSmartInstaller) { //Smart Installer does the running by itself if (m_runSmartInstaller) { //Smart Installer does the running by itself
cancelProgress(); cancelProgress();
appendMessage(tr("Please finalise the installation on your device."), NormalMessageFormat); appendMessage(tr("Please finalise the installation on your device.\n"), NormalMessageFormat);
emit finished(); emit finished();
return; return;
} }
@@ -168,7 +168,7 @@ void S60RunControlBase::startLaunching()
void S60RunControlBase::handleFinished() void S60RunControlBase::handleFinished()
{ {
appendMessage(tr("Finished."), NormalMessageFormat); appendMessage(tr("Finished.\n"), NormalMessageFormat);
} }
void S60RunControlBase::setProgress(int value) void S60RunControlBase::setProgress(int value)
@@ -252,11 +252,3 @@ char S60RunControlBase::installationDrive() const
{ {
return m_installationDrive; return m_installationDrive;
} }
void S60RunControlBase::appendMessage(const QString &msg, ProjectExplorer::OutputFormat format, bool addNewLine)
{
if (addNewLine)
RunControl::appendMessage(msg + '\n', format);
else
RunControl::appendMessage(msg, format);
}

View File

@@ -81,7 +81,6 @@ private:
protected slots: protected slots:
void reportLaunchFinished(); void reportLaunchFinished();
void appendMessage(const QString &msg, ProjectExplorer::OutputFormat format, bool addNewLine=true);
private slots: private slots:
void handleFinished(); void handleFinished();

View File

@@ -83,12 +83,12 @@ bool TrkRunControl::doStart()
{ {
if (m_serialPortName.isEmpty()) { if (m_serialPortName.isEmpty()) {
cancelProgress(); cancelProgress();
QString msg = tr("No device is connected. Please connect a device and try again."); QString msg = tr("No device is connected. Please connect a device and try again.\n");
appendMessage(msg, NormalMessageFormat); appendMessage(msg, NormalMessageFormat);
return false; return false;
} }
appendMessage(tr("Executable file: %1").arg(msgListFile(executableFileName())), appendMessage(tr("Executable file: %1\n").arg(msgListFile(executableFileName())),
NormalMessageFormat); NormalMessageFormat);
return true; return true;
} }
@@ -149,7 +149,7 @@ void TrkRunControl::doStop()
void TrkRunControl::printConnectFailed(const QString &errorMessage) void TrkRunControl::printConnectFailed(const QString &errorMessage)
{ {
appendMessage(tr("Could not connect to App TRK on device: %1. Restarting App TRK might help.").arg(errorMessage), appendMessage(tr("Could not connect to App TRK on device: %1. Restarting App TRK might help.\n").arg(errorMessage),
ErrorMessageFormat); ErrorMessageFormat);
} }
@@ -194,7 +194,7 @@ void TrkRunControl::slotWaitingForTrkClosed()
{ {
if (m_launcher && m_launcher->state() == trk::Launcher::WaitingForTrk) { if (m_launcher && m_launcher->state() == trk::Launcher::WaitingForTrk) {
stop(); stop();
appendMessage(tr("Canceled."), ErrorMessageFormat); appendMessage(tr("Canceled.\n"), ErrorMessageFormat);
emit finished(); emit finished();
} }
} }
@@ -215,7 +215,7 @@ void TrkRunControl::deviceRemoved(const SymbianUtils::SymbianDevice &d)
trk::Launcher::releaseToDeviceManager(m_launcher); trk::Launcher::releaseToDeviceManager(m_launcher);
m_launcher->deleteLater(); m_launcher->deleteLater();
m_launcher = 0; m_launcher = 0;
QString msg = tr("The device '%1' has been disconnected").arg(d.friendlyName()); QString msg = tr("The device '%1' has been disconnected.\n").arg(d.friendlyName());
appendMessage(msg, ErrorMessageFormat); appendMessage(msg, ErrorMessageFormat);
emit finished(); emit finished();
} }
@@ -233,16 +233,16 @@ void TrkRunControl::initLauncher(const QString &executable, trk::Launcher *launc
void TrkRunControl::printStartingNotice() void TrkRunControl::printStartingNotice()
{ {
appendMessage(tr("Starting application..."), NormalMessageFormat); appendMessage(tr("Starting application...\n"), NormalMessageFormat);
} }
void TrkRunControl::applicationRunNotice(uint pid) void TrkRunControl::applicationRunNotice(uint pid)
{ {
appendMessage(tr("Application running with pid %1.").arg(pid), NormalMessageFormat); appendMessage(tr("Application running with pid %1.\n").arg(pid), NormalMessageFormat);
setProgress(maxProgress()); setProgress(maxProgress());
} }
void TrkRunControl::applicationRunFailedNotice(const QString &errorMessage) void TrkRunControl::applicationRunFailedNotice(const QString &errorMessage)
{ {
appendMessage(tr("Could not start application: %1").arg(errorMessage), NormalMessageFormat); appendMessage(tr("Could not start application: %1\n").arg(errorMessage), NormalMessageFormat);
} }