[Fixed] Fixed an auto update bug in Win32 env.

Former-commit-id: c01b80c9d6
This commit is contained in:
Leroy.H.Y 2019-08-19 15:34:14 +08:00
parent 754ee71b05
commit 5e183fc59e
16 changed files with 114 additions and 85 deletions

View File

@ -8,21 +8,17 @@ QT += core gui widgets network
TARGET = Qv2ray TARGET = Qv2ray
TEMPLATE = app TEMPLATE = app
# The following define makes your compiler emit warnings if you use
# any feature of Qt which has been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS DEFINES += QT_DEPRECATED_WARNINGS
CONFIG += c++11 openssl-linked lrelease
# You can also make your code fail to compile if you use deprecated APIs. win32: QMAKE_TARGET_DESCRIPTION = "Qv2ray, a cross-platform v2ray GUI client."
# In order to do so, uncomment the following line. win32: QMAKE_TARGET_PRODUCT = "Qv2ray"
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
CONFIG += c++11 VERSION = 1.3.3
DEFINES += "QVVERSION=\"\\\"$${VERSION}\\\"\""
SOURCES += \ SOURCES += \
src/QvConfigUpgrade.cpp \
src/QvCoreConfigOperations_Convertion.cpp \ src/QvCoreConfigOperations_Convertion.cpp \
src/QvCoreConfigOperations_Generation.cpp \ src/QvCoreConfigOperations_Generation.cpp \
src/QvCoreConfigOperations_Verification.cpp \ src/QvCoreConfigOperations_Verification.cpp \
@ -38,7 +34,6 @@ SOURCES += \
src/w_SubscribeEditor.cpp src/w_SubscribeEditor.cpp
HEADERS += \ HEADERS += \
ignored_cpp_structs.hpp \
src/QJsonObjectInsertMacros.h \ src/QJsonObjectInsertMacros.h \
src/Qv2rayBase.h \ src/Qv2rayBase.h \
src/QvCoreConfigObjects.h \ src/QvCoreConfigObjects.h \
@ -70,16 +65,14 @@ TRANSLATIONS += \
translations/en-US.ts translations/en-US.ts
RC_ICONS += ./icons/Qv2ray.ico RC_ICONS += ./icons/Qv2ray.ico
ICON = ./icons/Qv2ray.icns ICON = ./icons/Qv2ray.icns
INCLUDEPATH += \ INCLUDEPATH += \
3rdparty/\ 3rdparty/ \
3rdparty/jsoncons/include 3rdparty/jsoncons/include
win32: QMAKE_CXXFLAGS += "-Wno-missing-field-initializers" win32: QMAKE_CXXFLAGS += "-Wno-missing-field-initializers"
# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin unix: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target !isEmpty(target.path): INSTALLS += target

BIN
libs/libcrypto-1_1.dll Normal file

Binary file not shown.

BIN
libs/libssl-1_1.dll Normal file

Binary file not shown.

View File

