diff --git a/src/plugins/remotelinux/linuxdevicetestdialog.cpp b/src/plugins/remotelinux/linuxdevicetestdialog.cpp index f0e89306f53..7230f4dc3c7 100644 --- a/src/plugins/remotelinux/linuxdevicetestdialog.cpp +++ b/src/plugins/remotelinux/linuxdevicetestdialog.cpp @@ -32,7 +32,11 @@ #include "linuxdevicetestdialog.h" #include "ui_linuxdevicetestdialog.h" +#include +#include +#include #include +#include namespace RemoteLinux { namespace Internal { @@ -80,13 +84,12 @@ void LinuxDeviceTestDialog::reject() void LinuxDeviceTestDialog::handleProgressMessage(const QString &message) { - m_d->ui.textEdit->appendPlainText(message); + addText(message, QLatin1String("black"), false); } void LinuxDeviceTestDialog::handleErrorMessage(const QString &message) { - m_d->ui.textEdit->appendHtml(QLatin1String("") + message - + QLatin1String("

")); + addText(message, QLatin1String("red"), false); } void LinuxDeviceTestDialog::handleTestFinished(AbstractLinuxDeviceTester::TestResult result) @@ -94,13 +97,21 @@ void LinuxDeviceTestDialog::handleTestFinished(AbstractLinuxDeviceTester::TestRe m_d->finished = true; m_d->ui.buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Close")); - if (result == AbstractLinuxDeviceTester::TestSuccess) { - m_d->ui.textEdit->appendHtml(QLatin1String("") - + tr("Device test finished successfully.") + QLatin1String("")); - } else { - m_d->ui.textEdit->appendHtml(QLatin1String("") - + tr("Device test failed.") + QLatin1String("

")); - } + if (result == AbstractLinuxDeviceTester::TestSuccess) + addText(tr("Device test finished successfully."), QLatin1String("blue"), true); + else + addText(tr("Device test failed."), QLatin1String("red"), true); +} + +void LinuxDeviceTestDialog::addText(const QString &text, const QString &color, bool bold) +{ + QTextCharFormat format = m_d->ui.textEdit->currentCharFormat(); + format.setForeground(QBrush(QColor(color))); + QFont font = format.font(); + font.setBold(bold); + format.setFont(font); + m_d->ui.textEdit->setCurrentCharFormat(format); + m_d->ui.textEdit->appendPlainText(text); } } // namespace RemoteLinux diff --git a/src/plugins/remotelinux/linuxdevicetestdialog.h b/src/plugins/remotelinux/linuxdevicetestdialog.h index 30377b0faec..0938c96b6b8 100644 --- a/src/plugins/remotelinux/linuxdevicetestdialog.h +++ b/src/plugins/remotelinux/linuxdevicetestdialog.h @@ -60,6 +60,8 @@ private slots: void handleTestFinished(RemoteLinux::AbstractLinuxDeviceTester::TestResult result); private: + void addText(const QString &text, const QString &color, bool bold); + Internal::LinuxDeviceTestDialogPrivate * const m_d; }; diff --git a/src/plugins/remotelinux/linuxdevicetester.cpp b/src/plugins/remotelinux/linuxdevicetester.cpp index 78d0875eb74..372f692afa8 100644 --- a/src/plugins/remotelinux/linuxdevicetester.cpp +++ b/src/plugins/remotelinux/linuxdevicetester.cpp @@ -142,7 +142,7 @@ void GenericLinuxDeviceTester::handleConnectionFailure() { QTC_ASSERT(m_d->state != Inactive, return); - emit errorMessage(tr("SSH connection failure: %1").arg(m_d->connection->errorString())); + emit errorMessage(tr("SSH connection failure: %1\n").arg(m_d->connection->errorString())); setFinished(TestFailure); } @@ -166,9 +166,9 @@ void GenericLinuxDeviceTester::handleProcessFinished(int exitStatus) if (exitStatus != SshRemoteProcess::ExitedNormally || m_d->process->exitCode() != 0) { if (!m_d->remoteStderr.isEmpty()) - emit errorMessage(tr("uname failed: %1").arg(QString::fromUtf8(m_d->remoteStderr))); + emit errorMessage(tr("uname failed: %1\n").arg(QString::fromUtf8(m_d->remoteStderr))); else - emit errorMessage(tr("uname failed.")); + emit errorMessage(tr("uname failed.\n")); } else { emit progressMessage(QString::fromUtf8(m_d->remoteStdout)); } @@ -176,8 +176,7 @@ void GenericLinuxDeviceTester::handleProcessFinished(int exitStatus) connect(&m_d->portsGatherer, SIGNAL(error(QString)), SLOT(handlePortsGatheringError(QString))); connect(&m_d->portsGatherer, SIGNAL(portListReady()), SLOT(handlePortListReady())); - emit progressMessage(QLatin1String("") - + tr("Checking if specified ports are available...")); + emit progressMessage(tr("Checking if specified ports are available...")); m_d->state = TestingPorts; m_d->portsGatherer.start(m_d->connection, m_d->deviceConfiguration); } @@ -186,7 +185,7 @@ void GenericLinuxDeviceTester::handlePortsGatheringError(const QString &message) { QTC_ASSERT(m_d->state == TestingPorts, return); - emit errorMessage(tr("Error gathering ports: %1").arg(message)); + emit errorMessage(tr("Error gathering ports: %1\n").arg(message)); setFinished(TestFailure); } @@ -201,7 +200,7 @@ void GenericLinuxDeviceTester::handlePortListReady() foreach (const int port, m_d->portsGatherer.usedPorts()) portList += QString::number(port) + QLatin1String(", "); portList.remove(portList.count() - 2, 2); - emit errorMessage(tr("The following specified ports are currently in use: %1") + emit errorMessage(tr("The following specified ports are currently in use: %1\n") .arg(portList)); } setFinished(TestSuccess); diff --git a/src/plugins/remotelinux/maddedevicetester.cpp b/src/plugins/remotelinux/maddedevicetester.cpp index 8b5aa411b26..adb5ff83271 100644 --- a/src/plugins/remotelinux/maddedevicetester.cpp +++ b/src/plugins/remotelinux/maddedevicetester.cpp @@ -133,7 +133,7 @@ void MaddeDeviceTester::handleConnectionError() { QTC_ASSERT(m_state != Inactive, return); - emit errorMessage(tr("SSH connection error: %1") + emit errorMessage(tr("SSH connection error: %1\n") .arg(m_processRunner->connection()->errorString())); m_result = TestFailure; setFinished(); @@ -177,10 +177,10 @@ void MaddeDeviceTester::handleQtTestFinished(int exitStatus) if (exitStatus != SshRemoteProcess::ExitedNormally || m_processRunner->process()->exitCode() != 0) { if (!m_stderr.isEmpty()) { - emit errorMessage(tr("Error checking for Qt libraries: %1") + emit errorMessage(tr("Error checking for Qt libraries: %1\n") .arg(QString::fromUtf8(m_stderr))); } else { - emit errorMessage(tr("Error checking for Qt libraries.")); + emit errorMessage(tr("Error checking for Qt libraries.\n")); } m_result = TestFailure; @@ -191,7 +191,7 @@ void MaddeDeviceTester::handleQtTestFinished(int exitStatus) m_stdout.clear(); m_stderr.clear(); - emit progressMessage(QLatin1Char('\n') + tr("Checking for connectivity support...")); + emit progressMessage(tr("Checking for connectivity support...")); m_state = MadDeveloperTest; m_processRunner->run(QString(QLatin1String("test -x") + MaemoGlobal::devrootshPath()).toUtf8()); } @@ -200,20 +200,20 @@ void MaddeDeviceTester::handleMadDeveloperTestFinished(int exitStatus) { if (exitStatus != SshRemoteProcess::ExitedNormally) { if (!m_stderr.isEmpty()) { - emit errorMessage(tr("Error checking for connectivity tool: %1") + emit errorMessage(tr("Error checking for connectivity tool: %1\n") .arg(QString::fromUtf8(m_stderr))); } else { - emit errorMessage(tr("Error checking for connectivity tool.")); + emit errorMessage(tr("Error checking for connectivity tool.\n")); } m_result = TestFailure; } else if (m_processRunner->process()->exitCode() != 0) { QString message = tr("Connectivity tool not installed on device. " - "Deployment will not be possible."); + "Deployment currently not possible."); if (m_deviceConfiguration->osType() == QLatin1String(HarmattanOsType)) { message += tr("Please switch the device to developer mode " - "via Settings -> Security.\n"); + "via Settings -> Security."); } - emit errorMessage(message); + emit errorMessage(message + QLatin1Char('\n')); m_result = TestFailure; } else { emit progressMessage(tr("Connectivity tool present.\n")); @@ -237,15 +237,15 @@ void MaddeDeviceTester::handleQmlToolingTestFinished(int exitStatus) { if (exitStatus != SshRemoteProcess::ExitedNormally) { if (!m_stderr.isEmpty()) { - emit errorMessage(tr("Error checking for QML tooling support: %1") + emit errorMessage(tr("Error checking for QML tooling support: %1\n") .arg(QString::fromUtf8(m_stderr))); } else { - emit errorMessage(tr("Error checking for QML tooling support.")); + emit errorMessage(tr("Error checking for QML tooling support.\n")); } m_result = TestFailure; } else if (m_processRunner->process()->exitCode() != 0) { emit errorMessage(tr("Missing directory '%1'. You will not be able to do " - "QML debugging on this device.").arg(QmlToolingDirectory)); + "QML debugging on this device.\n").arg(QmlToolingDirectory)); m_result = TestFailure; } else { emit progressMessage(tr("QML tooling support present.\n"));