Add trivial "Show in Folder" functionality to game screen
This commit is contained in:
parent
cf0f4b612e
commit
13dd5f305c
2 changed files with 13 additions and 0 deletions
|
@ -20,6 +20,7 @@
|
||||||
#include "gfx_es2/draw_buffer.h"
|
#include "gfx_es2/draw_buffer.h"
|
||||||
#include "i18n/i18n.h"
|
#include "i18n/i18n.h"
|
||||||
#include "math/curves.h"
|
#include "math/curves.h"
|
||||||
|
#include "util/text/utf8.h"
|
||||||
#include "ui/ui_context.h"
|
#include "ui/ui_context.h"
|
||||||
#include "ui/view.h"
|
#include "ui/view.h"
|
||||||
#include "ui/viewgroup.h"
|
#include "ui/viewgroup.h"
|
||||||
|
@ -77,6 +78,9 @@ void GameScreen::CreateViews() {
|
||||||
if (isRecentGame(gamePath_)) {
|
if (isRecentGame(gamePath_)) {
|
||||||
rightColumnItems->Add(new Choice(ga->T("Remove From Recent")))->OnClick.Handle(this, &GameScreen::OnRemoveFromRecent);
|
rightColumnItems->Add(new Choice(ga->T("Remove From Recent")))->OnClick.Handle(this, &GameScreen::OnRemoveFromRecent);
|
||||||
}
|
}
|
||||||
|
#ifdef _WIN32
|
||||||
|
rightColumnItems->Add(new Choice(ga->T("Show In Folder")))->OnClick.Handle(this, &GameScreen::OnShowInFolder);
|
||||||
|
#endif
|
||||||
|
|
||||||
UI::SetFocusedView(play);
|
UI::SetFocusedView(play);
|
||||||
}
|
}
|
||||||
|
@ -149,6 +153,14 @@ void GameScreen::update(InputState &input) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UI::EventReturn GameScreen::OnShowInFolder(UI::EventParams &e) {
|
||||||
|
#ifdef _WIN32
|
||||||
|
std::string str = std::string("explorer.exe /select,\"") + ReplaceAll(gamePath_, "/", "\\") + "\"";
|
||||||
|
_wsystem(ConvertUTF8ToWString(str).c_str());
|
||||||
|
#endif
|
||||||
|
return UI::EVENT_DONE;
|
||||||
|
}
|
||||||
|
|
||||||
UI::EventReturn GameScreen::OnSwitchBack(UI::EventParams &e) {
|
UI::EventReturn GameScreen::OnSwitchBack(UI::EventParams &e) {
|
||||||
screenManager()->finishDialog(this, DR_OK);
|
screenManager()->finishDialog(this, DR_OK);
|
||||||
return UI::EVENT_DONE;
|
return UI::EVENT_DONE;
|
||||||
|
|
|
@ -48,6 +48,7 @@ private:
|
||||||
UI::EventReturn OnSwitchBack(UI::EventParams &e);
|
UI::EventReturn OnSwitchBack(UI::EventParams &e);
|
||||||
UI::EventReturn OnCreateShortcut(UI::EventParams &e);
|
UI::EventReturn OnCreateShortcut(UI::EventParams &e);
|
||||||
UI::EventReturn OnRemoveFromRecent(UI::EventParams &e);
|
UI::EventReturn OnRemoveFromRecent(UI::EventParams &e);
|
||||||
|
UI::EventReturn OnShowInFolder(UI::EventParams &e);
|
||||||
|
|
||||||
std::string gamePath_;
|
std::string gamePath_;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue