From 4e06ec392b562e7a46bda2381de07f949289e496 Mon Sep 17 00:00:00 2001 From: "Matthew J. Milner" Date: Thu, 24 Oct 2024 10:48:44 +0200 Subject: [PATCH] Format with clang-format Signed-off-by: Matthew J. Milner --- avogadro/molequeue/client/client.cpp | 123 +++++++++--------- avogadro/molequeue/client/client.h | 39 +++--- avogadro/molequeue/inputgenerator.cpp | 31 +++-- avogadro/molequeue/inputgenerator.h | 2 +- avogadro/qtgui/generichighlighter.cpp | 10 +- avogadro/qtgui/generichighlighter.h | 2 +- avogadro/qtgui/interfacescript.cpp | 22 ++-- avogadro/qtgui/interfacescript.h | 2 +- avogadro/qtgui/richtextdelegate.cpp | 2 +- avogadro/qtgui/scriptloader.cpp | 8 +- avogadro/qtplugins/commandscripts/command.h | 6 +- .../gamessinput/gamesshighlighter.cpp | 29 +++-- .../qtplugins/gamessinput/gamessinput.cpp | 12 +- avogadro/qtplugins/gamessinput/gamessinput.h | 4 +- .../gamessinput/gamessinputdialog.cpp | 18 +-- .../qtplugins/gamessinput/gamessinputdialog.h | 3 +- avogadro/qtplugins/openbabel/obprocess.cpp | 11 +- .../qtplugins/quantuminput/quantuminput.h | 6 +- .../qtplugins/scriptcharges/scriptcharges.cpp | 4 +- .../scriptfileformats/scriptfileformats.cpp | 5 +- avogadro/quantumio/gamessukout.cpp | 14 +- 21 files changed, 175 insertions(+), 178 deletions(-) diff --git a/avogadro/molequeue/client/client.cpp b/avogadro/molequeue/client/client.cpp index 67d01bf6f5..17643d4d8d 100644 --- a/avogadro/molequeue/client/client.cpp +++ b/avogadro/molequeue/client/client.cpp @@ -5,20 +5,16 @@ #include "client.h" -#include "jsonrpcclient.h" #include "jobobject.h" +#include "jsonrpcclient.h" #include namespace Avogadro::MoleQueue { -Client::Client(QObject *parent_) : QObject(parent_), m_jsonRpcClient(nullptr) -{ -} +Client::Client(QObject* parent_) : QObject(parent_), m_jsonRpcClient(nullptr) {} -Client::~Client() -{ -} +Client::~Client() {} bool Client::isConnected() const { @@ -28,7 +24,7 @@ bool Client::isConnected() const return m_jsonRpcClient->isConnected(); } -bool Client::connectToServer(const QString &serverName) +bool Client::connectToServer(const QString& serverName) { if (!m_jsonRpcClient) { m_jsonRpcClient = new JsonRpcClient(this); @@ -60,7 +56,7 @@ int Client::requestQueueList() return localId; } -int Client::submitJob(const JobObject &job) +int Client::submitJob(const JobObject& job) { if (!m_jsonRpcClient) return -1; @@ -112,8 +108,8 @@ int Client::cancelJob(unsigned int moleQueueId) return localId; } -int Client::registerOpenWith(const QString &name, const QString &executable, - const QList &filePatterns) +int Client::registerOpenWith(const QString& name, const QString& executable, + const QList& filePatterns) { if (!m_jsonRpcClient) return -1; @@ -131,9 +127,9 @@ int Client::registerOpenWith(const QString &name, const QString &executable, return localId; } -int Client::registerOpenWith(const QString &name, - const QString &rpcServer, const QString &rpcMethod, - const QList &filePatterns) +int Client::registerOpenWith(const QString& name, const QString& rpcServer, + const QString& rpcMethod, + const QList& filePatterns) { if (!m_jsonRpcClient) return -1; @@ -167,7 +163,7 @@ int Client::listOpenWithNames() return localId; } -int Client::unregisterOpenWith(const QString &handlerName) +int Client::unregisterOpenWith(const QString& handlerName) { if (!m_jsonRpcClient) return -1; @@ -191,60 +187,60 @@ void Client::flush() m_jsonRpcClient->flush(); } -void Client::processResult(const QJsonObject &response) +void Client::processResult(const QJsonObject& response) { - if (response["id"] != QJsonValue::Null - && m_requests.contains(static_cast(response["id"].toDouble()))) { + if (response["id"] != QJsonValue::Null && + m_requests.contains(static_cast(response["id"].toDouble()))) { int localId = static_cast(response["id"].toDouble()); switch (m_requests[localId]) { - case ListQueues: - emit queueListReceived(response["result"].toObject()); - break; - case SubmitJob: - emit submitJobResponse(localId, - static_cast(response["result"] - .toObject()["moleQueueId"].toDouble())); - break; - case LookupJob: - emit lookupJobResponse(localId, response["result"].toObject()); - break; - case CancelJob: - emit cancelJobResponse(static_cast(response["result"] - .toObject()["moleQueueId"].toDouble())); - break; - case RegisterOpenWith: - emit registerOpenWithResponse(localId); - break; - case ListOpenWithNames: - emit listOpenWithNamesResponse(localId, response["result"].toArray()); - break; - case UnregisterOpenWith: - emit unregisterOpenWithResponse(localId); - break; - default: - break; + case ListQueues: + emit queueListReceived(response["result"].toObject()); + break; + case SubmitJob: + emit submitJobResponse( + localId, static_cast( + response["result"].toObject()["moleQueueId"].toDouble())); + break; + case LookupJob: + emit lookupJobResponse(localId, response["result"].toObject()); + break; + case CancelJob: + emit cancelJobResponse(static_cast( + response["result"].toObject()["moleQueueId"].toDouble())); + break; + case RegisterOpenWith: + emit registerOpenWithResponse(localId); + break; + case ListOpenWithNames: + emit listOpenWithNamesResponse(localId, response["result"].toArray()); + break; + case UnregisterOpenWith: + emit unregisterOpenWithResponse(localId); + break; + default: + break; } } } -void Client::processNotification(const QJsonObject ¬ification) +void Client::processNotification(const QJsonObject& notification) { if (notification["method"].toString() == "jobStateChanged") { QJsonObject params = notification["params"].toObject(); emit jobStateChanged( - static_cast(params["moleQueueId"].toDouble()), - params["oldState"].toString(), params["newState"].toString()); + static_cast(params["moleQueueId"].toDouble()), + params["oldState"].toString(), params["newState"].toString()); } } -void Client::processError(const QJsonObject &error) +void Client::processError(const QJsonObject& error) { int localId = static_cast(error["id"].toDouble()); int errorCode = -1; QString errorMessage = tr("No message specified."); QJsonValue errorData; - const QJsonValue &errorValue = error.value(QLatin1String("error")); + const QJsonValue& errorValue = error.value(QLatin1String("error")); if (errorValue.isObject()) { const QJsonObject errorObject = errorValue.toObject(); if (errorObject.value("code").isDouble()) @@ -258,27 +254,28 @@ void Client::processError(const QJsonObject &error) } QJsonObject Client::buildRegisterOpenWithRequest( - const QString &name, const QList &filePatterns, - const QJsonObject &handlerMethod) + const QString& name, const QList& filePatterns, + const QJsonObject& handlerMethod) { - QJsonArray patterns; - foreach (const QRegularExpression ®ex, filePatterns) { + QJsonArray patterns; + foreach (const QRegularExpression& regex, filePatterns) { QJsonObject pattern; pattern["regex"] = regex.pattern(); - pattern["caseSensitive"] = regex.patternOptions().testFlag(QRegularExpression::CaseInsensitiveOption); + pattern["caseSensitive"] = regex.patternOptions().testFlag( + QRegularExpression::CaseInsensitiveOption); patterns.append(pattern); } - QJsonObject params; - params["name"] = name; - params["method"] = handlerMethod; - params["patterns"] = patterns; + QJsonObject params; + params["name"] = name; + params["method"] = handlerMethod; + params["patterns"] = patterns; - QJsonObject packet = m_jsonRpcClient->emptyRequest(); - packet["method"] = QLatin1String("registerOpenWith"); - packet["params"] = params; + QJsonObject packet = m_jsonRpcClient->emptyRequest(); + packet["method"] = QLatin1String("registerOpenWith"); + packet["params"] = params; - return packet; + return packet; } -} // End namespace Avogadro +} // namespace Avogadro::MoleQueue diff --git a/avogadro/molequeue/client/client.h b/avogadro/molequeue/client/client.h index 51867ee936..f791476d40 100644 --- a/avogadro/molequeue/client/client.h +++ b/avogadro/molequeue/client/client.h @@ -8,11 +8,11 @@ #include "avogadromolequeueexport.h" +#include +#include #include #include #include -#include -#include namespace Avogadro { namespace MoleQueue { @@ -35,7 +35,7 @@ class AVOGADROMOLEQUEUE_EXPORT Client : public QObject Q_OBJECT public: - explicit Client(QObject *parent_ = nullptr); + explicit Client(QObject* parent_ = nullptr); ~Client(); /** @@ -50,7 +50,7 @@ public slots: * @param serverName Name of the socket to connect to, the default of * "MoleQueue" is usually correct when connecting to the running MoleQueue. */ - bool connectToServer(const QString &serverName = "MoleQueue"); + bool connectToServer(const QString& serverName = "MoleQueue"); /** * Request the list of queues and programs from the server. The signal @@ -65,7 +65,7 @@ public slots: * @param job The job specification to be submitted to MoleQueue. * @return The local ID of the job submission request. */ - int submitJob(const JobObject &job); + int submitJob(const JobObject& job); /** * Request information about a job. You should supply the MoleQueue ID that @@ -98,8 +98,8 @@ public slots: executable /absolute/path/to/selected/fileName ~~~ */ - int registerOpenWith(const QString &name, const QString &executable, - const QList &filePatterns); + int registerOpenWith(const QString& name, const QString& executable, + const QList& filePatterns); /** * Register a JSON-RPC 2.0 local socket file handler with MoleQueue. @@ -125,9 +125,9 @@ executable /absolute/path/to/selected/fileName ~~~ * where is replaced by the @a rpcMethod argument. */ - int registerOpenWith(const QString &name, - const QString &rpcServer, const QString &rpcMethod, - const QList &filePatterns); + int registerOpenWith(const QString& name, const QString& rpcServer, + const QString& rpcMethod, + const QList& filePatterns); /** * @brief Request a list of all file handler names. @@ -141,7 +141,7 @@ executable /absolute/path/to/selected/fileName * @return The local ID of the request. * @sa listOpenWithNames */ - int unregisterOpenWith(const QString &handlerName); + int unregisterOpenWith(const QString& handlerName); /** * @brief flush Flush all pending messages to the server. @@ -215,16 +215,17 @@ executable /absolute/path/to/selected/fileName protected slots: /** Parse the response object and emit the appropriate signal(s). */ - void processResult(const QJsonObject &response); + void processResult(const QJsonObject& response); /** Parse a notification object and emit the appropriate signal(s). */ - void processNotification(const QJsonObject ¬ification); + void processNotification(const QJsonObject& notification); /** Parse an error object and emit the appropriate signal(s). */ - void processError(const QJsonObject ¬ification); + void processError(const QJsonObject& notification); protected: - enum MessageType { + enum MessageType + { Invalid = -1, ListQueues, SubmitJob, @@ -235,13 +236,13 @@ protected slots: UnregisterOpenWith }; - JsonRpcClient *m_jsonRpcClient; + JsonRpcClient* m_jsonRpcClient; QHash m_requests; private: - QJsonObject buildRegisterOpenWithRequest(const QString &name, - const QList &filePatterns, - const QJsonObject &handlerMethod); + QJsonObject buildRegisterOpenWithRequest( + const QString& name, const QList& filePatterns, + const QJsonObject& handlerMethod); }; } // End namespace MoleQueue diff --git a/avogadro/molequeue/inputgenerator.cpp b/avogadro/molequeue/inputgenerator.cpp index 98858d2622..bf5eeeb829 100644 --- a/avogadro/molequeue/inputgenerator.cpp +++ b/avogadro/molequeue/inputgenerator.cpp @@ -21,8 +21,8 @@ namespace Avogadro::MoleQueue { -using QtGui::PythonScript; using QtGui::GenericHighlighter; +using QtGui::PythonScript; InputGenerator::InputGenerator(const QString& scriptFilePath_, QObject* parent_) : QObject(parent_), m_interpreter(new PythonScript(scriptFilePath_, this)), @@ -36,9 +36,7 @@ InputGenerator::InputGenerator(QObject* parent_) { } -InputGenerator::~InputGenerator() -{ -} +InputGenerator::~InputGenerator() {} bool InputGenerator::debug() const { @@ -242,7 +240,7 @@ bool InputGenerator::generateInput(const QJsonObject& options_, m_errors << tr("Malformed file entry at index %1: Not an object.") .arg(m_filenames.size()); } // end if/else file is JSON object - } // end foreach file + } // end foreach file } else { result = false; m_errors << tr("'files' member not an array."); @@ -355,7 +353,8 @@ bool InputGenerator::insertMolecule(QJsonObject& json, std::string str; if (!format->writeString(str, mol)) { - m_errors << tr("Error saving molecule representation to string: %1", "%1 = error message") + m_errors << tr("Error saving molecule representation to string: %1", + "%1 = error message") .arg(QString::fromStdString(format->error())); return false; } @@ -654,7 +653,8 @@ bool InputGenerator::parsePattern(const QJsonValue& json, QJsonObject patternObj(json.toObject()); QString regexPattern; - QRegularExpression::PatternOptions patternOptions = QRegularExpression::NoPatternOption; + QRegularExpression::PatternOptions patternOptions = + QRegularExpression::NoPatternOption; if (patternObj.contains(QStringLiteral("regexp")) && patternObj.value(QStringLiteral("regexp")).isString()) { @@ -665,22 +665,21 @@ bool InputGenerator::parsePattern(const QJsonValue& json, // Convert wildcard pattern (* -> .* and ? -> .) QString wildcard = patternObj.value(QStringLiteral("wildcard")).toString(); regexPattern = QRegularExpression::escape(wildcard) - .replace("\\*", ".*") - .replace("\\?", "."); - } - else if (patternObj.contains(QStringLiteral("string")) && - patternObj.value(QStringLiteral("string")).isString()) { + .replace("\\*", ".*") + .replace("\\?", "."); + } else if (patternObj.contains(QStringLiteral("string")) && + patternObj.value(QStringLiteral("string")).isString()) { // Escape the string so it is treated literally in the regex regexPattern = QRegularExpression::escape( - patternObj.value(QStringLiteral("string")).toString() - ); + patternObj.value(QStringLiteral("string")).toString()); } else { return false; } // Set case sensitivity if specified if (patternObj.contains(QStringLiteral("caseSensitive"))) { - bool caseSensitive = patternObj.value(QStringLiteral("caseSensitive")).toBool(true); + bool caseSensitive = + patternObj.value(QStringLiteral("caseSensitive")).toBool(true); if (!caseSensitive) { patternOptions |= QRegularExpression::CaseInsensitiveOption; } @@ -692,4 +691,4 @@ bool InputGenerator::parsePattern(const QJsonValue& json, return pattern.isValid(); } -} // namespace Avogadro +} // namespace Avogadro::MoleQueue diff --git a/avogadro/molequeue/inputgenerator.h b/avogadro/molequeue/inputgenerator.h index ad52374ac6..1727097cb0 100644 --- a/avogadro/molequeue/inputgenerator.h +++ b/avogadro/molequeue/inputgenerator.h @@ -30,7 +30,7 @@ class Molecule; namespace QtGui { class GenericHighlighter; class PythonScript; -} +} // namespace QtGui namespace MoleQueue { /** diff --git a/avogadro/qtgui/generichighlighter.cpp b/avogadro/qtgui/generichighlighter.cpp index d9447f4d87..1827ede17c 100644 --- a/avogadro/qtgui/generichighlighter.cpp +++ b/avogadro/qtgui/generichighlighter.cpp @@ -14,9 +14,7 @@ GenericHighlighter::GenericHighlighter(QObject* parent_) { } -GenericHighlighter::~GenericHighlighter() -{ -} +GenericHighlighter::~GenericHighlighter() {} GenericHighlighter::GenericHighlighter(const GenericHighlighter& other) : QSyntaxHighlighter(static_cast(nullptr)) @@ -67,14 +65,14 @@ QList GenericHighlighter::rules() const void GenericHighlighter::highlightBlock(const QString& text) { - for (auto & m_rule : m_rules) + for (auto& m_rule : m_rules) m_rule.apply(text, *this); } void GenericHighlighter::Rule::apply(const QString& text, GenericHighlighter& highlighter) { - for (auto & m_pattern : m_patterns) { + for (auto& m_pattern : m_patterns) { // each m_pattern is a QRegularExpression // We want to highlight every occurrence of m_pattern QRegularExpressionMatchIterator iterator = m_pattern.globalMatch(text); @@ -116,4 +114,4 @@ void GenericHighlighter::Rule::setFormat(const QTextCharFormat& format) m_format = format; } -} // namespace Avogadro +} // namespace Avogadro::QtGui diff --git a/avogadro/qtgui/generichighlighter.h b/avogadro/qtgui/generichighlighter.h index 0ff01e903c..ba9067d019 100644 --- a/avogadro/qtgui/generichighlighter.h +++ b/avogadro/qtgui/generichighlighter.h @@ -94,7 +94,7 @@ class AVOGADROQTGUI_EXPORT GenericHighlighter : public QSyntaxHighlighter QList m_rules; }; -} // namespace QtPlugins +} // namespace QtGui } // namespace Avogadro #endif // AVOGADRO_QTPLUGINS_GENERICHIGHLIGHTER_H diff --git a/avogadro/qtgui/interfacescript.cpp b/avogadro/qtgui/interfacescript.cpp index 1de9cdfbc9..47bad7ecf8 100644 --- a/avogadro/qtgui/interfacescript.cpp +++ b/avogadro/qtgui/interfacescript.cpp @@ -411,7 +411,7 @@ bool InterfaceScript::generateInput(const QJsonObject& options_, m_errors << tr("Malformed file entry at index %1: Not an object.") .arg(m_filenames.size()); } // end if/else file is JSON object - } // end foreach file + } // end foreach file } else { result = false; m_errors << tr("'files' member not an array."); @@ -850,11 +850,12 @@ bool InterfaceScript::parsePattern(const QJsonValue& json, QRegularExpression& pattern) const { if (!json.isObject()) - return false; + return false; QJsonObject patternObj(json.toObject()); QString regexPattern; - QRegularExpression::PatternOptions patternOptions = QRegularExpression::NoPatternOption; + QRegularExpression::PatternOptions patternOptions = + QRegularExpression::NoPatternOption; if (patternObj.contains(QStringLiteral("regexp")) && patternObj.value(QStringLiteral("regexp")).isString()) { @@ -865,22 +866,21 @@ bool InterfaceScript::parsePattern(const QJsonValue& json, // Convert wildcard pattern (* -> .* and ? -> .) QString wildcard = patternObj.value(QStringLiteral("wildcard")).toString(); regexPattern = QRegularExpression::escape(wildcard) - .replace("\\*", ".*") - .replace("\\?", "."); - } - else if (patternObj.contains(QStringLiteral("string")) && - patternObj.value(QStringLiteral("string")).isString()) { + .replace("\\*", ".*") + .replace("\\?", "."); + } else if (patternObj.contains(QStringLiteral("string")) && + patternObj.value(QStringLiteral("string")).isString()) { // Escape the string so it is treated literally in the regex regexPattern = QRegularExpression::escape( - patternObj.value(QStringLiteral("string")).toString() - ); + patternObj.value(QStringLiteral("string")).toString()); } else { return false; } // Set case sensitivity if specified if (patternObj.contains(QStringLiteral("caseSensitive"))) { - bool caseSensitive = patternObj.value(QStringLiteral("caseSensitive")).toBool(true); + bool caseSensitive = + patternObj.value(QStringLiteral("caseSensitive")).toBool(true); if (!caseSensitive) { patternOptions |= QRegularExpression::CaseInsensitiveOption; } diff --git a/avogadro/qtgui/interfacescript.h b/avogadro/qtgui/interfacescript.h index 0a4008b792..d2e0888e33 100644 --- a/avogadro/qtgui/interfacescript.h +++ b/avogadro/qtgui/interfacescript.h @@ -12,10 +12,10 @@ #include +#include #include #include #include -#include class QJsonDocument; class QProcess; diff --git a/avogadro/qtgui/richtextdelegate.cpp b/avogadro/qtgui/richtextdelegate.cpp index 4b8ea899e0..54cd8ad0cc 100644 --- a/avogadro/qtgui/richtextdelegate.cpp +++ b/avogadro/qtgui/richtextdelegate.cpp @@ -27,7 +27,7 @@ RichTextDelegate::RichTextDelegate(QObject* parent_) { } -RichTextDelegate::~RichTextDelegate(){}; +RichTextDelegate::~RichTextDelegate() {}; QSize RichTextDelegate::sizeHint(const QStyleOptionViewItem& o, const QModelIndex& index) const diff --git a/avogadro/qtgui/scriptloader.cpp b/avogadro/qtgui/scriptloader.cpp index 47b353b8c8..5a3b799f0e 100644 --- a/avogadro/qtgui/scriptloader.cpp +++ b/avogadro/qtgui/scriptloader.cpp @@ -113,8 +113,8 @@ QMultiMap ScriptLoader::scriptList(const QString& type) } } } // "commands" JSON is array - } // document is json - } // plugin.json file exists + } // document is json + } // plugin.json file exists continue; } // end reading subdirectories with plugin.json @@ -123,7 +123,7 @@ QMultiMap ScriptLoader::scriptList(const QString& type) fileList << filePath; } } // end dir.exists() - } // end for directory list + } // end for directory list // go through the list of files to see if they're actually scripts foreach (const QString& filePath, fileList) { @@ -144,7 +144,7 @@ QMultiMap ScriptLoader::scriptList(const QString& type) } else // new entry scriptList.insert(displayName, filePath); } // run queryProgramName - } // foreach files + } // foreach files return scriptList; } diff --git a/avogadro/qtplugins/commandscripts/command.h b/avogadro/qtplugins/commandscripts/command.h index d1e4b4b00c..72d196600c 100644 --- a/avogadro/qtplugins/commandscripts/command.h +++ b/avogadro/qtplugins/commandscripts/command.h @@ -23,7 +23,7 @@ class FileFormat; namespace QtGui { class InterfaceScript; class InterfaceWidget; -} +} // namespace QtGui namespace QtPlugins { @@ -89,7 +89,7 @@ private slots: const Io::FileFormat* m_outputFormat; QString m_outputFileName; }; -} -} +} // namespace QtPlugins +} // namespace Avogadro #endif // AVOGADRO_QTPLUGINS_COMMAND_H diff --git a/avogadro/qtplugins/gamessinput/gamesshighlighter.cpp b/avogadro/qtplugins/gamessinput/gamesshighlighter.cpp index 1abecc1b7b..f76b101300 100644 --- a/avogadro/qtplugins/gamessinput/gamesshighlighter.cpp +++ b/avogadro/qtplugins/gamessinput/gamesshighlighter.cpp @@ -177,15 +177,18 @@ GamessHighlighter::GamessHighlighter(QTextDocument* parent_) m_highlightingRules.append(rule); m_numberFormat.setForeground(Qt::blue); - rule.pattern = QRegularExpression(R"((\b|[\s-])[0-9]+\.([0-9]+\b)?|\.[0-9]+\b)"); + rule.pattern = + QRegularExpression(R"((\b|[\s-])[0-9]+\.([0-9]+\b)?|\.[0-9]+\b)"); rule.format = m_numberFormat; m_highlightingRules.append(rule); m_numberFormat.setForeground(Qt::blue); - rule.pattern = QRegularExpression(R"((\b|[\s-])[0-9]+\.([0-9]+\b)?|\.[0-9]+\b)"); + rule.pattern = + QRegularExpression(R"((\b|[\s-])[0-9]+\.([0-9]+\b)?|\.[0-9]+\b)"); rule.format = m_numberFormat; m_highlightingRules.append(rule); - rule.pattern = QRegularExpression(R"((\b|[\s-])[0-9]+([0-9]+\b)?|\.[0-9]+\b)"); + rule.pattern = + QRegularExpression(R"((\b|[\s-])[0-9]+([0-9]+\b)?|\.[0-9]+\b)"); rule.format = m_numberFormat; m_highlightingRules.append(rule); @@ -201,7 +204,8 @@ void GamessHighlighter::highlightBlock(const QString& text) QRegularExpression pattern("![^\n]*"); QRegularExpressionMatch commentMatch = pattern.match(text); if (commentMatch.hasMatch()) - setFormat(commentMatch.capturedStart(), commentMatch.capturedLength(), m_singleLineCommentFormat); + setFormat(commentMatch.capturedStart(), commentMatch.capturedLength(), + m_singleLineCommentFormat); setCurrentBlockState(0); @@ -209,7 +213,8 @@ void GamessHighlighter::highlightBlock(const QString& text) int keywordLength = 0; if (previousBlockState() != 1) { foreach (const QString& regexString, m_keywords) { - QRegularExpression startExpression(regexString, QRegularExpression::CaseInsensitiveOption); + QRegularExpression startExpression( + regexString, QRegularExpression::CaseInsensitiveOption); QRegularExpressionMatch startMatch = startExpression.match(text); startIndex = startMatch.capturedStart(); keywordLength = startMatch.capturedLength(); @@ -221,7 +226,8 @@ void GamessHighlighter::highlightBlock(const QString& text) } while (startIndex >= 0) { - QRegularExpression endExpression(R"(\s\$END\b)", QRegularExpression::CaseInsensitiveOption); + QRegularExpression endExpression(R"(\s\$END\b)", + QRegularExpression::CaseInsensitiveOption); QRegularExpressionMatch match = endExpression.match(text, startIndex); int endIndex = match.capturedStart(); int blockLength; @@ -236,7 +242,8 @@ void GamessHighlighter::highlightBlock(const QString& text) bool found = false; foreach (const QString& regexString, m_keywords) { QRegularExpression newExpression(regexString); - QRegularExpressionMatch newMatch = newExpression.match(text, startIndex + blockLength); + QRegularExpressionMatch newMatch = + newExpression.match(text, startIndex + blockLength); int index = newMatch.capturedStart(); if (index > startIndex) { found = true; @@ -254,8 +261,10 @@ void GamessHighlighter::highlightBlock(const QString& text) 1) { // Anything outside of data blocks is a comment foreach (const HighlightingRule& rule, m_highlightingRules) { QRegularExpression otherExpression(rule.pattern); - otherExpression.setPatternOptions(QRegularExpression::CaseInsensitiveOption); - QRegularExpressionMatchIterator iterator = otherExpression.globalMatch(text); + otherExpression.setPatternOptions( + QRegularExpression::CaseInsensitiveOption); + QRegularExpressionMatchIterator iterator = + otherExpression.globalMatch(text); while (iterator.hasNext()) { QRegularExpressionMatch otherMatch = iterator.next(); int index = otherMatch.capturedStart(); @@ -270,4 +279,4 @@ void GamessHighlighter::highlightBlock(const QString& text) setFormat(80, text.length(), m_errorFormat); } -} // End namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/gamessinput/gamessinput.cpp b/avogadro/qtplugins/gamessinput/gamessinput.cpp index 40ee38f01c..4328bd0188 100644 --- a/avogadro/qtplugins/gamessinput/gamessinput.cpp +++ b/avogadro/qtplugins/gamessinput/gamessinput.cpp @@ -35,9 +35,7 @@ GamessInput::GamessInput(QObject* parent_) connect(m_action, SIGNAL(triggered()), SLOT(menuActivated())); } -GamessInput::~GamessInput() -{ -} +GamessInput::~GamessInput() {} QList GamessInput::actions() const { @@ -101,11 +99,11 @@ void GamessInput::menuActivated() { if (!m_dialog) { m_dialog = new GamessInputDialog(qobject_cast(parent())); - connect(m_dialog, SIGNAL(openJobOutput(Avogadro::MoleQueue::JobObject)), this, - SLOT(openJobOutput(Avogadro::MoleQueue::JobObject))); + connect(m_dialog, SIGNAL(openJobOutput(Avogadro::MoleQueue::JobObject)), + this, SLOT(openJobOutput(Avogadro::MoleQueue::JobObject))); } m_dialog->setMolecule(m_molecule); m_dialog->show(); } -} -} +} // namespace QtPlugins +} // namespace Avogadro diff --git a/avogadro/qtplugins/gamessinput/gamessinput.h b/avogadro/qtplugins/gamessinput/gamessinput.h index 3a4e48df91..8ec948ac38 100644 --- a/avogadro/qtplugins/gamessinput/gamessinput.h +++ b/avogadro/qtplugins/gamessinput/gamessinput.h @@ -62,7 +62,7 @@ private slots: const Io::FileFormat* m_outputFormat; QString m_outputFileName; }; -} -} +} // namespace QtPlugins +} // namespace Avogadro #endif // AVOGADRO_QTPLUGINS_GAMESSINPUT_H diff --git a/avogadro/qtplugins/gamessinput/gamessinputdialog.cpp b/avogadro/qtplugins/gamessinput/gamessinputdialog.cpp index deeadfa1c3..2d2297da42 100644 --- a/avogadro/qtplugins/gamessinput/gamessinputdialog.cpp +++ b/avogadro/qtplugins/gamessinput/gamessinputdialog.cpp @@ -28,9 +28,9 @@ #include #include +using Avogadro::MoleQueue::JobObject; using Avogadro::MoleQueue::MoleQueueDialog; using Avogadro::MoleQueue::MoleQueueManager; -using Avogadro::MoleQueue::JobObject; namespace Avogadro::QtPlugins { @@ -117,9 +117,7 @@ GamessInputDialog::GamessInputDialog(QWidget* parent_, Qt::WindowFlags f) updatePreviewText(); } -GamessInputDialog::~GamessInputDialog() -{ -} +GamessInputDialog::~GamessInputDialog() {} void GamessInputDialog::setMolecule(QtGui::Molecule* mol) { @@ -172,9 +170,7 @@ void GamessInputDialog::connectBasic() SLOT(updatePreviewText())); } -void GamessInputDialog::connectPreview() -{ -} +void GamessInputDialog::connectPreview() {} void GamessInputDialog::connectButtons() { @@ -435,14 +431,12 @@ void GamessInputDialog::updatePreviewText() auto calculate( static_cast(ui.calculateCombo->currentIndex())); - auto theory( - static_cast(ui.theoryCombo->currentIndex())); + auto theory(static_cast(ui.theoryCombo->currentIndex())); auto basis(static_cast(ui.basisCombo->currentIndex())); auto state(static_cast(ui.stateCombo->currentIndex())); auto multiplicity( static_cast(ui.multiplicityCombo->currentIndex())); - auto charge( - static_cast(ui.chargeCombo->currentIndex())); + auto charge(static_cast(ui.chargeCombo->currentIndex())); // Disable basis selection for semiempirical methods. ui.basisCombo->setEnabled(theory != TheoryAM1 && theory != TheoryPM3); @@ -738,4 +732,4 @@ void GamessInputDialog::updateTitlePlaceholder() ui.titleEdit->setPlaceholderText(generateJobTitle()); } -} // end namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/gamessinput/gamessinputdialog.h b/avogadro/qtplugins/gamessinput/gamessinputdialog.h index 3a1c195f0f..15c386ca6b 100644 --- a/avogadro/qtplugins/gamessinput/gamessinputdialog.h +++ b/avogadro/qtplugins/gamessinput/gamessinputdialog.h @@ -32,7 +32,8 @@ class GamessInputDialog : public QDialog Q_OBJECT public: - explicit GamessInputDialog(QWidget* parent_ = nullptr, Qt::WindowFlags f = {}); + explicit GamessInputDialog(QWidget* parent_ = nullptr, + Qt::WindowFlags f = {}); ~GamessInputDialog() override; void setMolecule(QtGui::Molecule* mol); diff --git a/avogadro/qtplugins/openbabel/obprocess.cpp b/avogadro/qtplugins/openbabel/obprocess.cpp index e44ac91fa7..108828f4e8 100644 --- a/avogadro/qtplugins/openbabel/obprocess.cpp +++ b/avogadro/qtplugins/openbabel/obprocess.cpp @@ -506,11 +506,13 @@ void OBProcess::optimizeGeometryReadLog() // Emit the last printed step if (m_optimizeGeometryMaxSteps >= 0) { - QRegularExpression lastStepParser(R"(\n\s*([0-9]+)\s+([-0-9.]+)\s+([-0-9.]+)\n)"); - QRegularExpressionMatchIterator matchIterator = lastStepParser.globalMatch(m_optimizeGeometryLog); + QRegularExpression lastStepParser( + R"(\n\s*([0-9]+)\s+([-0-9.]+)\s+([-0-9.]+)\n)"); + QRegularExpressionMatchIterator matchIterator = + lastStepParser.globalMatch(m_optimizeGeometryLog); QRegularExpressionMatch lastMatch; while (matchIterator.hasNext()) { - lastMatch = matchIterator.next(); // Capture the last match + lastMatch = matchIterator.next(); // Capture the last match } if (lastMatch.hasMatch()) { int step = lastMatch.captured(1).toInt(); @@ -542,7 +544,8 @@ void OBProcess::conformerReadLog() // Emit the last printed step if (m_optimizeGeometryMaxSteps >= 0) { - QRegularExpression lastStepParser(R"(\n\s*([0-9]+)\s+([-0-9.]+)\s+([-0-9.]+)\n)"); + QRegularExpression lastStepParser( + R"(\n\s*([0-9]+)\s+([-0-9.]+)\s+([-0-9.]+)\n)"); QRegularExpressionMatch match; if ((match = lastStepParser.match(m_optimizeGeometryLog)).hasMatch()) { int step = match.captured(1).toInt(); diff --git a/avogadro/qtplugins/quantuminput/quantuminput.h b/avogadro/qtplugins/quantuminput/quantuminput.h index eda102421d..642a145534 100644 --- a/avogadro/qtplugins/quantuminput/quantuminput.h +++ b/avogadro/qtplugins/quantuminput/quantuminput.h @@ -22,7 +22,7 @@ class FileFormat; namespace MoleQueue { class InputGeneratorDialog; class JobObject; -} +} // namespace MoleQueue namespace QtPlugins { @@ -85,7 +85,7 @@ private slots: const Io::FileFormat* m_outputFormat; QString m_outputFileName; }; -} -} +} // namespace QtPlugins +} // namespace Avogadro #endif // AVOGADRO_QTPLUGINS_QUANTUMINPUT_H diff --git a/avogadro/qtplugins/scriptcharges/scriptcharges.cpp b/avogadro/qtplugins/scriptcharges/scriptcharges.cpp index 43b4e72950..1a35523756 100644 --- a/avogadro/qtplugins/scriptcharges/scriptcharges.cpp +++ b/avogadro/qtplugins/scriptcharges/scriptcharges.cpp @@ -69,11 +69,11 @@ void ScriptCharges::registerModels() for (QList::const_iterator it = m_models.constBegin(), itEnd = m_models.constEnd(); it != itEnd; ++it) { - if (!Calc::ChargeManager::registerModel((*it)->newInstance()) ) { + if (!Calc::ChargeManager::registerModel((*it)->newInstance())) { qDebug() << "Could not register model" << (*it)->identifier().c_str() << "due to name conflict."; } } } -} // end namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/qtplugins/scriptfileformats/scriptfileformats.cpp b/avogadro/qtplugins/scriptfileformats/scriptfileformats.cpp index d08ae7ae25..0bea6c0337 100644 --- a/avogadro/qtplugins/scriptfileformats/scriptfileformats.cpp +++ b/avogadro/qtplugins/scriptfileformats/scriptfileformats.cpp @@ -20,8 +20,7 @@ namespace Avogadro::QtPlugins { -ScriptFileFormats::ScriptFileFormats(QObject* p) - : ExtensionPlugin(p) +ScriptFileFormats::ScriptFileFormats(QObject* p) : ExtensionPlugin(p) { refreshFileFormats(); } @@ -80,4 +79,4 @@ void ScriptFileFormats::registerFileFormats() } } -} // end namespace Avogadro +} // namespace Avogadro::QtPlugins diff --git a/avogadro/quantumio/gamessukout.cpp b/avogadro/quantumio/gamessukout.cpp index eecc5763c0..f506a9636e 100644 --- a/avogadro/quantumio/gamessukout.cpp +++ b/avogadro/quantumio/gamessukout.cpp @@ -17,11 +17,11 @@ using std::vector; namespace Avogadro { namespace QuantumIO { -using Quantum::S; -using Quantum::SP; -using Quantum::P; using Quantum::D; using Quantum::F; +using Quantum::P; +using Quantum::S; +using Quantum::SP; using Quantum::UU; using Quantum::orbital; @@ -170,9 +170,7 @@ GamessukOut::GamessukOut(const QString& qtfilename, GaussianSet* basis) GamessukOutNoQt(filename, basis); } // end GamessukOut -GamessukOut::~GamessukOut() -{ -} // end ~GamessukOut +GamessukOut::~GamessukOut() {} // end ~GamessukOut void GamessukOut::GamessukOutNoQt(const std::string& filename, GaussianSet* basis) @@ -784,5 +782,5 @@ void GamessukOut::load(GaussianSet* basis) } // end load -} // End Namespace -} +} // namespace QuantumIO +} // namespace Avogadro