mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 12:34:37 +03:00
chore: refactor code
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
#include "TrafficLooper.hpp"
|
#include "TrafficLooper.hpp"
|
||||||
|
|
||||||
#include "rpc/gRPC.h"
|
#include "rpc/gRPC.h"
|
||||||
#include "ui/mainwindow.h"
|
#include "ui/mainwindow_interface.h"
|
||||||
|
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,8 @@ namespace NekoRay::fmt {
|
|||||||
|
|
||||||
virtual QString InsecureHint() { return {}; };
|
virtual QString InsecureHint() { return {}; };
|
||||||
|
|
||||||
|
QString DisplayInsecureHint();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
QString DisplayInsecureHint(const QSharedPointer<AbstractBean> &);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,10 +5,10 @@
|
|||||||
#include "SocksHttpBean.hpp"
|
#include "SocksHttpBean.hpp"
|
||||||
|
|
||||||
namespace NekoRay::fmt {
|
namespace NekoRay::fmt {
|
||||||
QString DisplayInsecureHint(const QSharedPointer<AbstractBean> &bean) {
|
QString AbstractBean::DisplayInsecureHint() {
|
||||||
if (!dataStore->insecure_hint) return {};
|
if (!dataStore->insecure_hint) return {};
|
||||||
auto insecure_hint = bean->InsecureHint();
|
auto insecure_hint = InsecureHint();
|
||||||
auto stream = GetStreamSettings(bean.data());
|
auto stream = GetStreamSettings(this);
|
||||||
if (stream != nullptr) insecure_hint += "\n" + stream->InsecureHint();
|
if (stream != nullptr) insecure_hint += "\n" + stream->InsecureHint();
|
||||||
return insecure_hint.trimmed();
|
return insecure_hint.trimmed();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ namespace NekoRay::fmt {
|
|||||||
class V2rayStreamSettings : public JsonStore {
|
class V2rayStreamSettings : public JsonStore {
|
||||||
public:
|
public:
|
||||||
QString network = "tcp";
|
QString network = "tcp";
|
||||||
QString security = "none";
|
QString security = "";
|
||||||
QString packet_encoding = ""; // sing-box only vmess
|
QString packet_encoding = "";
|
||||||
// ws/h2/grpc/tcp-http
|
// ws/h2/grpc/tcp-http
|
||||||
QString path = "";
|
QString path = "";
|
||||||
QString host = "";
|
QString host = "";
|
||||||
|
|||||||
@@ -1,12 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QMenu>
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
// Dialogs
|
// Dialogs
|
||||||
|
|
||||||
inline QWidget *mainwindow;
|
|
||||||
|
|
||||||
#define Dialog_DialogBasicSettings "DialogBasicSettings"
|
#define Dialog_DialogBasicSettings "DialogBasicSettings"
|
||||||
#define Dialog_DialogEditProfile "DialogEditProfile"
|
#define Dialog_DialogEditProfile "DialogEditProfile"
|
||||||
#define Dialog_DialogManageGroups "DialogManageGroups"
|
#define Dialog_DialogManageGroups "DialogManageGroups"
|
||||||
@@ -14,37 +11,6 @@ inline QWidget *mainwindow;
|
|||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
|
|
||||||
inline QList<QAction *>
|
|
||||||
CreateActions(QWidget *parent, const QList<QString> &texts, const std::function<void(QAction *)> &slot) {
|
|
||||||
QList<QAction *> acts;
|
|
||||||
|
|
||||||
for (const auto &text: texts) {
|
|
||||||
acts.push_back(new QAction(text, parent)); //按顺序来
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < acts.size(); i++) {
|
|
||||||
if (acts[i]->text() == "[Separator]") {
|
|
||||||
acts[i]->setSeparator(true);
|
|
||||||
acts[i]->setText("");
|
|
||||||
acts[i]->setDisabled(true);
|
|
||||||
acts[i]->setData(-1);
|
|
||||||
} else {
|
|
||||||
acts[i]->setData(i);
|
|
||||||
QObject::connect(acts[i], &QAction::triggered, parent, [=] {
|
|
||||||
slot(acts[i]);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return acts;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QMenu *CreateMenu(QWidget *parent, const QList<QString> &texts, const std::function<void(QAction *)> &slot) {
|
|
||||||
auto menu = new QMenu(parent);
|
|
||||||
menu->addActions(CreateActions(parent, texts, slot));
|
|
||||||
return menu;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define QRegExpValidator_Number new QRegularExpressionValidator(QRegularExpression("^[0-9]+$")
|
#define QRegExpValidator_Number new QRegularExpressionValidator(QRegularExpression("^[0-9]+$")
|
||||||
|
|
||||||
// NekoRay Save&Load
|
// NekoRay Save&Load
|
||||||
|
|||||||
@@ -170,7 +170,10 @@ namespace NekoRay {
|
|||||||
auto item = _item.get();
|
auto item = _item.get();
|
||||||
switch (item->type) {
|
switch (item->type) {
|
||||||
case itemType::string:
|
case itemType::string:
|
||||||
object.insert(item->name, *(QString *) item->ptr);
|
// Allow Empty
|
||||||
|
if (!((QString *) item->ptr)->isEmpty()) {
|
||||||
|
object.insert(item->name, *(QString *) item->ptr);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case itemType::integer:
|
case itemType::integer:
|
||||||
object.insert(item->name, *(int *) item->ptr);
|
object.insert(item->name, *(int *) item->ptr);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#include "NekoRay_Utils.hpp"
|
#include "NekoRay_Utils.hpp"
|
||||||
|
|
||||||
#include "3rdparty/QThreadCreateThread.hpp"
|
#include "3rdparty/QThreadCreateThread.hpp"
|
||||||
#include "main/GuiUtils.hpp"
|
|
||||||
|
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
@@ -25,7 +24,7 @@ QString GetRandomString(int randomStringLength) {
|
|||||||
|
|
||||||
const QString possibleCharacters("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
|
const QString possibleCharacters("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
|
||||||
|
|
||||||
std::uniform_int_distribution<int> dist(0, possibleCharacters.count() - 1);
|
std::uniform_int_distribution<int> dist(0, possibleCharacters.length() - 1);
|
||||||
|
|
||||||
QString randomString;
|
QString randomString;
|
||||||
for (int i = 0; i < randomStringLength; ++i) {
|
for (int i = 0; i < randomStringLength; ++i) {
|
||||||
|
|||||||
@@ -10,14 +10,17 @@
|
|||||||
inline QString software_name = "NekoRay";
|
inline QString software_name = "NekoRay";
|
||||||
inline QString software_core_name = "V2Ray";
|
inline QString software_core_name = "V2Ray";
|
||||||
|
|
||||||
inline std::function<void()> release_runguard;
|
// Main Functions
|
||||||
|
|
||||||
// Dialogs
|
inline std::function<void()> MF_release_runguard;
|
||||||
|
|
||||||
inline std::function<void(QString)> showLog;
|
// MainWindow functions
|
||||||
inline std::function<void(QString, QString)> showLog_ext;
|
|
||||||
inline std::function<void(QString)> showLog_ext_vt100;
|
inline QWidget *mainwindow;
|
||||||
inline std::function<void(QString, QString)> dialog_message;
|
inline std::function<void(QString)> MW_show_log;
|
||||||
|
inline std::function<void(QString, QString)> MW_show_log_ext;
|
||||||
|
inline std::function<void(QString)> MW_show_log_ext_vt100;
|
||||||
|
inline std::function<void(QString, QString)> MW_dialog_message;
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ int main(int argc, char *argv[]) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
release_runguard = [&] { guard.release(); };
|
MF_release_runguard = [&] { guard.release(); };
|
||||||
|
|
||||||
// icons
|
// icons
|
||||||
QIcon::setFallbackSearchPaths(QStringList{
|
QIcon::setFallbackSearchPaths(QStringList{
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ namespace QtGrpc {
|
|||||||
QStringList errstr;
|
QStringList errstr;
|
||||||
errstr << "grpc-status error code:" << Int2String(errCode) << ", error msg:"
|
errstr << "grpc-status error code:" << Int2String(errCode) << ", error msg:"
|
||||||
<< QLatin1String(networkReply->rawHeader(GrpcStatusMessage));
|
<< QLatin1String(networkReply->rawHeader(GrpcStatusMessage));
|
||||||
showLog(errstr.join(" "));
|
MW_show_log(errstr.join(" "));
|
||||||
statusCode = QNetworkReply::NetworkError::ProtocolUnknownError;
|
statusCode = QNetworkReply::NetworkError::ProtocolUnknownError;
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ namespace NekoRay::sub {
|
|||||||
auto j = DecodeB64IfValid(link.fragment().toUtf8(), QByteArray::Base64UrlEncoding);
|
auto j = DecodeB64IfValid(link.fragment().toUtf8(), QByteArray::Base64UrlEncoding);
|
||||||
if (j.isEmpty()) return;
|
if (j.isEmpty()) return;
|
||||||
ent->bean->FromJsonBytes(j.toUtf8());
|
ent->bean->FromJsonBytes(j.toUtf8());
|
||||||
showLog("nekoray format: " + ent->bean->DisplayTypeAndName());
|
MW_show_log("nekoray format: " + ent->bean->DisplayTypeAndName());
|
||||||
}
|
}
|
||||||
|
|
||||||
// SOCKS
|
// SOCKS
|
||||||
@@ -138,6 +138,8 @@ namespace NekoRay::sub {
|
|||||||
bean->config_simple = QJsonObject2QString(result, false);
|
bean->config_simple = QJsonObject2QString(result, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ent == nullptr) return;
|
||||||
|
|
||||||
// Fix
|
// Fix
|
||||||
auto stream = fmt::GetStreamSettings(ent->bean.get());
|
auto stream = fmt::GetStreamSettings(ent->bean.get());
|
||||||
if (needFix && stream != nullptr) {
|
if (needFix && stream != nullptr) {
|
||||||
@@ -155,7 +157,6 @@ namespace NekoRay::sub {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// End
|
// End
|
||||||
if (ent == nullptr) return;
|
|
||||||
profileManager->AddProfile(ent, gid_add_to);
|
profileManager->AddProfile(ent, gid_add_to);
|
||||||
update_counter++;
|
update_counter++;
|
||||||
}
|
}
|
||||||
@@ -351,11 +352,11 @@ namespace NekoRay::sub {
|
|||||||
// 网络请求
|
// 网络请求
|
||||||
if (asURL) {
|
if (asURL) {
|
||||||
auto groupName = group == nullptr ? content : group->name;
|
auto groupName = group == nullptr ? content : group->name;
|
||||||
showLog(">>>>>>>> " + QObject::tr("Requesting subscription: %1").arg(groupName));
|
MW_show_log(">>>>>>>> " + QObject::tr("Requesting subscription: %1").arg(groupName));
|
||||||
|
|
||||||
auto resp = NetworkRequestHelper::HttpGet(content);
|
auto resp = NetworkRequestHelper::HttpGet(content);
|
||||||
if (!resp.error.isEmpty()) {
|
if (!resp.error.isEmpty()) {
|
||||||
showLog("<<<<<<<< " + QObject::tr("Requesting subscription %1 error: %2")
|
MW_show_log("<<<<<<<< " + QObject::tr("Requesting subscription %1 error: %2")
|
||||||
.arg(groupName, resp.error + "\n" + resp.data));
|
.arg(groupName, resp.error + "\n" + resp.data));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -380,7 +381,7 @@ namespace NekoRay::sub {
|
|||||||
group->Save();
|
group->Save();
|
||||||
//
|
//
|
||||||
if (dataStore->sub_clear) {
|
if (dataStore->sub_clear) {
|
||||||
showLog(QObject::tr("Clearing servers..."));
|
MW_show_log(QObject::tr("Clearing servers..."));
|
||||||
for (const auto &profile: in) {
|
for (const auto &profile: in) {
|
||||||
profileManager->DeleteProfile(profile->id);
|
profileManager->DeleteProfile(profile->id);
|
||||||
}
|
}
|
||||||
@@ -413,19 +414,15 @@ namespace NekoRay::sub {
|
|||||||
notice_deleted += ent->bean->DisplayTypeAndName() + "\n";
|
notice_deleted += ent->bean->DisplayTypeAndName() + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
runOnUiThread([=] {
|
auto change = "\n" + QObject::tr("Added %1 profiles:\n%2\nDeleted %3 Profiles:\n%4")
|
||||||
auto change = "\n" + QObject::tr("Added %1 profiles:\n%2\nDeleted %3 Profiles:\n%4")
|
.arg(only_out.length()).arg(notice_added)
|
||||||
.arg(only_out.length()).arg(notice_added)
|
.arg(only_in.length()).arg(notice_deleted);
|
||||||
.arg(only_in.length()).arg(notice_deleted);
|
if (only_out.length() + only_in.length() == 0) change = QObject::tr("Nothing");
|
||||||
if (only_out.length() + only_in.length() == 0) change = QObject::tr("Nothing");
|
MW_show_log("<<<<<<<< " + QObject::tr("Change of %1:").arg(group->name) + " " + change);
|
||||||
showLog("<<<<<<<< " + QObject::tr("Change of %1:").arg(group->name) + " " + change);
|
MW_dialog_message("SubUpdater", "finish-dingyue");
|
||||||
dialog_message("SubUpdater", "finish-dingyue");
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
NekoRay::dataStore->imported_count = rawUpdater->update_counter;
|
NekoRay::dataStore->imported_count = rawUpdater->update_counter;
|
||||||
runOnUiThread([=] {
|
MW_dialog_message("SubUpdater", "finish");
|
||||||
dialog_message("SubUpdater", "finish");
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,10 +14,10 @@ namespace NekoRay::sys {
|
|||||||
|
|
||||||
if (show_log) {
|
if (show_log) {
|
||||||
connect(this, &QProcess::readyReadStandardOutput, this, [&]() {
|
connect(this, &QProcess::readyReadStandardOutput, this, [&]() {
|
||||||
showLog_ext_vt100(readAllStandardOutput().trimmed());
|
MW_show_log_ext_vt100(readAllStandardOutput().trimmed());
|
||||||
});
|
});
|
||||||
connect(this, &QProcess::readyReadStandardError, this, [&]() {
|
connect(this, &QProcess::readyReadStandardError, this, [&]() {
|
||||||
showLog_ext_vt100(readAllStandardError().trimmed());
|
MW_show_log_ext_vt100(readAllStandardError().trimmed());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -25,23 +25,23 @@ namespace NekoRay::sys {
|
|||||||
connect(this, &QProcess::errorOccurred, this, [&](QProcess::ProcessError error) {
|
connect(this, &QProcess::errorOccurred, this, [&](QProcess::ProcessError error) {
|
||||||
if (!killed) {
|
if (!killed) {
|
||||||
crashed = true;
|
crashed = true;
|
||||||
showLog_ext(tag, "errorOccurred:" + errorString());
|
MW_show_log_ext(tag, "errorOccurred:" + errorString());
|
||||||
dialog_message("ExternalProcess", "Crashed");
|
MW_dialog_message("ExternalProcess", "Crashed");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
connect(this, &QProcess::stateChanged, this, [&](QProcess::ProcessState state) {
|
connect(this, &QProcess::stateChanged, this, [&](QProcess::ProcessState state) {
|
||||||
if (state == QProcess::NotRunning) {
|
if (state == QProcess::NotRunning) {
|
||||||
if (killed) { // 用户命令退出
|
if (killed) { // 用户命令退出
|
||||||
showLog_ext(tag, "Stopped");
|
MW_show_log_ext(tag, "Stopped");
|
||||||
} else if (!crashed) { // 异常退出
|
} else if (!crashed) { // 异常退出
|
||||||
crashed = true;
|
crashed = true;
|
||||||
showLog_ext(tag, "[Error] Program exited accidentally: " + errorString());
|
MW_show_log_ext(tag, "[Error] Program exited accidentally: " + errorString());
|
||||||
Kill();
|
Kill();
|
||||||
dialog_message("ExternalProcess", "Crashed");
|
MW_dialog_message("ExternalProcess", "Crashed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
showLog_ext(tag, "[Starting] " + env.join(" ") + " " + program + " " + arguments.join(" "));
|
MW_show_log_ext(tag, "[Starting] " + env.join(" ") + " " + program + " " + arguments.join(" "));
|
||||||
}
|
}
|
||||||
|
|
||||||
QProcess::setEnvironment(env);
|
QProcess::setEnvironment(env);
|
||||||
@@ -66,12 +66,12 @@ namespace NekoRay::sys {
|
|||||||
ExternalProcess::arguments = args;
|
ExternalProcess::arguments = args;
|
||||||
|
|
||||||
connect(this, &QProcess::readyReadStandardOutput, this, [&]() {
|
connect(this, &QProcess::readyReadStandardOutput, this, [&]() {
|
||||||
showLog(readAllStandardOutput().trimmed());
|
MW_show_log(readAllStandardOutput().trimmed());
|
||||||
});
|
});
|
||||||
connect(this, &QProcess::readyReadStandardError, this, [&]() {
|
connect(this, &QProcess::readyReadStandardError, this, [&]() {
|
||||||
auto log = readAllStandardError().trimmed();
|
auto log = readAllStandardError().trimmed();
|
||||||
if (show_stderr) {
|
if (show_stderr) {
|
||||||
showLog(log);
|
MW_show_log(log);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (log.contains("token is set")) {
|
if (log.contains("token is set")) {
|
||||||
@@ -81,7 +81,7 @@ namespace NekoRay::sys {
|
|||||||
connect(this, &QProcess::errorOccurred, this, [&](QProcess::ProcessError error) {
|
connect(this, &QProcess::errorOccurred, this, [&](QProcess::ProcessError error) {
|
||||||
if (error == QProcess::ProcessError::FailedToStart) {
|
if (error == QProcess::ProcessError::FailedToStart) {
|
||||||
failed_to_start = true;
|
failed_to_start = true;
|
||||||
showLog("start core error occurred: " + errorString() + "\n");
|
MW_show_log("start core error occurred: " + errorString() + "\n");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
connect(this, &QProcess::stateChanged, this, [&](QProcess::ProcessState state) {
|
connect(this, &QProcess::stateChanged, this, [&](QProcess::ProcessState state) {
|
||||||
@@ -91,8 +91,8 @@ namespace NekoRay::sys {
|
|||||||
if (failed_to_start) return; // no retry
|
if (failed_to_start) return; // no retry
|
||||||
|
|
||||||
restart_id = NekoRay::dataStore->started_id;
|
restart_id = NekoRay::dataStore->started_id;
|
||||||
dialog_message("ExternalProcess", "Crashed");
|
MW_dialog_message("ExternalProcess", "Crashed");
|
||||||
showLog("[Error] core exited, restarting.\n");
|
MW_show_log("[Error] core exited, restarting.\n");
|
||||||
|
|
||||||
// Restart
|
// Restart
|
||||||
setTimeout([=] {
|
setTimeout([=] {
|
||||||
@@ -103,7 +103,7 @@ namespace NekoRay::sys {
|
|||||||
} else if (state == QProcess::Running && restart_id >= 0) {
|
} else if (state == QProcess::Running && restart_id >= 0) {
|
||||||
// Restart profile
|
// Restart profile
|
||||||
setTimeout([=] {
|
setTimeout([=] {
|
||||||
dialog_message("ExternalProcess", "CoreRestarted," + Int2String(restart_id));
|
MW_dialog_message("ExternalProcess", "CoreRestarted," + Int2String(restart_id));
|
||||||
restart_id = -1;
|
restart_id = -1;
|
||||||
}, this, 1000);
|
}, this, 1000);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1146,7 +1146,7 @@ End: %2</source>
|
|||||||
<translation>克隆</translation>
|
<translation>克隆</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Update subscripton</source>
|
<source>Update subscription</source>
|
||||||
<translation>更新订阅</translation>
|
<translation>更新订阅</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
@@ -1158,8 +1158,8 @@ End: %2</source>
|
|||||||
<translation>批量复制选中项目的分享链接 (Nekoray)</translation>
|
<translation>批量复制选中项目的分享链接 (Nekoray)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Allow connections from the LAN</source>
|
<source>Allow other devices to connect</source>
|
||||||
<translation>允许来自局域网的连接</translation>
|
<translation>允许其他设备连接</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Manual addition of profiles is not allowed in subscription groupings.</source>
|
<source>Manual addition of profiles is not allowed in subscription groupings.</source>
|
||||||
@@ -1189,6 +1189,10 @@ End: %2</source>
|
|||||||
<source>Restart Program</source>
|
<source>Restart Program</source>
|
||||||
<translation>重启程序</translation>
|
<translation>重启程序</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Not Running</source>
|
||||||
|
<translation>未启动</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>ProxyItem</name>
|
<name>ProxyItem</name>
|
||||||
|
|||||||
@@ -220,7 +220,7 @@ DialogBasicSettings::DialogBasicSettings(QWidget *parent)
|
|||||||
file.open(QIODevice::ReadWrite | QIODevice::Truncate);
|
file.open(QIODevice::ReadWrite | QIODevice::Truncate);
|
||||||
file.write(Int2String(neko_core_new).toUtf8());
|
file.write(Int2String(neko_core_new).toUtf8());
|
||||||
file.close();
|
file.close();
|
||||||
dialog_message("", "RestartProgram");
|
MW_dialog_message("", "RestartProgram");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
connect(ui->switch_core_v2ray, &QRadioButton::clicked, this, switch_core_on_click);
|
connect(ui->switch_core_v2ray, &QRadioButton::clicked, this, switch_core_on_click);
|
||||||
@@ -281,7 +281,7 @@ void DialogBasicSettings::accept() {
|
|||||||
D_SAVE_BOOL(insecure_hint)
|
D_SAVE_BOOL(insecure_hint)
|
||||||
D_SAVE_BOOL(skip_cert)
|
D_SAVE_BOOL(skip_cert)
|
||||||
|
|
||||||
dialog_message(Dialog_DialogBasicSettings, "UpdateDataStore");
|
MW_dialog_message(Dialog_DialogBasicSettings, "UpdateDataStore");
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,5 +304,5 @@ void DialogBasicSettings::on_set_custom_icon_clicked() {
|
|||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dialog_message(Dialog_DialogBasicSettings, "UpdateIcon");
|
MW_dialog_message(Dialog_DialogBasicSettings, "UpdateIcon");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "dialog_hotkey.h"
|
#include "dialog_hotkey.h"
|
||||||
#include "ui_dialog_hotkey.h"
|
#include "ui_dialog_hotkey.h"
|
||||||
|
|
||||||
#include "ui/mainwindow.h"
|
#include "ui/mainwindow_interface.h"
|
||||||
|
|
||||||
DialogHotkey::DialogHotkey(QWidget *parent) :
|
DialogHotkey::DialogHotkey(QWidget *parent) :
|
||||||
QDialog(parent), ui(new Ui::DialogHotkey) {
|
QDialog(parent), ui(new Ui::DialogHotkey) {
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ void DialogManageGroups::on_add_clicked() {
|
|||||||
if (ret == QDialog::Accepted) {
|
if (ret == QDialog::Accepted) {
|
||||||
NekoRay::profileManager->AddGroup(ent);
|
NekoRay::profileManager->AddGroup(ent);
|
||||||
AddGroupToListIfExist(ent->id)
|
AddGroupToListIfExist(ent->id)
|
||||||
dialog_message(Dialog_DialogManageGroups, "refresh-1");
|
MW_dialog_message(Dialog_DialogManageGroups, "refresh-1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -67,7 +67,6 @@ DialogManageRoutes::DialogManageRoutes(QWidget *parent) :
|
|||||||
blockDomainTxt = new AutoCompleteTextEdit("geosite", sourceStringsDomain, this);
|
blockDomainTxt = new AutoCompleteTextEdit("geosite", sourceStringsDomain, this);
|
||||||
//
|
//
|
||||||
const auto sourceStringsIP = Qv2ray::components::GeositeReader::ReadGeoSiteFromFile(geositeFn);
|
const auto sourceStringsIP = Qv2ray::components::GeositeReader::ReadGeoSiteFromFile(geositeFn);
|
||||||
qDebug() << sourceStringsIP;
|
|
||||||
directIPTxt = new AutoCompleteTextEdit("geoip", sourceStringsIP, this);
|
directIPTxt = new AutoCompleteTextEdit("geoip", sourceStringsIP, this);
|
||||||
proxyIPTxt = new AutoCompleteTextEdit("geoip", sourceStringsIP, this);
|
proxyIPTxt = new AutoCompleteTextEdit("geoip", sourceStringsIP, this);
|
||||||
blockIPTxt = new AutoCompleteTextEdit("geoip", sourceStringsIP, this);
|
blockIPTxt = new AutoCompleteTextEdit("geoip", sourceStringsIP, this);
|
||||||
@@ -106,7 +105,7 @@ void DialogManageRoutes::accept() {
|
|||||||
//
|
//
|
||||||
QString info = "UpdateDataStore";
|
QString info = "UpdateDataStore";
|
||||||
if (routeChanged) info += "RouteChanged";
|
if (routeChanged) info += "RouteChanged";
|
||||||
dialog_message(Dialog_DialogManageRoutes, info);
|
MW_dialog_message(Dialog_DialogManageRoutes, info);
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -40,6 +40,6 @@ void DialogVPNSettings::accept() {
|
|||||||
D_SAVE_STRING_QTEXTEDIT(vpn_bypass_cidr)
|
D_SAVE_STRING_QTEXTEDIT(vpn_bypass_cidr)
|
||||||
D_SAVE_STRING_QTEXTEDIT(vpn_bypass_process)
|
D_SAVE_STRING_QTEXTEDIT(vpn_bypass_process)
|
||||||
//
|
//
|
||||||
dialog_message("", "UpdateDataStore,VPNChanged");
|
MW_dialog_message("", "UpdateDataStore,VPNChanged");
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -329,7 +329,7 @@ void DialogEditProfile::accept() {
|
|||||||
ent->Save();
|
ent->Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
dialog_message(Dialog_DialogEditProfile, "accept");
|
MW_dialog_message(Dialog_DialogEditProfile, "accept");
|
||||||
QDialog::accept();
|
QDialog::accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "edit_chain.h"
|
#include "edit_chain.h"
|
||||||
#include "ui_edit_chain.h"
|
#include "ui_edit_chain.h"
|
||||||
|
|
||||||
#include "ui/mainwindow.h"
|
#include "ui/mainwindow_interface.h"
|
||||||
#include "ui/widget/ProxyItem.h"
|
#include "ui/widget/ProxyItem.h"
|
||||||
|
|
||||||
#include "db/Database.hpp"
|
#include "db/Database.hpp"
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent), ui(new Ui::MainWindow) {
|
: QMainWindow(parent), ui(new Ui::MainWindow) {
|
||||||
mainwindow = this;
|
mainwindow = this;
|
||||||
dialog_message = [=](const QString &a, const QString &b) {
|
MW_dialog_message = [=](const QString &a, const QString &b) {
|
||||||
runOnUiThread([=] {
|
runOnUiThread([=] {
|
||||||
dialog_message_impl(a, b);
|
dialog_message_impl(a, b);
|
||||||
});
|
});
|
||||||
@@ -137,17 +137,17 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
auto bar = ui->masterLogBrowser->verticalScrollBar();
|
auto bar = ui->masterLogBrowser->verticalScrollBar();
|
||||||
bar->setValue(bar->maximum());
|
bar->setValue(bar->maximum());
|
||||||
});
|
});
|
||||||
showLog = [=](const QString &log) {
|
MW_show_log = [=](const QString &log) {
|
||||||
runOnUiThread([=] {
|
runOnUiThread([=] {
|
||||||
show_log_impl(log);
|
show_log_impl(log);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
showLog_ext = [=](const QString &tag, const QString &log) {
|
MW_show_log_ext = [=](const QString &tag, const QString &log) {
|
||||||
runOnUiThread([=] {
|
runOnUiThread([=] {
|
||||||
show_log_impl("[" + tag + "] " + log);
|
show_log_impl("[" + tag + "] " + log);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
showLog_ext_vt100 = [=](const QString &log) {
|
MW_show_log_ext_vt100 = [=](const QString &log) {
|
||||||
runOnUiThread([=] {
|
runOnUiThread([=] {
|
||||||
show_log_impl(cleanVT100String(log));
|
show_log_impl(cleanVT100String(log));
|
||||||
});
|
});
|
||||||
@@ -257,7 +257,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
//
|
//
|
||||||
ui->menu_program_preference->addActions(ui->menu_preferences->actions());
|
ui->menu_program_preference->addActions(ui->menu_preferences->actions());
|
||||||
connect(ui->menu_add_from_clipboard2, &QAction::triggered, ui->menu_add_from_clipboard, &QAction::trigger);
|
connect(ui->menu_add_from_clipboard2, &QAction::triggered, ui->menu_add_from_clipboard, &QAction::trigger);
|
||||||
connect(ui->actionRestart_Program, &QAction::triggered, this, [=] { dialog_message("", "RestartProgram"); });
|
connect(ui->actionRestart_Program, &QAction::triggered, this, [=] { MW_dialog_message("", "RestartProgram"); });
|
||||||
//
|
//
|
||||||
connect(ui->menu_program, &QMenu::aboutToShow, this, [=]() {
|
connect(ui->menu_program, &QMenu::aboutToShow, this, [=]() {
|
||||||
ui->actionRemember_last_proxy->setChecked(NekoRay::dataStore->remember_enable);
|
ui->actionRemember_last_proxy->setChecked(NekoRay::dataStore->remember_enable);
|
||||||
@@ -328,7 +328,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
});
|
});
|
||||||
connect(ui->actionAllow_LAN, &QAction::triggered, this, [=](bool checked) {
|
connect(ui->actionAllow_LAN, &QAction::triggered, this, [=](bool checked) {
|
||||||
NekoRay::dataStore->inbound_address = checked ? "::" : "127.0.0.1";
|
NekoRay::dataStore->inbound_address = checked ? "::" : "127.0.0.1";
|
||||||
dialog_message("", "UpdateDataStore");
|
MW_dialog_message("", "UpdateDataStore");
|
||||||
});
|
});
|
||||||
//
|
//
|
||||||
connect(ui->checkBox_VPN, &QCheckBox::clicked, this, [=](bool checked) {
|
connect(ui->checkBox_VPN, &QCheckBox::clicked, this, [=](bool checked) {
|
||||||
@@ -491,7 +491,7 @@ void MainWindow::dialog_message_impl(const QString &sender, const QString &info)
|
|||||||
// 订阅完毕
|
// 订阅完毕
|
||||||
refresh_proxy_list();
|
refresh_proxy_list();
|
||||||
if (!info.contains("dingyue")) {
|
if (!info.contains("dingyue")) {
|
||||||
showLog(tr("Imported %1 profile(s)").arg(NekoRay::dataStore->imported_count));
|
show_log_impl(tr("Imported %1 profile(s)").arg(NekoRay::dataStore->imported_count));
|
||||||
}
|
}
|
||||||
} else if (sender == "ExternalProcess") {
|
} else if (sender == "ExternalProcess") {
|
||||||
if (info == "Crashed") {
|
if (info == "Crashed") {
|
||||||
@@ -563,7 +563,7 @@ void MainWindow::on_menu_exit_triggered() {
|
|||||||
hide();
|
hide();
|
||||||
ExitNekorayCore();
|
ExitNekorayCore();
|
||||||
//
|
//
|
||||||
release_runguard();
|
MF_release_runguard();
|
||||||
if (exit_reason == 1) {
|
if (exit_reason == 1) {
|
||||||
QDir::setCurrent(QApplication::applicationDirPath());
|
QDir::setCurrent(QApplication::applicationDirPath());
|
||||||
QProcess::startDetached("./updater", QStringList{});
|
QProcess::startDetached("./updater", QStringList{});
|
||||||
@@ -640,9 +640,9 @@ void MainWindow::refresh_status(const QString &traffic_update) {
|
|||||||
|
|
||||||
// From UI
|
// From UI
|
||||||
if (last_test_time.addSecs(2) < QTime::currentTime()) {
|
if (last_test_time.addSecs(2) < QTime::currentTime()) {
|
||||||
ui->label_running->setText(tr("Running: %1").arg(running.isNull()
|
auto txt = running == nullptr ? tr("Not Running")
|
||||||
? tr("None")
|
: tr("Running: %1").arg(running->bean->DisplayName().left(50));
|
||||||
: running->bean->DisplayName().left(50)));
|
ui->label_running->setText(txt);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
auto display_http = tr("None");
|
auto display_http = tr("None");
|
||||||
@@ -737,6 +737,9 @@ void MainWindow::refresh_groups() {
|
|||||||
NekoRay::dataStore->refreshing_group_list = false;
|
NekoRay::dataStore->refreshing_group_list = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::refresh_proxy_list(const int &id) {
|
||||||
|
refresh_proxy_list_impl(id, {});
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::refresh_proxy_list_impl(const int &id, NekoRay::GroupSortAction groupSortAction) {
|
void MainWindow::refresh_proxy_list_impl(const int &id, NekoRay::GroupSortAction groupSortAction) {
|
||||||
if (id < 0) {
|
if (id < 0) {
|
||||||
@@ -761,9 +764,6 @@ void MainWindow::refresh_proxy_list_impl(const int &id, NekoRay::GroupSortAction
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto f0 = std::make_unique<QTableWidgetItem>();
|
auto f0 = std::make_unique<QTableWidgetItem>();
|
||||||
// auto font = f0->font();
|
|
||||||
// font.setPointSize(9);
|
|
||||||
// f0->setFont(font);
|
|
||||||
f0->setData(114514, profile->id);
|
f0->setData(114514, profile->id);
|
||||||
|
|
||||||
// C0: is Running
|
// C0: is Running
|
||||||
@@ -779,7 +779,7 @@ void MainWindow::refresh_proxy_list_impl(const int &id, NekoRay::GroupSortAction
|
|||||||
// C1: Type
|
// C1: Type
|
||||||
f = f0->clone();
|
f = f0->clone();
|
||||||
f->setText(profile->bean->DisplayType());
|
f->setText(profile->bean->DisplayType());
|
||||||
auto insecure_hint = DisplayInsecureHint(profile->bean);
|
auto insecure_hint = profile->bean->DisplayInsecureHint();
|
||||||
if (!insecure_hint.isEmpty()) {
|
if (!insecure_hint.isEmpty()) {
|
||||||
f->setBackground(Qt::red);
|
f->setBackground(Qt::red);
|
||||||
f->setToolTip(insecure_hint);
|
f->setToolTip(insecure_hint);
|
||||||
@@ -1006,7 +1006,7 @@ void MainWindow::on_menu_copy_links_triggered() {
|
|||||||
}
|
}
|
||||||
if (links.length() == 0) return;
|
if (links.length() == 0) return;
|
||||||
QApplication::clipboard()->setText(links.join("\n"));
|
QApplication::clipboard()->setText(links.join("\n"));
|
||||||
showLog(tr("Copied %1 item(s)").arg(links.length()));
|
show_log_impl(tr("Copied %1 item(s)").arg(links.length()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_menu_copy_links_nkr_triggered() {
|
void MainWindow::on_menu_copy_links_nkr_triggered() {
|
||||||
@@ -1017,7 +1017,7 @@ void MainWindow::on_menu_copy_links_nkr_triggered() {
|
|||||||
}
|
}
|
||||||
if (links.length() == 0) return;
|
if (links.length() == 0) return;
|
||||||
QApplication::clipboard()->setText(links.join("\n"));
|
QApplication::clipboard()->setText(links.join("\n"));
|
||||||
showLog(tr("Copied %1 item(s)").arg(links.length()));
|
show_log_impl(tr("Copied %1 item(s)").arg(links.length()));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_menu_export_config_triggered() {
|
void MainWindow::on_menu_export_config_triggered() {
|
||||||
@@ -1175,7 +1175,7 @@ void MainWindow::on_menu_delete_repeat_triggered() {
|
|||||||
|
|
||||||
bool mw_sub_updating = false;
|
bool mw_sub_updating = false;
|
||||||
|
|
||||||
void MainWindow::on_menu_update_subscripton_triggered() {
|
void MainWindow::on_menu_update_subscription_triggered() {
|
||||||
auto group = NekoRay::profileManager->CurrentGroup();
|
auto group = NekoRay::profileManager->CurrentGroup();
|
||||||
if (group->url.isEmpty()) return;
|
if (group->url.isEmpty()) return;
|
||||||
if (mw_sub_updating) return;
|
if (mw_sub_updating) return;
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QMainWindow>
|
#include <QMainWindow>
|
||||||
|
|
||||||
|
#include "main/NekoRay.hpp"
|
||||||
|
|
||||||
|
#ifndef MW_INTERFACE
|
||||||
|
|
||||||
#include <QTableWidgetItem>
|
#include <QTableWidgetItem>
|
||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
#include <QSystemTrayIcon>
|
#include <QSystemTrayIcon>
|
||||||
@@ -11,9 +16,10 @@
|
|||||||
#include "GroupSort.hpp"
|
#include "GroupSort.hpp"
|
||||||
|
|
||||||
#include "db/ProxyEntity.hpp"
|
#include "db/ProxyEntity.hpp"
|
||||||
#include "db/Group.hpp"
|
|
||||||
#include "main/GuiUtils.hpp"
|
#include "main/GuiUtils.hpp"
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace NekoRay::sys { class CoreProcess; }
|
namespace NekoRay::sys { class CoreProcess; }
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
@@ -26,11 +32,11 @@ class MainWindow : public QMainWindow {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWindow(QWidget *parent = nullptr);
|
explicit MainWindow(QWidget *parent = nullptr);
|
||||||
|
|
||||||
~MainWindow();
|
~MainWindow() override;
|
||||||
|
|
||||||
void refresh_proxy_list(const int &id = -1) { refresh_proxy_list_impl(id, {}); };
|
void refresh_proxy_list(const int &id = -1);
|
||||||
|
|
||||||
void show_group(int gid);
|
void show_group(int gid);
|
||||||
|
|
||||||
@@ -62,6 +68,8 @@ public slots:
|
|||||||
|
|
||||||
void on_menu_exit_triggered();
|
void on_menu_exit_triggered();
|
||||||
|
|
||||||
|
#ifndef MW_INTERFACE
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void on_masterLogBrowser_customContextMenuRequested(const QPoint &pos);
|
void on_masterLogBrowser_customContextMenuRequested(const QPoint &pos);
|
||||||
@@ -108,7 +116,7 @@ private slots:
|
|||||||
|
|
||||||
void on_menu_remove_unavailable_triggered();
|
void on_menu_remove_unavailable_triggered();
|
||||||
|
|
||||||
void on_menu_update_subscripton_triggered();
|
void on_menu_update_subscription_triggered();
|
||||||
|
|
||||||
void on_menu_resolve_domain_triggered();
|
void on_menu_resolve_domain_triggered();
|
||||||
|
|
||||||
@@ -174,6 +182,8 @@ private:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject *obj, QEvent *event) override;
|
bool eventFilter(QObject *obj, QEvent *event) override;
|
||||||
|
|
||||||
|
#endif // MW_INTERFACE
|
||||||
};
|
};
|
||||||
|
|
||||||
inline MainWindow *GetMainWindow() {
|
inline MainWindow *GetMainWindow() {
|
||||||
|
|||||||
@@ -540,7 +540,7 @@
|
|||||||
<addaction name="menu_delete_repeat"/>
|
<addaction name="menu_delete_repeat"/>
|
||||||
<addaction name="menu_resolve_domain"/>
|
<addaction name="menu_resolve_domain"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="menu_update_subscripton"/>
|
<addaction name="menu_update_subscription"/>
|
||||||
</widget>
|
</widget>
|
||||||
<addaction name="menu_add_from_input"/>
|
<addaction name="menu_add_from_input"/>
|
||||||
<addaction name="menu_add_from_clipboard"/>
|
<addaction name="menu_add_from_clipboard"/>
|
||||||
@@ -745,7 +745,7 @@
|
|||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Allow connections from the LAN</string>
|
<string>Allow other devices to connect</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="menu_remove_unavailable">
|
<action name="menu_remove_unavailable">
|
||||||
@@ -822,9 +822,9 @@
|
|||||||
<string notr="true">Ctrl+D</string>
|
<string notr="true">Ctrl+D</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="menu_update_subscripton">
|
<action name="menu_update_subscription">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Update subscripton</string>
|
<string>Update subscription</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
<property name="shortcut">
|
||||||
<string notr="true">Ctrl+U</string>
|
<string notr="true">Ctrl+U</string>
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ void MainWindow::setup_grpc() {
|
|||||||
#ifndef NKR_NO_GRPC
|
#ifndef NKR_NO_GRPC
|
||||||
// Setup Connection
|
// Setup Connection
|
||||||
defaultClient = new Client([=](const QString &errStr) {
|
defaultClient = new Client([=](const QString &errStr) {
|
||||||
showLog("[Error] gRPC: " + errStr);
|
MW_show_log("[Error] gRPC: " + errStr);
|
||||||
}, "127.0.0.1:" + Int2String(NekoRay::dataStore->core_port), NekoRay::dataStore->core_token);
|
}, "127.0.0.1:" + Int2String(NekoRay::dataStore->core_port), NekoRay::dataStore->core_token);
|
||||||
auto t = new QTimer();
|
auto t = new QTimer();
|
||||||
connect(t, &QTimer::timeout, this, [=]() {
|
connect(t, &QTimer::timeout, this, [=]() {
|
||||||
@@ -228,7 +228,7 @@ void MainWindow::neko_start(int _id) {
|
|||||||
|
|
||||||
if (NekoRay::dataStore->started_id >= 0) neko_stop();
|
if (NekoRay::dataStore->started_id >= 0) neko_stop();
|
||||||
show_log_impl(">>>>>>>> " + tr("Starting profile %1").arg(ent->bean->DisplayTypeAndName()));
|
show_log_impl(">>>>>>>> " + tr("Starting profile %1").arg(ent->bean->DisplayTypeAndName()));
|
||||||
auto insecure_hint = DisplayInsecureHint(ent->bean);
|
auto insecure_hint = ent->bean->DisplayInsecureHint();
|
||||||
if (!insecure_hint.isEmpty()) show_log_impl(">>>>>>>> " + tr("Profile is insecure: %1").arg(insecure_hint));
|
if (!insecure_hint.isEmpty()) show_log_impl(">>>>>>>> " + tr("Profile is insecure: %1").arg(insecure_hint));
|
||||||
|
|
||||||
#ifndef NKR_NO_GRPC
|
#ifndef NKR_NO_GRPC
|
||||||
|
|||||||
5
ui/mainwindow_interface.h
Normal file
5
ui/mainwindow_interface.h
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define MW_INTERFACE
|
||||||
|
|
||||||
|
#include "mainwindow.h"
|
||||||
@@ -109,7 +109,7 @@ void GroupItem::on_edit_clicked() {
|
|||||||
if (ret == QDialog::Accepted) {
|
if (ret == QDialog::Accepted) {
|
||||||
ent->Save();
|
ent->Save();
|
||||||
refresh_data();
|
refresh_data();
|
||||||
dialog_message(Dialog_DialogManageGroups, "refresh" + Int2String(ent->id));
|
MW_dialog_message(Dialog_DialogManageGroups, "refresh" + Int2String(ent->id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,7 +118,7 @@ void GroupItem::on_remove_clicked() {
|
|||||||
if (QMessageBox::question(this, tr("Confirmation"), tr("Remove %1?").arg(ent->name)) ==
|
if (QMessageBox::question(this, tr("Confirmation"), tr("Remove %1?").arg(ent->name)) ==
|
||||||
QMessageBox::StandardButton::Yes) {
|
QMessageBox::StandardButton::Yes) {
|
||||||
NekoRay::profileManager->DeleteGroup(ent->id);
|
NekoRay::profileManager->DeleteGroup(ent->id);
|
||||||
dialog_message(Dialog_DialogManageGroups, "refresh-1");
|
MW_dialog_message(Dialog_DialogManageGroups, "refresh-1");
|
||||||
delete item;
|
delete item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user