mirror of
https://github.com/Qv2ray/Qv2ray.git
synced 2025-05-20 02:40:20 +08:00
[CHANGE] Changed cpp/hpp naming style and added Qr Code library
Signed-off-by: Leroy.H.Y <me@lhy0403.top>
Former-commit-id: 867d107464
This commit is contained in:
parent
408479f8c7
commit
cd24390272
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -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
|
||||
|
1
3rdparty/qzxing_noTests
vendored
Submodule
1
3rdparty/qzxing_noTests
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 812fd390ef9d6167555b364120773c9a9fe91023
|
@ -1 +1 @@
|
||||
255
|
||||
385
|
||||
|
45
Qv2ray.pro
45
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")
|
||||
|
@ -1,10 +1,10 @@
|
||||
#ifndef QV2RAYBASE_H
|
||||
#define QV2RAYBASE_H
|
||||
#include <QtCore>
|
||||
#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
|
||||
|
@ -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)
|
||||
|
||||
|
@ -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"
|
@ -1,4 +1,4 @@
|
||||
#include "QvCoreConfigOperations.h"
|
||||
#include "QvCoreConfigOperations.hpp"
|
||||
namespace Qv2ray
|
||||
{
|
||||
namespace ConfigOperations
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "QvCoreConfigOperations.h"
|
||||
#include "QvCoreConfigOperations.hpp"
|
||||
|
||||
namespace Qv2ray
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
#include "QvCoreConfigOperations.h"
|
||||
#include "QvUtils.h"
|
||||
#include "QvCoreConfigOperations.hpp"
|
||||
#include "QvUtils.hpp"
|
||||
|
||||
namespace Qv2ray
|
||||
{
|
||||
|
@ -1,11 +1,11 @@
|
||||
#include <QObject>
|
||||
#include <QWidget>
|
||||
#include <QDesktopServices>
|
||||
#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
|
||||
{
|
||||
|
@ -1,10 +1,10 @@
|
||||
#ifndef VINTERACT_H
|
||||
#ifndef VINTERACT_H
|
||||
#define VINTERACT_H
|
||||
#include <QProcess>
|
||||
#include <QString>
|
||||
#include "Qv2rayBase.h"
|
||||
#include "Qv2rayBase.hpp"
|
||||
#include <grpc++/grpc++.h>
|
||||
#include "QvUtils.h"
|
||||
#include "QvUtils.hpp"
|
||||
#include "v2ray_api_commands.pb.h"
|
||||
#include "v2ray_api_commands.grpc.pb.h"
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "QvUtils.h"
|
||||
#include "QvUtils.hpp"
|
||||
#include <QTextStream>
|
||||
|
||||
namespace Qv2ray
|
||||
|
@ -1,7 +1,7 @@
|
||||
#ifndef UTILS_H
|
||||
#define UTILS_H
|
||||
|
||||
#include "Qv2rayBase.h"
|
||||
#include "Qv2rayBase.hpp"
|
||||
#include <QMessageBox>
|
||||
#include <QUuid>
|
||||
|
12
src/main.cpp
12
src/main.cpp
@ -4,10 +4,10 @@
|
||||
#include <QStyle>
|
||||
#include <QStyleFactory>
|
||||
|
||||
#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
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include <QThread>
|
||||
#include "QvNetSpeedPlugin.h"
|
||||
#include "QvUtils.h"
|
||||
#include "QvNetSpeedPlugin.hpp"
|
||||
#include "QvUtils.hpp"
|
||||
|
||||
#include "w_MainWindow.h"
|
||||
#include "w_MainWindow.hpp"
|
||||
namespace Qv2ray
|
||||
{
|
||||
namespace Utils
|
||||
|
@ -1,6 +1,6 @@
|
||||
#ifdef __linux__
|
||||
#include "QvNetSpeedPlugin.h"
|
||||
#include "QvUtils.h"
|
||||
#include "QvNetSpeedPlugin.hpp"
|
||||
#include "QvUtils.hpp"
|
||||
#include <QLocalSocket>
|
||||
#include <QLocalServer>
|
||||
namespace Qv2ray
|
||||
|
@ -5,13 +5,13 @@
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
|
||||
#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)
|
||||
|
@ -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:
|
@ -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;
|
||||
|
@ -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),
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef W_JSONEDITOR_H
|
||||
#ifndef W_JSONEDITOR_H
|
||||
#define W_JSONEDITOR_H
|
||||
|
||||
#include <QDialog>
|
||||
#include <QtCore>
|
||||
#include "QJsonModel.h"
|
||||
#include "QJsonModel.hpp"
|
||||
|
||||
namespace Ui
|
||||
{
|
@ -12,15 +12,15 @@
|
||||
#include <QVersionNumber>
|
||||
#include <QKeyEvent>
|
||||
|
||||
#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()
|
||||
{
|
||||
|
@ -6,10 +6,10 @@
|
||||
#include <QtCharts>
|
||||
#include <QSystemTrayIcon>
|
||||
|
||||
#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"
|
||||
|
@ -294,58 +294,58 @@
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Type</string>
|
||||
<string>Config Type</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="_OutBoundTypeLabel">
|
||||
<widget class="QLabel" name="routeCountLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Address</string>
|
||||
<string>Protocol</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="_hostLabel">
|
||||
<widget class="QLabel" name="_OutBoundTypeLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Port Number</string>
|
||||
<string>Address</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLabel" name="_portLabel">
|
||||
<widget class="QLabel" name="_hostLabel">
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
<string>Routes Count</string>
|
||||
<string>Port Number</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<widget class="QLabel" name="_portLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@ -357,9 +357,9 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLabel" name="label_9">
|
||||
<widget class="QLabel" name="muxLabel">
|
||||
<property name="text">
|
||||
<string>TextLabel</string>
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -3,9 +3,9 @@
|
||||
#include <QIntValidator>
|
||||
#include <iostream>
|
||||
|
||||
#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),
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef CONFEDIT_H
|
||||
#ifndef CONFEDIT_H
|
||||
#define CONFEDIT_H
|
||||
|
||||
#include <QtCore>
|
||||
#include <QDialog>
|
||||
#include "QvCoreConfigObjects.h"
|
||||
#include "QvCoreConfigObjects.hpp"
|
||||
#include "ui_w_OutboundEditor.h"
|
||||
|
||||
namespace Ui
|
@ -3,9 +3,9 @@
|
||||
#include <QStyleFactory>
|
||||
#include <QStyle>
|
||||
|
||||
#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;
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#include <QDialog>
|
||||
#include <ui_w_PrefrencesWindow.h>
|
||||
#include "Qv2rayBase.h"
|
||||
#include "Qv2rayBase.hpp"
|
||||
|
||||
namespace Ui
|
||||
{
|
@ -45,7 +45,7 @@
|
||||
<enum>QTabWidget::Rounded</enum>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>2</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="tab">
|
||||
<attribute name="title">
|
||||
@ -314,61 +314,61 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Username</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="socksAuthUsernameTxt">
|
||||
<property name="placeholderText">
|
||||
<string notr="true">user</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="socksAuthPasswordTxt">
|
||||
<property name="placeholderText">
|
||||
<string notr="true">pass</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_14">
|
||||
<property name="text">
|
||||
<string>SOCKS UDP</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_25">
|
||||
<property name="text">
|
||||
<string>Local IP</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="socksUDPCB">
|
||||
<property name="text">
|
||||
<string>Enabled</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_25">
|
||||
<property name="text">
|
||||
<string>Local IP</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QLineEdit" name="socksUDPIP">
|
||||
<property name="placeholderText">
|
||||
<string notr="true">127.0.0.1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0">
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string>Username</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QLineEdit" name="socksAuthUsernameTxt">
|
||||
<property name="placeholderText">
|
||||
<string notr="true">user</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Password</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QLineEdit" name="socksAuthPasswordTxt">
|
||||
<property name="placeholderText">
|
||||
<string notr="true">pass</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
@ -658,7 +658,7 @@
|
||||
<item row="4" column="0">
|
||||
<widget class="QLabel" name="label_52">
|
||||
<property name="text">
|
||||
<string>User Name</string>
|
||||
<string>Username</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -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));
|
||||
|
@ -1,4 +1,4 @@
|
||||
#ifndef W_QVOUTBOUNDEDITOR_H
|
||||
#ifndef W_QVOUTBOUNDEDITOR_H
|
||||
#define W_QVOUTBOUNDEDITOR_H
|
||||
|
||||
#include <list>
|
||||
@ -6,7 +6,7 @@
|
||||
#include <QJsonArray>
|
||||
#include <QJsonObject>
|
||||
#include <QListWidgetItem>
|
||||
#include "QvUtils.h"
|
||||
#include "QvUtils.hpp"
|
||||
|
||||
namespace Ui
|
||||
{
|
@ -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) :
|
||||
|
@ -1,9 +1,9 @@
|
||||
#ifndef W_SUBSCRIBEEDITOR_H
|
||||
#ifndef W_SUBSCRIBEEDITOR_H
|
||||
#define W_SUBSCRIBEEDITOR_H
|
||||
|
||||
#include <QDialog>
|
||||
#include "QvUtils.h"
|
||||
#include "QvHTTPRequestHelper.h"
|
||||
#include "QvUtils.hpp"
|
||||
#include "QvHTTPRequestHelper.hpp"
|
||||
|
||||
namespace Ui
|
||||
{
|
@ -37,7 +37,7 @@
|
||||
<string>A</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<iconset resource="../../resources.qrc">
|
||||
<normaloff>:/icons/add_connection_btn.png</normaloff>:/icons/add_connection_btn.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
@ -57,7 +57,7 @@
|
||||
<string>R</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../resources.qrc">
|
||||
<iconset resource="../../resources.qrc">
|
||||
<normaloff>:/icons/remove_connection_btn.png</normaloff>:/icons/remove_connection_btn.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
@ -211,7 +211,7 @@
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../resources.qrc"/>
|
||||
<include location="../../resources.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
|
@ -22,7 +22,7 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "QJsonModel.h"
|
||||
#include "QJsonModel.hpp"
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
#include <QFont>
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "QObjectMessageProxy.h"
|
||||
#include "QObjectMessageProxy.hpp"
|
||||
namespace Qv2ray
|
||||
{
|
||||
namespace Utils
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <QString>
|
||||
#include <QDebug>
|
||||
#include "QPingModel.h"
|
||||
#include "QPingModel.hpp"
|
||||
|
||||
namespace Qv2ray
|
||||
{
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "QvHTTPRequestHelper.h"
|
||||
#include "QvHTTPRequestHelper.hpp"
|
||||
#include <QByteArray>
|
||||
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()
|
||||
{
|
||||
|
@ -1,5 +1,4 @@
|
||||
/*
|
||||
* Qv2ray
|
||||
/*
|
||||
Copyright (C) 2019 SoneWinstone (jianwenzhen@qq.com)
|
||||
Copyright (C) 2019 Leroy.H.Y
|
||||
|
||||
@ -24,7 +23,7 @@
|
||||
#include <QNetworkRequest>
|
||||
#include <QNetworkReply>
|
||||
#include <QNetworkAccessManager>
|
||||
#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);
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include <QCryptographicHash>
|
||||
|
||||
#include "QvRunguard.h"
|
||||
#include "QvRunguard.hpp"
|
||||
namespace Qv2ray
|
||||
{
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user