ui: fixed a misleading UI text when importing a configuration

This commit is contained in:
Qv2ray-dev 2020-02-13 10:13:59 +08:00
parent de896ed166
commit b55d930b3a
4 changed files with 13 additions and 19 deletions

View File

@ -148,7 +148,7 @@ namespace Qv2ray::core::connection
return QDir().rename(QV2RAY_SUBSCRIPTION_DIR + originalName, QV2RAY_SUBSCRIPTION_DIR + newName); 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); QFile source(sourceFilePath);
@ -159,8 +159,9 @@ namespace Qv2ray::core::connection
auto root = CONFIGROOT(JsonFromString(StringFromFile(&source))); auto root = CONFIGROOT(JsonFromString(StringFromFile(&source)));
if (!keepInbounds) { if (!importComplex) {
JSON_ROOT_TRY_REMOVE("inbounds") JSON_ROOT_TRY_REMOVE("inbounds")
JSON_ROOT_TRY_REMOVE("routing")
} }
JSON_ROOT_TRY_REMOVE("log") JSON_ROOT_TRY_REMOVE("log")

View File

@ -19,7 +19,7 @@ namespace Qv2ray::core::connection
bool RenameSubscription(const QString &originalName, const QString &newName); bool RenameSubscription(const QString &originalName, const QString &newName);
// File Protocol // File Protocol
CONFIGROOT ConvertConfigFromFile(QString sourceFilePath, bool keepInbounds); CONFIGROOT ConvertConfigFromFile(QString sourceFilePath, bool importComplex);
} }
} }

View File

@ -102,7 +102,7 @@ void ImportConfigWindow::on_beginImportBtn_clicked()
switch (tabWidget->currentIndex()) { switch (tabWidget->currentIndex()) {
case 0: { case 0: {
// From File... // From File...
bool keepInBound = keepImportedInboundCheckBox->isChecked(); bool ImportAsComplex = keepImportedInboundCheckBox->isChecked();
QString path = fileLineTxt->text(); QString path = fileLineTxt->text();
if (!V2rayKernelInstance::ValidateConfig(path)) { if (!V2rayKernelInstance::ValidateConfig(path)) {
@ -111,7 +111,7 @@ void ImportConfigWindow::on_beginImportBtn_clicked()
} }
aliasPrefix += "_" + QFileInfo(path).fileName(); aliasPrefix += "_" + QFileInfo(path).fileName();
CONFIGROOT config = ConvertConfigFromFile(path, keepInBound); CONFIGROOT config = ConvertConfigFromFile(path, ImportAsComplex);
connections[aliasPrefix] = config; connections[aliasPrefix] = config;
break; break;
} }

View File

@ -82,20 +82,6 @@
</item> </item>
</layout> </layout>
</item> </item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>Inbound</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QCheckBox" name="keepImportedInboundCheckBox">
<property name="text">
<string>Keep imported inbound settings</string>
</property>
</widget>
</item>
<item row="2" column="0"> <item row="2" column="0">
<widget class="QLabel" name="label_10"> <widget class="QLabel" name="label_10">
<property name="text"> <property name="text">
@ -110,6 +96,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0" colspan="2">
<widget class="QCheckBox" name="keepImportedInboundCheckBox">
<property name="text">
<string>Import as Complex Config (Manually edit route rules and inbounds)</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
<widget class="QWidget" name="tabWidgetPage2"> <widget class="QWidget" name="tabWidgetPage2">