@ -1,15 +1,15 @@
#ifndef HCONFIGOBJECTS_H #ifndef QV2RAYBASE_H
#define HCONFIGOBJECTS_H #define QV2RAYBASE_H
#include <QtCore> #include <QtCore>
#include "QvTinyLog.h" #include "QvTinyLog.h"
#include "QvCoreConfigObjects.h" #include "QvCoreConfigObjects.h"
#define QV2RAY_VERSION_STRING "v1.3.2" #define QV2RAY_CONFIG_VERSION "2"
#define QV2RAY_CONFIG_VERSION "1.1" #define QV2RAY_VERSION_STRING "v" QVVERSION
#define QV2RAY_CONFIG_PATH (Qv2ray::Utils::GetConfigDirPath() + "/") #define QV2RAY_CONFIG_DIR_PATH (Qv2ray::Utils::GetConfigDirPath() + "/")
#define QV2RAY_GUI_CONFIG_PATH (QV2RAY_CONFIG_PATH + "Qv2ray.conf") #define QV2RAY_CONFIG_FILE_PATH (QV2RAY_CONFIG_DIR_PATH + "Qv2ray.conf")
#define QV2RAY_GENERATED_CONFIG_FILE_PATH (QV2RAY_CONFIG_PATH + "generated/config.gen.json") #define QV2RAY_GENERATED_FILE_PATH (QV2RAY_CONFIG_DIR_PATH + "generated/config.gen.json")
#define QV2RAY_VCORE_LOG_DIRNAME "logs/" #define QV2RAY_VCORE_LOG_DIRNAME "logs/"
#define QV2RAY_VCORE_ACCESS_LOG_FILENAME "access.log" #define QV2RAY_VCORE_ACCESS_LOG_FILENAME "access.log"
@ -18,15 +18,15 @@
#define QV2RAY_CONNECTION_FILE_EXTENSION ".qv2ray.json" #define QV2RAY_CONNECTION_FILE_EXTENSION ".qv2ray.json"
// GUI TOOLS // GUI TOOLS
#define RED(obj) \ #define RED(obj) \
auto _p = ui->obj->palette(); \ auto _temp = ui->obj->palette(); \
_p.setColor(QPalette::Text, Qt::red); \ _temp.setColor(QPalette::Text, Qt::red); \
ui->obj->setPalette(_p); ui->obj->setPalette(_temp);
#define BLACK(obj) \ #define BLACK(obj) \
auto _p = ui->obj->palette(); \ auto _temp = ui->obj->palette(); \
_p.setColor(QPalette::Text, Qt::black); \ _temp.setColor(QPalette::Text, Qt::black); \
ui->obj->setPalette(_p); ui->obj->setPalette(_temp);
#define QSTRING(std_string) QString::fromStdString(std_string) #define QSTRING(std_string) QString::fromStdString(std_string)
@ -36,12 +36,11 @@
#define NEWLINE "\r" #define NEWLINE "\r"
#endif #endif
namespace Qv2ray namespace Qv2ray
{ {
namespace QvConfigModels namespace QvConfigModels
{ {
struct QvBasicInboundSetting { struct Qv2rayBasicInboundsConfig {
string listenip; string listenip;
// SOCKS // SOCKS
int socks_port; int socks_port;
@ -51,12 +50,8 @@ namespace Qv2ray
int http_port; int http_port;
bool http_useAuth; bool http_useAuth;
AccountObject httpAccount; AccountObject httpAccount;
QvBasicInboundSetting(): Qv2rayBasicInboundsConfig(): listenip(), socks_port(), socks_useAuth(), socksAccount(), http_port(), http_useAuth(), httpAccount() {}
listenip(), Qv2rayBasicInboundsConfig(string listen, int socksPort, int httpPort): Qv2rayBasicInboundsConfig() {
socks_port(), socks_useAuth(), socksAccount(),
http_port(), http_useAuth(), httpAccount() {}
QvBasicInboundSetting(string listen, int socksPort, int httpPort): QvBasicInboundSetting()
{
socks_port = socksPort; socks_port = socksPort;
http_port = httpPort; http_port = httpPort;
listenip = listen; listenip = listen;
@ -64,7 +59,7 @@ namespace Qv2ray
XTOSTRUCT(O(listenip, socks_port, socks_useAuth, socksAccount, http_port, http_useAuth, httpAccount)) XTOSTRUCT(O(listenip, socks_port, socks_useAuth, socksAccount, http_port, http_useAuth, httpAccount))
}; };
struct Qv2Config { struct Qv2rayConfig {
string config_version; string config_version;
bool runAsRoot; bool runAsRoot;
int logLevel; int logLevel;
@ -81,13 +76,13 @@ namespace Qv2ray
bool withLocalDNS; bool withLocalDNS;
list<string> dnsList; list<string> dnsList;
// //
QvBasicInboundSetting inBoundSettings; Qv2rayBasicInboundsConfig inBoundSettings;
list<string> configs; list<string> configs;
map<string, string> subscribes; map<string, string> subscribes;
MuxObject mux; MuxObject mux;
Qv2Config(): config_version(QV2RAY_CONFIG_VERSION), runAsRoot(false), logLevel(), proxyDefault(), proxyCN(), withLocalDNS(), inBoundSettings(), configs(), subscribes(), mux() { } Qv2rayConfig(): config_version(QV2RAY_CONFIG_VERSION), runAsRoot(false), logLevel(), proxyDefault(), proxyCN(), withLocalDNS(), inBoundSettings(), configs(), subscribes(), mux() { }
Qv2Config(string lang, string exePath, string assetsPath, int log, QvBasicInboundSetting _inBoundSettings): Qv2Config() Qv2rayConfig(string lang, string exePath, string assetsPath, int log, Qv2rayBasicInboundsConfig _inBoundSettings): Qv2rayConfig() {
{ // These settings below are defaults.
ignoredVersion = ""; ignoredVersion = "";
autoStartConfig = ""; autoStartConfig = "";
language = lang; language = lang;
@ -106,14 +101,14 @@ namespace Qv2ray
} }
XTOSTRUCT(O(config_version, runAsRoot, logLevel, language, autoStartConfig, ignoredVersion, v2CorePath, v2AssetsPath, proxyDefault, proxyCN, withLocalDNS, dnsList, inBoundSettings, mux, configs, subscribes)) XTOSTRUCT(O(config_version, runAsRoot, logLevel, language, autoStartConfig, ignoredVersion, v2CorePath, v2AssetsPath, proxyDefault, proxyCN, withLocalDNS, dnsList, inBoundSettings, mux, configs, subscribes))
}; };
QJsonObject UpgradeConfig(int fromVersion, int toVersion, QJsonObject root);
} }
} }
// I want to use all namespaces
using namespace std; using namespace std;
using namespace Qv2ray; using namespace Qv2ray;
using namespace Qv2ray::V2ConfigModels; using namespace Qv2ray::V2ConfigModels;
using namespace Qv2ray::QvConfigModels; using namespace Qv2ray::QvConfigModels;
#endif // QCONFIGOBJECTS_H #endif // QV2RAYBASE_H

27
src/QvConfigUpgrade.cpp Normal file
View File

@ -0,0 +1,27 @@
#include "Qv2rayBase.h"
#define XConfLog(oldVersion, newVersion) LOG(MODULE_CONFIG, "Migrating config from version " \
+ to_string(oldVersion) + " to " + to_string(newVersion))
namespace Qv2ray {
namespace QvConfigModels {
// Secret member
QJsonObject UpgradeConfig_Inc(int fromVersion, QJsonObject root) {
XConfLog(fromVersion, fromVersion + 1);
switch (fromVersion) {
case 1:
break;
}
return root;
}
// Exported function
QJsonObject UpgradeConfig(int fromVersion, int toVersion, QJsonObject root) {
for (int i = fromVersion; i < toVersion; i++) {
root = UpgradeConfig_Inc(i, root);
}
return root;
}
}
}

View File

@ -6,7 +6,7 @@ namespace Qv2ray
// -------------------------- BEGIN CONFIG CONVERSIONS ---------------------------------------------------------------------------- // -------------------------- BEGIN CONFIG CONVERSIONS ----------------------------------------------------------------------------
bool SaveConnectionConfig(QJsonObject obj, const QString *alias) bool SaveConnectionConfig(QJsonObject obj, const QString *alias)
{ {
QFile config(QV2RAY_CONFIG_PATH + *alias + QV2RAY_CONNECTION_FILE_EXTENSION); QFile config(QV2RAY_CONFIG_DIR_PATH + *alias + QV2RAY_CONNECTION_FILE_EXTENSION);
return StringToFile(JSONToString(obj), &config); return StringToFile(JSONToString(obj), &config);
} }
@ -109,7 +109,7 @@ namespace Qv2ray
QMap<QString, QJsonObject> list; QMap<QString, QJsonObject> list;
foreach (auto conn, connectionNames) { foreach (auto conn, connectionNames) {
QString jsonString = StringFromFile(new QFile(QV2RAY_CONFIG_PATH + QString::fromStdString(conn) + QV2RAY_CONNECTION_FILE_EXTENSION)); QString jsonString = StringFromFile(new QFile(QV2RAY_CONFIG_DIR_PATH + QString::fromStdString(conn) + QV2RAY_CONNECTION_FILE_EXTENSION));
QJsonObject connectionObject = JSONFromString(jsonString); QJsonObject connectionObject = JSONFromString(jsonString);
list.insert(QString::fromStdString(conn), connectionObject); list.insert(QString::fromStdString(conn), connectionObject);
} }
@ -119,13 +119,13 @@ namespace Qv2ray
bool RenameConnection(QString originalName, QString newName) bool RenameConnection(QString originalName, QString newName)
{ {
return QFile(QV2RAY_CONFIG_PATH + originalName + QV2RAY_CONNECTION_FILE_EXTENSION).rename(QV2RAY_CONFIG_PATH + newName + QV2RAY_CONNECTION_FILE_EXTENSION); return QFile(QV2RAY_CONFIG_DIR_PATH + originalName + QV2RAY_CONNECTION_FILE_EXTENSION).rename(QV2RAY_CONFIG_DIR_PATH + newName + QV2RAY_CONNECTION_FILE_EXTENSION);
} }
int StartPreparation(QJsonObject fullConfig) int StartPreparation(QJsonObject fullConfig)
{ {
QString json = JSONToString(fullConfig); QString json = JSONToString(fullConfig);
StringToFile(json, new QFile(QV2RAY_GENERATED_CONFIG_FILE_PATH)); StringToFile(json, new QFile(QV2RAY_GENERATED_FILE_PATH));
return 0; return 0;
} }
} }

