mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-10-21 02:09:05 +02:00
Qt: Correct Browse... handling for multithreaded.
This commit is contained in:
1 parent
67884d60b3
commit
8b40f1a814
3 files changed
+35
-22
No files matched your search
+22
-21
@@ -67,12 +67,6 @@
|
||||
#include "android/android-ndk-profiler/prof.h"
|
||||
#endif
|
||||
|
||||
#ifdef USING_QT_UI
|
||||
#include <QFileDialog>
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
#endif
|
||||
|
||||
#include <sstream>
|
||||
|
||||
bool MainScreen::showHomebrewTab = false;
|
||||
@@ -447,12 +441,18 @@ GameBrowser::GameBrowser(std::string path, bool allowBrowsing, bool *gridStyle,
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void GameBrowser::FocusGame(std::string gamePath) {
|
||||
void GameBrowser::FocusGame(const std::string &gamePath) {
|
||||
focusGamePath_ = gamePath;
|
||||
Refresh();
|
||||
focusGamePath_.clear();
|
||||
}
|
||||
|
||||
void GameBrowser::SetPath(const std::string &path) {
|
||||
path_.SetPath(path);
|
||||
g_Config.currentDirectory = path_.GetPath();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
UI::EventReturn GameBrowser::LayoutChange(UI::EventParams &e) {
|
||||
*gridStyle_ = e.a == 0 ? true : false;
|
||||
Refresh();
|
||||
@@ -466,14 +466,9 @@ UI::EventReturn GameBrowser::LastClick(UI::EventParams &e) {
|
||||
|
||||
UI::EventReturn GameBrowser::HomeClick(UI::EventParams &e) {
|
||||
#ifdef __ANDROID__
|
||||
path_.SetPath(g_Config.memStickDirectory);
|
||||
SetPath(g_Config.memStickDirectory);
|
||||
#elif defined(USING_QT_UI)
|
||||
I18NCategory *mm = GetI18NCategory("MainMenu");
|
||||
QString fileName = QFileDialog::getExistingDirectory(NULL, "Browse for Folder", g_Config.currentDirectory.c_str());
|
||||
if (QDir(fileName).exists())
|
||||
path_.SetPath(fileName.toStdString());
|
||||
else
|
||||
return UI::EVENT_DONE;
|
||||
System_SendMessage("browse_folder", "");
|
||||
#elif defined(_WIN32)
|
||||
#if PPSSPP_PLATFORM(UWP)
|
||||
// TODO UWP
|
||||
@@ -482,14 +477,12 @@ UI::EventReturn GameBrowser::HomeClick(UI::EventParams &e) {
|
||||
std::string folder = W32Util::BrowseForFolder(MainWindow::GetHWND(), mm->T("Choose folder"));
|
||||
if (!folder.size())
|
||||
return UI::EVENT_DONE;
|
||||
path_.SetPath(folder);
|
||||
SetPath(folder);
|
||||
#endif
|
||||
#else
|
||||
path_.SetPath(getenv("HOME"));
|
||||
SetPath(getenv("HOME"));
|
||||
#endif
|
||||
|
||||
g_Config.currentDirectory = path_.GetPath();
|
||||
Refresh();
|
||||
return UI::EVENT_DONE;
|
||||
}
|
||||
|
||||
@@ -742,7 +735,7 @@ UI::EventReturn GameBrowser::GameButtonHighlight(UI::EventParams &e) {
|
||||
}
|
||||
|
||||
UI::EventReturn GameBrowser::NavigateClick(UI::EventParams &e) {
|
||||
DirButton *button = static_cast<DirButton *>(e.v);
|
||||
DirButton *button = static_cast<DirButton *>(e.v);
|
||||
std::string text = button->GetPath();
|
||||
if (button->PathAbsolute()) {
|
||||
path_.SetPath(text);
|
||||
@@ -1004,8 +997,16 @@ void MainScreen::sendMessage(const char *message, const char *value) {
|
||||
// Always call the base class method first to handle the most common messages.
|
||||
UIScreenWithBackground::sendMessage(message, value);
|
||||
|
||||
if (!strcmp(message, "boot") && screenManager()->topScreen() == this) {
|
||||
screenManager()->switchScreen(new EmuScreen(value));
|
||||
if (screenManager()->topScreen() == this) {
|
||||
if (!strcmp(message, "boot")) {
|
||||
screenManager()->switchScreen(new EmuScreen(value));
|
||||
}
|
||||
if (!strcmp(message, "browse_folderSelect")) {
|
||||
int tab = tabHolder_->GetCurrentTab();
|
||||
if (tab >= 0 && tab < (int)gameBrowsers_.size()) {
|
||||
gameBrowsers_[tab]->SetPath(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!strcmp(message, "permission_granted") && !strcmp(value, "storage")) {
|
||||
RecreateViews();
|
||||
|
||||
Reference in new issue
Block a user