Merge pull request #7298 from spycrab/usb_keyboard_hotkey
Hotkeys: Add "Toggle USB Keyboard" hotkey
This commit is contained in:
commit
ddf09a0841
|
@ -20,7 +20,7 @@
|
|||
#include "InputCommon/GCPadStatus.h"
|
||||
|
||||
// clang-format off
|
||||
constexpr std::array<const char*, 130> s_hotkey_labels{{
|
||||
constexpr std::array<const char*, 131> s_hotkey_labels{{
|
||||
_trans("Open"),
|
||||
_trans("Change Disc"),
|
||||
_trans("Eject Disc"),
|
||||
|
@ -68,6 +68,7 @@ constexpr std::array<const char*, 130> s_hotkey_labels{{
|
|||
_trans("Connect Wii Remote 3"),
|
||||
_trans("Connect Wii Remote 4"),
|
||||
_trans("Connect Balance Board"),
|
||||
_trans("Toggle USB Keyboard"),
|
||||
|
||||
_trans("Next Profile for Wii Remote 1"),
|
||||
_trans("Previous Profile for Wii Remote 1"),
|
||||
|
@ -271,7 +272,7 @@ constexpr std::array<HotkeyGroupInfo, NUM_HOTKEY_GROUPS> s_groups_info = {
|
|||
{_trans("Stepping"), HK_STEP, HK_SKIP},
|
||||
{_trans("Program Counter"), HK_SHOW_PC, HK_SET_PC},
|
||||
{_trans("Breakpoint"), HK_BP_TOGGLE, HK_MBP_ADD},
|
||||
{_trans("Wii"), HK_TRIGGER_SYNC_BUTTON, HK_BALANCEBOARD_CONNECT},
|
||||
{_trans("Wii"), HK_TRIGGER_SYNC_BUTTON, HK_TOGGLE_USB_KEYBOARD},
|
||||
{_trans("Controller Profile"), HK_NEXT_WIIMOTE_PROFILE_1, HK_PREV_GAME_WIIMOTE_PROFILE_4},
|
||||
{_trans("Graphics Toggles"), HK_TOGGLE_CROP, HK_TOGGLE_TEXTURES},
|
||||
{_trans("Internal Resolution"), HK_INCREASE_IR, HK_DECREASE_IR},
|
||||
|
|
|
@ -66,6 +66,7 @@ enum Hotkey
|
|||
HK_WIIMOTE3_CONNECT,
|
||||
HK_WIIMOTE4_CONNECT,
|
||||
HK_BALANCEBOARD_CONNECT,
|
||||
HK_TOGGLE_USB_KEYBOARD,
|
||||
|
||||
HK_NEXT_WIIMOTE_PROFILE_1,
|
||||
HK_PREV_WIIMOTE_PROFILE_1,
|
||||
|
|
|
@ -238,6 +238,12 @@ void HotkeyScheduler::Run()
|
|||
|
||||
if (wiimote_id > -1)
|
||||
emit ConnectWiiRemote(wiimote_id);
|
||||
|
||||
if (IsHotkey(HK_TOGGLE_USB_KEYBOARD))
|
||||
{
|
||||
Settings::Instance().SetUSBKeyboardConnected(
|
||||
!Settings::Instance().IsUSBKeyboardConnected());
|
||||
}
|
||||
}
|
||||
|
||||
if (IsHotkey(HK_PREV_WIIMOTE_PROFILE_1))
|
||||
|
|
|
@ -520,3 +520,17 @@ void Settings::SetBatchModeEnabled(bool batch)
|
|||
{
|
||||
m_batch = batch;
|
||||
}
|
||||
|
||||
bool Settings::IsUSBKeyboardConnected() const
|
||||
{
|
||||
return SConfig::GetInstance().m_WiiKeyboard;
|
||||
}
|
||||
|
||||
void Settings::SetUSBKeyboardConnected(bool connected)
|
||||
{
|
||||
if (IsUSBKeyboardConnected() != connected)
|
||||
{
|
||||
SConfig::GetInstance().m_WiiKeyboard = connected;
|
||||
emit USBKeyboardConnectionChanged(connected);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,6 +87,9 @@ public:
|
|||
bool IsBatchModeEnabled() const;
|
||||
void SetBatchModeEnabled(bool batch);
|
||||
|
||||
bool IsUSBKeyboardConnected() const;
|
||||
void SetUSBKeyboardConnected(bool connected);
|
||||
|
||||
// Graphics
|
||||
void SetHideCursor(bool hide_cursor);
|
||||
bool GetHideCursor() const;
|
||||
|
@ -169,6 +172,7 @@ signals:
|
|||
void AutoUpdateTrackChanged(const QString& mode);
|
||||
void AnalyticsToggled(bool enabled);
|
||||
void DevicesChanged();
|
||||
void USBKeyboardConnectionChanged(bool connected);
|
||||
|
||||
private:
|
||||
bool m_batch = false;
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "Core/Core.h"
|
||||
#include "Core/IOS/IOS.h"
|
||||
|
||||
#include "DolphinQt/Settings.h"
|
||||
#include "DolphinQt/Settings/USBDeviceAddToWhitelistDialog.h"
|
||||
|
||||
#include "UICommon/USBUtils.h"
|
||||
|
@ -73,6 +74,8 @@ void WiiPane::ConnectLayout()
|
|||
connect(m_pal60_mode_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
|
||||
connect(m_sd_card_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
|
||||
connect(m_connect_keyboard_checkbox, &QCheckBox::toggled, this, &WiiPane::OnSaveConfig);
|
||||
connect(&Settings::Instance(), &Settings::USBKeyboardConnectionChanged,
|
||||
m_connect_keyboard_checkbox, &QCheckBox::setChecked);
|
||||
|
||||
// Whitelisted USB Passthrough Devices
|
||||
connect(m_whitelist_usb_list, &QListWidget::itemClicked, this, &WiiPane::ValidateSelectionState);
|
||||
|
@ -190,7 +193,6 @@ void WiiPane::OnEmulationStateChanged(bool running)
|
|||
m_screensaver_checkbox->setEnabled(!running);
|
||||
m_pal60_mode_checkbox->setEnabled(!running);
|
||||
m_sd_card_checkbox->setEnabled(!running);
|
||||
m_connect_keyboard_checkbox->setEnabled(!running);
|
||||
m_system_language_choice->setEnabled(!running);
|
||||
m_aspect_ratio_choice->setEnabled(!running);
|
||||
m_wiimote_motor->setEnabled(!running);
|
||||
|
@ -203,7 +205,7 @@ void WiiPane::LoadConfig()
|
|||
{
|
||||
m_screensaver_checkbox->setChecked(Config::Get(Config::SYSCONF_SCREENSAVER));
|
||||
m_pal60_mode_checkbox->setChecked(Config::Get(Config::SYSCONF_PAL60));
|
||||
m_connect_keyboard_checkbox->setChecked(SConfig::GetInstance().m_WiiKeyboard);
|
||||
m_connect_keyboard_checkbox->setChecked(Settings::Instance().IsUSBKeyboardConnected());
|
||||
m_sd_card_checkbox->setChecked(SConfig::GetInstance().m_WiiSDCard);
|
||||
m_aspect_ratio_choice->setCurrentIndex(Config::Get(Config::SYSCONF_WIDESCREEN));
|
||||
m_system_language_choice->setCurrentIndex(Config::Get(Config::SYSCONF_LANGUAGE));
|
||||
|
@ -221,7 +223,7 @@ void WiiPane::OnSaveConfig()
|
|||
{
|
||||
Config::SetBase(Config::SYSCONF_SCREENSAVER, m_screensaver_checkbox->isChecked());
|
||||
Config::SetBase(Config::SYSCONF_PAL60, m_pal60_mode_checkbox->isChecked());
|
||||
SConfig::GetInstance().m_WiiKeyboard = m_connect_keyboard_checkbox->isChecked();
|
||||
Settings::Instance().SetUSBKeyboardConnected(m_connect_keyboard_checkbox->isChecked());
|
||||
SConfig::GetInstance().m_WiiSDCard = m_sd_card_checkbox->isChecked();
|
||||
Config::SetBase<u32>(Config::SYSCONF_SENSOR_BAR_POSITION,
|
||||
TranslateSensorBarPosition(m_wiimote_ir_sensor_position->currentIndex()));
|
||||
|
|
Loading…
Reference in New Issue