Add F2 Hotkey to open current commit ID URL

This commit is contained in:
illusion98 2020-02-01 03:58:31 -05:00
parent 910a21f424
commit a7f6fd6ef6
2 changed files with 14 additions and 6 deletions

View File

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

View File

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