More NewUI

This commit is contained in:
Henrik Rydgard 2013-07-18 11:39:54 +02:00
parent 3a8b5809cd
commit 086746e0fd
3 changed files with 57 additions and 1 deletions

View File

@ -26,6 +26,7 @@
#include "UI/GameInfoCache.h" #include "UI/GameInfoCache.h"
#include "UI/MiscScreens.h" #include "UI/MiscScreens.h"
#include "Core/Config.h" #include "Core/Config.h"
#include "android/jni/TestRunner.h"
namespace UI { namespace UI {
@ -237,12 +238,15 @@ void GlobalSettingsScreen::CreateViews() {
using namespace UI; using namespace UI;
root_ = new ScrollView(ORIENT_VERTICAL); root_ = new ScrollView(ORIENT_VERTICAL);
enableReports_ = g_Config.sReportHost != "";
I18NCategory *g = GetI18NCategory("General"); I18NCategory *g = GetI18NCategory("General");
I18NCategory *gs = GetI18NCategory("Graphics"); I18NCategory *gs = GetI18NCategory("Graphics");
LinearLayout *list = root_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f))); LinearLayout *list = root_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)));
list->Add(new ItemHeader("General")); list->Add(new ItemHeader("General"));
list->Add(new CheckBox(&g_Config.bNewUI, gs->T("New UI"))); list->Add(new CheckBox(&g_Config.bNewUI, gs->T("New UI")));
list->Add(new CheckBox(&enableReports_, gs->T("Enable error reporting")));
static const char *fpsChoices[] = { static const char *fpsChoices[] = {
"None", "Speed", "FPS", "Both" "None", "Speed", "FPS", "Both"
@ -250,7 +254,7 @@ void GlobalSettingsScreen::CreateViews() {
list->Add(new PopupMultiChoice(&g_Config.iShowFPSCounter, gs->T("Show FPS"), fpsChoices, 0, 4, gs, screenManager())); list->Add(new PopupMultiChoice(&g_Config.iShowFPSCounter, gs->T("Show FPS"), fpsChoices, 0, 4, gs, screenManager()));
list->Add(new Choice(gs->T("Language")))->OnClick.Handle(this, &GlobalSettingsScreen::OnLanguage); list->Add(new Choice(gs->T("Language")))->OnClick.Handle(this, &GlobalSettingsScreen::OnLanguage);
list->Add(new Choice(gs->T("Developer Tools")))->OnClick.Handle(this, &GlobalSettingsScreen::OnDeveloperTools);
list->Add(new Choice(g->T("Back")))->OnClick.Handle(this, &GlobalSettingsScreen::OnBack); list->Add(new Choice(g->T("Back")))->OnClick.Handle(this, &GlobalSettingsScreen::OnBack);
} }
@ -264,8 +268,14 @@ UI::EventReturn GlobalSettingsScreen::OnLanguage(UI::EventParams &e) {
return UI::EVENT_DONE; return UI::EVENT_DONE;
} }
UI::EventReturn GlobalSettingsScreen::OnDeveloperTools(UI::EventParams &e) {
screenManager()->push(new DeveloperToolsScreen());
return UI::EVENT_DONE;
}
UI::EventReturn GlobalSettingsScreen::OnBack(UI::EventParams &e) { UI::EventReturn GlobalSettingsScreen::OnBack(UI::EventParams &e) {
screenManager()->finishDialog(this, DR_OK); screenManager()->finishDialog(this, DR_OK);
g_Config.sReportHost = enableReports_ ? "report.ppsspp.org" : "";
g_Config.Save(); g_Config.Save();
return UI::EVENT_DONE; return UI::EVENT_DONE;
} }
@ -273,3 +283,31 @@ UI::EventReturn GlobalSettingsScreen::OnBack(UI::EventParams &e) {
void GlobalSettingsScreen::DrawBackground(UIContext &dc) { void GlobalSettingsScreen::DrawBackground(UIContext &dc) {
::DrawBackground(1.0f); ::DrawBackground(1.0f);
} }
void DeveloperToolsScreen::DrawBackground(UIContext &dc) {
::DrawBackground(1.0f);
}
void DeveloperToolsScreen::CreateViews() {
using namespace UI;
root_ = new ScrollView(ORIENT_VERTICAL);
I18NCategory *g = GetI18NCategory("General");
I18NCategory *d = GetI18NCategory("Developer");
LinearLayout *list = root_->Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(1.0f)));
list->Add(new ItemHeader(g->T("General")));
list->Add(new Choice(d->T("Run CPU Tests")))->OnClick.Handle(this, &DeveloperToolsScreen::OnRunCPUTests);
list->Add(new Choice(g->T("Back")))->OnClick.Handle(this, &DeveloperToolsScreen::OnBack);
}
UI::EventReturn DeveloperToolsScreen::OnBack(UI::EventParams &e) {
screenManager()->finishDialog(this, DR_OK);
return UI::EVENT_DONE;
}
UI::EventReturn DeveloperToolsScreen::OnRunCPUTests(UI::EventParams &e) {
RunTests();
return UI::EVENT_DONE;
}

View File

@ -57,4 +57,21 @@ private:
UI::EventReturn OnLanguage(UI::EventParams &e); UI::EventReturn OnLanguage(UI::EventParams &e);
UI::EventReturn OnFactoryReset(UI::EventParams &e); UI::EventReturn OnFactoryReset(UI::EventParams &e);
UI::EventReturn OnBack(UI::EventParams &e); UI::EventReturn OnBack(UI::EventParams &e);
UI::EventReturn OnDeveloperTools(UI::EventParams &e);
// Temporaries to convert bools to other kinds of settings
bool enableReports_;
};
class DeveloperToolsScreen : public UIScreen {
public:
DeveloperToolsScreen() {}
protected:
virtual void CreateViews();
virtual void DrawBackground(UIContext &dc);
private:
UI::EventReturn OnBack(UI::EventParams &e);
UI::EventReturn OnRunCPUTests(UI::EventParams &e);
}; };

View File

@ -783,6 +783,7 @@ void DeveloperScreen::render() {
if (UICheckBox(GEN_ID, x, y += stride, d->T("Report","Enable Compatibility Server Reports"), ALIGN_TOPLEFT, &reportingEnabled)) { if (UICheckBox(GEN_ID, x, y += stride, d->T("Report","Enable Compatibility Server Reports"), ALIGN_TOPLEFT, &reportingEnabled)) {
g_Config.sReportHost = reportingEnabled ? reportHostOfficial : ""; g_Config.sReportHost = reportingEnabled ? reportHostOfficial : "";
} }
UICheckBox(GEN_ID, x, y += stride, d->T("New UI"), ALIGN_TOPLEFT, &g_Config.bNewUI);
VLinear vlinear(x, y + stride + 12, 16); VLinear vlinear(x, y + stride + 12, 16);