From 7a38f459ad10a360865ebfc049f4fe398ab94857 Mon Sep 17 00:00:00 2001 From: Sacha Date: Fri, 11 Jan 2013 19:43:42 +1000 Subject: [PATCH] Experimental Qt file dialog support --- Qt/Native.pro | 2 +- Qt/Settings.pri | 1 + android/jni/MenuScreens.cpp | 16 ++++++++++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Qt/Native.pro b/Qt/Native.pro index c0be10d0ce..c08db9b8e2 100755 --- a/Qt/Native.pro +++ b/Qt/Native.pro @@ -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 \ diff --git a/Qt/Settings.pri b/Qt/Settings.pri index c31a8218aa..4425495b9b 100644 --- a/Qt/Settings.pri +++ b/Qt/Settings.pri @@ -1,3 +1,4 @@ +DEFINES += USING_QT_UI blackberry|symbian|contains(MEEGO_EDITION,harmattan): CONFIG += mobile_platform unix:!blackberry:!symbian:!macx: CONFIG += linux diff --git a/android/jni/MenuScreens.cpp b/android/jni/MenuScreens.cpp index bd8124ff99..0d788b454d 100644 --- a/android/jni/MenuScreens.cpp +++ b/android/jni/MenuScreens.cpp @@ -42,6 +42,12 @@ #include "MenuScreens.h" #include "EmuScreen.h" +#ifdef USING_QT_UI +#include +#include +#include +#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(); }