mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-26 15:53:35 +01:00
Merge pull request #15002 from unknownbrackets/ui-open-memstick
UI: Add button to show memstick folder
This commit is contained in:
6 files changed
+31
-9
No files matched your search
+3
-1
@@ -5,6 +5,7 @@
|
||||
// Qt 4.7+ / 5.0+ implementation of the framework.
|
||||
// Currently supports: Android, Linux, Windows, Mac OSX
|
||||
|
||||
#include "ppsspp_config.h"
|
||||
#include <QApplication>
|
||||
#include <QClipboard>
|
||||
#include <QDesktopWidget>
|
||||
@@ -41,6 +42,7 @@
|
||||
#include "Common/Data/Text/I18n.h"
|
||||
#include "Common/Thread/ThreadUtil.h"
|
||||
#include "Common/Data/Encoding/Utf8.h"
|
||||
#include "Common/StringUtils.h"
|
||||
#include "Core/Config.h"
|
||||
#include "Core/ConfigValues.h"
|
||||
#include "Core/HW/Camera.h"
|
||||
@@ -282,7 +284,7 @@ void Vibrate(int length_ms) {
|
||||
}
|
||||
|
||||
void OpenDirectory(const char *path) {
|
||||
// Unsupported
|
||||
QDesktopServices::openUrl(QUrl::fromLocalFile(QString::fromUtf8(path)));
|
||||
}
|
||||
|
||||
void LaunchBrowser(const char *url)
|
||||
|
||||
+10
-4
@@ -190,12 +190,18 @@ void System_AskForPermission(SystemPermission permission) {}
|
||||
PermissionStatus System_GetPermissionStatus(SystemPermission permission) { return PERMISSION_STATUS_GRANTED; }
|
||||
|
||||
void OpenDirectory(const char *path) {
|
||||
#if defined(_WIN32)
|
||||
PIDLIST_ABSOLUTE pidl = ILCreateFromPath(ConvertUTF8ToWString(ReplaceAll(path, "/", "\\")).c_str());
|
||||
#if PPSSPP_PLATFORM(WINDOWS)
|
||||
SFGAOF flags;
|
||||
PIDLIST_ABSOLUTE pidl = nullptr;
|
||||
HRESULT hr = SHParseDisplayName(ConvertUTF8ToWString(ReplaceAll(path, "/", "\\")).c_str(), nullptr, &pidl, 0, &flags);
|
||||
if (pidl) {
|
||||
SHOpenFolderAndSelectItems(pidl, 0, NULL, 0);
|
||||
ILFree(pidl);
|
||||
if (SUCCEEDED(hr))
|
||||
SHOpenFolderAndSelectItems(pidl, 0, NULL, 0);
|
||||
CoTaskMemFree(pidl);
|
||||
}
|
||||
#elif PPSSPP_PLATFORM(MAC)
|
||||
std::string command = std::string("open ") + path;
|
||||
system(command.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -168,7 +168,7 @@ void GameScreen::CreateViews() {
|
||||
if (isRecentGame(gamePath_)) {
|
||||
rightColumnItems->Add(AddOtherChoice(new Choice(ga->T("Remove From Recent"))))->OnClick.Handle(this, &GameScreen::OnRemoveFromRecent);
|
||||
}
|
||||
#if PPSSPP_PLATFORM(WINDOWS) && !PPSSPP_PLATFORM(UWP)
|
||||
#if (defined(USING_QT_UI) || PPSSPP_PLATFORM(WINDOWS) || PPSSPP_PLATFORM(MAC)) && !PPSSPP_PLATFORM(UWP)
|
||||
rightColumnItems->Add(AddOtherChoice(new Choice(ga->T("Show In Folder"))))->OnClick.Handle(this, &GameScreen::OnShowInFolder);
|
||||
#endif
|
||||
if (g_Config.bEnableCheats) {
|
||||
|
||||
@@ -894,6 +894,10 @@ void GameSettingsScreen::CreateViews() {
|
||||
|
||||
systemSettings->Add(new ItemHeader(sy->T("PSP Memory Stick")));
|
||||
|
||||
#if (defined(USING_QT_UI) || PPSSPP_PLATFORM(WINDOWS) || PPSSPP_PLATFORM(MAC)) && !PPSSPP_PLATFORM(UWP)
|
||||
systemSettings->Add(new Choice(sy->T("Show Memory Stick folder")))->OnClick.Handle(this, &GameSettingsScreen::OnOpenMemStick);
|
||||
#endif
|
||||
|
||||
#if PPSSPP_PLATFORM(ANDROID)
|
||||
memstickDisplay_ = g_Config.memStickDirectory.ToVisualString();
|
||||
auto memstickPath = systemSettings->Add(new ChoiceWithValueDisplay(&memstickDisplay_, sy->T("Memory Stick folder", "Memory Stick folder"), (const char *)nullptr));
|
||||
@@ -1167,6 +1171,11 @@ UI::EventReturn GameSettingsScreen::OnChangeMemStickDir(UI::EventParams &e) {
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
UI::EventReturn GameSettingsScreen::OnOpenMemStick(UI::EventParams &e) {
|
||||
OpenDirectory(File::ResolvePath(g_Config.memStickDirectory.ToString().c_str()).c_str());
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
#if defined(_WIN32) && !PPSSPP_PLATFORM(UWP)
|
||||
|
||||
UI::EventReturn GameSettingsScreen::OnSavePathMydoc(UI::EventParams &e) {
|
||||
|
||||
@@ -117,6 +117,7 @@ private:
|
||||
UI::EventReturn OnAudioDevice(UI::EventParams &e);
|
||||
UI::EventReturn OnJitAffectingSetting(UI::EventParams &e);
|
||||
UI::EventReturn OnChangeMemStickDir(UI::EventParams &e);
|
||||
UI::EventReturn OnOpenMemStick(UI::EventParams &e);
|
||||
#if defined(_WIN32) && !PPSSPP_PLATFORM(UWP)
|
||||
UI::EventReturn OnSavePathMydoc(UI::EventParams &e);
|
||||
UI::EventReturn OnSavePathOther(UI::EventParams &e);
|
||||
|
||||
+7
-3
@@ -108,10 +108,14 @@ static std::thread inputBoxThread;
|
||||
static bool inputBoxRunning = false;
|
||||
|
||||
void OpenDirectory(const char *path) {
|
||||
PIDLIST_ABSOLUTE pidl = ILCreateFromPath(ConvertUTF8ToWString(ReplaceAll(path, "/", "\\")).c_str());
|
||||
SFGAOF flags;
|
||||
PIDLIST_ABSOLUTE pidl = nullptr;
|
||||
HRESULT hr = SHParseDisplayName(ConvertUTF8ToWString(ReplaceAll(path, "/", "\\")).c_str(), nullptr, &pidl, 0, &flags);
|
||||
|
||||
if (pidl) {
|
||||
SHOpenFolderAndSelectItems(pidl, 0, NULL, 0);
|
||||
ILFree(pidl);
|
||||
if (SUCCEEDED(hr))
|
||||
SHOpenFolderAndSelectItems(pidl, 0, nullptr, 0);
|
||||
CoTaskMemFree(pidl);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user