From 46c13543a4e85cb2f42c6abbdf9ef642420e9ba4 Mon Sep 17 00:00:00 2001 From: Qv2ray-dev <59914293+Qv2ray-dev@users.noreply.github.com> Date: Sun, 1 Mar 2020 17:24:58 +0800 Subject: [PATCH] fix: changed inline code block settings --- _clang-format | 2 +- makespec/BUILDVERSION | 2 +- src/common/QvHelpers.cpp | 5 +++- src/components/pac/QvGFWPACConverter.cpp | 5 +++- src/components/speedchart/speedplotview.cpp | 5 +++- src/core/CoreSafeTypes.hpp | 10 +++++-- src/core/config/ConfigUpgrade.cpp | 5 +++- src/core/connection/Serialization.cpp | 5 +++- src/core/handler/ConnectionHandler.cpp | 29 ++++++++++++++++----- src/main.cpp | 5 +++- src/ui/editors/w_InboundEditor.cpp | 8 ++++-- src/ui/editors/w_RoutesEditor.cpp | 10 +++++-- src/ui/w_ExportConfig.cpp | 1 + src/ui/w_MainWindow.cpp | 5 +++- src/ui/w_PreferencesWindow.cpp | 20 +++++++++++--- src/ui/w_SubscriptionManager.cpp | 4 +-- src/ui/widgets/StreamSettingsWidget.cpp | 4 ++- 17 files changed, 96 insertions(+), 29 deletions(-) diff --git a/_clang-format b/_clang-format index 38833c2c..8586680d 100644 --- a/_clang-format +++ b/_clang-format @@ -5,7 +5,7 @@ AlignAfterOpenBracket: Align AllowAllArgumentsOnNextLine: 'false' AllowAllConstructorInitializersOnNextLine: 'false' AllowAllParametersOfDeclarationOnNextLine: 'false' -AllowShortBlocksOnASingleLine: 'true' +AllowShortBlocksOnASingleLine: 'false' AllowShortCaseLabelsOnASingleLine: 'true' AllowShortFunctionsOnASingleLine: None AllowShortIfStatementsOnASingleLine: 'false' diff --git a/makespec/BUILDVERSION b/makespec/BUILDVERSION index b9da2614..a6c9dc98 100644 --- a/makespec/BUILDVERSION +++ b/makespec/BUILDVERSION @@ -1 +1 @@ -4211 +4215 diff --git a/src/common/QvHelpers.cpp b/src/common/QvHelpers.cpp index 38cdc08d..dee61789 100644 --- a/src/common/QvHelpers.cpp +++ b/src/common/QvHelpers.cpp @@ -118,7 +118,10 @@ namespace Qv2ray::common { list list; - for (auto line : _string.split(QRegExp("[\r\n]"), QString::SkipEmptyParts)) { list.push_back(line.toStdString()); } + for (auto line : _string.split(QRegExp("[\r\n]"), QString::SkipEmptyParts)) + { + list.push_back(line.toStdString()); + } return list; } diff --git a/src/components/pac/QvGFWPACConverter.cpp b/src/components/pac/QvGFWPACConverter.cpp index 3148d86f..30e0e9e8 100644 --- a/src/components/pac/QvGFWPACConverter.cpp +++ b/src/components/pac/QvGFWPACConverter.cpp @@ -50,7 +50,10 @@ namespace Qv2ray::components::pac if (originLine[startPosition] == '\n') startPosition += 1; - for (size_t i = startPosition; i < endPosition; ++i) { returnBuffer += originLine[i]; } + for (size_t i = startPosition; i < endPosition; ++i) + { + returnBuffer += originLine[i]; + } } return returnBuffer; diff --git a/src/components/speedchart/speedplotview.cpp b/src/components/speedchart/speedplotview.cpp index 7174fd0e..6a393104 100644 --- a/src/components/speedchart/speedplotview.cpp +++ b/src/components/speedchart/speedplotview.cpp @@ -191,7 +191,10 @@ void SpeedPlotView::pushPoint(const SpeedPlotView::PointData &point) { m_datahalfMin.push_back(point); - while (m_datahalfMin.length() > VIEWABLE) { m_datahalfMin.removeFirst(); } + while (m_datahalfMin.length() > VIEWABLE) + { + m_datahalfMin.removeFirst(); + } } void SpeedPlotView::replot() diff --git a/src/core/CoreSafeTypes.hpp b/src/core/CoreSafeTypes.hpp index 5cfbb859..67360464 100644 --- a/src/core/CoreSafeTypes.hpp +++ b/src/core/CoreSafeTypes.hpp @@ -53,7 +53,10 @@ namespace Qv2ray::core { QList list; - for (auto str : strings) { list << IDType(str); } + for (auto str : strings) + { + list << IDType(str); + } return list; } @@ -63,7 +66,10 @@ namespace Qv2ray::core { QList list; - for (auto id : ids) { list << id.toString(); } + for (auto id : ids) + { + list << id.toString(); + } return list; } diff --git a/src/core/config/ConfigUpgrade.cpp b/src/core/config/ConfigUpgrade.cpp index 043cbe3c..28d09ed3 100644 --- a/src/core/config/ConfigUpgrade.cpp +++ b/src/core/config/ConfigUpgrade.cpp @@ -266,7 +266,10 @@ namespace Qv2ray { LOG(MODULE_SETTINGS, "Migrating config from version " + QSTRN(fromVersion) + " to " + QSTRN(toVersion)) - for (int i = fromVersion; i < toVersion; i++) { root = UpgradeConfig_Inc(i, root); } + for (int i = fromVersion; i < toVersion; i++) + { + root = UpgradeConfig_Inc(i, root); + } return root; } diff --git a/src/core/connection/Serialization.cpp b/src/core/connection/Serialization.cpp index 2e7bb53d..7875498f 100644 --- a/src/core/connection/Serialization.cpp +++ b/src/core/connection/Serialization.cpp @@ -420,7 +420,10 @@ namespace Qv2ray::core::connection else if (net == "http" || net == "h2") { // Fill hosts for HTTP - for (auto _host : host.split(',')) { streaming.httpSettings.host.push_back(_host.trimmed()); } + for (auto _host : host.split(',')) + { + streaming.httpSettings.host.push_back(_host.trimmed()); + } streaming.httpSettings.path = path; } diff --git a/src/core/handler/ConnectionHandler.cpp b/src/core/handler/ConnectionHandler.cpp index d8fde426..81004e85 100644 --- a/src/core/handler/ConnectionHandler.cpp +++ b/src/core/handler/ConnectionHandler.cpp @@ -29,7 +29,10 @@ namespace Qv2ray::core::handlers auto val = GlobalConfig.subscriptions[key]; groups[gkey] = val; - for (auto conn : val.connections) { connections[ConnectionId(conn)].groupId = GroupId(key); } + for (auto conn : val.connections) + { + connections[ConnectionId(conn)].groupId = GroupId(key); + } } for (auto key : GlobalConfig.groups.keys()) @@ -43,7 +46,10 @@ namespace Qv2ray::core::handlers auto val = GlobalConfig.groups[key]; groups[gkey] = val; - for (auto conn : val.connections) { connections[ConnectionId(conn)].groupId = GroupId(key); } + for (auto conn : val.connections) + { + connections[ConnectionId(conn)].groupId = GroupId(key); + } } // @@ -78,7 +84,9 @@ namespace Qv2ray::core::handlers newGlobalConfig.subscriptions.clear(); for (auto i = 0; i < connections.count(); i++) - { newGlobalConfig.connections[connections.keys()[i].toString()] = connections.values()[i]; } + { + newGlobalConfig.connections[connections.keys()[i].toString()] = connections.values()[i]; + } for (auto i = 0; i < groups.count(); i++) { @@ -122,12 +130,18 @@ namespace Qv2ray::core::handlers void QvConnectionHandler::StartLatencyTest() { - for (auto connection : connections.keys()) { StartLatencyTest(connection); } + for (auto connection : connections.keys()) + { + StartLatencyTest(connection); + } } void QvConnectionHandler::StartLatencyTest(const GroupId &id) { - for (auto connection : groups[id].connections) { StartLatencyTest(connection); } + for (auto connection : groups[id].connections) + { + StartLatencyTest(connection); + } } void QvConnectionHandler::StartLatencyTest(const ConnectionId &id) @@ -302,7 +316,10 @@ namespace Qv2ray::core::handlers // Copy construct auto list = groups[id].connections; - for (auto conn : list) { MoveConnectionGroup(conn, DefaultGroupId); } + for (auto conn : list) + { + MoveConnectionGroup(conn, DefaultGroupId); + } // if (groups[id].isSubscription) { diff --git a/src/main.cpp b/src/main.cpp index ae943cce..912c07ca 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -361,7 +361,10 @@ int main(int argc, char *argv[]) } else { - for (auto lang : langs) { LOG(MODULE_INIT, "Found Translator: " + lang) } + for (auto lang : langs) + { + LOG(MODULE_INIT, "Found Translator: " + lang) + } } // Qv2ray Initialize, find possible config paths and verify them. diff --git a/src/ui/editors/w_InboundEditor.cpp b/src/ui/editors/w_InboundEditor.cpp index 08d3ab91..7a7957a1 100644 --- a/src/ui/editors/w_InboundEditor.cpp +++ b/src/ui/editors/w_InboundEditor.cpp @@ -144,7 +144,9 @@ void InboundEditor::LoadUIData() httpAccountListBox->clear(); for (auto user : httpSettings["accounts"].toArray()) - { httpAccountListBox->addItem(user.toObject()["user"].toString() + ":" + user.toObject()["pass"].toString()); } + { + httpAccountListBox->addItem(user.toObject()["user"].toString() + ":" + user.toObject()["pass"].toString()); + } // SOCKS socksAuthCombo->setCurrentText(socksSettings["auth"].toString()); @@ -153,7 +155,9 @@ void InboundEditor::LoadUIData() socksUserLevelSB->setValue(socksSettings["userLevel"].toInt()); for (auto user : socksSettings["accounts"].toArray()) - { socksAccountListBox->addItem(user.toObject()["user"].toString() + ":" + user.toObject()["pass"].toString()); } + { + socksAccountListBox->addItem(user.toObject()["user"].toString() + ":" + user.toObject()["pass"].toString()); + } // Dokodemo-Door dokoFollowRedirectCB->setChecked(dokoSettings["followRedirect"].toBool()); diff --git a/src/ui/editors/w_RoutesEditor.cpp b/src/ui/editors/w_RoutesEditor.cpp index 00581303..9a7141fc 100644 --- a/src/ui/editors/w_RoutesEditor.cpp +++ b/src/ui/editors/w_RoutesEditor.cpp @@ -446,7 +446,10 @@ void RouteEditor::ShowCurrentRuleDetail() balancerSelectionCombo->clear(); // BUG added the wrong items, should be outbound list. - for (auto out : outbounds) { balancerSelectionCombo->addItem((out)["tag"].toString()); } + for (auto out : outbounds) + { + balancerSelectionCombo->addItem((out)["tag"].toString()); + } // // Balancers combo and balancer list. @@ -726,7 +729,10 @@ void RouteEditor::on_addOutboundBtn_clicked() // conf is rootObject, needs to unwrap it. auto confList = conf["outbounds"].toArray(); - for (int i = 0; i < confList.count(); i++) { AddOutbound(OUTBOUND(confList[i].toObject())); } + for (int i = 0; i < confList.count(); i++) + { + AddOutbound(OUTBOUND(confList[i].toObject())); + } } CHECKEMPTYRULES diff --git a/src/ui/w_ExportConfig.cpp b/src/ui/w_ExportConfig.cpp index fa659aba..49704c06 100644 --- a/src/ui/w_ExportConfig.cpp +++ b/src/ui/w_ExportConfig.cpp @@ -1,4 +1,5 @@ #include "w_ExportConfig.hpp" + #include "common/QvHelpers.hpp" #include "core/connection/Serialization.hpp" diff --git a/src/ui/w_MainWindow.cpp b/src/ui/w_MainWindow.cpp index 69863337..e19e9353 100644 --- a/src/ui/w_MainWindow.cpp +++ b/src/ui/w_MainWindow.cpp @@ -924,6 +924,9 @@ void MainWindow::OnGroupCreated(const GroupId &id, const QString &displayName) } void MainWindow::OnGroupDeleted(const GroupId &id, const QList &connections) { - for (auto conn : connections) { groupNodes[id]->removeChild(connectionNodes[conn].get()); } + for (auto conn : connections) + { + groupNodes[id]->removeChild(connectionNodes[conn].get()); + } groupNodes.remove(id); } diff --git a/src/ui/w_PreferencesWindow.cpp b/src/ui/w_PreferencesWindow.cpp index d6a1e537..eca5af3b 100644 --- a/src/ui/w_PreferencesWindow.cpp +++ b/src/ui/w_PreferencesWindow.cpp @@ -43,7 +43,10 @@ PreferencesWindow::PreferencesWindow(QWidget *parent) : QDialog(parent), Current languageComboBox->clear(); QDirIterator it(":/translations"); - while (it.hasNext()) { languageComboBox->addItem(it.next().split("/").last().split(".").first()); } + while (it.hasNext()) + { + languageComboBox->addItem(it.next().split("/").last().split(".").first()); + } // Set auto start button state SetAutoStartButtonsState(GetLaunchAtLoginStatus()); @@ -162,11 +165,17 @@ PreferencesWindow::PreferencesWindow(QWidget *parent) : QDialog(parent), Current auto autoStartConnId = ConnectionId(CurrentConfig.autoStartId); auto autoStartGroupId = ConnectionManager->GetConnectionGroupId(autoStartConnId); - for (auto group : ConnectionManager->AllGroups()) { autoStartSubsCombo->addItem(ConnectionManager->GetDisplayName(group)); } + for (auto group : ConnectionManager->AllGroups()) + { + autoStartSubsCombo->addItem(ConnectionManager->GetDisplayName(group)); + } autoStartSubsCombo->setCurrentText(ConnectionManager->GetDisplayName(autoStartGroupId)); - for (auto conn : ConnectionManager->Connections(autoStartGroupId)) { autoStartConnCombo->addItem(ConnectionManager->GetDisplayName(conn)); } + for (auto conn : ConnectionManager->Connections(autoStartGroupId)) + { + autoStartConnCombo->addItem(ConnectionManager->GetDisplayName(conn)); + } autoStartConnCombo->setCurrentText(ConnectionManager->GetDisplayName(autoStartConnId)); @@ -1011,7 +1020,10 @@ void PreferencesWindow::on_autoStartSubsCombo_currentIndexChanged(const QString auto list = ConnectionManager->Connections(groupId); autoStartConnCombo->clear(); - for (auto id : list) { autoStartConnCombo->addItem(ConnectionManager->GetDisplayName(id)); } + for (auto id : list) + { + autoStartConnCombo->addItem(ConnectionManager->GetDisplayName(id)); + } } void PreferencesWindow::on_autoStartConnCombo_currentIndexChanged(const QString &arg1) diff --git a/src/ui/w_SubscriptionManager.cpp b/src/ui/w_SubscriptionManager.cpp index 983d621b..543365d3 100644 --- a/src/ui/w_SubscriptionManager.cpp +++ b/src/ui/w_SubscriptionManager.cpp @@ -13,9 +13,7 @@ SubscribeEditor::SubscribeEditor(QWidget *parent) : QDialog(parent) for (auto subs : ConnectionManager->Subscriptions()) { - subscriptionList->addTopLevelItem(new QTreeWidgetItem(QStringList() // - << ConnectionManager->GetDisplayName(subs) // - << subs.toString())); // + subscriptionList->addTopLevelItem(new QTreeWidgetItem(QStringList{ ConnectionManager->GetDisplayName(subs), subs.toString() })); // } } diff --git a/src/ui/widgets/StreamSettingsWidget.cpp b/src/ui/widgets/StreamSettingsWidget.cpp index ff47e83f..b342b30c 100644 --- a/src/ui/widgets/StreamSettingsWidget.cpp +++ b/src/ui/widgets/StreamSettingsWidget.cpp @@ -35,7 +35,9 @@ void StreamSettingsWidget::SetStreamObject(StreamSettingsObject sso) QString wsHeaders; for (auto item = stream.wsSettings.headers.begin(); item != stream.wsSettings.headers.end(); item++) - { wsHeaders += item.key() + "|" + item.value() + NEWLINE; } + { + wsHeaders += item.key() + "|" + item.value() + NEWLINE; + } wsHeadersTxt->setPlainText(wsHeaders); // mKCP