mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-26 23:10:38 +00:00
Refresh buttons after installing homebrew.
This commit is contained in:
parent
40dcd585a0
commit
adb2ebe87f
@ -41,7 +41,10 @@ public:
|
||||
|
||||
// Returns false if no install is in progress.
|
||||
bool IsInstallInProgress() const {
|
||||
return installInProgress_;
|
||||
return installInProgress_ || IsDownloadInProgress();
|
||||
}
|
||||
bool IsDownloadInProgress() const {
|
||||
return curDownload_.get() != nullptr;
|
||||
}
|
||||
float GetCurrentInstallProgress() const {
|
||||
return installProgress_;
|
||||
|
18
UI/Store.cpp
18
UI/Store.cpp
@ -187,7 +187,8 @@ void ProductItemView::Update(const InputState &input_state) {
|
||||
// This is a "details" view of a game. Lets you install it.
|
||||
class ProductView : public UI::LinearLayout {
|
||||
public:
|
||||
ProductView(const StoreEntry &entry) : LinearLayout(UI::ORIENT_VERTICAL), entry_(entry), installButton_(0) {
|
||||
ProductView(const StoreEntry &entry)
|
||||
: LinearLayout(UI::ORIENT_VERTICAL), entry_(entry), installButton_(0), wasInstalled_(false) {
|
||||
CreateViews();
|
||||
}
|
||||
|
||||
@ -198,8 +199,13 @@ private:
|
||||
UI::EventReturn OnInstall(UI::EventParams &e);
|
||||
UI::EventReturn OnUninstall(UI::EventParams &e);
|
||||
|
||||
bool IsGameInstalled() {
|
||||
return g_GameManager.IsGameInstalled(entry_.file);
|
||||
}
|
||||
|
||||
StoreEntry entry_;
|
||||
UI::Button *installButton_;
|
||||
bool wasInstalled_;
|
||||
};
|
||||
|
||||
void ProductView::CreateViews() {
|
||||
@ -213,10 +219,12 @@ void ProductView::CreateViews() {
|
||||
Add(new TextView(entry_.author));
|
||||
|
||||
I18NCategory *st = GetI18NCategory("Store");
|
||||
if (!g_GameManager.IsGameInstalled(entry_.file)) {
|
||||
wasInstalled_ = IsGameInstalled();
|
||||
if (!wasInstalled_) {
|
||||
installButton_ = Add(new Button(st->T("Install")));
|
||||
installButton_->OnClick.Handle(this, &ProductView::OnInstall);
|
||||
} else {
|
||||
installButton_ = nullptr;
|
||||
Add(new TextView(st->T("Already Installed")));
|
||||
Add(new Button(st->T("Uninstall")))->OnClick.Handle(this, &ProductView::OnUninstall);
|
||||
}
|
||||
@ -232,6 +240,12 @@ void ProductView::CreateViews() {
|
||||
}
|
||||
|
||||
void ProductView::Update(const InputState &input_state) {
|
||||
if (wasInstalled_ != IsGameInstalled()) {
|
||||
CreateViews();
|
||||
}
|
||||
if (installButton_) {
|
||||
installButton_->SetEnabled(!g_GameManager.IsInstallInProgress());
|
||||
}
|
||||
View::Update(input_state);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user