diff options
author | Tobias Nätterlund <tobias.naetterlund.qnx@kdab.com> | 2013-10-18 10:45:43 +0200 |
---|---|---|
committer | Tobias Nätterlund <tobias.naetterlund@kdab.com> | 2013-10-21 10:31:15 +0200 |
commit | c35a6d610cb2f7bc4650fc9358905d34c9dff2ad (patch) | |
tree | e130aea002b03fa7ca993aa3bcffc42339782454 /src/plugins/qnx | |
parent | 3d2ef178f67138ce8aa89449aa65fc56e9b74a01 (diff) | |
download | qt-creator-c35a6d610cb2f7bc4650fc9358905d34c9dff2ad.tar.gz |
QNX: Refactor BlackBerryLogProcessRunner
This change introduce a separate class for running the slog2info
process, in order to be able to use that for pure QNX (non-BlackBerry)
devices.
Also moved from using QSsh::SshRemoteProcessRunner to use
ProcessExplorer::SshDeviceProcess for the tail/slog2info processes
instead.
Change-Id: If917bd2a1099800f1a7333639d674c8d1b16de7b
Reviewed-by: Mehdi Fekari <mfekari@blackberry.com>
Reviewed-by: David Kaspar <dkaspar@blackberry.com>
Reviewed-by: Nicolas Arnaud-Cormos <nicolas@kdab.com>
Diffstat (limited to 'src/plugins/qnx')
-rw-r--r-- | src/plugins/qnx/blackberrylogprocessrunner.cpp | 212 | ||||
-rw-r--r-- | src/plugins/qnx/blackberrylogprocessrunner.h | 43 | ||||
-rw-r--r-- | src/plugins/qnx/qnx.pro | 6 | ||||
-rw-r--r-- | src/plugins/qnx/qnx.qbs | 2 | ||||
-rw-r--r-- | src/plugins/qnx/slog2inforunner.cpp | 172 | ||||
-rw-r--r-- | src/plugins/qnx/slog2inforunner.h | 93 |
6 files changed, 309 insertions, 219 deletions
diff --git a/src/plugins/qnx/blackberrylogprocessrunner.cpp b/src/plugins/qnx/blackberrylogprocessrunner.cpp index d040c67dcb..07cb13a00a 100644 --- a/src/plugins/qnx/blackberrylogprocessrunner.cpp +++ b/src/plugins/qnx/blackberrylogprocessrunner.cpp @@ -30,227 +30,71 @@ ****************************************************************************/ #include "blackberrylogprocessrunner.h" +#include "slog2inforunner.h" -#include <ssh/sshremoteprocessrunner.h> +#include <projectexplorer/devicesupport/sshdeviceprocess.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_slog2InfoRunner = new Slog2InfoRunner(appId, m_device, this); + connect(m_slog2InfoRunner, SIGNAL(finished()), this, SIGNAL(finished())); + connect(m_slog2InfoRunner, SIGNAL(output(QString,Utils::OutputFormat)), this, SIGNAL(output(QString,Utils::OutputFormat))); - m_tailCommand = QLatin1String("tail -c +1 -f /accounts/1000/appdata/") + m_appId - + QLatin1String("/logs/log"); - m_slog2infoCommand = QString::fromLatin1("slog2info -w -b ") + m_appId; + m_tailProcess = new ProjectExplorer::SshDeviceProcess(m_device, this); + connect(m_tailProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(readTailStandardOutput())); + connect(m_tailProcess, SIGNAL(readyReadStandardError()), this, SLOT(readTailStandardError())); + connect(m_tailProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(handleTailProcessError())); } 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); + m_slog2InfoRunner->start(); + launchTailProcess(); } -void BlackBerryLogProcessRunner::handleTailOutput() +void BlackBerryLogProcessRunner::readTailStandardOutput() { - 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); + const QString message = QString::fromLatin1(m_tailProcess->readAllStandardOutput()); + emit output(message, Utils::StdOutFormat); } -void BlackBerryLogProcessRunner::handleSlog2infoOutput() +void BlackBerryLogProcessRunner::readTailStandardError() { - 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()); + const QString message = QString::fromLatin1(m_tailProcess->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) +void BlackBerryLogProcessRunner::handleTailProcessError() { - QTC_ASSERT(!command.isEmpty(), return); - - ProjectExplorer::DeviceProcessSignalOperation::Ptr signalOperation = - m_device->signalOperation(); - connect(signalOperation.data(), SIGNAL(finished(QString)), SIGNAL(finished())); - signalOperation->killProcess(command); - - processRunner->cancel(); - - delete processRunner; + emit output(tr("Cannot show debug output. Error: %1").arg(m_tailProcess->errorString()), Utils::StdErrFormat); } -void BlackBerryLogProcessRunner::handleSlog2infoFound() +void BlackBerryLogProcessRunner::launchTailProcess() { - 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())) + if (m_tailProcess->state() == QProcess::Running) 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); + QStringList parameters; + parameters << QLatin1String("-c") + << QLatin1String("+1") + << QLatin1String("-f") + << QLatin1String("/accounts/1000/appdata/") + m_appId + QLatin1String("/logs/log"); + m_tailProcess->start(QLatin1String("tail"), parameters); } 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; - } - } + m_slog2InfoRunner->stop(); + m_tailProcess->kill(); emit finished(); } diff --git a/src/plugins/qnx/blackberrylogprocessrunner.h b/src/plugins/qnx/blackberrylogprocessrunner.h index 8a80bb0317..49a8948f20 100644 --- a/src/plugins/qnx/blackberrylogprocessrunner.h +++ b/src/plugins/qnx/blackberrylogprocessrunner.h @@ -35,19 +35,18 @@ #include "blackberrydeviceconfiguration.h" #include <utils/outputformat.h> -#include <ssh/sshconnection.h> - -#include <QDateTime> #include <QObject> -namespace QSsh { -class SshRemoteProcessRunner; +namespace ProjectExplorer { +class SshDeviceProcess; } namespace Qnx { namespace Internal { +class Slog2InfoRunner; + class BlackBerryLogProcessRunner : public QObject { Q_OBJECT @@ -63,39 +62,17 @@ public slots: void stop(); private slots: - void handleSlog2infoFound(); - void readLaunchTime(); - void readApplicationLog(); - - void handleTailOutput(); - void handleTailProcessConnectionError(); - - void handleSlog2infoOutput(); - void handleSlog2infoProcessConnectionError(); - - void handleLogError(); + void launchTailProcess(); + void readTailStandardOutput(); + void readTailStandardError(); + void handleTailProcessError(); 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); + ProjectExplorer::SshDeviceProcess *m_tailProcess; + Slog2InfoRunner *m_slog2InfoRunner; }; } // namespace Internal } // namespace Qnx diff --git a/src/plugins/qnx/qnx.pro b/src/plugins/qnx/qnx.pro index c6edbf0faa..55e3620235 100644 --- a/src/plugins/qnx/qnx.pro +++ b/src/plugins/qnx/qnx.pro @@ -96,7 +96,8 @@ SOURCES += qnxplugin.cpp \ blackberryinstallwizardpages.cpp \ blackberryinstallwizard.cpp \ qnxdeviceprocesssignaloperation.cpp \ - qnxdeviceprocesslist.cpp + qnxdeviceprocesslist.cpp \ + slog2inforunner.cpp HEADERS += qnxplugin.h\ qnxconstants.h \ @@ -192,7 +193,8 @@ HEADERS += qnxplugin.h\ blackberryinstallwizardpages.h \ blackberryinstallwizard.h \ qnxdeviceprocesssignaloperation.h \ - qnxdeviceprocesslist.h + qnxdeviceprocesslist.h \ + slog2inforunner.h FORMS += \ diff --git a/src/plugins/qnx/qnx.qbs b/src/plugins/qnx/qnx.qbs index 1a9af37cef..cecd40ed1f 100644 --- a/src/plugins/qnx/qnx.qbs +++ b/src/plugins/qnx/qnx.qbs @@ -236,6 +236,8 @@ QtcPlugin { "qnxruncontrolfactory.h", "qnxutils.cpp", "qnxutils.h", + "slog2inforunner.cpp", + "slog2inforunner.h", "images/target-small.png", "images/target.png", ] diff --git a/src/plugins/qnx/slog2inforunner.cpp b/src/plugins/qnx/slog2inforunner.cpp new file mode 100644 index 0000000000..1b46523798 --- /dev/null +++ b/src/plugins/qnx/slog2inforunner.cpp @@ -0,0 +1,172 @@ +/************************************************************************** +** +** Copyright (C) 2013 BlackBerry Limited. All rights reserved. +** +** Contact: BlackBerry (qt@blackberry.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 "slog2inforunner.h" + +#include <projectexplorer/devicesupport/sshdeviceprocess.h> +#include <utils/qtcassert.h> + +using namespace Qnx; +using namespace Qnx::Internal; + +Slog2InfoRunner::Slog2InfoRunner(const QString &applicationId, const RemoteLinux::LinuxDevice::ConstPtr &device, QObject *parent) + : QObject(parent) + , m_applicationId(applicationId) + , m_found(false) + , m_currentLogs(false) +{ + m_testProcess = new ProjectExplorer::SshDeviceProcess(device, this); + connect(m_testProcess, SIGNAL(finished()), this, SLOT(handleTestProcessCompleted())); + + m_launchDateTimeProcess = new ProjectExplorer::SshDeviceProcess(device, this); + connect(m_launchDateTimeProcess, SIGNAL(finished()), this, SLOT(launchSlog2Info())); + + m_logProcess = new ProjectExplorer::SshDeviceProcess(device, this); + connect(m_logProcess, SIGNAL(readyReadStandardOutput()), this, SLOT(readLogStandardOutput())); + connect(m_logProcess, SIGNAL(readyReadStandardError()), this, SLOT(readLogStandardError())); + connect(m_logProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(handleLogError())); + connect(m_logProcess, SIGNAL(started()), this, SIGNAL(started())); + connect(m_logProcess, SIGNAL(finished()), this, SIGNAL(finished())); +} + +void Slog2InfoRunner::start() +{ + m_testProcess->start(QLatin1String("slog2info"), QStringList()); +} + +void Slog2InfoRunner::stop() +{ + if (m_testProcess->state() == QProcess::Running) + m_testProcess->kill(); + + if (m_logProcess->state() == QProcess::Running) + m_logProcess->kill(); +} + +bool Slog2InfoRunner::commandFound() const +{ + return m_found; +} + +void Slog2InfoRunner::handleTestProcessCompleted() +{ + m_found = (m_testProcess->exitCode() == 0); + if (m_found) + readLaunchTime(); + else + emit commandMissing(); +} + +void Slog2InfoRunner::readLaunchTime() +{ + QStringList arguments; + arguments << QLatin1String("+\"%d %H:%M:%S\""); + m_launchDateTimeProcess->start(QLatin1String("date"), arguments); +} + +void Slog2InfoRunner::launchSlog2Info() +{ + QTC_CHECK(!m_applicationId.isEmpty()); + QTC_CHECK(m_found); + + if (m_logProcess && m_logProcess->state() == QProcess::Running) + return; + + m_launchDateTime = QDateTime::fromString(QString::fromLatin1(m_launchDateTimeProcess->readAllStandardOutput()).trimmed(), + QString::fromLatin1("dd HH:mm:ss")); + + QStringList arguments; + arguments << QLatin1String("-w") + << QLatin1String("-b") + << m_applicationId; + m_logProcess->start(QLatin1String("slog2info"), arguments); +} + +void Slog2InfoRunner::readLogStandardOutput() +{ + const QString message = QString::fromLatin1(m_logProcess->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_applicationId).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_applicationId) && !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; + } + } +} + +bool Slog2InfoRunner::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 Slog2InfoRunner::readLogStandardError() +{ + const QString message = QString::fromLatin1(m_logProcess->readAllStandardError()); + emit output(message, Utils::StdErrFormat); +} + +void Slog2InfoRunner::handleLogError() +{ + emit output(tr("Cannot show slog2info output. Error: %1").arg(m_logProcess->errorString()), Utils::StdErrFormat); +} diff --git a/src/plugins/qnx/slog2inforunner.h b/src/plugins/qnx/slog2inforunner.h new file mode 100644 index 0000000000..52455e2466 --- /dev/null +++ b/src/plugins/qnx/slog2inforunner.h @@ -0,0 +1,93 @@ +/************************************************************************** +** +** Copyright (C) 2013 BlackBerry Limited. All rights reserved. +** +** Contact: BlackBerry (qt@blackberry.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 QNX_INTERNAL_SLOG2INFORUNNER_H +#define QNX_INTERNAL_SLOG2INFORUNNER_H + +#include <QObject> + +#include <remotelinux/linuxdevice.h> +#include <utils/outputformat.h> + +#include <QDateTime> + +namespace ProjectExplorer { +class SshDeviceProcess; +} + +namespace Qnx { +namespace Internal { + +class Slog2InfoRunner : public QObject +{ + Q_OBJECT +public: + explicit Slog2InfoRunner(const QString &applicationId, const RemoteLinux::LinuxDevice::ConstPtr &device, QObject *parent = 0); + + void start(); + void stop(); + + bool commandFound() const; + +signals: + void commandMissing(); + void started(); + void finished(); + void output(const QString &msg, Utils::OutputFormat format); + +private slots: + void handleTestProcessCompleted(); + void launchSlog2Info(); + + void readLogStandardOutput(); + void readLogStandardError(); + void handleLogError(); + +private: + void readLaunchTime(); + bool showQtMessage(const QString &pattern, const QString &line); + + QString m_applicationId; + + bool m_found; + + QDateTime m_launchDateTime; + bool m_currentLogs; + + ProjectExplorer::SshDeviceProcess *m_launchDateTimeProcess; + ProjectExplorer::SshDeviceProcess *m_testProcess; + ProjectExplorer::SshDeviceProcess *m_logProcess; +}; + +} // namespace Internal +} // namespace Qnx + +#endif // QNX_INTERNAL_SLOG2INFORUNNER_H |