diff --git a/.gitmodules b/.gitmodules index 9a7b0117..f04e64e4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "3rdparty/x2struct"] path = 3rdparty/x2struct url = https://github.com/xyz347/x2struct +[submodule "3rdparty/qzxing_noTests"] + path = 3rdparty/qzxing_noTests + url = https://github.com/lhy0403/qzxing_noTests diff --git a/3rdparty/qzxing_noTests b/3rdparty/qzxing_noTests new file mode 160000 index 00000000..812fd390 --- /dev/null +++ b/3rdparty/qzxing_noTests @@ -0,0 +1 @@ +Subproject commit 812fd390ef9d6167555b364120773c9a9fe91023 diff --git a/Build.Counter b/Build.Counter index ace9d036..df90c3c7 100644 --- a/Build.Counter +++ b/Build.Counter @@ -1 +1 @@ -255 +385 diff --git a/Qv2ray.pro b/Qv2ray.pro index ae5cea1a..40826c2a 100644 --- a/Qv2ray.pro +++ b/Qv2ray.pro @@ -6,6 +6,8 @@ QT += core gui widgets network charts +include(3rdparty/qzxing_noTests/QZXing.pri) + TARGET = qv2ray TEMPLATE = app DEFINES += QT_DEPRECATED_WARNINGS @@ -52,29 +54,29 @@ INCLUDEPATH += \ libs/gen/ HEADERS += \ - src/Qv2rayBase.h \ - src/QvCoreConfigObjects.h \ - src/QvCoreConfigOperations.h \ - src/QvCoreInteractions.h \ - src/QvUtils.h \ - src/ui/w_InboundEditor.h \ - src/ui/w_OutboundEditor.h \ - src/ui/w_RoutesEditor.h \ - src/ui/w_SubscriptionEditor.h \ + src/Qv2rayBase.hpp \ + src/QvCoreConfigObjects.hpp \ + src/QvCoreConfigOperations.hpp \ + src/QvCoreInteractions.hpp \ + src/QvUtils.hpp \ + src/ui/w_ImportConfig.hpp \ + src/ui/w_InboundEditor.hpp \ + src/ui/w_JsonEditor.hpp \ + src/ui/w_MainWindow.hpp \ + src/ui/w_OutboundEditor.hpp \ + src/ui/w_PrefrencesWindow.hpp \ + src/ui/w_RoutesEditor.hpp \ + src/ui/w_SubscriptionEditor.hpp \ + src/utils/QJsonModel.hpp \ src/utils/QJsonObjectInsertMacros.h \ - src/utils/QObjectMessageProxy.h \ - src/utils/QPingModel.h \ - src/utils/QvHTTPRequestHelper.h \ - src/utils/QvNetSpeedPlugin.h \ - src/utils/QvRunguard.h \ - src/utils/QvTinyLog.h \ - src/utils/QJsonModel.h \ - src/ui/w_JsonEditor.h \ - src/ui/w_ImportConfig.h \ - src/ui/w_MainWindow.h \ - src/ui/w_PrefrencesWindow.h \ + src/utils/QObjectMessageProxy.hpp \ + src/utils/QPingModel.hpp \ + src/utils/QvHTTPRequestHelper.hpp \ + src/utils/QvNetSpeedPlugin.hpp \ + src/utils/QvRunguard.hpp \ libs/gen/v2ray_api_commands.pb.h \ - libs/gen/v2ray_api_commands.grpc.pb.h + libs/gen/v2ray_api_commands.grpc.pb.h \ + src/utils/QvTinyLog.hpp FORMS += \ src/ui/w_ImportConfig.ui \ @@ -137,6 +139,7 @@ TRANSLATIONS += translations/en-US.ts message(" ") QMAKE_CXXFLAGS += "-Wno-missing-field-initializers" "-Wno-unused-parameter" "-Wno-unused-variable" + win32 { message("Configuring for win32 environment") message(" --> Setting up target descriptions") diff --git a/src/Qv2rayBase.h b/src/Qv2rayBase.hpp similarity index 97% rename from src/Qv2rayBase.h rename to src/Qv2rayBase.hpp index c6b6bd4b..99a07c1e 100644 --- a/src/Qv2rayBase.h +++ b/src/Qv2rayBase.hpp @@ -1,10 +1,10 @@ #ifndef QV2RAYBASE_H #define QV2RAYBASE_H #include -#include "QvTinyLog.h" -#include "QvCoreConfigObjects.h" -#include "QvNetSpeedPlugin.h" -#include "QObjectMessageProxy.h" +#include "QvTinyLog.hpp" +#include "QvCoreConfigObjects.hpp" +#include "QvNetSpeedPlugin.hpp" +#include "QObjectMessageProxy.hpp" #define QV2RAY_CONFIG_VERSION 9 diff --git a/src/QvConfigUpgrade.cpp b/src/QvConfigUpgrade.cpp index 4c29c8ea..085b30b6 100644 --- a/src/QvConfigUpgrade.cpp +++ b/src/QvConfigUpgrade.cpp @@ -3,7 +3,7 @@ // from old to newer versions of Qv2ray. // -#include "QvUtils.h" +#include "QvUtils.hpp" #define UPDATELOG(msg) LOG(MODULE_CONFIG, " [" + to_string(fromVersion) + "-" + to_string(fromVersion + 1) + "] --> " msg) diff --git a/src/QvCoreConfigObjects.h b/src/QvCoreConfigObjects.hpp similarity index 100% rename from src/QvCoreConfigObjects.h rename to src/QvCoreConfigObjects.hpp diff --git a/src/QvCoreConfigOperations.h b/src/QvCoreConfigOperations.hpp similarity index 99% rename from src/QvCoreConfigOperations.h rename to src/QvCoreConfigOperations.hpp index 802c07b4..4c1c4db9 100644 --- a/src/QvCoreConfigOperations.h +++ b/src/QvCoreConfigOperations.hpp @@ -1,7 +1,7 @@ #ifndef CONFIGGENERATION_H #define CONFIGGENERATION_H -#include "QvUtils.h" +#include "QvUtils.hpp" #include "QJsonObjectInsertMacros.h" #define OUTBOUND_TAG_DIRECT "outBound_DIRECT" diff --git a/src/QvCoreConfigOperations_Convertion.cpp b/src/QvCoreConfigOperations_Convertion.cpp index d51dc903..fffb55d4 100644 --- a/src/QvCoreConfigOperations_Convertion.cpp +++ b/src/QvCoreConfigOperations_Convertion.cpp @@ -1,4 +1,4 @@ -#include "QvCoreConfigOperations.h" +#include "QvCoreConfigOperations.hpp" namespace Qv2ray { namespace ConfigOperations diff --git a/src/QvCoreConfigOperations_Generation.cpp b/src/QvCoreConfigOperations_Generation.cpp index 71af6b08..f24316fe 100644 --- a/src/QvCoreConfigOperations_Generation.cpp +++ b/src/QvCoreConfigOperations_Generation.cpp @@ -1,4 +1,4 @@ -#include "QvCoreConfigOperations.h" +#include "QvCoreConfigOperations.hpp" namespace Qv2ray { diff --git a/src/QvCoreConfigOperations_Verification.cpp b/src/QvCoreConfigOperations_Verification.cpp index f72cc3da..6b3b75b5 100644 --- a/src/QvCoreConfigOperations_Verification.cpp +++ b/src/QvCoreConfigOperations_Verification.cpp @@ -1,5 +1,5 @@ -#include "QvCoreConfigOperations.h" -#include "QvUtils.h" +#include "QvCoreConfigOperations.hpp" +#include "QvUtils.hpp" namespace Qv2ray { diff --git a/src/QvCoreInteractions.cpp b/src/QvCoreInteractions.cpp index f8ea8cec..bedef02e 100644 --- a/src/QvCoreInteractions.cpp +++ b/src/QvCoreInteractions.cpp @@ -1,11 +1,11 @@ #include #include #include -#include "QvCoreInteractions.h" -#include "QvCoreConfigOperations.h" +#include "QvCoreInteractions.hpp" +#include "QvCoreConfigOperations.hpp" -#include "QvTinyLog.h" -#include "w_MainWindow.h" +#include "QvTinyLog.hpp" +#include "w_MainWindow.hpp" namespace Qv2ray { diff --git a/src/QvCoreInteractions.h b/src/QvCoreInteractions.hpp similarity index 95% rename from src/QvCoreInteractions.h rename to src/QvCoreInteractions.hpp index ba44335f..94163954 100644 --- a/src/QvCoreInteractions.h +++ b/src/QvCoreInteractions.hpp @@ -1,10 +1,10 @@ -#ifndef VINTERACT_H +#ifndef VINTERACT_H #define VINTERACT_H #include #include -#include "Qv2rayBase.h" +#include "Qv2rayBase.hpp" #include -#include "QvUtils.h" +#include "QvUtils.hpp" #include "v2ray_api_commands.pb.h" #include "v2ray_api_commands.grpc.pb.h" diff --git a/src/QvUtils.cpp b/src/QvUtils.cpp index 8146fd3a..c3d8ac80 100644 --- a/src/QvUtils.cpp +++ b/src/QvUtils.cpp @@ -1,4 +1,4 @@ -#include "QvUtils.h" +#include "QvUtils.hpp" #include namespace Qv2ray diff --git a/src/QvUtils.h b/src/QvUtils.hpp similarity index 98% rename from src/QvUtils.h rename to src/QvUtils.hpp index 2450f5f2..e70bb7e5 100644 --- a/src/QvUtils.h +++ b/src/QvUtils.hpp @@ -1,7 +1,7 @@ #ifndef UTILS_H #define UTILS_H -#include "Qv2rayBase.h" +#include "Qv2rayBase.hpp" #include #include diff --git a/src/main.cpp b/src/main.cpp index 2e99f82a..8c42c9b5 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -4,10 +4,10 @@ #include #include -#include "QvUtils.h" -#include "Qv2rayBase.h" -#include "QvRunguard.h" -#include "w_MainWindow.h" +#include "QvUtils.hpp" +#include "Qv2rayBase.hpp" +#include "QvRunguard.hpp" +#include "w_MainWindow.hpp" bool verifyConfigAvaliability(QString path, bool checkExistingConfig) { @@ -139,7 +139,9 @@ int main(int argc, char *argv[]) LOG("LICENCE", NEWLINE "This program comes with ABSOLUTELY NO WARRANTY." NEWLINE "This is free software, and you are welcome to redistribute it" NEWLINE "under certain conditions." NEWLINE - NEWLINE + NEWLINE NEWLINE + "Libraries that are used in Qv2ray and their authors are listed below:" NEWLINE + "QJsonModel: Copyright (c) 2011 SCHUTZ Sacha" NEWLINE "Qv2ray Current Developer Copyright (C) 2019 Leroy.H.Y (@lhy0403)" NEWLINE "Hv2ray Initial Designs & gRPC implementation Copyright (C) 2019 Hork (@aliyuchang33)" NEWLINE "Hv2ray/Qv2ray HTTP Request Helper (partial) Copyright 2019 (C) SOneWinstone (@SoneWinstone)" NEWLINE diff --git a/src/ui/NetSpeedBar/QvNetSpeedBar.cpp b/src/ui/NetSpeedBar/QvNetSpeedBar.cpp index 7b4271c7..b5d2eb34 100644 --- a/src/ui/NetSpeedBar/QvNetSpeedBar.cpp +++ b/src/ui/NetSpeedBar/QvNetSpeedBar.cpp @@ -1,8 +1,8 @@ #include -#include "QvNetSpeedPlugin.h" -#include "QvUtils.h" +#include "QvNetSpeedPlugin.hpp" +#include "QvUtils.hpp" -#include "w_MainWindow.h" +#include "w_MainWindow.hpp" namespace Qv2ray { namespace Utils diff --git a/src/ui/NetSpeedBar/QvNetSpeedBar_linux.cpp b/src/ui/NetSpeedBar/QvNetSpeedBar_linux.cpp index c144cb0a..0e905b4a 100644 --- a/src/ui/NetSpeedBar/QvNetSpeedBar_linux.cpp +++ b/src/ui/NetSpeedBar/QvNetSpeedBar_linux.cpp @@ -1,6 +1,6 @@ #ifdef __linux__ -#include "QvNetSpeedPlugin.h" -#include "QvUtils.h" +#include "QvNetSpeedPlugin.hpp" +#include "QvUtils.hpp" #include #include namespace Qv2ray diff --git a/src/ui/w_ImportConfig.cpp b/src/ui/w_ImportConfig.cpp index 8af38357..bdf2b586 100644 --- a/src/ui/w_ImportConfig.cpp +++ b/src/ui/w_ImportConfig.cpp @@ -5,13 +5,13 @@ #include #include -#include "QvUtils.h" -#include "QvCoreInteractions.h" -#include "QvCoreConfigOperations.h" -#include "w_OutboundEditor.h" -#include "w_ImportConfig.h" - +#include "QvUtils.hpp" +#include "QvCoreInteractions.hpp" +#include "QvCoreConfigOperations.hpp" +#include "w_OutboundEditor.hpp" +#include "w_ImportConfig.hpp" +#include "QZXing" ImportConfigWindow::ImportConfigWindow(QWidget *parent) : QDialog(parent) diff --git a/src/ui/w_ImportConfig.h b/src/ui/w_ImportConfig.hpp similarity index 95% rename from src/ui/w_ImportConfig.h rename to src/ui/w_ImportConfig.hpp index 516ae901..c906b9e4 100644 --- a/src/ui/w_ImportConfig.h +++ b/src/ui/w_ImportConfig.hpp @@ -16,6 +16,7 @@ class ImportConfigWindow : public QDialog public: explicit ImportConfigWindow(QWidget *parent = nullptr); ~ImportConfigWindow(); + void OpenImporter(); signals: void s_reload_config(bool need_restart); private slots: diff --git a/src/ui/w_InboundEditor.cpp b/src/ui/w_InboundEditor.cpp index 4985020b..39b14761 100644 --- a/src/ui/w_InboundEditor.cpp +++ b/src/ui/w_InboundEditor.cpp @@ -1,7 +1,7 @@ -#include "w_InboundEditor.h" +#include "w_InboundEditor.hpp" #include "ui_w_InboundEditor.h" -#include "QvUtils.h" -#include "QvCoreConfigOperations.h" +#include "QvUtils.hpp" +#include "QvCoreConfigOperations.hpp" static bool isLoading = false; #define PREPARE_RETURN if(isLoading) return; diff --git a/src/ui/w_InboundEditor.h b/src/ui/w_InboundEditor.hpp similarity index 100% rename from src/ui/w_InboundEditor.h rename to src/ui/w_InboundEditor.hpp diff --git a/src/ui/w_JsonEditor.cpp b/src/ui/w_JsonEditor.cpp index c062c67b..6ce1076d 100644 --- a/src/ui/w_JsonEditor.cpp +++ b/src/ui/w_JsonEditor.cpp @@ -1,7 +1,7 @@ -#include "w_JsonEditor.h" +#include "w_JsonEditor.hpp" #include "ui_w_JsonEditor.h" -#include "QvUtils.h" +#include "QvUtils.hpp" JsonEditor::JsonEditor(QJsonObject rootObject, QWidget *parent) : QDialog(parent), diff --git a/src/ui/w_JsonEditor.h b/src/ui/w_JsonEditor.hpp similarity index 91% rename from src/ui/w_JsonEditor.h rename to src/ui/w_JsonEditor.hpp index 397cbb22..0126e77d 100644 --- a/src/ui/w_JsonEditor.h +++ b/src/ui/w_JsonEditor.hpp @@ -1,9 +1,9 @@ -#ifndef W_JSONEDITOR_H +#ifndef W_JSONEDITOR_H #define W_JSONEDITOR_H #include #include -#include "QJsonModel.h" +#include "QJsonModel.hpp" namespace Ui { diff --git a/src/ui/w_MainWindow.cpp b/src/ui/w_MainWindow.cpp index 3154c267..c114806e 100644 --- a/src/ui/w_MainWindow.cpp +++ b/src/ui/w_MainWindow.cpp @@ -12,15 +12,15 @@ #include #include -#include "w_OutboundEditor.h" -#include "w_ImportConfig.h" -#include "w_MainWindow.h" -#include "w_RoutesEditor.h" -#include "w_PrefrencesWindow.h" -#include "w_SubscriptionEditor.h" -#include "w_JsonEditor.h" +#include "w_OutboundEditor.hpp" +#include "w_ImportConfig.hpp" +#include "w_MainWindow.hpp" +#include "w_RoutesEditor.hpp" +#include "w_PrefrencesWindow.hpp" +#include "w_SubscriptionEditor.hpp" +#include "w_JsonEditor.hpp" -#include "QvNetSpeedPlugin.h" +#include "QvNetSpeedPlugin.hpp" #define TRAY_TOOLTIP_PREFIX "Qv2ray " QV2RAY_VERSION_STRING @@ -222,6 +222,8 @@ void MainWindow::LoadConnections() if (items.count() > 0) { ui->connectionListWidget->setCurrentItem(items.first()); } + + ShowAndSetConnection(CurrentConnectionName, false, false); } } void MainWindow::OnConfigListChanged(bool need_restart) @@ -412,6 +414,8 @@ void MainWindow::ShowAndSetConnection(QString guiConnectionName, bool SetConnect ui->_portLabel->setText(QSTRING(to_string(Server.port))); } + ui->routeCountLabel->setText(QString::number((connections[guiConnectionName])["routing"].toArray().count())); + // --------- END Show Connection // // Set Connection @@ -545,10 +549,10 @@ void MainWindow::on_removeConfigButton_clicked() } void MainWindow::on_importConfigButton_clicked() { + // TODO ImportConfigWindow *w = new ImportConfigWindow(this); - connect(w, &ImportConfigWindow::s_reload_config, this, &MainWindow::OnConfigListChanged); - w->exec(); - ShowAndSetConnection(CurrentConnectionName, false, false); + //w->OpenImporter(); + OnConfigListChanged(false); } void MainWindow::on_addConfigButton_clicked() { diff --git a/src/ui/w_MainWindow.h b/src/ui/w_MainWindow.hpp similarity index 95% rename from src/ui/w_MainWindow.h rename to src/ui/w_MainWindow.hpp index b6a9e952..4beba250 100644 --- a/src/ui/w_MainWindow.h +++ b/src/ui/w_MainWindow.hpp @@ -6,10 +6,10 @@ #include #include -#include "QvUtils.h" -#include "QvCoreInteractions.h" -#include "QvCoreConfigOperations.h" -#include "QvHTTPRequestHelper.h" +#include "QvUtils.hpp" +#include "QvCoreInteractions.hpp" +#include "QvCoreConfigOperations.hpp" +#include "QvHTTPRequestHelper.hpp" #include "ui_w_MainWindow.h" diff --git a/src/ui/w_MainWindow.ui b/src/ui/w_MainWindow.ui index f29f8132..65a7a289 100644 --- a/src/ui/w_MainWindow.ui +++ b/src/ui/w_MainWindow.ui @@ -294,58 +294,58 @@ - + - Type + Config Type - + - + - Address + Protocol - + - + - Port Number + Address - + - + - Routes Count + Port Number - + - TextLabel + @@ -357,9 +357,9 @@ - + - TextLabel + diff --git a/src/ui/w_OutboundEditor.cpp b/src/ui/w_OutboundEditor.cpp index f2bbeb1d..cc323029 100644 --- a/src/ui/w_OutboundEditor.cpp +++ b/src/ui/w_OutboundEditor.cpp @@ -3,9 +3,9 @@ #include #include -#include "w_OutboundEditor.h" -#include "w_MainWindow.h" -#include "w_JsonEditor.h" +#include "w_OutboundEditor.hpp" +#include "w_MainWindow.hpp" +#include "w_JsonEditor.hpp" OutboundEditor::OutboundEditor(QWidget *parent) : QDialog(parent), diff --git a/src/ui/w_OutboundEditor.h b/src/ui/w_OutboundEditor.hpp similarity index 98% rename from src/ui/w_OutboundEditor.h rename to src/ui/w_OutboundEditor.hpp index d31678c4..4ccf7b50 100644 --- a/src/ui/w_OutboundEditor.h +++ b/src/ui/w_OutboundEditor.hpp @@ -1,9 +1,9 @@ -#ifndef CONFEDIT_H +#ifndef CONFEDIT_H #define CONFEDIT_H #include #include -#include "QvCoreConfigObjects.h" +#include "QvCoreConfigObjects.hpp" #include "ui_w_OutboundEditor.h" namespace Ui diff --git a/src/ui/w_PrefrencesWindow.cpp b/src/ui/w_PrefrencesWindow.cpp index 9d830dfa..981a6a0a 100644 --- a/src/ui/w_PrefrencesWindow.cpp +++ b/src/ui/w_PrefrencesWindow.cpp @@ -3,9 +3,9 @@ #include #include -#include "QvUtils.h" -#include "QvCoreInteractions.h" -#include "w_PrefrencesWindow.h" +#include "QvUtils.hpp" +#include "QvCoreInteractions.hpp" +#include "w_PrefrencesWindow.hpp" #define LOADINGCHECK if(!finishedLoading) return; diff --git a/src/ui/w_PrefrencesWindow.h b/src/ui/w_PrefrencesWindow.hpp similarity index 99% rename from src/ui/w_PrefrencesWindow.h rename to src/ui/w_PrefrencesWindow.hpp index e7994152..a860cb4e 100644 --- a/src/ui/w_PrefrencesWindow.h +++ b/src/ui/w_PrefrencesWindow.hpp @@ -3,7 +3,7 @@ #include #include -#include "Qv2rayBase.h" +#include "Qv2rayBase.hpp" namespace Ui { diff --git a/src/ui/w_PrefrencesWindow.ui b/src/ui/w_PrefrencesWindow.ui index 9209186a..c6100664 100644 --- a/src/ui/w_PrefrencesWindow.ui +++ b/src/ui/w_PrefrencesWindow.ui @@ -45,7 +45,7 @@ QTabWidget::Rounded - 0 + 2 @@ -314,61 +314,61 @@ - - - Username - - - - - - - user - - - - - - - Password - - - - - - - pass - - - - SOCKS UDP - - - - Local IP - - - - + Enabled - + + + + Local IP + + + + 127.0.0.1 + + + + Username + + + + + + + user + + + + + + + Password + + + + + + + pass + + + @@ -658,7 +658,7 @@ - User Name + Username diff --git a/src/ui/w_RoutesEditor.cpp b/src/ui/w_RoutesEditor.cpp index 5a5f8816..cfd14480 100644 --- a/src/ui/w_RoutesEditor.cpp +++ b/src/ui/w_RoutesEditor.cpp @@ -1,9 +1,9 @@ -#include "w_RoutesEditor.h" -#include "QvCoreConfigOperations.h" +#include "w_RoutesEditor.hpp" +#include "QvCoreConfigOperations.hpp" #include "ui_w_RoutesEditor.h" -#include "w_OutboundEditor.h" -#include "w_JsonEditor.h" -#include "w_InboundEditor.h" +#include "w_OutboundEditor.hpp" +#include "w_JsonEditor.hpp" +#include "w_InboundEditor.hpp" #define CurrentRule this->rules[this->currentRuleIndex] #define STATUS(msg) ui->statusLabel->setText(tr(msg)); diff --git a/src/ui/w_RoutesEditor.h b/src/ui/w_RoutesEditor.hpp similarity index 97% rename from src/ui/w_RoutesEditor.h rename to src/ui/w_RoutesEditor.hpp index dc978e66..7c82e965 100644 --- a/src/ui/w_RoutesEditor.h +++ b/src/ui/w_RoutesEditor.hpp @@ -1,4 +1,4 @@ -#ifndef W_QVOUTBOUNDEDITOR_H +#ifndef W_QVOUTBOUNDEDITOR_H #define W_QVOUTBOUNDEDITOR_H #include @@ -6,7 +6,7 @@ #include #include #include -#include "QvUtils.h" +#include "QvUtils.hpp" namespace Ui { diff --git a/src/ui/w_SubscriptionEditor.cpp b/src/ui/w_SubscriptionEditor.cpp index 9298f42e..60031048 100644 --- a/src/ui/w_SubscriptionEditor.cpp +++ b/src/ui/w_SubscriptionEditor.cpp @@ -1,8 +1,8 @@ -#include "w_SubscriptionEditor.h" +#include "w_SubscriptionEditor.hpp" #include "ui_w_SubscriptionEditor.h" -#include "QvHTTPRequestHelper.h" -#include "QvUtils.h" -#include "QvCoreConfigOperations.h" +#include "QvHTTPRequestHelper.hpp" +#include "QvUtils.hpp" +#include "QvCoreConfigOperations.hpp" SubscribeEditor::SubscribeEditor(QWidget *parent) : diff --git a/src/ui/w_SubscriptionEditor.h b/src/ui/w_SubscriptionEditor.hpp similarity index 89% rename from src/ui/w_SubscriptionEditor.h rename to src/ui/w_SubscriptionEditor.hpp index 794e5272..3d0f9db9 100644 --- a/src/ui/w_SubscriptionEditor.h +++ b/src/ui/w_SubscriptionEditor.hpp @@ -1,9 +1,9 @@ -#ifndef W_SUBSCRIBEEDITOR_H +#ifndef W_SUBSCRIBEEDITOR_H #define W_SUBSCRIBEEDITOR_H #include -#include "QvUtils.h" -#include "QvHTTPRequestHelper.h" +#include "QvUtils.hpp" +#include "QvHTTPRequestHelper.hpp" namespace Ui { diff --git a/src/ui/w_SubscriptionEditor.ui b/src/ui/w_SubscriptionEditor.ui index e2a435d2..28c7d895 100644 --- a/src/ui/w_SubscriptionEditor.ui +++ b/src/ui/w_SubscriptionEditor.ui @@ -37,7 +37,7 @@ A - + :/icons/add_connection_btn.png:/icons/add_connection_btn.png @@ -57,7 +57,7 @@ R - + :/icons/remove_connection_btn.png:/icons/remove_connection_btn.png @@ -211,7 +211,7 @@ - + diff --git a/src/utils/QJsonModel.cpp b/src/utils/QJsonModel.cpp index 37f98d11..479723a5 100644 --- a/src/utils/QJsonModel.cpp +++ b/src/utils/QJsonModel.cpp @@ -22,7 +22,7 @@ * SOFTWARE. */ -#include "QJsonModel.h" +#include "QJsonModel.hpp" #include #include #include diff --git a/src/utils/QJsonModel.h b/src/utils/QJsonModel.hpp similarity index 100% rename from src/utils/QJsonModel.h rename to src/utils/QJsonModel.hpp diff --git a/src/utils/QObjectMessageProxy.cpp b/src/utils/QObjectMessageProxy.cpp index c22ac62e..fa3f2b48 100644 --- a/src/utils/QObjectMessageProxy.cpp +++ b/src/utils/QObjectMessageProxy.cpp @@ -1,4 +1,4 @@ -#include "QObjectMessageProxy.h" +#include "QObjectMessageProxy.hpp" namespace Qv2ray { namespace Utils diff --git a/src/utils/QObjectMessageProxy.h b/src/utils/QObjectMessageProxy.hpp similarity index 100% rename from src/utils/QObjectMessageProxy.h rename to src/utils/QObjectMessageProxy.hpp diff --git a/src/utils/QPingModel.cpp b/src/utils/QPingModel.cpp index 835350cd..7afda926 100644 --- a/src/utils/QPingModel.cpp +++ b/src/utils/QPingModel.cpp @@ -1,6 +1,6 @@ #include #include -#include "QPingModel.h" +#include "QPingModel.hpp" namespace Qv2ray { diff --git a/src/utils/QPingModel.h b/src/utils/QPingModel.hpp similarity index 100% rename from src/utils/QPingModel.h rename to src/utils/QPingModel.hpp diff --git a/src/utils/QvHTTPRequestHelper.cpp b/src/utils/QvHTTPRequestHelper.cpp index 4d07d0ce..63ca32ed 100644 --- a/src/utils/QvHTTPRequestHelper.cpp +++ b/src/utils/QvHTTPRequestHelper.cpp @@ -1,8 +1,8 @@ -#include "QvHTTPRequestHelper.h" +#include "QvHTTPRequestHelper.hpp" #include namespace Qv2ray { - QvHttpRequestHelper::QvHttpRequestHelper() + QvHttpRequestHelper::QvHttpRequestHelper() : reply() { } @@ -16,7 +16,7 @@ namespace Qv2ray QUrl qUrl = QUrl(url); if (!qUrl.isValid()) { - qDebug() << "URL is invalid!\n"; + LOG(MODULE_NETWORK, "Provided URL is invalid") return false; } @@ -33,12 +33,8 @@ namespace Qv2ray { this->setUrl(url); reply = accessManager.get(request); - reply->waitForReadyRead(5000); - - if (!reply->isReadable()) - return QByteArray(); - else - return reply->readAll(); + bool isReadyRead = reply->waitForReadyRead(10000); + return isReadyRead ? reply->readAll() : QByteArray(); } void QvHttpRequestHelper::get(const QString &url) @@ -50,41 +46,41 @@ namespace Qv2ray connect(reply, &QNetworkReply::readyRead, this, &QvHttpRequestHelper::onReadyRead); } - void QvHttpRequestHelper::post(const QString &url, const QByteArray &data) - { - this->setUrl(url); - request.setRawHeader("Content-Type", "application/json"); - reply = accessManager.post(request, data); - connect(reply, &QNetworkReply::finished, this, &QvHttpRequestHelper::onRequestFinished); - connect(reply, &QNetworkReply::readyRead, this, &QvHttpRequestHelper::onReadyRead); - } + //void QvHttpRequestHelper::post(const QString &url, const QByteArray &data) + //{ + // this->setUrl(url); + // request.setRawHeader("Content-Type", "application/json"); + // reply = accessManager.post(request, data); + // connect(reply, &QNetworkReply::finished, this, &QvHttpRequestHelper::onRequestFinished); + // connect(reply, &QNetworkReply::readyRead, this, &QvHttpRequestHelper::onReadyRead); + //} - void QvHttpRequestHelper::put(const QString &url, const QByteArray &data) - { - this->setUrl(url); - request.setRawHeader("Content-Type", "application/json"); - reply = accessManager.put(request, data); - connect(reply, &QNetworkReply::finished, this, &QvHttpRequestHelper::onRequestFinished); - connect(reply, &QNetworkReply::readyRead, this, &QvHttpRequestHelper::onReadyRead); - } + // void QvHttpRequestHelper::put(const QString &url, const QByteArray &data) + // { + // this->setUrl(url); + // request.setRawHeader("Content-Type", "application/json"); + // reply = accessManager.put(request, data); + // connect(reply, &QNetworkReply::finished, this, &QvHttpRequestHelper::onRequestFinished); + // connect(reply, &QNetworkReply::readyRead, this, &QvHttpRequestHelper::onReadyRead); + // } - void QvHttpRequestHelper::del(const QString &url) - { - this->setUrl(url); - request.setRawHeader("Content-Type", "application/json"); - reply = accessManager.deleteResource(request); - connect(reply, &QNetworkReply::finished, this, &QvHttpRequestHelper::onRequestFinished); - connect(reply, &QNetworkReply::readyRead, this, &QvHttpRequestHelper::onReadyRead); - } + // void QvHttpRequestHelper::del(const QString &url) + // { + // this->setUrl(url); + // request.setRawHeader("Content-Type", "application/json"); + // reply = accessManager.deleteResource(request); + // connect(reply, &QNetworkReply::finished, this, &QvHttpRequestHelper::onRequestFinished); + // connect(reply, &QNetworkReply::readyRead, this, &QvHttpRequestHelper::onReadyRead); + // } - void QvHttpRequestHelper::login(const QString &url, const QByteArray &data) - { - this->setUrl(url); - request.setRawHeader("Content-Type", "application/x-www-form-urlencoded"); - reply = accessManager.post(request, data); - connect(reply, &QNetworkReply::finished, this, &QvHttpRequestHelper::onRequestFinished); - connect(reply, &QNetworkReply::readyRead, this, &QvHttpRequestHelper::onReadyRead); - } + // void QvHttpRequestHelper::login(const QString &url, const QByteArray &data) + // { + // this->setUrl(url); + // request.setRawHeader("Content-Type", "application/x-www-form-urlencoded"); + // reply = accessManager.post(request, data); + // connect(reply, &QNetworkReply::finished, this, &QvHttpRequestHelper::onRequestFinished); + // connect(reply, &QNetworkReply::readyRead, this, &QvHttpRequestHelper::onReadyRead); + // } void QvHttpRequestHelper::onRequestFinished() { diff --git a/src/utils/QvHTTPRequestHelper.h b/src/utils/QvHTTPRequestHelper.hpp similarity index 83% rename from src/utils/QvHTTPRequestHelper.h rename to src/utils/QvHTTPRequestHelper.hpp index 97f0d42f..1b82e75a 100644 --- a/src/utils/QvHTTPRequestHelper.h +++ b/src/utils/QvHTTPRequestHelper.hpp @@ -1,5 +1,4 @@ -/* - * Qv2ray +/* Copyright (C) 2019 SoneWinstone (jianwenzhen@qq.com) Copyright (C) 2019 Leroy.H.Y @@ -24,7 +23,7 @@ #include #include #include -#include "QvUtils.h" +#include "QvUtils.hpp" namespace Qv2ray { @@ -39,13 +38,13 @@ namespace Qv2ray // get QByteArray syncget(const QString &url); void get(const QString &url); - // insert - void post(const QString &url, const QByteArray &data); - // update - void put(const QString &url, const QByteArray &data); - // delete - void del(const QString &url); - void login(const QString &url, const QByteArray &data); + //// insert + //void post(const QString &url, const QByteArray &data); + //// update + //void put(const QString &url, const QByteArray &data); + //// delete + //void del(const QString &url); + //void login(const QString &url, const QByteArray &data); signals: void httpRequestFinished(QByteArray &data); diff --git a/src/utils/QvNetSpeedPlugin.h b/src/utils/QvNetSpeedPlugin.hpp similarity index 100% rename from src/utils/QvNetSpeedPlugin.h rename to src/utils/QvNetSpeedPlugin.hpp diff --git a/src/utils/QvRunguard.cpp b/src/utils/QvRunguard.cpp index 5c68d196..103a4675 100644 --- a/src/utils/QvRunguard.cpp +++ b/src/utils/QvRunguard.cpp @@ -1,6 +1,6 @@ #include -#include "QvRunguard.h" +#include "QvRunguard.hpp" namespace Qv2ray { diff --git a/src/utils/QvRunguard.h b/src/utils/QvRunguard.hpp similarity index 100% rename from src/utils/QvRunguard.h rename to src/utils/QvRunguard.hpp diff --git a/src/utils/QvTinyLog.h b/src/utils/QvTinyLog.hpp similarity index 100% rename from src/utils/QvTinyLog.h rename to src/utils/QvTinyLog.hpp diff --git a/translations/en-US.ts b/translations/en-US.ts index f9262280..4e74577c 100644 --- a/translations/en-US.ts +++ b/translations/en-US.ts @@ -4,115 +4,170 @@ ImportConfigWindow - + Import file - + Name - + Import Source - + File - + VMess String - - + + Subscription Link - + Scan Image - - #Import + + Import - + Path - - + + Select - + Inbound - + Keep imported inbound settings - + + Edit Config + + + + + Open in JSON Editor + + + + VMess Connection String - + + Put your vmess:// here + + + + + VMess Check Status + + + + + Processing + + + + + 0/0 + + + + + Line Failed + + + + + 0 + + + + TO DO IN VERSION 2 - + + GroupBox + + + + ---TODO--- - - Select File: + + Select Image File - + + Scan from Screen + + + + + Go + + + + Select file to import - + Import config file - + Failed to check the validity of the config file. - - + + VMess String Check - + VMess string is not valid. - + VMess config is not valid. @@ -401,6 +456,11 @@ Json Structure Preview + + + Format JSON + + Json Editor @@ -411,11 +471,6 @@ OK - - - Format Json - - @@ -448,19 +503,19 @@ - + Connect - + Disconnect - + Reconnect @@ -485,38 +540,62 @@ - + + Add new connection manually + + + + + Import connection + + + + + Duplicate connection + + + + + D + + + + + Delete a connection + + + + + Edit connection + + + + + Edit connection as JSON + + + + { } - + Config Details - - Type - - - - + Ping - - - #AddConnection - - A - - + #ImportConnection @@ -526,251 +605,240 @@ - - #EditConnection - - - - + ... - - #RemoveConnection - - - - + R - + + Config Type + + + + + Protocol + + + + Address - + Port Number - - Routes Count - - - - - - TextLabel - - - - + Mux - + QR Code - + VMess - + Log - + Speed Graph - + Speed - + 0.00 B/s 0.00 B/s - + Data - + 0.00 B 0.00 B - + #ManuallyCreateConnection - + #Exit - + #Preferences - + #Start - + #Stop - + #Restart - - + + Hide - + Quit - + Rename - + Connect to this - + Edit as Json - - - + + + Show - + Update - + Found a new version: - + Download Link: - - + + No connection selected! - + Share as vmess:// - + Share as QRCore - - + + Please select a config from the list. - - - + + + Connected To Server: - + Disconnected + - Rename a Connection - + The name cannot be empty - - + + Removing this Connection - + Failed to delete connection file, please delete manually. - - + + No Config Selected - - + + Please Select a Config - + The name has been used already, Please choose another. - + Connected - + Are you sure to remove this connection? @@ -1022,427 +1090,484 @@ PrefrencesWindow - - - - + + + + Prefrences - + General - - Language - - - - - zh-CN - - - - - en-US + + UI Theme + Dark Chart Theme + + + + + Language + + + + + zh-CN + + + + + en-US + + + + Log Level - + none - + debug - + info - + warning - + error - + Automatically Connect To - + Transparent Proxy Support - - - - - - - - - - + + + + + + + + + + + + + Enabled - + v2ray Assets Path - - + + Select - + + Connection Settings + + + + + General Connection Settings + + + + Statistics - + API Port - + v2ray Core Path - - InBound Settings - - - - - + + + Port - - + + + Authentication - - + + + Username - - + + + Password - + Listening Address - + + Inbound Settings + + + + SOCKS Inbound Settings - + SOCKS UDP - + Local IP - + HTTP Inbound Settings - - Route Settings - - - - + Enable Proxy - + Bypass Chinese Mainland - + Use Local DNS - + DNS List - - NetSpeed Bar Settings - - - - + Items - - - - - + + + + + ... - + Page Y Offset - + Pages - + Lines - + Text Style - + Font - - + + Bold - - + + Italic - + Size - + Color - + A: - + R: - + G: - + B: - + Style - + Content - + Content Type - + Text/Tag - + You can config how the network speed toolbar looks like in this panel - + Apply Network Speed Bar UI Settings - + About - + Qv2ray - + Version: - + + TIME + + + + Official Repo: - + <html><head/><body><p><a href="https://github.com/lhy0403/Qv2ray"><span style=" text-decoration: underline; color:#2980b9;">https://github.com/lhy0403/Qv2ray</span></a></p></body></html> - + License: - + <html><head/><body><p><a href="https://www.gnu.org/licenses/gpl-3.0.txt"><span style=" text-decoration: underline; color:#2980b9;">GPLv3 (https://www.gnu.org/licenses/gpl-3.0.txt)</span></a></p></body></html> - + About Qt - + Ingore Next Version - + + Forward Proxy + + + + + Status + + + + + Type + + + + + HTTP + + + + + Socks + + + + + Host Address + + + + + Network Toolbar Settings + + + + Cancel - + Built Time - + Page - + Item(s) - + Port numbers cannot be the same - + Open v2ray core file - - + + Enable tProxy Support - + This will append capabilities to the v2ray executable. - + Qv2ray will copy your v2ray core to this path: - + If anything goes wrong after enabling this, please refer to issue #57 or the link below: - + Qv2ray cannot copy one or both v2ray files from: - + to this path: - - + + Failed to setcap onto v2ray executable. You may need to run `setcap` manually. - + tProxy is not supported on macOS and Windows - + Open v2ray assets folder @@ -1450,23 +1575,23 @@ QObject - + Qv2ray Cannot Continue - + You are running a lower version of Qv2ray compared to the current config file. - + Please report if you think this is an error. - - + + Qv2ray will now exit. @@ -1486,42 +1611,42 @@ - + DependencyMissing - + Cannot find openssl libs - + This could be caused by a missing of `openssl` package in your system. Or an AppImage issue. - + If you are using AppImage, please report a bug. - + Please refer to Github Issue #65 to check for solutions. - + Github Issue Link: - + Technical Details - + Another instance of Qv2ray is already running. @@ -1644,277 +1769,293 @@ RouteEditor - - - + + + Enabled - + InBounds - + Outbound - + + Source IP Matching List + + + + + Target Domain List + + + + Protocol - + HTTP - + TLS - + BitTorrent - + e.g. 80, 443, 8000-8080 - + + Enable Balancers + + + + Balancers - - Users + + Outbound Tag - + + Users List + + + + Network - + TCP - + UDP - + Both - - - - - - - - + + + + + + + + ... - + Inbound List - + Inbound Information - - + + Tag - - + + Type - - + + Address - - - + + + Port - + Route Editor - - + D - + + F + + + + + B + + + + Routes - + Domain/IP - - Set Inbound/Outbound - - - - + Route Details - - Target Host List - - - - + Target IP List - - Source IP List - - - - + Outbound List - + Outbound Information - + Status - - - - + + + + No Tag - - + + Any - - + + Items - + Cannot find an inbound by tag: - + Index Out Of Range - + Cannot Edit - + This outbound entry is not supported by the GUI editor. - + Currently, this type of outbound is not supported by the editor. - - - + + + + Changing route inbound/outbound - + You didn't select an outbound. - + Banlancer will be used. - + + One or more inbound config(s) have no tag configured, do you still want to continue? - + Are you sure to change the inbound/outbound of currently selected route? - + Current inbound/outbound combinations: - + Inbounds: - + Outbound: - - + + We will launch Json Editor instead.