Skip to content

Commit

Permalink
Implement media key chooser in hotkeys tab
Browse files Browse the repository at this point in the history
  • Loading branch information
malensek committed Mar 27, 2015
1 parent fce0fee commit 663fc8b
Showing 1 changed file with 30 additions and 1 deletion.
31 changes: 30 additions & 1 deletion SettingsUI/Hotkeys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,23 @@ void Hotkeys::LoadSelection(int idx) {
_argCombo.ShowWindow(SW_SHOW);
break;

case HotkeyInfo::MediaKey: {
_argument.SetWindowTextW(L"Action:");
_argCombo.ResetContent();
unsigned int numMediaKeys = HotkeyInfo::MediaKeyNames.size();
for (unsigned int i = 0; i < numMediaKeys; ++i) {
_argCombo.InsertString(i, HotkeyInfo::MediaKeyNames[i].c_str());
}
if (current.args.size() > 0) {
//TODO: this needs to be translated again
_argCombo.SelectString(0, current.args[0].c_str());
}

_argument.ShowWindow(SW_SHOW);
_argCombo.ShowWindow(SW_SHOW);
}
break;

default:
_argument.ShowWindow(SW_HIDE);
_argCombo.ShowWindow(SW_HIDE);
Expand Down Expand Up @@ -229,14 +246,26 @@ void Hotkeys::OnCbnSelchangeArg() {
= (HotkeyInfo::HotkeyActions) _action.GetCurSel();

switch (action) {
case HotkeyInfo::EjectDrive:
case HotkeyInfo::EjectDrive: {
wchar_t buf[2];
_argCombo.GetWindowText(buf, 2);
if (current->args.size() <= 0) {
current->args.resize(1);
}
current->args[0] = buf;
}
break;

case HotkeyInfo::MediaKey: {
wchar_t buf[128];
_argCombo.GetWindowText(buf, 128);
if (current->args.size() <= 0) {
current->args.resize(1);
}
current->args[0] = buf;
}
break;

}
LoadSelection(_selIdx);
}

0 comments on commit 663fc8b

Please sign in to comment.