View File

@ -64,12 +64,12 @@ namespace Qv2ray
Status = STARTING; Status = STARTING;
if (ValidateV2rayCoreExe()) { if (ValidateV2rayCoreExe()) {
if (VerifyVConfigFile(QV2RAY_GENERATED_CONFIG_FILE_PATH)) { if (VerifyVConfigFile(QV2RAY_GENERATED_FILE_PATH)) {
QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("V2RAY_LOCATION_ASSET", QString::fromStdString(GetGlobalConfig().v2AssetsPath)); env.insert("V2RAY_LOCATION_ASSET", QString::fromStdString(GetGlobalConfig().v2AssetsPath));
vProcess->setProcessEnvironment(env); vProcess->setProcessEnvironment(env);
vProcess->start(QString::fromStdString(GetGlobalConfig().v2CorePath), QStringList() << "-config" vProcess->start(QString::fromStdString(GetGlobalConfig().v2CorePath), QStringList() << "-config"
<< QV2RAY_GENERATED_CONFIG_FILE_PATH, << QV2RAY_GENERATED_FILE_PATH,
QIODevice::ReadWrite | QIODevice::Text); QIODevice::ReadWrite | QIODevice::Text);
vProcess->waitForStarted(); vProcess->waitForStarted();
Status = STARTED; Status = STARTED;

View File

@ -76,6 +76,7 @@ namespace Qv2ray
void QvHttpRequestHelper::onRequestFinished() void QvHttpRequestHelper::onRequestFinished()
{ {
LOG(MODULE_NETWORK, "Network request errcode: " + to_string(reply->error()));
emit httpRequestFinished(this->data); emit httpRequestFinished(this->data);
} }

View File

@ -11,9 +11,11 @@ using namespace std;
#define MODULE_INIT "INIT" #define MODULE_INIT "INIT"
#define MODULE_UPDATE "UPDATE" #define MODULE_UPDATE "UPDATE"
#define MODULE_VCORE "VCORE" #define MODULE_VCORE "VCORE"
#define MODULE_CONFIG "CONFIG"
#define MODULE_CONNECTION_VMESS "CONNETION-VMESS" #define MODULE_CONNECTION_VMESS "CONNETION-VMESS"
#define MODULE_CONNECTION "CONNECTION" #define MODULE_CONNECTION "CONNECTION"
#define MODULE_UI "UI" #define MODULE_UI "UI"
#define MODULE_NETWORK "NETWORK"
#define MODULE_FILE "FILE" #define MODULE_FILE "FILE"
#endif // QVTINYLOG_H #endif // QVTINYLOG_H

View File

@ -5,14 +5,14 @@ namespace Qv2ray
{ {
namespace Utils namespace Utils
{ {
static Qv2Config GlobalConfig; static Qv2rayConfig GlobalConfig;
static QString ConfigDirPath; static QString ConfigDirPath;
void SetGlobalConfig(Qv2Config conf) void SetGlobalConfig(Qv2rayConfig conf)
{ {
GlobalConfig = conf; GlobalConfig = conf;
} }
Qv2Config GetGlobalConfig() Qv2rayConfig GetGlobalConfig()
{ {
return GlobalConfig; return GlobalConfig;
} }
@ -29,7 +29,7 @@ namespace Qv2ray
void SaveGlobalConfig() void SaveGlobalConfig()
{ {
QFile config(QV2RAY_GUI_CONFIG_PATH); QFile config(QV2RAY_CONFIG_FILE_PATH);
QString str = StructToJSONString(GetGlobalConfig()); QString str = StructToJSONString(GetGlobalConfig());
StringToFile(str, &config); StringToFile(str, &config);
} }
@ -89,11 +89,11 @@ namespace Qv2ray
void LoadGlobalConfig() void LoadGlobalConfig()
{ {
QFile file(QV2RAY_GUI_CONFIG_PATH); QFile file(QV2RAY_CONFIG_FILE_PATH);
file.open(QFile::ReadOnly); file.open(QFile::ReadOnly);
QTextStream stream(&file); QTextStream stream(&file);
auto str = stream.readAll(); auto str = stream.readAll();
auto config = StructFromJSONString<Qv2Config>(str); auto config = StructFromJSONString<Qv2rayConfig>(str);
SetGlobalConfig(config); SetGlobalConfig(config);
file.close(); file.close();
} }

View File

@ -21,8 +21,8 @@ namespace Qv2ray
void SetConfigDirPath(QString path); void SetConfigDirPath(QString path);
QString GetConfigDirPath(); QString GetConfigDirPath();
void SetGlobalConfig(Qv2Config conf); void SetGlobalConfig(Qv2rayConfig conf);
Qv2Config GetGlobalConfig(); Qv2rayConfig GetGlobalConfig();
void SaveGlobalConfig(); void SaveGlobalConfig();
void LoadGlobalConfig(); void LoadGlobalConfig();

View File

@ -34,17 +34,17 @@ bool initQv()
auto ConfigDir = new QDir(configPath); auto ConfigDir = new QDir(configPath);
if (!ConfigDir->exists()) { if (!ConfigDir->exists()) {
auto result = QDir().mkdir(QV2RAY_CONFIG_PATH); auto result = QDir().mkdir(QV2RAY_CONFIG_DIR_PATH);
if (result) { if (result) {
LOG(MODULE_INIT, "Created Qv2ray config dir at: " + QV2RAY_CONFIG_PATH.toStdString()) LOG(MODULE_INIT, "Created Qv2ray config dir at: " + QV2RAY_CONFIG_DIR_PATH.toStdString())
} else { } else {
LOG(MODULE_INIT, "Failed to create config dir at: " + QV2RAY_CONFIG_PATH.toStdString()) LOG(MODULE_INIT, "Failed to create config dir at: " + QV2RAY_CONFIG_DIR_PATH.toStdString())
return false; return false;
} }
} }
auto genPath = QV2RAY_CONFIG_PATH + "generated/"; auto genPath = QV2RAY_CONFIG_DIR_PATH + "generated/";
if (!QDir(genPath).exists()) { if (!QDir(genPath).exists()) {
auto result2 = QDir().mkdir(genPath); auto result2 = QDir().mkdir(genPath);
@ -56,20 +56,24 @@ bool initQv()
return false; return false;
} }
} }
QFile configFile(QV2RAY_CONFIG_FILE_PATH);
if (!QFile(QV2RAY_GUI_CONFIG_PATH).exists()) { if (!configFile.exists()) {
// This is first run! // This is first run!
// //
// These below genenrated very basic global config. // These below genenrated very basic global config.
QvBasicInboundSetting inboundSetting = QvBasicInboundSetting("127.0.0.1", 1080, 8000); Qv2rayBasicInboundsConfig inboundSetting = Qv2rayBasicInboundsConfig("127.0.0.1", 1080, 8000);
Qv2Config conf = Qv2Config("zh-CN", exeDefaultPath.toStdString(), v2AssetsPath.toStdString(), 2, inboundSetting); Qv2rayConfig conf = Qv2rayConfig("zh-CN", exeDefaultPath.toStdString(), v2AssetsPath.toStdString(), 2, inboundSetting);
// //
// Save initial config. // Save initial config.
SetGlobalConfig(conf); SetGlobalConfig(conf);
SaveGlobalConfig(); SaveGlobalConfig();
// //
LOG(MODULE_INIT, "Created initial default config file.") LOG(MODULE_INIT, "Created initial config file.")
} else { } else {
auto conf = JSONFromString(StringFromFile(&configFile));
if(conf["config_version"].toString() != QV2RAY_CONFIG_VERSION) {
UpgradeConfig(stoi(conf["config_version"].toString().toStdString()), stoi(QV2RAY_CONFIG_VERSION), conf);
}
LoadGlobalConfig(); LoadGlobalConfig();
LOG(MODULE_INIT, "Loaded config file.") LOG(MODULE_INIT, "Loaded config file.")
} }
@ -87,12 +91,10 @@ int main(int argc, char *argv[])
"Hv2ray/Qv2ray (partial) Copyright 2019 (C) SoneWinstone\r\n" "Hv2ray/Qv2ray (partial) Copyright 2019 (C) SoneWinstone\r\n"
"Qv2ray Copyright (C) 2019 Leroy.H.Y\r\n" "Qv2ray Copyright (C) 2019 Leroy.H.Y\r\n"
"\r\n" "\r\n"
"Qv2ray Version: " QV2RAY_VERSION_STRING "Qv2ray " QV2RAY_VERSION_STRING " running on " + QSysInfo::prettyProductName().toStdString() + QSysInfo::currentCpuArchitecture().toStdString())
"\r\n" #ifdef QT_DEBUG
"OS: " + QSysInfo::prettyProductName().toStdString() + LOG("DEBUG", "============================== This is a debug build, many features are not stable enough. ==============================")
"\r\n" #endif
"Arch: " + QSysInfo::currentCpuArchitecture().toStdString())
LOG("DEBUG", "============================== This is a debug build ==============================")
// //
QApplication _qApp(argc, argv); QApplication _qApp(argc, argv);
// //
@ -128,11 +130,21 @@ int main(int argc, char *argv[])
); );
if (!guard.isSingleInstance()) { if (!guard.isSingleInstance()) {
LOG(MODULE_INIT, "Another Instance running, QUIT.") LOG(MODULE_INIT, "Another Instance running, Quit.")
Utils::QvMessageBox(nullptr, "Qv2ray", QObject::tr("#AnotherInstanceRunning")); QvMessageBox(nullptr, "Qv2ray", QObject::tr("#AnotherInstanceRunning"));
return -1; return -1;
} }
#ifdef __WIN32
auto osslReqVersion = QSslSocket::sslLibraryBuildVersionString().toStdString();
auto osslCurVersion = QSslSocket::sslLibraryVersionString().toStdString();
if (osslCurVersion != osslReqVersion){
LOG(MODULE_NETWORK, "Required OpenSSL version: " + osslReqVersion)
LOG(MODULE_NETWORK, "Current OpenSSL version: " + osslCurVersion)
QvMessageBox(nullptr, QObject::tr("DependencyMissing"), QObject::tr("osslDependMissing,PleaseReDownload"));
LOG(MODULE_NETWORK, "OpenSSL library MISSING, Quitting.")
return -2;
}
#endif
// Show MainWindow // Show MainWindow
MainWindow w; MainWindow w;
return _qApp.exec(); return _qApp.exec();

View File

@ -75,7 +75,7 @@ void ImportConfigWindow::on_buttonBox_accepted()
config.remove("QV2RAY_ALIAS"); config.remove("QV2RAY_ALIAS");
} }
Qv2Config conf = GetGlobalConfig(); Qv2rayConfig conf = GetGlobalConfig();
conf.configs.push_back(alias.toStdString()); conf.configs.push_back(alias.toStdString());
SetGlobalConfig(conf); SetGlobalConfig(conf);
auto needReload = SaveConnectionConfig(config, &alias); auto needReload = SaveConnectionConfig(config, &alias);

