mirror of
https://github.com/MatsuriDayo/nekoray.git
synced 2025-12-17 12:34:37 +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_mw", &hotkey_mainwindow, itemType::string));
|
||||||
_add(new configItem("hk_group", &hotkey_group, itemType::string));
|
_add(new configItem("hk_group", &hotkey_group, itemType::string));
|
||||||
_add(new configItem("hk_route", &hotkey_route, 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("fakedns", &fake_dns, itemType::boolean));
|
||||||
_add(new configItem("active_routing", &active_routing, itemType::string));
|
_add(new configItem("active_routing", &active_routing, itemType::string));
|
||||||
_add(new configItem("mw_size", &mw_size, itemType::string));
|
_add(new configItem("mw_size", &mw_size, itemType::string));
|
||||||
|
|||||||
@@ -126,6 +126,7 @@ namespace NekoRay {
|
|||||||
QString hotkey_mainwindow = "";
|
QString hotkey_mainwindow = "";
|
||||||
QString hotkey_group = "";
|
QString hotkey_group = "";
|
||||||
QString hotkey_route = "";
|
QString hotkey_route = "";
|
||||||
|
QString hotkey_system_proxy_menu = "";
|
||||||
|
|
||||||
// Other Core
|
// Other Core
|
||||||
ExtraCore *extraCore = new ExtraCore;
|
ExtraCore *extraCore = new ExtraCore;
|
||||||
|
|||||||
@@ -376,6 +376,10 @@
|
|||||||
<source>Trigger main window</source>
|
<source>Trigger main window</source>
|
||||||
<translation>显示/隐藏主窗口</translation>
|
<translation>显示/隐藏主窗口</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>System Proxy</source>
|
||||||
|
<translation>系统代理</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>DialogManageGroups</name>
|
<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_mainwindow->setKeySequence(NekoRay::dataStore->hotkey_mainwindow);
|
||||||
ui->show_groups->setKeySequence(NekoRay::dataStore->hotkey_group);
|
ui->show_groups->setKeySequence(NekoRay::dataStore->hotkey_group);
|
||||||
ui->show_routes->setKeySequence(NekoRay::dataStore->hotkey_route);
|
ui->show_routes->setKeySequence(NekoRay::dataStore->hotkey_route);
|
||||||
|
ui->system_proxy->setKeySequence(NekoRay::dataStore->hotkey_system_proxy_menu);
|
||||||
GetMainWindow()->RegisterHotkey(true);
|
GetMainWindow()->RegisterHotkey(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -16,6 +17,7 @@ DialogHotkey::~DialogHotkey() {
|
|||||||
NekoRay::dataStore->hotkey_mainwindow = ui->show_mainwindow->keySequence().toString();
|
NekoRay::dataStore->hotkey_mainwindow = ui->show_mainwindow->keySequence().toString();
|
||||||
NekoRay::dataStore->hotkey_group = ui->show_groups->keySequence().toString();
|
NekoRay::dataStore->hotkey_group = ui->show_groups->keySequence().toString();
|
||||||
NekoRay::dataStore->hotkey_route = ui->show_routes->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();
|
NekoRay::dataStore->Save();
|
||||||
}
|
}
|
||||||
GetMainWindow()->RegisterHotkey(false);
|
GetMainWindow()->RegisterHotkey(false);
|
||||||
|
|||||||
@@ -14,17 +14,20 @@
|
|||||||
<string>Hotkey</string>
|
<string>Hotkey</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<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">
|
<item row="1" column="1">
|
||||||
<widget class="QtExtKeySequenceEdit" name="show_groups"/>
|
<widget class="QtExtKeySequenceEdit" name="show_groups"/>
|
||||||
</item>
|
</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">
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="focusPolicy">
|
<property name="focusPolicy">
|
||||||
<enum>Qt::StrongFocus</enum>
|
<enum>Qt::StrongFocus</enum>
|
||||||
@@ -34,19 +37,9 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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">
|
<item row="0" column="1">
|
||||||
<widget class="QtExtKeySequenceEdit" name="show_mainwindow"/>
|
<widget class="QtExtKeySequenceEdit" name="show_mainwindow"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QtExtKeySequenceEdit" name="show_routes"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
@@ -54,6 +47,23 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</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>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
@@ -64,10 +74,11 @@
|
|||||||
</customwidget>
|
</customwidget>
|
||||||
</customwidgets>
|
</customwidgets>
|
||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>buttonBox</tabstop>
|
|
||||||
<tabstop>show_mainwindow</tabstop>
|
<tabstop>show_mainwindow</tabstop>
|
||||||
<tabstop>show_groups</tabstop>
|
<tabstop>show_groups</tabstop>
|
||||||
<tabstop>show_routes</tabstop>
|
<tabstop>show_routes</tabstop>
|
||||||
|
<tabstop>system_proxy</tabstop>
|
||||||
|
<tabstop>buttonBox</tabstop>
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
|
|||||||
@@ -1401,10 +1401,12 @@ void MainWindow::RegisterHotkey(bool unregister) {
|
|||||||
}
|
}
|
||||||
if (unregister) return;
|
if (unregister) return;
|
||||||
|
|
||||||
QStringList regstr;
|
QStringList regstr{
|
||||||
regstr += NekoRay::dataStore->hotkey_mainwindow;
|
NekoRay::dataStore->hotkey_mainwindow,
|
||||||
regstr += NekoRay::dataStore->hotkey_group;
|
NekoRay::dataStore->hotkey_group,
|
||||||
regstr += NekoRay::dataStore->hotkey_route;
|
NekoRay::dataStore->hotkey_route,
|
||||||
|
NekoRay::dataStore->hotkey_system_proxy_menu,
|
||||||
|
};
|
||||||
|
|
||||||
for (const auto &key: regstr) {
|
for (const auto &key: regstr) {
|
||||||
if (key.isEmpty()) continue;
|
if (key.isEmpty()) continue;
|
||||||
@@ -1432,6 +1434,8 @@ void MainWindow::HotkeyEvent(const QString &key) {
|
|||||||
on_menu_manage_groups_triggered();
|
on_menu_manage_groups_triggered();
|
||||||
} else if (key == NekoRay::dataStore->hotkey_route) {
|
} else if (key == NekoRay::dataStore->hotkey_route) {
|
||||||
on_menu_routing_settings_triggered();
|
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