summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMehdi Fekari <mfekari@blackberry.com>2013-09-02 16:57:01 +0200
committerMehdi Fekari <mfekari@blackberry.com>2013-09-06 09:36:43 +0200
commitaef2df499a4046498a3b833ff929bc41dcdd2e56 (patch)
treef15716bee986f4a4e18bb7585a852fecd55360c1
parent59c35e96c4505e9818bd557c00ec6faf20bb8df3 (diff)
downloadqt-creator-aef2df499a4046498a3b833ff929bc41dcdd2e56.tar.gz
Qnx: Refactor BlackBerryApplicationRunner class
This patch refactors the BlackBerryApplicationRunner class and instantiates two log processes using slog2info and tail commands. The latter is used to get error logs if the application fails to launch. Slog2info display logs only when the app is correctly launched. If the app failed to launch (failed to load shared libraries... etc) the error logs are then written in /accounts/.../appData/logs/log. Change-Id: Ie2804ba7a3f67e40ece1e6973cfbcb2ee11ae0b0 Reviewed-by: Tobias Nätterlund <tobias.naetterlund@kdab.com> Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com>
-rw-r--r--src/plugins/qnx/blackberryapplicationrunner.cpp182
-rw-r--r--src/plugins/qnx/blackberryapplicationrunner.h24
-rw-r--r--src/plugins/qnx/blackberrylogprocessrunner.cpp257
-rw-r--r--src/plugins/qnx/blackberrylogprocessrunner.h103
-rw-r--r--src/plugins/qnx/qnx.pro6
-rw-r--r--src/plugins/qnx/qnx.qbs2
6 files changed, 389 insertions, 185 deletions
diff --git a/src/plugins/qnx/blackberryapplicationrunner.cpp b/src/plugins/qnx/blackberryapplicationrunner.cpp
index 7ceb5056d3..23ee2c2b0a 100644
--- a/src/plugins/qnx/blackberryapplicationrunner.cpp
+++ b/src/plugins/qnx/blackberryapplicationrunner.cpp
@@ -33,6 +33,7 @@
#include "blackberrydeployconfiguration.h"
#include "blackberryrunconfiguration.h"
+#include "blackberrylogprocessrunner.h"
#include "qnxconstants.h"
#include <projectexplorer/target.h>
@@ -58,18 +59,13 @@ using namespace Qnx::Internal;
BlackBerryApplicationRunner::BlackBerryApplicationRunner(bool debugMode, BlackBerryRunConfiguration *runConfiguration, QObject *parent)
: QObject(parent)
, m_debugMode(debugMode)
- , m_slog2infoFound(false)
- , m_currentLogs(false)
, m_pid(-1)
, m_appId(QString())
, m_running(false)
, m_stopping(false)
- , m_tailCommand(QString())
, m_launchProcess(0)
, m_stopProcess(0)
- , m_tailProcess(0)
- , m_testSlog2Process(0)
- , m_launchDateTimeProcess(0)
+ , m_logProcessRunner(0)
, m_runningStateTimer(new QTimer(this))
, m_runningStateProcess(0)
{
@@ -90,7 +86,7 @@ BlackBerryApplicationRunner::BlackBerryApplicationRunner(bool debugMode, BlackBe
m_runningStateTimer->setInterval(3000);
m_runningStateTimer->setSingleShot(true);
connect(m_runningStateTimer, SIGNAL(timeout()), this, SLOT(determineRunningState()));
- connect(this, SIGNAL(started()), this, SLOT(checkSlog2Info()));
+ connect(this, SIGNAL(started()), this, SLOT(startLogProcessRunner()));
connect(&m_launchStopProcessParser, SIGNAL(pidParsed(qint64)), this, SLOT(setPid(qint64)));
connect(&m_launchStopProcessParser, SIGNAL(applicationIdParsed(QString)), this, SLOT(setApplicationId(QString)));
@@ -122,16 +118,16 @@ void BlackBerryApplicationRunner::start()
m_running = true;
}
-void BlackBerryApplicationRunner::checkSlog2Info()
+void BlackBerryApplicationRunner::startLogProcessRunner()
{
- if (m_slog2infoFound) {
- readLaunchTime();
- } else if (!m_testSlog2Process) {
- m_testSlog2Process = new QSsh::SshRemoteProcessRunner(this);
- connect(m_testSlog2Process, SIGNAL(processClosed(int)),
- this, SLOT(handleSlog2InfoFound()));
- m_testSlog2Process->run("slog2info", m_sshParams);
+ if (!m_logProcessRunner) {
+ m_logProcessRunner = new BlackBerryLogProcessRunner(this, m_appId, m_device);
+ connect(m_logProcessRunner, SIGNAL(output(QString,Utils::OutputFormat)),
+ this, SIGNAL(output(QString,Utils::OutputFormat)));
+ connect(m_logProcessRunner, SIGNAL(finished()), this, SIGNAL(finished()));
}
+
+ m_logProcessRunner->start();
}
void BlackBerryApplicationRunner::startFinished(int exitCode, QProcess::ExitStatus exitStatus)
@@ -156,13 +152,6 @@ ProjectExplorer::RunControl::StopResult BlackBerryApplicationRunner::stop()
return ProjectExplorer::RunControl::AsynchronousStop;
m_stopping = true;
- m_currentLogs = false;
-
- if (m_testSlog2Process && m_testSlog2Process->isProcessRunning()) {
- m_testSlog2Process->cancel();
- delete m_testSlog2Process;
- m_testSlog2Process = 0;
- }
QStringList args;
args << QLatin1String("-terminateApp");
@@ -225,76 +214,6 @@ void BlackBerryApplicationRunner::readStandardError()
}
}
-void BlackBerryApplicationRunner::killTailProcess()
-{
- QTC_ASSERT(!m_tailCommand.isEmpty(), return);
-
- QString killCommand = m_device->processSupport()->killProcessByNameCommandLine(m_tailCommand);
-
- QSsh::SshRemoteProcessRunner *slayProcess = new QSsh::SshRemoteProcessRunner(this);
- connect(slayProcess, SIGNAL(processClosed(int)), this, SIGNAL(finished()));
- slayProcess->run(killCommand.toLatin1(), m_sshParams);
-
- // Not supported by OpenSSH server
- //m_tailProcess->sendSignalToProcess(Utils::SshRemoteProcess::KillSignal);
- m_tailProcess->cancel();
-
- delete m_tailProcess;
- m_tailProcess = 0;
-}
-
-void BlackBerryApplicationRunner::tailApplicationLog()
-{
- QSsh::SshRemoteProcessRunner *process = qobject_cast<QSsh::SshRemoteProcessRunner *>(sender());
- QTC_ASSERT(process, return);
-
- m_launchDateTime = QDateTime::fromString(QString::fromLatin1(process->readAllStandardOutput()).trimmed(),
- QString::fromLatin1("dd HH:mm:ss"));
-
- if (m_stopping || (m_tailProcess && m_tailProcess->isProcessRunning()))
- return;
-
- QTC_CHECK(!m_appId.isEmpty());
-
- if (!m_tailProcess) {
- m_tailProcess = new QSsh::SshRemoteProcessRunner(this);
-
- connect(m_tailProcess, SIGNAL(readyReadStandardOutput()),
- this, SLOT(handleTailOutput()));
- connect(m_tailProcess, SIGNAL(readyReadStandardError()),
- this, SLOT(handleTailError()));
- connect(m_tailProcess, SIGNAL(connectionError()),
- this, SLOT(handleTailConnectionError()));
- }
-
- if (m_slog2infoFound) {
- m_tailCommand = QString::fromLatin1("slog2info -w -b ") + m_appId;
- } else {
- m_tailCommand = QLatin1String("tail -c +1 -f /accounts/1000/appdata/") + m_appId
- + QLatin1String("/logs/log");
- }
- m_tailProcess->run(m_tailCommand.toLatin1(), m_sshParams);
-}
-
-void BlackBerryApplicationRunner::handleSlog2InfoFound()
-{
- QSsh::SshRemoteProcessRunner *process = qobject_cast<QSsh::SshRemoteProcessRunner *>(sender());
- QTC_ASSERT(process, return);
-
- m_slog2infoFound = (process->processExitCode() == 0);
-
- readLaunchTime();
-}
-
-void BlackBerryApplicationRunner::readLaunchTime()
-{
- m_launchDateTimeProcess = new QSsh::SshRemoteProcessRunner(this);
- connect(m_launchDateTimeProcess, SIGNAL(processClosed(int)),
- this, SLOT(tailApplicationLog()));
-
- m_launchDateTimeProcess->run("date +\"%d %H:%M:%S\"", m_sshParams);
-}
-
void BlackBerryApplicationRunner::setPid(qint64 pid)
{
m_pid = pid;
@@ -305,75 +224,6 @@ void BlackBerryApplicationRunner::setApplicationId(const QString &applicationId)
m_appId = applicationId;
}
-void BlackBerryApplicationRunner::handleTailOutput()
-{
- QSsh::SshRemoteProcessRunner *process = qobject_cast<QSsh::SshRemoteProcessRunner *>(sender());
- QTC_ASSERT(process, return);
-
- const QString message = QString::fromLatin1(process->readAllStandardOutput());
- if (m_slog2infoFound) {
- const QStringList multiLine = message.split(QLatin1Char('\n'));
- Q_FOREACH (const QString &line, multiLine) {
- // Check if logs are from the recent launch
- // Note: This is useless if/once slog2info -b displays only logs from recent launches
- if (!m_currentLogs) {
- QDateTime dateTime = QDateTime::fromString(line.split(m_appId).first().mid(4).trimmed(),
- QString::fromLatin1("dd HH:mm:ss.zzz"));
-
- m_currentLogs = dateTime >= m_launchDateTime;
- if (!m_currentLogs)
- continue;
- }
-
- // The line could be a part of a previous log message that contains a '\n'
- // In that case only the message body is displayed
- if (!line.contains(m_appId) && !line.isEmpty()) {
- emit output(line + QLatin1Char('\n'), Utils::StdOutFormat);
- continue;
- }
-
- QStringList validLineBeginnings;
- validLineBeginnings << QLatin1String("qt-msg 0 ")
- << QLatin1String("qt-msg* 0 ")
- << QLatin1String("default* 9000 ")
- << QLatin1String("default 9000 ")
- << QLatin1String(" 0 ");
- Q_FOREACH (const QString &beginning, validLineBeginnings) {
- if (showQtMessage(beginning, line))
- break;
- }
- }
- return;
- }
- emit output(message, Utils::StdOutFormat);
-}
-
-bool BlackBerryApplicationRunner::showQtMessage(const QString& pattern, const QString& line)
-{
- const int index = line.indexOf(pattern);
- if (index != -1) {
- const QString str = line.right(line.length()-index-pattern.length()) + QLatin1Char('\n');
- emit output(str, Utils::StdOutFormat);
- return true;
- }
- return false;
-}
-
-void BlackBerryApplicationRunner::handleTailError()
-{
- QSsh::SshRemoteProcessRunner *process = qobject_cast<QSsh::SshRemoteProcessRunner *>(sender());
- QTC_ASSERT(process, return);
-
- const QString message = QString::fromLatin1(process->readAllStandardError());
- emit output(message, Utils::StdErrFormat);
-}
-
-void BlackBerryApplicationRunner::handleTailConnectionError()
-{
- emit output(tr("Cannot show debug output. Error: %1").arg(m_tailProcess->lastConnectionErrorString()),
- Utils::StdErrFormat);
-}
-
void BlackBerryApplicationRunner::startRunningStateTimer()
{
if (m_running)
@@ -431,8 +281,12 @@ void BlackBerryApplicationRunner::reset()
m_runningStateProcess->kill();
}
- if (m_tailProcess && m_tailProcess->isProcessRunning())
- killTailProcess();
- else
+ if (m_logProcessRunner) {
+ m_logProcessRunner->stop();
+
+ delete m_logProcessRunner;
+ m_logProcessRunner = 0;
+ } else {
emit finished();
+ }
}
diff --git a/src/plugins/qnx/blackberryapplicationrunner.h b/src/plugins/qnx/blackberryapplicationrunner.h
index afe7bba7ee..99ede3b333 100644
--- a/src/plugins/qnx/blackberryapplicationrunner.h
+++ b/src/plugins/qnx/blackberryapplicationrunner.h
@@ -52,6 +52,7 @@ namespace Qnx {
namespace Internal {
class BlackBerryRunConfiguration;
+class BlackBerryLogProcessRunner;
class BlackBerryApplicationRunner : public QObject
{
@@ -66,7 +67,6 @@ public:
public slots:
void start();
- void checkSlog2Info();
signals:
void output(const QString &msg, Utils::OutputFormat format);
@@ -76,37 +76,25 @@ signals:
void startFailed(const QString &msg);
private slots:
- bool showQtMessage(const QString& pattern, const QString& line);
- void tailApplicationLog();
void startFinished(int exitCode, QProcess::ExitStatus exitStatus);
void stopFinished(int exitCode, QProcess::ExitStatus exitStatus);
void readStandardOutput();
void readStandardError();
- void handleTailOutput();
- void handleTailError();
- void handleTailConnectionError();
-
void startRunningStateTimer();
void determineRunningState();
void readRunningStateStandardOutput();
- void handleSlog2InfoFound();
- void readLaunchTime();
-
void setPid(qint64 pid);
void setApplicationId(const QString &applicationId);
+ void startLogProcessRunner();
+
private:
void reset();
- void killTailProcess();
bool m_debugMode;
- bool m_slog2infoFound;
- bool m_currentLogs;
-
- QDateTime m_launchDateTime;
qint64 m_pid;
QString m_appId;
@@ -119,15 +107,13 @@ private:
BlackBerryDeviceConfiguration::ConstPtr m_device;
QString m_barPackage;
QSsh::SshConnectionParameters m_sshParams;
- QString m_tailCommand;
QProcess *m_launchProcess;
QProcess *m_stopProcess;
BlackBerryProcessParser m_launchStopProcessParser;
- QSsh::SshRemoteProcessRunner *m_tailProcess;
- QSsh::SshRemoteProcessRunner *m_testSlog2Process;
- QSsh::SshRemoteProcessRunner *m_launchDateTimeProcess;
+ BlackBerryLogProcessRunner *m_logProcessRunner;
+
QTimer *m_runningStateTimer;
QProcess *m_runningStateProcess;
};
diff --git a/src/plugins/qnx/blackberrylogprocessrunner.cpp b/src/plugins/qnx/blackberrylogprocessrunner.cpp
new file mode 100644
index 0000000000..e324899561
--- /dev/null
+++ b/src/plugins/qnx/blackberrylogprocessrunner.cpp
@@ -0,0 +1,257 @@
+/**************************************************************************
+**
+** Copyright (C) 2011 - 2013 Research In Motion
+**
+** Contact: Research In Motion (blackberry-qt@qnx.com)
+** Contact: KDAB (info@kdab.com)
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#include "blackberrylogprocessrunner.h"
+
+#include <ssh/sshremoteprocessrunner.h>
+#include <utils/qtcassert.h>
+
+using namespace Qnx::Internal;
+
+BlackBerryLogProcessRunner::BlackBerryLogProcessRunner(QObject *parent, const QString& appId, const BlackBerryDeviceConfiguration::ConstPtr &device)
+ : QObject(parent)
+ , m_currentLogs(false)
+ , m_slog2infoFound(false)
+ , m_tailProcess(0)
+ , m_slog2infoProcess(0)
+ , m_testSlog2Process(0)
+ , m_launchDateTimeProcess(0)
+{
+ Q_ASSERT(!appId.isEmpty() && device);
+
+ m_appId = appId;
+ m_device = device;
+
+ // The BlackBerry device always uses key authentication
+ m_sshParams = m_device->sshParameters();
+ m_sshParams.authenticationType = QSsh::SshConnectionParameters::AuthenticationTypePublicKey;
+
+ m_tailCommand = QLatin1String("tail -c +1 -f /accounts/1000/appdata/") + m_appId
+ + QLatin1String("/logs/log");
+ m_slog2infoCommand = QString::fromLatin1("slog2info -w -b ") + m_appId;
+}
+
+void BlackBerryLogProcessRunner::start()
+{
+ if (!m_testSlog2Process) {
+ m_testSlog2Process = new QSsh::SshRemoteProcessRunner(this);
+ connect(m_testSlog2Process, SIGNAL(processClosed(int)), this, SLOT(handleSlog2infoFound()));
+ }
+
+ m_testSlog2Process->run("slog2info", m_sshParams);
+}
+
+void BlackBerryLogProcessRunner::handleTailOutput()
+{
+ QSsh::SshRemoteProcessRunner *process = qobject_cast<QSsh::SshRemoteProcessRunner *>(sender());
+ QTC_ASSERT(process, return);
+
+ const QString message = QString::fromLatin1(process->readAllStandardOutput());
+ // if slog2info found then m_tailProcess should only display 'launching' error logs
+ m_slog2infoFound ? output(message, Utils::StdErrFormat) : output(message, Utils::StdOutFormat);
+}
+
+void BlackBerryLogProcessRunner::handleSlog2infoOutput()
+{
+ QSsh::SshRemoteProcessRunner *process = qobject_cast<QSsh::SshRemoteProcessRunner *>(sender());
+ QTC_ASSERT(process, return);
+
+ const QString message = QString::fromLatin1(process->readAllStandardOutput());
+ const QStringList multiLine = message.split(QLatin1Char('\n'));
+ Q_FOREACH (const QString &line, multiLine) {
+ // Note: This is useless if/once slog2info -b displays only logs from recent launches
+ if (!m_launchDateTime.isNull())
+ {
+ // Check if logs are from the recent launch
+ if (!m_currentLogs) {
+ QDateTime dateTime = QDateTime::fromString(line.split(m_appId).first().mid(4).trimmed(),
+ QString::fromLatin1("dd HH:mm:ss.zzz"));
+
+ m_currentLogs = dateTime >= m_launchDateTime;
+ if (!m_currentLogs)
+ continue;
+ }
+ }
+
+ // The line could be a part of a previous log message that contains a '\n'
+ // In that case only the message body is displayed
+ if (!line.contains(m_appId) && !line.isEmpty()) {
+ emit output(line + QLatin1Char('\n'), Utils::StdOutFormat);
+ continue;
+ }
+
+ QStringList validLineBeginnings;
+ validLineBeginnings << QLatin1String("qt-msg 0 ")
+ << QLatin1String("qt-msg* 0 ")
+ << QLatin1String("default* 9000 ")
+ << QLatin1String("default 9000 ")
+ << QLatin1String(" 0 ");
+ Q_FOREACH (const QString &beginning, validLineBeginnings) {
+ if (showQtMessage(beginning, line))
+ break;
+ }
+ }
+}
+
+void BlackBerryLogProcessRunner::handleLogError()
+{
+ QSsh::SshRemoteProcessRunner *process = qobject_cast<QSsh::SshRemoteProcessRunner *>(sender());
+ QTC_ASSERT(process, return);
+
+ const QString message = QString::fromLatin1(process->readAllStandardError());
+ emit output(message, Utils::StdErrFormat);
+}
+
+void BlackBerryLogProcessRunner::handleTailProcessConnectionError()
+{
+ QSsh::SshRemoteProcessRunner *process = qobject_cast<QSsh::SshRemoteProcessRunner *>(sender());
+ QTC_ASSERT(process, return);
+
+ emit output(tr("Cannot show debug output. Error: %1").arg(process->lastConnectionErrorString()),
+ Utils::StdErrFormat);
+}
+
+void BlackBerryLogProcessRunner::handleSlog2infoProcessConnectionError()
+{
+ QSsh::SshRemoteProcessRunner *process = qobject_cast<QSsh::SshRemoteProcessRunner *>(sender());
+ QTC_ASSERT(process, return);
+
+ emit output(tr("Cannot show slog2info output. Error: %1").arg(process->lastConnectionErrorString()),
+ Utils::StdErrFormat);
+}
+
+bool BlackBerryLogProcessRunner::showQtMessage(const QString &pattern, const QString &line)
+{
+ const int index = line.indexOf(pattern);
+ if (index != -1) {
+ const QString str = line.right(line.length()-index-pattern.length()) + QLatin1Char('\n');
+ emit output(str, Utils::StdOutFormat);
+ return true;
+ }
+ return false;
+}
+
+void BlackBerryLogProcessRunner::killProcessRunner(QSsh::SshRemoteProcessRunner *processRunner, const QString &command)
+{
+ QTC_ASSERT(!command.isEmpty(), return);
+
+ QString killCommand = m_device->processSupport()->killProcessByNameCommandLine(command);
+
+ QSsh::SshRemoteProcessRunner *slayProcess = new QSsh::SshRemoteProcessRunner(this);
+ connect(slayProcess, SIGNAL(processClosed(int)), this, SIGNAL(finished()));
+ slayProcess->run(killCommand.toLatin1(), m_sshParams);
+
+ processRunner->cancel();
+
+ delete processRunner;
+}
+
+void BlackBerryLogProcessRunner::handleSlog2infoFound()
+{
+ QSsh::SshRemoteProcessRunner *process = qobject_cast<QSsh::SshRemoteProcessRunner *>(sender());
+ QTC_ASSERT(process, return);
+
+ m_slog2infoFound = (process->processExitCode() == 0);
+
+ readLaunchTime();
+}
+
+void BlackBerryLogProcessRunner::readLaunchTime()
+{
+ m_launchDateTimeProcess = new QSsh::SshRemoteProcessRunner(this);
+ connect(m_launchDateTimeProcess, SIGNAL(processClosed(int)),
+ this, SLOT(readApplicationLog()));
+
+ m_launchDateTimeProcess->run("date +\"%d %H:%M:%S\"", m_sshParams);
+}
+
+void BlackBerryLogProcessRunner::readApplicationLog()
+{
+ QSsh::SshRemoteProcessRunner *process = qobject_cast<QSsh::SshRemoteProcessRunner *>(sender());
+ QTC_ASSERT(process, return);
+
+ if (m_tailProcess && m_tailProcess->isProcessRunning())
+ return;
+
+ QTC_CHECK(!m_appId.isEmpty());
+
+ if (!m_tailProcess) {
+ m_tailProcess = new QSsh::SshRemoteProcessRunner(this);
+ connect(m_tailProcess, SIGNAL(readyReadStandardOutput()),
+ this, SLOT(handleTailOutput()));
+ connect(m_tailProcess, SIGNAL(readyReadStandardError()),
+ this, SLOT(handleLogError()));
+ connect(m_tailProcess, SIGNAL(connectionError()),
+ this, SLOT(handleTailProcessConnectionError()));
+ }
+
+ m_tailProcess->run(m_tailCommand.toLatin1(), m_sshParams);
+
+ if (!m_slog2infoFound || (m_slog2infoProcess && m_slog2infoProcess->isProcessRunning()))
+ return;
+
+ if (!m_slog2infoProcess) {
+ m_launchDateTime = QDateTime::fromString(QString::fromLatin1(process->readAllStandardOutput()).trimmed(),
+ QString::fromLatin1("dd HH:mm:ss"));
+ m_slog2infoProcess = new QSsh::SshRemoteProcessRunner(this);
+ connect(m_slog2infoProcess, SIGNAL(readyReadStandardOutput()),
+ this, SLOT(handleSlog2infoOutput()));
+ connect(m_slog2infoProcess, SIGNAL(readyReadStandardError()),
+ this, SLOT(handleLogError()));
+ connect(m_slog2infoProcess, SIGNAL(connectionError()),
+ this, SLOT(handleSlog2infoProcessConnectionError()));
+ }
+
+ m_slog2infoProcess->run(m_slog2infoCommand.toLatin1(), m_sshParams);
+}
+
+void BlackBerryLogProcessRunner::stop()
+{
+ if (m_testSlog2Process && m_testSlog2Process->isProcessRunning()) {
+ m_testSlog2Process->cancel();
+ delete m_testSlog2Process;
+ m_testSlog2Process = 0;
+ }
+
+ if (m_tailProcess && m_tailProcess->isProcessRunning()) {
+ killProcessRunner(m_tailProcess, m_tailCommand);
+ m_tailProcess = 0;
+ }
+
+ if (m_slog2infoFound) {
+ if (m_slog2infoProcess && m_slog2infoProcess->isProcessRunning()) {
+ killProcessRunner(m_slog2infoProcess, m_slog2infoCommand);
+ m_slog2infoProcess = 0;
+ }
+ }
+
+ emit finished();
+}
diff --git a/src/plugins/qnx/blackberrylogprocessrunner.h b/src/plugins/qnx/blackberrylogprocessrunner.h
new file mode 100644
index 0000000000..155ea5d3ba
--- /dev/null
+++ b/src/plugins/qnx/blackberrylogprocessrunner.h
@@ -0,0 +1,103 @@
+/**************************************************************************
+**
+** Copyright (C) 2011 - 2013 Research In Motion
+**
+** Contact: Research In Motion (blackberry-qt@qnx.com)
+** Contact: KDAB (info@kdab.com)
+**
+** This file is part of Qt Creator.
+**
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+****************************************************************************/
+
+#ifndef BLACKBERRYSLOGPROCESS_H
+#define BLACKBERRYSLOGPROCESS_H
+
+#include "blackberrydeviceconfiguration.h"
+
+#include <utils/outputformat.h>
+#include <ssh/sshconnection.h>
+
+#include <QDateTime>
+
+#include <QObject>
+
+namespace QSsh {
+class SshRemoteProcessRunner;
+}
+
+namespace Qnx {
+namespace Internal {
+
+class BlackBerryLogProcessRunner : public QObject
+{
+ Q_OBJECT
+public:
+ explicit BlackBerryLogProcessRunner(QObject *parent, const QString &appId, const BlackBerryDeviceConfiguration::ConstPtr &device);
+ void start();
+
+signals:
+ void output(const QString &msg, Utils::OutputFormat format);
+ void finished();
+
+public slots:
+ void stop();
+
+private slots:
+ void handleSlog2infoFound();
+ void readLaunchTime();
+ void readApplicationLog();
+
+ void handleTailOutput();
+ void handleTailProcessConnectionError();
+
+ void handleSlog2infoOutput();
+ void handleSlog2infoProcessConnectionError();
+
+ void handleLogError();
+
+private:
+ QString m_appId;
+ QString m_tailCommand;
+ QString m_slog2infoCommand;
+
+ bool m_currentLogs;
+ bool m_slog2infoFound;
+
+ QDateTime m_launchDateTime;
+
+ BlackBerryDeviceConfiguration::ConstPtr m_device;
+ QSsh::SshConnectionParameters m_sshParams;
+
+ QSsh::SshRemoteProcessRunner *m_tailProcess;
+ QSsh::SshRemoteProcessRunner *m_slog2infoProcess;
+
+ QSsh::SshRemoteProcessRunner *m_testSlog2Process;
+ QSsh::SshRemoteProcessRunner *m_launchDateTimeProcess;
+
+ bool showQtMessage(const QString& pattern, const QString& line);
+ void killProcessRunner(QSsh::SshRemoteProcessRunner *processRunner, const QString& command);
+};
+} // namespace Internal
+} // namespace Qnx
+
+#endif // BLACKBERRYSLOGPROCESS_H
diff --git a/src/plugins/qnx/qnx.pro b/src/plugins/qnx/qnx.pro
index 3ecc380a30..fa67ae8d40 100644
--- a/src/plugins/qnx/qnx.pro
+++ b/src/plugins/qnx/qnx.pro
@@ -95,7 +95,8 @@ SOURCES += qnxplugin.cpp \
blackberryutils.cpp \
qnxdevicetester.cpp \
blackberryconfigurationmanager.cpp \
- blackberrydevicelistdetector.cpp
+ blackberrydevicelistdetector.cpp \
+ blackberrylogprocessrunner.cpp
HEADERS += qnxplugin.h\
qnxconstants.h \
@@ -190,7 +191,8 @@ HEADERS += qnxplugin.h\
blackberryutils.h \
qnxdevicetester.h \
blackberryconfigurationmanager.h \
- blackberrydevicelistdetector.h
+ blackberrydevicelistdetector.h \
+ blackberrylogprocessrunner.h
FORMS += \
blackberrydeviceconfigurationwizardsetuppage.ui \
diff --git a/src/plugins/qnx/qnx.qbs b/src/plugins/qnx/qnx.qbs
index 3106ba474c..39a0c59885 100644
--- a/src/plugins/qnx/qnx.qbs
+++ b/src/plugins/qnx/qnx.qbs
@@ -117,6 +117,8 @@ QtcPlugin {
"blackberrydevicelistdetector.h",
"blackberrydeviceprocesssupport.h",
"blackberrydeviceprocesssupport.cpp",
+ "blackberrylogprocessrunner.cpp",
+ "blackberrylogprocessrunner.h",
"blackberryqtversion.cpp",
"blackberryqtversion.h",
"blackberryqtversionfactory.cpp",