From d83757f1a1b1c676d5f27af2140c6bf2efcca798 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 5 Aug 2020 13:58:06 +0200 Subject: [PATCH] astyle formatting --- gui/assistant.cpp | 124 +++++++++++++++++++++++----------------------- gui/assistant.h | 45 ++++++++--------- 2 files changed, 84 insertions(+), 85 deletions(-) diff --git a/gui/assistant.cpp b/gui/assistant.cpp index d97c917cc..90d9b1aa2 100644 --- a/gui/assistant.cpp +++ b/gui/assistant.cpp @@ -1,62 +1,62 @@ -#include "assistant.h" - -#include -#include -#include -#include -#include - -Assistant::Assistant() - : mProc(nullptr) -{ -} - -Assistant::~Assistant() -{ - if (mProc && mProc->state() == QProcess::Running) { - mProc->terminate(); - mProc->waitForFinished(3000); - } - delete mProc; -} - -void Assistant::showDocumentation(const QString &page) -{ - if (!startAssistant()) - return; - - QByteArray ba("SetSource "); - ba.append("qthelp://cppcheck.sourceforge.net/doc/"); - - mProc->write(ba + page.toLocal8Bit() + '\n'); -} - -bool Assistant::startAssistant() -{ - if (!mProc) - mProc = new QProcess(); - - if (mProc->state() != QProcess::Running) { - QString app = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QDir::separator(); -#if !defined(Q_OS_MAC) - app += QLatin1String("assistant"); -#else - app += QLatin1String("Assistant.app/Contents/MacOS/Assistant"); -#endif - - QStringList args; - args << QLatin1String("-collectionFile") - << QLatin1String("online-help.qhc") - << QLatin1String("-enableRemoteControl"); - - mProc->start(app, args); - - if (!mProc->waitForStarted()) { - QMessageBox::critical(nullptr, - tr("Cppcheck"), - tr("Unable to launch Qt Assistant (%1)").arg(app)); - return false; - } - } - return true; -} +#include "assistant.h" + +#include +#include +#include +#include +#include + +Assistant::Assistant() + : mProc(nullptr) +{ +} + +Assistant::~Assistant() +{ + if (mProc && mProc->state() == QProcess::Running) { + mProc->terminate(); + mProc->waitForFinished(3000); + } + delete mProc; +} + +void Assistant::showDocumentation(const QString &page) +{ + if (!startAssistant()) + return; + + QByteArray ba("SetSource "); + ba.append("qthelp://cppcheck.sourceforge.net/doc/"); + + mProc->write(ba + page.toLocal8Bit() + '\n'); +} + +bool Assistant::startAssistant() +{ + if (!mProc) + mProc = new QProcess(); + + if (mProc->state() != QProcess::Running) { + QString app = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QDir::separator(); +#if !defined(Q_OS_MAC) + app += QLatin1String("assistant"); +#else + app += QLatin1String("Assistant.app/Contents/MacOS/Assistant"); +#endif + + QStringList args; + args << QLatin1String("-collectionFile") + << QLatin1String("online-help.qhc") + << QLatin1String("-enableRemoteControl"); + + mProc->start(app, args); + + if (!mProc->waitForStarted()) { + QMessageBox::critical(nullptr, + tr("Cppcheck"), + tr("Unable to launch Qt Assistant (%1)").arg(app)); + return false; + } + } + return true; +} diff --git a/gui/assistant.h b/gui/assistant.h index 4ac5218b1..a65913823 100644 --- a/gui/assistant.h +++ b/gui/assistant.h @@ -1,23 +1,22 @@ -#ifndef ASSISTANT_H -#define ASSISTANT_H - -#include -#include - -class QProcess; - -class Assistant -{ - Q_DECLARE_TR_FUNCTIONS(Assistant) - -public: - Assistant(); - ~Assistant(); - void showDocumentation(const QString &file); - -private: - bool startAssistant(); - QProcess *mProc; -}; - -#endif // ASSISTANT_H +#ifndef ASSISTANT_H +#define ASSISTANT_H + +#include +#include + +class QProcess; + +class Assistant { + Q_DECLARE_TR_FUNCTIONS(Assistant) + +public: + Assistant(); + ~Assistant(); + void showDocumentation(const QString &file); + +private: + bool startAssistant(); + QProcess *mProc; +}; + +#endif // ASSISTANT_H