More UI fixes

This commit is contained in:
Henrik Rydgard 2013-06-05 16:48:16 +02:00
parent a7f7410668
commit 28eb21a0d1
3 changed files with 25 additions and 19 deletions

View File

@ -395,9 +395,9 @@ void NativeInitGraphics() {
ui_theme.buttonStyle.bgColor = 0xFFFFFFFF;
ui_theme.buttonStyle.fgColor = 0xFFFFFFFF;
ui_theme.buttonStyle.image = I_BUTTON;
ui_theme.buttonFocusedStyle.bgColor = 0xFF808080;
ui_theme.buttonFocusedStyle.bgColor = 0xFFe0e0e0;
ui_theme.buttonFocusedStyle.fgColor = 0xFFFFFFFF;
ui_theme.buttonFocusedStyle.image = I_BUTTON;
ui_theme.buttonFocusedStyle.image = I_BUTTON_SELECTED;
ui_theme.buttonDownStyle.bgColor = 0xFFFFFFFF;
ui_theme.buttonDownStyle.fgColor = 0xFFFFFFFF;
ui_theme.buttonDownStyle.image = I_BUTTON_SELECTED;
@ -414,8 +414,7 @@ void NativeInitGraphics() {
UIInit(&ui_atlas, theme);
uiTexture = new Texture();
if (!uiTexture->Load("ui_atlas.zim"))
{
if (!uiTexture->Load("ui_atlas.zim")) {
PanicAlert("Failed to load ui_atlas.zim.\n\nPlace it in the directory \"assets\" under your PPSSPP directory.");
ELOG("Failed to load ui_atlas.zim");
}

View File

@ -38,7 +38,7 @@ PluginScreen::PluginScreen() {
}
void PluginScreen::CreateViews() {
I18NCategory *c = GetI18NCategory("Plugin");
I18NCategory *p = GetI18NCategory("Plugin");
// Build the UI.
using namespace UI;
@ -58,9 +58,10 @@ void PluginScreen::CreateViews() {
tvDescription_ = scrollContents->Add(new TextView(0, "Looking for download...", ALIGN_LEFT, 1.0f, new LinearLayoutParams(textMargins)));
const char *legalityNotice =
"* Mai's Atrac3+ decoder is required for audio in many games.\n"
p->T("Origins are dubious", "* Mai's Atrac3+ decoder is currently required\n"
"for audio in many games.\n"
"Please note that the origins of this code are dubious.\n"
"Choose More Information for more information.";
"Choose More Information for more information.");
scrollContents->Add(new TextView(0, legalityNotice, ALIGN_LEFT, 1.0f, new LinearLayoutParams(textMargins) ));
@ -70,28 +71,28 @@ void PluginScreen::CreateViews() {
ViewGroup *buttonBar = new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(buttonMargins));
root_->Add(buttonBar);
buttonBack_ = new Button(c->T("Back"), new LinearLayoutParams(1.0));
buttonBack_ = new Button(p->T("Back"), new LinearLayoutParams(1.0));
buttonBar->Add(buttonBack_)->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
buttonDownload_ = new Button(c->T("Download"), new LinearLayoutParams(1.0));
buttonDownload_ = new Button(p->T("Download and install"), new LinearLayoutParams(1.0));
buttonDownload_->SetEnabled(false);
buttonBar->Add(buttonDownload_)->OnClick.Handle(this, &PluginScreen::OnDownload);
buttonBar->Add(new Button(c->T("More Information"), new LinearLayoutParams(1.0)))->OnClick.Handle(this, &PluginScreen::OnInformation);
buttonBar->Add(new Button(p->T("More Information"), new LinearLayoutParams(1.0)))->OnClick.Handle(this, &PluginScreen::OnInformation);
}
void PluginScreen::update(InputState &input) {
UIScreen::update(input);
I18NCategory *p = GetI18NCategory("Plugin");
downloader_.Update();
if (json_.get() && json_->Done()) {
if (json_->ResultCode() != 200) {
char codeStr[18];
sprintf(codeStr, "%i", json_->ResultCode());
tvDescription_->SetText(std::string("Failed to check availability (") + codeStr + ").\nPlease try again later and check that you have a\nworking internet connection.");
tvDescription_->SetText(p->T("Failed to reach server", "Failed to reach server.\nPlease try again later and check that you have a\nworking internet connection."));
buttonDownload_->SetEnabled(false);
}
else
{
} else {
std::string json;
json_->buffer().TakeAll(&json);
@ -114,8 +115,8 @@ void PluginScreen::update(InputState &input) {
buttonDownload_->SetEnabled(false);
} else {
buttonDownload_->SetEnabled(true);
const char *notInstalledText = "To download and install Mai's Atrac3+ decoding support, click Download.\n";
const char *reInstallText = "Mai's Atrac3+ decoder already installed.\nWould you like to redownload and reinstall it?\n";
const char *notInstalledText = p->T("To download and install", "To download and install Mai's Atrac3+ decoding support, click Download.\n");
const char *reInstallText = p->T("Already installed", "Mai's Atrac3+ decoder already installed.\nWould you like to redownload and reinstall it?\n");
tvDescription_->SetText(Atrac3plus_Decoder::IsInstalled() ? reInstallText : notInstalledText);
}
}
@ -130,13 +131,13 @@ void PluginScreen::update(InputState &input) {
if (at3plusdecoder_->ResultCode() == 200) {
// Yay!
tvDescription_->SetText("Mai Atrac3plus plugin downloaded and installed.\n"
"Please press Back.");
tvDescription_->SetText(p->T("Installed Correctly", "Mai Atrac3plus plugin downloaded and installed.\n"
"Please press Back."));
buttonDownload_->SetVisibility(UI::V_GONE);
} else {
char codeStr[18];
sprintf(codeStr, "%i", at3plusdecoder_->ResultCode());
tvDescription_->SetText(std::string("Failed to download (") + codeStr + ").\nPlease try again later.");
tvDescription_->SetText(p->T("Failed to download plugin", "Failed to download plugin.\nPlease try again later."));
progress_->SetVisibility(UI::V_GONE);
buttonDownload_->SetEnabled(true);
}

View File

@ -28,6 +28,10 @@
#include "file/file_util.h"
#include "net/http_client.h"
// Uses the new UI framework through UIScreen for simplicity.
// Looks disappointingly like the old UI, right? Don't worry, it's just the theme.
// A redesign is coming. And note that you can control this new UI with your
// keyboard or Xbox controller.
class PluginScreen : public UIScreen {
public:
@ -40,9 +44,11 @@ protected:
virtual void DrawBackground();
private:
// Event handlers
UI::EventReturn OnDownload(UI::EventParams &e);
UI::EventReturn OnInformation(UI::EventParams &e);
// Keeping track of downloads
http::Downloader downloader_;
std::shared_ptr<http::Download> json_;
std::shared_ptr<http::Download> at3plusdecoder_;