More plugin stuff

This commit is contained in:
Henrik Rydgard 2013-06-02 14:38:22 +02:00
parent 68e75ae134
commit e5090e36c2
3 changed files with 29 additions and 6 deletions

View File

@ -6,7 +6,8 @@ namespace Atrac3plus_Decoder {
bool IsInstalled();
bool CanAutoInstall();
bool DoAutoInstall();
std::string GetInstalledFilename();
int Init();
int Shutdown();

View File

@ -24,9 +24,19 @@
#include "ui/view.h"
#include "ui/viewgroup.h"
#include "ui/ui_context.h"
#include "Core/HW/atrac3plus.h"
void UIScreen::update(InputState &input) {
if (!root_) {
CreateViews();
}
if (orientationChanged_) {
delete root_;
root_ = 0;
CreateViews();
}
UpdateViewHierarchy(input, root_);
}
@ -46,7 +56,9 @@ void UIScreen::touch(const TouchInput &touch) {
PluginScreen::PluginScreen() {
// Let's start by downloading the json. We'll find out in Update when it's finished.
json_ = downloader_.StartDownload("http://www.ppsspp.org/update/at3plusdecoder.json", "");
}
void PluginScreen::CreateViews() {
I18NCategory *c = GetI18NCategory("Plugin");
// Build the UI.
@ -54,7 +66,6 @@ PluginScreen::PluginScreen() {
root_ = new LinearLayout(ORIENT_VERTICAL);
Margins textMargins(20,17);
tvDescription_ = root_->Add(new TextView(0, "Audio decoding support", ALIGN_HCENTER, 1.0f, new LinearLayoutParams(textMargins)));
@ -64,12 +75,14 @@ PluginScreen::PluginScreen() {
"reverse engineered code in the US and some other countries.\n"
"Choose \"More Information\" for more info.\n", ALIGN_LEFT, 1.0f, new LinearLayoutParams(1.0, textMargins)));
progress_ = root_->Add(new ProgressBar());
ViewGroup *buttonBar = new LinearLayout(ORIENT_HORIZONTAL);
root_->Add(buttonBar);
buttonDownload_ = new Button(c->T("Download"), new LinearLayoutParams(1.0));
buttonBar->Add(buttonDownload_)->OnClick.Add(std::bind(&PluginScreen::OnDownload, this, p::_1));
buttonBar->Add(new Button(c->T("More Information"), new LinearLayoutParams(1.0)))->OnClick.Add(std::bind(&PluginScreen::OnInformation, this, p::_1));
buttonBar->Add(buttonDownload_)->OnClick.Add(std::bind(&PluginScreen::OnDownload, this, placeholder::_1));
buttonBar->Add(new Button(c->T("More Information"), new LinearLayoutParams(1.0)))->OnClick.Add(std::bind(&PluginScreen::OnInformation, this, placeholder::_1));
}
void PluginScreen::update(InputState &input) {

View File

@ -29,13 +29,18 @@
class UIScreen : public Screen {
public:
UIScreen() : Screen(), root_(0) {}
UIScreen() : Screen(), root_(0), orientationChanged_(false) {}
~UIScreen() { delete root_; }
virtual void update(InputState &input);
virtual void render();
virtual void touch(const TouchInput &touch);
protected:
virtual void CreateViews() = 0;
UI::ViewGroup *root_;
bool orientationChanged_;
};
class PluginScreen : public UIScreen {
@ -43,6 +48,9 @@ public:
PluginScreen();
virtual void update(InputState &input);
protected:
virtual void CreateViews();
private:
UI::EventReturn OnDownload(UI::EventParams &e);
@ -55,4 +63,5 @@ private:
// UI widgets that need updating
UI::TextView *tvDescription_;
UI::Button *buttonDownload_;
UI::ProgressBar *progress_;
};