mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 20:44:38 +03:00
feat: hotkey system proxy
This commit is contained in:
@@ -50,6 +50,7 @@ namespace NekoRay {
|
||||
_add(new configItem("hk_mw", &hotkey_mainwindow, itemType::string));
|
||||
_add(new configItem("hk_group", &hotkey_group, itemType::string));
|
||||
_add(new configItem("hk_route", &hotkey_route, itemType::string));
|
||||
_add(new configItem("hk_spmenu", &hotkey_system_proxy_menu, itemType::string));
|
||||
_add(new configItem("fakedns", &fake_dns, itemType::boolean));
|
||||
_add(new configItem("active_routing", &active_routing, itemType::string));
|
||||
_add(new configItem("mw_size", &mw_size, itemType::string));
|
||||
|
||||
@@ -126,6 +126,7 @@ namespace NekoRay {
|
||||
QString hotkey_mainwindow = "";
|
||||
QString hotkey_group = "";
|
||||
QString hotkey_route = "";
|
||||
QString hotkey_system_proxy_menu = "";
|
||||
|
||||
// Other Core
|
||||
ExtraCore *extraCore = new ExtraCore;
|
||||
|
||||
@@ -376,6 +376,10 @@
|
||||
<source>Trigger main window</source>
|
||||
<translation>显示/隐藏主窗口</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>System Proxy</source>
|
||||
<translation>系统代理</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>DialogManageGroups</name>
|
||||
|
||||
@@ -8,6 +8,7 @@ DialogHotkey::DialogHotkey(QWidget *parent) : QDialog(parent), ui(new Ui::Dialog
|
||||
ui->show_mainwindow->setKeySequence(NekoRay::dataStore->hotkey_mainwindow);
|
||||
ui->show_groups->setKeySequence(NekoRay::dataStore->hotkey_group);
|
||||
ui->show_routes->setKeySequence(NekoRay::dataStore->hotkey_route);
|
||||
ui->system_proxy->setKeySequence(NekoRay::dataStore->hotkey_system_proxy_menu);
|
||||
GetMainWindow()->RegisterHotkey(true);
|
||||
}
|
||||
|
||||
@@ -16,6 +17,7 @@ DialogHotkey::~DialogHotkey() {
|
||||
NekoRay::dataStore->hotkey_mainwindow = ui->show_mainwindow->keySequence().toString();
|
||||
NekoRay::dataStore->hotkey_group = ui->show_groups->keySequence().toString();
|
||||
NekoRay::dataStore->hotkey_route = ui->show_routes->keySequence().toString();
|
||||
NekoRay::dataStore->hotkey_system_proxy_menu = ui->system_proxy->keySequence().toString();
|
||||
NekoRay::dataStore->Save();
|
||||
}
|
||||
GetMainWindow()->RegisterHotkey(false);
|
||||
|
||||
@@ -14,17 +14,20 @@
|
||||
<string>Hotkey</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Trigger main window</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QtExtKeySequenceEdit" name="show_groups"/>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Show routes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QtExtKeySequenceEdit" name="show_routes"/>
|
||||
</item>
|
||||
<item row="4" column="1">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="focusPolicy">
|
||||
<enum>Qt::StrongFocus</enum>
|
||||
@@ -34,19 +37,9 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Show routes</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QtExtKeySequenceEdit" name="show_mainwindow"/>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QtExtKeySequenceEdit" name="show_routes"/>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="text">
|
||||
@@ -54,6 +47,23 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Trigger main window</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>System Proxy</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QtExtKeySequenceEdit" name="system_proxy"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
@@ -64,10 +74,11 @@
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<tabstops>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
<tabstop>show_mainwindow</tabstop>
|
||||
<tabstop>show_groups</tabstop>
|
||||
<tabstop>show_routes</tabstop>
|
||||
<tabstop>system_proxy</tabstop>
|
||||
<tabstop>buttonBox</tabstop>
|
||||
</tabstops>
|
||||
<resources/>
|
||||
<connections>
|
||||
|
||||
@@ -1401,10 +1401,12 @@ void MainWindow::RegisterHotkey(bool unregister) {
|
||||
}
|
||||
if (unregister) return;
|
||||
|
||||
QStringList regstr;
|
||||
regstr += NekoRay::dataStore->hotkey_mainwindow;
|
||||
regstr += NekoRay::dataStore->hotkey_group;
|
||||
regstr += NekoRay::dataStore->hotkey_route;
|
||||
QStringList regstr{
|
||||
NekoRay::dataStore->hotkey_mainwindow,
|
||||
NekoRay::dataStore->hotkey_group,
|
||||
NekoRay::dataStore->hotkey_route,
|
||||
NekoRay::dataStore->hotkey_system_proxy_menu,
|
||||
};
|
||||
|
||||
for (const auto &key: regstr) {
|
||||
if (key.isEmpty()) continue;
|
||||
@@ -1432,6 +1434,8 @@ void MainWindow::HotkeyEvent(const QString &key) {
|
||||
on_menu_manage_groups_triggered();
|
||||
} else if (key == NekoRay::dataStore->hotkey_route) {
|
||||
on_menu_routing_settings_triggered();
|
||||
} else if (key == NekoRay::dataStore->hotkey_system_proxy_menu) {
|
||||
ui->menu_spmode->popup(QCursor::pos());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user