Experimental Qt file dialog support

This commit is contained in:
Sacha 2013-01-11 19:43:42 +10:00
parent 40852ff533
commit 7a38f459ad
3 changed files with 18 additions and 1 deletions

View File

@ -54,7 +54,7 @@ INCLUDEPATH += ../ext/snappy
# Zlib
!symbian: {
SOURCES += ../ext/zlib/adler32.c \
SOURCES += ../ext/zlib/adler32.c \
../ext/zlib/compress.c \
../ext/zlib/crc32.c \
../ext/zlib/deflate.c \

View File

@ -1,3 +1,4 @@
DEFINES += USING_QT_UI
blackberry|symbian|contains(MEEGO_EDITION,harmattan): CONFIG += mobile_platform
unix:!blackberry:!symbian:!macx: CONFIG += linux

View File

@ -42,6 +42,12 @@
#include "MenuScreens.h"
#include "EmuScreen.h"
#ifdef USING_QT_UI
#include <QFileDialog>
#include <QFile>
#include <QDir>
#endif
// Ugly communication with NativeApp
extern std::string game_title;
@ -163,6 +169,15 @@ void MenuScreen::render() {
if (UIButton(GEN_ID, vlinear, w, "Load...", ALIGN_RIGHT)) {
#if defined(USING_QT_UI) && defined(USING_GLES2)
QString fileName = QFileDialog::getOpenFileName(NULL, "Load ROM", g_Config.currentDirectory.c_str(), "PSP ROMs (*.iso *.cso *.pbp *.elf)");
if (QFile::exists(fileName)) {
QDir newPath;
g_Config.currentDirectory = newPath.filePath(fileName).toStdString();
g_Config.Save();
screenManager()->switchScreen(new EmuScreen(fileName.toStdString()));
}
#else
FileSelectScreenOptions options;
options.allowChooseDirectory = true;
options.filter = "iso:cso:pbp:elf:prx:";
@ -172,6 +187,7 @@ void MenuScreen::render() {
options.iconMapping["pbp"] = I_ICON_EXE;
options.iconMapping["elf"] = I_ICON_EXE;
screenManager()->switchScreen(new FileSelectScreen(options));
#endif
UIReset();
}