[UI] Add F2 Hotkey to open current git commit in browser

This commit is contained in:
illusion98 2020-02-01 03:58:31 -05:00 committed by Rick Gibbed
parent 211e30d791
commit c3f3bd8701
2 changed files with 14 additions and 6 deletions

View File

@ -154,6 +154,10 @@ bool EmulatorWindow::Initialize() {
ShowHelpWebsite();
} break;
case 0x71: { // VK_F2
ShowCommitID();
} break;
default: { handled = false; } break;
}
e->set_handled(handled);
@ -258,12 +262,8 @@ bool EmulatorWindow::Initialize() {
auto help_menu = MenuItem::Create(MenuItem::Type::kPopup, L"&Help");
{
help_menu->AddChild(MenuItem::Create(
MenuItem::Type::kString, L"Build commit on GitHub...", [this]() {
std::wstring url =
std::wstring(L"https://github.com/xenia-project/xenia/tree/") +
xe::to_wstring(XE_BUILD_COMMIT) + L"/";
LaunchBrowser(url.c_str());
}));
MenuItem::Type::kString, L"Build commit on GitHub...", L"F2",
std::bind(&EmulatorWindow::ShowCommitID, this)));
help_menu->AddChild(MenuItem::Create(
MenuItem::Type::kString, L"Recent changes on GitHub...", [this]() {
std::wstring url =
@ -427,6 +427,13 @@ void EmulatorWindow::ToggleFullscreen() {
void EmulatorWindow::ShowHelpWebsite() { LaunchBrowser(L"https://xenia.jp"); }
void EmulatorWindow::ShowCommitID() {
std::wstring url =
std::wstring(L"https://github.com/xenia-project/xenia/commit/") +
xe::to_wstring(XE_BUILD_COMMIT) + L"/";
LaunchBrowser(url.c_str());
}
void EmulatorWindow::UpdateTitle() {
std::wstring title(base_title_);

View File

@ -56,6 +56,7 @@ class EmulatorWindow {
void GpuTraceFrame();
void GpuClearCaches();
void ShowHelpWebsite();
void ShowCommitID();
Emulator* emulator_;
std::unique_ptr<ui::Loop> loop_;