View File

@ -210,7 +210,7 @@ void MainWindow::on_stopButton_clicked()
LOG(MODULE_VCORE, "Disconnected: " + CurrentConnectionName.toStdString()) LOG(MODULE_VCORE, "Disconnected: " + CurrentConnectionName.toStdString())
this->vinstance->Stop(); this->vinstance->Stop();
hTray->setToolTip(TRAY_TOOLTIP_PREFIX); hTray->setToolTip(TRAY_TOOLTIP_PREFIX);
QFile(QV2RAY_GENERATED_CONFIG_FILE_PATH).remove(); QFile(QV2RAY_GENERATED_FILE_PATH).remove();
ui->statusLabel->setText(tr("#Disconnected")); ui->statusLabel->setText(tr("#Disconnected"));
ui->logText->clear(); ui->logText->clear();
trayMenu->actions()[2]->setEnabled(true); trayMenu->actions()[2]->setEnabled(true);

View File

@ -27,7 +27,6 @@ class MainWindow : public QMainWindow
void UpdateLog(); void UpdateLog();
private slots: private slots:
void VersionUpdate(QByteArray &data); void VersionUpdate(QByteArray &data);
void on_restartButton_clicked();
void on_startButton_clicked(); void on_startButton_clicked();
void on_stopButton_clicked(); void on_stopButton_clicked();
void on_activatedTray(QSystemTrayIcon::ActivationReason reason); void on_activatedTray(QSystemTrayIcon::ActivationReason reason);
@ -48,9 +47,6 @@ class MainWindow : public QMainWindow
void on_connectionListWidget_customContextMenuRequested(const QPoint &pos); void on_connectionListWidget_customContextMenuRequested(const QPoint &pos);
void on_action_RenameConnection_triggered();
void on_action_StartThis_triggered();
void on_connectionListWidget_itemChanged(QListWidgetItem *item); void on_connectionListWidget_itemChanged(QListWidgetItem *item);
void on_removeConfigButton_clicked(); void on_removeConfigButton_clicked();
@ -62,6 +58,9 @@ class MainWindow : public QMainWindow
void on_editConfigButton_clicked(); void on_editConfigButton_clicked();
private: private:
void on_action_StartThis_triggered();
void on_action_RenameConnection_triggered();
void on_restartButton_clicked();
Ui::MainWindow *ui; Ui::MainWindow *ui;
QvHttpRequestHelper HTTPRequestHelper; QvHttpRequestHelper HTTPRequestHelper;
QSystemTrayIcon *hTray; QSystemTrayIcon *hTray;

View File

@ -77,7 +77,7 @@ class PrefrencesWindow : public QDialog
private: private:
bool IsConnectionPropertyChanged = false; bool IsConnectionPropertyChanged = false;
bool finishedLoading = false; bool finishedLoading = false;
Qv2ray::QvConfigModels::Qv2Config CurrentConfig; Qv2ray::QvConfigModels::Qv2rayConfig CurrentConfig;
Ui::PrefrencesWindow *ui; Ui::PrefrencesWindow *ui;
}; };
#endif // HVCONF_H #endif // HVCONF_H