This commit is contained in:
Hootan Hemmati 2024-12-16 02:27:05 +03:00 committed by GitHub
commit 9149fe30cc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 12 additions and 2 deletions

View File

@ -1,5 +1,3 @@
// DO NOT INCLUDE THIS
namespace NekoGui { namespace NekoGui {
class Routing : public JsonStore { class Routing : public JsonStore {
@ -89,6 +87,7 @@ namespace NekoGui {
bool flag_debug = false; bool flag_debug = false;
bool flag_restart_tun_on = false; bool flag_restart_tun_on = false;
bool flag_reorder = false; bool flag_reorder = false;
bool flag_toggle_config = false; // Pbac2
// Saved // Saved
@ -159,6 +158,7 @@ namespace NekoGui {
QString hotkey_group = ""; QString hotkey_group = "";
QString hotkey_route = ""; QString hotkey_route = "";
QString hotkey_system_proxy_menu = ""; QString hotkey_system_proxy_menu = "";
QString hotkey_toggle_config = ""; // Pf754
// Core // Core
int core_box_clash_api = -9090; int core_box_clash_api = -9090;

View File

@ -91,6 +91,7 @@ int main(int argc, char* argv[]) {
if (NekoGui::dataStore->argv.contains("-debug")) NekoGui::dataStore->flag_debug = true; if (NekoGui::dataStore->argv.contains("-debug")) NekoGui::dataStore->flag_debug = true;
if (NekoGui::dataStore->argv.contains("-flag_restart_tun_on")) NekoGui::dataStore->flag_restart_tun_on = true; if (NekoGui::dataStore->argv.contains("-flag_restart_tun_on")) NekoGui::dataStore->flag_restart_tun_on = true;
if (NekoGui::dataStore->argv.contains("-flag_reorder")) NekoGui::dataStore->flag_reorder = true; if (NekoGui::dataStore->argv.contains("-flag_reorder")) NekoGui::dataStore->flag_reorder = true;
if (NekoGui::dataStore->argv.contains("-toggle_config")) NekoGui::dataStore->flag_toggle_config = true;
#ifdef NKR_CPP_USE_APPDATA #ifdef NKR_CPP_USE_APPDATA
NekoGui::dataStore->flag_use_appdata = true; // Example: Package & MacOS NekoGui::dataStore->flag_use_appdata = true; // Example: Package & MacOS
#endif #endif

View File

@ -9,6 +9,7 @@ DialogHotkey::DialogHotkey(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog
ui->show_groups->setKeySequence(NekoGui::dataStore->hotkey_group); ui->show_groups->setKeySequence(NekoGui::dataStore->hotkey_group);
ui->show_routes->setKeySequence(NekoGui::dataStore->hotkey_route); ui->show_routes->setKeySequence(NekoGui::dataStore->hotkey_route);
ui->system_proxy->setKeySequence(NekoGui::dataStore->hotkey_system_proxy_menu); ui->system_proxy->setKeySequence(NekoGui::dataStore->hotkey_system_proxy_menu);
ui->toggle_config->setKeySequence(NekoGui::dataStore->hotkey_toggle_config);
GetMainWindow()->RegisterHotkey(true); GetMainWindow()->RegisterHotkey(true);
} }
@ -18,6 +19,7 @@ DialogHotkey::~DialogHotkey() {
NekoGui::dataStore->hotkey_group = ui->show_groups->keySequence().toString(); NekoGui::dataStore->hotkey_group = ui->show_groups->keySequence().toString();
NekoGui::dataStore->hotkey_route = ui->show_routes->keySequence().toString(); NekoGui::dataStore->hotkey_route = ui->show_routes->keySequence().toString();
NekoGui::dataStore->hotkey_system_proxy_menu = ui->system_proxy->keySequence().toString(); NekoGui::dataStore->hotkey_system_proxy_menu = ui->system_proxy->keySequence().toString();
NekoGui::dataStore->hotkey_toggle_config = ui->toggle_config->keySequence().toString();
NekoGui::dataStore->Save(); NekoGui::dataStore->Save();
} }
GetMainWindow()->RegisterHotkey(false); GetMainWindow()->RegisterHotkey(false);

View File

@ -1725,6 +1725,7 @@ void MainWindow::RegisterHotkey(bool unregister) {
NekoGui::dataStore->hotkey_group, NekoGui::dataStore->hotkey_group,
NekoGui::dataStore->hotkey_route, NekoGui::dataStore->hotkey_route,
NekoGui::dataStore->hotkey_system_proxy_menu, NekoGui::dataStore->hotkey_system_proxy_menu,
NekoGui::dataStore->hotkey_toggle_config,
}; };
for (const auto &key: regstr) { for (const auto &key: regstr) {
@ -1755,6 +1756,12 @@ void MainWindow::HotkeyEvent(const QString &key) {
on_menu_routing_settings_triggered(); on_menu_routing_settings_triggered();
} else if (key == NekoGui::dataStore->hotkey_system_proxy_menu) { } else if (key == NekoGui::dataStore->hotkey_system_proxy_menu) {
ui->menu_spmode->popup(QCursor::pos()); ui->menu_spmode->popup(QCursor::pos());
} else if (key == NekoGui::dataStore->hotkey_toggle_config) {
if (NekoGui::dataStore->started_id >= 0) {
neko_stop();
} else {
neko_start();
}
} }
}); });
} }