From b55d930b3a3a680d1daa74efeed0e59f3ae9f980 Mon Sep 17 00:00:00 2001 From: Qv2ray-dev <59914293+Qv2ray-dev@users.noreply.github.com> Date: Thu, 13 Feb 2020 10:13:59 +0800 Subject: [PATCH] ui: fixed a misleading UI text when importing a configuration --- src/core/connection/ConnectionIO.cpp | 5 +++-- src/core/connection/ConnectionIO.hpp | 2 +- src/ui/w_ImportConfig.cpp | 4 ++-- src/ui/w_ImportConfig.ui | 21 +++++++-------------- 4 files changed, 13 insertions(+), 19 deletions(-) diff --git a/src/core/connection/ConnectionIO.cpp b/src/core/connection/ConnectionIO.cpp index e51c421f..0ad437bb 100644 --- a/src/core/connection/ConnectionIO.cpp +++ b/src/core/connection/ConnectionIO.cpp @@ -148,7 +148,7 @@ namespace Qv2ray::core::connection return QDir().rename(QV2RAY_SUBSCRIPTION_DIR + originalName, QV2RAY_SUBSCRIPTION_DIR + newName); } - CONFIGROOT ConvertConfigFromFile(QString sourceFilePath, bool keepInbounds) + CONFIGROOT ConvertConfigFromFile(QString sourceFilePath, bool importComplex) { QFile source(sourceFilePath); @@ -159,8 +159,9 @@ namespace Qv2ray::core::connection auto root = CONFIGROOT(JsonFromString(StringFromFile(&source))); - if (!keepInbounds) { + if (!importComplex) { JSON_ROOT_TRY_REMOVE("inbounds") + JSON_ROOT_TRY_REMOVE("routing") } JSON_ROOT_TRY_REMOVE("log") diff --git a/src/core/connection/ConnectionIO.hpp b/src/core/connection/ConnectionIO.hpp index 6f87202f..8d4f7d21 100644 --- a/src/core/connection/ConnectionIO.hpp +++ b/src/core/connection/ConnectionIO.hpp @@ -19,7 +19,7 @@ namespace Qv2ray::core::connection bool RenameSubscription(const QString &originalName, const QString &newName); // File Protocol - CONFIGROOT ConvertConfigFromFile(QString sourceFilePath, bool keepInbounds); + CONFIGROOT ConvertConfigFromFile(QString sourceFilePath, bool importComplex); } } diff --git a/src/ui/w_ImportConfig.cpp b/src/ui/w_ImportConfig.cpp index 3d93f0a5..642385f4 100644 --- a/src/ui/w_ImportConfig.cpp +++ b/src/ui/w_ImportConfig.cpp @@ -102,7 +102,7 @@ void ImportConfigWindow::on_beginImportBtn_clicked() switch (tabWidget->currentIndex()) { case 0: { // From File... - bool keepInBound = keepImportedInboundCheckBox->isChecked(); + bool ImportAsComplex = keepImportedInboundCheckBox->isChecked(); QString path = fileLineTxt->text(); if (!V2rayKernelInstance::ValidateConfig(path)) { @@ -111,7 +111,7 @@ void ImportConfigWindow::on_beginImportBtn_clicked() } aliasPrefix += "_" + QFileInfo(path).fileName(); - CONFIGROOT config = ConvertConfigFromFile(path, keepInBound); + CONFIGROOT config = ConvertConfigFromFile(path, ImportAsComplex); connections[aliasPrefix] = config; break; } diff --git a/src/ui/w_ImportConfig.ui b/src/ui/w_ImportConfig.ui index cf8e3e6a..a49017e7 100644 --- a/src/ui/w_ImportConfig.ui +++ b/src/ui/w_ImportConfig.ui @@ -82,20 +82,6 @@ - - - - Inbound - - - - - - - Keep imported inbound settings - - - @@ -110,6 +96,13 @@ + + + + Import as Complex Config (Manually edit route rules and inbounds) + + +