forked from qt-creator/qt-creator
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:
@@ -248,12 +248,12 @@ void DebuggerRunControl::start()
|
||||
d->m_engine->startDebugger(this);
|
||||
|
||||
if (d->m_running)
|
||||
appendMessage(tr("Debugging starts"), NormalMessageFormat);
|
||||
appendMessage(tr("Debugging starts\n"), NormalMessageFormat);
|
||||
}
|
||||
|
||||
void DebuggerRunControl::startFailed()
|
||||
{
|
||||
appendMessage(tr("Debugging has failed"), NormalMessageFormat);
|
||||
appendMessage(tr("Debugging has failed\n"), NormalMessageFormat);
|
||||
d->m_running = false;
|
||||
emit finished();
|
||||
d->m_engine->handleStartFailed();
|
||||
@@ -261,7 +261,7 @@ void DebuggerRunControl::startFailed()
|
||||
|
||||
void DebuggerRunControl::handleFinished()
|
||||
{
|
||||
appendMessage(tr("Debugging has finished"), NormalMessageFormat);
|
||||
appendMessage(tr("Debugging has finished\n"), NormalMessageFormat);
|
||||
if (d->m_engine)
|
||||
d->m_engine->handleFinished();
|
||||
debuggerCore()->runControlFinished(d->m_engine);
|
||||
|
@@ -107,7 +107,7 @@ void LocalApplicationRunControl::start()
|
||||
m_applicationLauncher.start(m_runMode, m_executable, m_commandLineArguments);
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -135,7 +135,7 @@ void LocalApplicationRunControl::slotAppendMessage(const QString &err,
|
||||
|
||||
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);
|
||||
appendMessage(msg, NormalMessageFormat);
|
||||
emit finished();
|
||||
|
@@ -97,7 +97,7 @@ void QmlRunControl::start()
|
||||
m_commandLineArguments);
|
||||
|
||||
emit started();
|
||||
QString msg = tr("Starting %1 %2")
|
||||
QString msg = tr("Starting %1 %2\n")
|
||||
.arg(QDir::toNativeSeparators(m_executable), m_commandLineArguments);
|
||||
appendMessage(msg, NormalMessageFormat);
|
||||
}
|
||||
@@ -130,7 +130,7 @@ void QmlRunControl::slotAppendMessage(const QString &line, OutputFormat format)
|
||||
|
||||
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);
|
||||
appendMessage(msg, exitCode ? ErrorMessageFormat : NormalMessageFormat);
|
||||
emit finished();
|
||||
|
@@ -97,11 +97,11 @@ bool CodaRunControl::doStart()
|
||||
{
|
||||
if (m_address.isEmpty() && m_serialPort.isEmpty()) {
|
||||
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);
|
||||
return false;
|
||||
}
|
||||
appendMessage(tr("Executable file: %1").arg(msgListFile(executableFileName())),
|
||||
appendMessage(tr("Executable file: %1\n").arg(msgListFile(executableFileName())),
|
||||
NormalMessageFormat);
|
||||
return true;
|
||||
}
|
||||
@@ -122,14 +122,14 @@ bool CodaRunControl::setupLauncher()
|
||||
|
||||
if (m_serialPort.length()) {
|
||||
// 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);
|
||||
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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
connect(SymbianUtils::SymbianDeviceManager::instance(), SIGNAL(deviceRemoved(const SymbianUtils::SymbianDevice)),
|
||||
@@ -151,7 +151,7 @@ bool CodaRunControl::setupLauncher()
|
||||
m_codaDevice->setDevice(codaSocket);
|
||||
codaSocket->connectToHost(m_address, m_port);
|
||||
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()));
|
||||
if (debug)
|
||||
@@ -178,7 +178,7 @@ void CodaRunControl::doStop()
|
||||
|
||||
void CodaRunControl::slotError(const QString &error)
|
||||
{
|
||||
appendMessage(tr("Error: %1").arg(error), ErrorMessageFormat);
|
||||
appendMessage(tr("Error: %1\n").arg(error), ErrorMessageFormat);
|
||||
finishRunControl();
|
||||
}
|
||||
|
||||
@@ -238,7 +238,7 @@ void CodaRunControl::handleConnected()
|
||||
if (m_state >= StateConnected)
|
||||
return;
|
||||
m_state = StateConnected;
|
||||
appendMessage(tr("Connected."), NormalMessageFormat);
|
||||
appendMessage(tr("Connected.\n"), NormalMessageFormat);
|
||||
setProgress(maxProgress()*0.80);
|
||||
initCommunication();
|
||||
}
|
||||
@@ -249,7 +249,7 @@ void CodaRunControl::handleContextRemoved(const CodaEvent &event)
|
||||
= static_cast<const CodaRunControlContextRemovedEvent &>(event).ids();
|
||||
if (!m_runningProcessId.isEmpty()
|
||||
&& removedItems.contains(m_runningProcessId.toAscii())) {
|
||||
appendMessage(tr("Process has finished."), NormalMessageFormat);
|
||||
appendMessage(tr("Process has finished.\n"), NormalMessageFormat);
|
||||
finishRunControl();
|
||||
}
|
||||
}
|
||||
@@ -274,7 +274,7 @@ void CodaRunControl::handleContextSuspended(const CodaEvent &event)
|
||||
switch (me.reason()) {
|
||||
case TcfSuspendEvent::Other:
|
||||
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)
|
||||
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()) {
|
||||
//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();
|
||||
} else {
|
||||
setProgress(maxProgress()*0.90);
|
||||
@@ -326,7 +326,7 @@ void CodaRunControl::handleFindProcesses(const CodaCommandResult &result)
|
||||
commandLineArguments().split(' '),
|
||||
QString(),
|
||||
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;
|
||||
if (ok) {
|
||||
setProgress(maxProgress());
|
||||
appendMessage(tr("Launched."), NormalMessageFormat);
|
||||
appendMessage(tr("Launched.\n"), NormalMessageFormat);
|
||||
} else {
|
||||
appendMessage(tr("Launch failed: %1").arg(result.toString()), ErrorMessageFormat);
|
||||
appendMessage(tr("Launch failed: %1\n").arg(result.toString()), ErrorMessageFormat);
|
||||
finishRunControl();
|
||||
}
|
||||
}
|
||||
@@ -381,14 +381,14 @@ void CodaRunControl::cancelConnection()
|
||||
return;
|
||||
|
||||
stop();
|
||||
appendMessage(tr("Canceled."), ErrorMessageFormat);
|
||||
appendMessage(tr("Canceled.\n"), ErrorMessageFormat);
|
||||
emit finished();
|
||||
}
|
||||
|
||||
void CodaRunControl::deviceRemoved(const SymbianUtils::SymbianDevice &device)
|
||||
{
|
||||
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);
|
||||
finishRunControl();
|
||||
}
|
||||
|
@@ -498,7 +498,7 @@ S60DeviceDebugRunControl::S60DeviceDebugRunControl(S60DeviceRunConfiguration *rc
|
||||
Debugger::DebuggerRunControl(rc, sp, masterSlaveEngineTypes)
|
||||
{
|
||||
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());
|
||||
appendMessage(msg, ErrorMessageFormat);
|
||||
}
|
||||
@@ -506,7 +506,7 @@ S60DeviceDebugRunControl::S60DeviceDebugRunControl(S60DeviceRunConfiguration *rc
|
||||
|
||||
void S60DeviceDebugRunControl::start()
|
||||
{
|
||||
appendMessage(tr("Launching debugger..."), NormalMessageFormat);
|
||||
appendMessage(tr("Launching debugger...\n"), NormalMessageFormat);
|
||||
Debugger::DebuggerRunControl::start();
|
||||
}
|
||||
|
||||
@@ -516,14 +516,6 @@ bool S60DeviceDebugRunControl::promptToStop(bool *) const
|
||||
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) :
|
||||
IRunControlFactory(parent)
|
||||
{
|
||||
|
@@ -140,7 +140,6 @@ public:
|
||||
const QPair<Debugger::DebuggerEngineType, Debugger::DebuggerEngineType> &masterSlaveEngineTypes);
|
||||
virtual void start();
|
||||
virtual bool promptToStop(bool *optionalPrompt = 0) const;
|
||||
virtual void appendMessage(const QString &msg, ProjectExplorer::OutputFormat format, bool addNewLine=true);
|
||||
};
|
||||
|
||||
class S60DeviceDebugRunControlFactory : public ProjectExplorer::IRunControlFactory
|
||||
|
@@ -356,7 +356,7 @@ void S60EmulatorRunControl::start()
|
||||
m_applicationLauncher.start(ApplicationLauncher::Gui, m_executable, QString());
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -393,7 +393,7 @@ void S60EmulatorRunControl::slotAppendMessage(const QString &line, OutputFormat
|
||||
|
||||
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);
|
||||
emit finished();
|
||||
}
|
||||
|
@@ -115,7 +115,7 @@ void S60RunControlBase::start()
|
||||
|
||||
if (m_runSmartInstaller) { //Smart Installer does the running by itself
|
||||
cancelProgress();
|
||||
appendMessage(tr("Please finalise the installation on your device."), NormalMessageFormat);
|
||||
appendMessage(tr("Please finalise the installation on your device.\n"), NormalMessageFormat);
|
||||
emit finished();
|
||||
return;
|
||||
}
|
||||
@@ -168,7 +168,7 @@ void S60RunControlBase::startLaunching()
|
||||
|
||||
void S60RunControlBase::handleFinished()
|
||||
{
|
||||
appendMessage(tr("Finished."), NormalMessageFormat);
|
||||
appendMessage(tr("Finished.\n"), NormalMessageFormat);
|
||||
}
|
||||
|
||||
void S60RunControlBase::setProgress(int value)
|
||||
@@ -252,11 +252,3 @@ char S60RunControlBase::installationDrive() const
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
@@ -81,7 +81,6 @@ private:
|
||||
|
||||
protected slots:
|
||||
void reportLaunchFinished();
|
||||
void appendMessage(const QString &msg, ProjectExplorer::OutputFormat format, bool addNewLine=true);
|
||||
|
||||
private slots:
|
||||
void handleFinished();
|
||||
|
@@ -83,12 +83,12 @@ bool TrkRunControl::doStart()
|
||||
{
|
||||
if (m_serialPortName.isEmpty()) {
|
||||
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);
|
||||
return false;
|
||||
}
|
||||
|
||||
appendMessage(tr("Executable file: %1").arg(msgListFile(executableFileName())),
|
||||
appendMessage(tr("Executable file: %1\n").arg(msgListFile(executableFileName())),
|
||||
NormalMessageFormat);
|
||||
return true;
|
||||
}
|
||||
@@ -149,7 +149,7 @@ void TrkRunControl::doStop()
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ void TrkRunControl::slotWaitingForTrkClosed()
|
||||
{
|
||||
if (m_launcher && m_launcher->state() == trk::Launcher::WaitingForTrk) {
|
||||
stop();
|
||||
appendMessage(tr("Canceled."), ErrorMessageFormat);
|
||||
appendMessage(tr("Canceled.\n"), ErrorMessageFormat);
|
||||
emit finished();
|
||||
}
|
||||
}
|
||||
@@ -215,7 +215,7 @@ void TrkRunControl::deviceRemoved(const SymbianUtils::SymbianDevice &d)
|
||||
trk::Launcher::releaseToDeviceManager(m_launcher);
|
||||
m_launcher->deleteLater();
|
||||
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);
|
||||
emit finished();
|
||||
}
|
||||
@@ -233,16 +233,16 @@ void TrkRunControl::initLauncher(const QString &executable, trk::Launcher *launc
|
||||
|
||||
void TrkRunControl::printStartingNotice()
|
||||
{
|
||||
appendMessage(tr("Starting application..."), NormalMessageFormat);
|
||||
appendMessage(tr("Starting application...\n"), NormalMessageFormat);
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
Reference in New Issue
Block a user