mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-11 01:25:07 +02:00
Convert more screens to SimpleDialogScreen
This commit is contained in:
+5
-2
@@ -37,7 +37,7 @@ CopyableText::CopyableText(ImageID imageID, std::string_view text, UI::LinearLay
|
||||
});
|
||||
}
|
||||
|
||||
TopBar::TopBar(std::string_view title, UI::LayoutParams *layoutParams) : UI::LinearLayout(ORIENT_HORIZONTAL, layoutParams) {
|
||||
TopBar::TopBar(const UIContext &ctx, std::string_view title, UI::LayoutParams *layoutParams) : UI::LinearLayout(ORIENT_HORIZONTAL, layoutParams) {
|
||||
using namespace UI;
|
||||
SetSpacing(10.0f);
|
||||
if (!layoutParams) {
|
||||
@@ -51,11 +51,14 @@ TopBar::TopBar(std::string_view title, UI::LayoutParams *layoutParams) : UI::Lin
|
||||
});
|
||||
|
||||
if (!title.empty()) {
|
||||
Add(new TextView(title, ALIGN_CENTER | FLAG_WRAP_TEXT, false, new LinearLayoutParams(1.0f, G_VCENTER)));
|
||||
TextView *titleView = Add(new TextView(title, ALIGN_CENTER | FLAG_WRAP_TEXT, false, new LinearLayoutParams(1.0f, G_VCENTER)));
|
||||
titleView->SetTextColor(ctx.GetTheme().itemDownStyle.fgColor);
|
||||
// To balance the centering, add a spacer on the right.
|
||||
Add(new Spacer(50.0f));
|
||||
}
|
||||
SetBG(ctx.GetTheme().itemDownStyle.background);
|
||||
}
|
||||
|
||||
SettingInfoMessage::SettingInfoMessage(int align, float cutOffY, UI::AnchorLayoutParams *lp)
|
||||
: UI::LinearLayout(ORIENT_HORIZONTAL, lp), cutOffY_(cutOffY) {
|
||||
using namespace UI;
|
||||
|
||||
+2
-1
@@ -17,7 +17,8 @@ public:
|
||||
|
||||
class TopBar : public UI::LinearLayout {
|
||||
public:
|
||||
TopBar(std::string_view title, UI::LayoutParams *layoutParams = nullptr);
|
||||
// The context is needed to get the theme for the background.
|
||||
TopBar(const UIContext &ctx, std::string_view title, UI::LayoutParams *layoutParams = nullptr);
|
||||
UI::View *GetBackButton() const { return backButton_; }
|
||||
private:
|
||||
UI::Choice *backButton_ = nullptr;
|
||||
|
||||
@@ -11,7 +11,7 @@ void UISimpleBaseDialogScreen::CreateViews() {
|
||||
const bool portrait = UsePortraitLayout();
|
||||
|
||||
root_ = new LinearLayout(ORIENT_VERTICAL, new LayoutParams(FILL_PARENT, FILL_PARENT));
|
||||
root_->Add(new TopBar(GetTitle()));
|
||||
root_->Add(new TopBar(*screenManager()->getUIContext(), GetTitle()));
|
||||
|
||||
if (canScroll) {
|
||||
ScrollView *scroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, FILL_PARENT, 1.0f));
|
||||
|
||||
+7
-13
@@ -506,21 +506,15 @@ void StoreScreen::ParseListing(const std::string &json) {
|
||||
}
|
||||
}
|
||||
|
||||
void StoreScreen::CreateViews() {
|
||||
std::string_view StoreScreen::GetTitle() const {
|
||||
auto mm = GetI18NCategory(I18NCat::MAINMENU);
|
||||
return mm->T("PPSSPP Homebrew Store");
|
||||
}
|
||||
|
||||
void StoreScreen::CreateDialogViews(UI::ViewGroup *parent) {
|
||||
using namespace UI;
|
||||
|
||||
root_ = new LinearLayout(ORIENT_VERTICAL);
|
||||
|
||||
auto di = GetI18NCategory(I18NCat::DIALOG);
|
||||
auto mm = GetI18NCategory(I18NCat::MAINMENU);
|
||||
|
||||
// Top bar
|
||||
LinearLayout *topBar = root_->Add(new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(FILL_PARENT, 64.0f)));
|
||||
topBar->Add(new Choice(ImageID("I_NAVIGATE_BACK"), new LinearLayoutParams(WRAP_CONTENT, FILL_PARENT)))->OnClick.Handle<UIScreen>(this, &UIScreen::OnBack);
|
||||
titleText_ = new TextView(mm->T("PPSSPP Homebrew Store"), ALIGN_VCENTER, false, new LinearLayoutParams(WRAP_CONTENT, FILL_PARENT));
|
||||
titleText_->SetTextColor(screenManager()->getUIContext()->GetTheme().itemDownStyle.fgColor);
|
||||
topBar->Add(titleText_);
|
||||
topBar->SetBG(screenManager()->getUIContext()->GetTheme().itemDownStyle.background);
|
||||
|
||||
LinearLayout *content;
|
||||
if (connectionError_ || loading_) {
|
||||
@@ -561,7 +555,7 @@ void StoreScreen::CreateViews() {
|
||||
lastSelectedName_.clear();
|
||||
}
|
||||
}
|
||||
root_->Add(content);
|
||||
parent->Add(content);
|
||||
}
|
||||
|
||||
ProductItemView *StoreScreen::GetSelectedItem() {
|
||||
|
||||
+5
-2
@@ -24,6 +24,7 @@
|
||||
#include "Common/Net/HTTPClient.h"
|
||||
|
||||
#include "UI/BaseScreens.h"
|
||||
#include "UI/SimpleDialogScreen.h"
|
||||
|
||||
// Game screen: Allows you to start a game, delete saves, delete the game,
|
||||
// set game specific settings, etc.
|
||||
@@ -60,7 +61,7 @@ struct StoreEntry {
|
||||
u64 size;
|
||||
};
|
||||
|
||||
class StoreScreen : public UIBaseDialogScreen {
|
||||
class StoreScreen : public UISimpleBaseDialogScreen {
|
||||
public:
|
||||
StoreScreen();
|
||||
~StoreScreen();
|
||||
@@ -69,11 +70,13 @@ public:
|
||||
const char *tag() const override { return "Store"; }
|
||||
|
||||
protected:
|
||||
void CreateViews() override;
|
||||
void CreateDialogViews(UI::ViewGroup *parent) override;
|
||||
void OnGameSelected(UI::EventParams &e);
|
||||
void OnRetry(UI::EventParams &e);
|
||||
void OnGameLaunch(UI::EventParams &e);
|
||||
|
||||
std::string_view GetTitle() const override;
|
||||
bool CanScroll() const override { return false; } // does its own scrolling
|
||||
private:
|
||||
void ParseListing(const std::string &json);
|
||||
ProductItemView *GetSelectedItem();
|
||||
|
||||
@@ -89,7 +89,7 @@
|
||||
<ClCompile Include="TabbedDialogScreen.cpp">
|
||||
<Filter>Screens</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SimpleDialogScreen.cpp">
|
||||
<ClCompile Include="SimpleDialogScreen.cpp">
|
||||
<Filter>Screens</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="RetroAchievementScreens.cpp">
|
||||
|
||||
+2
-5
@@ -26,15 +26,12 @@ UploadScreen::~UploadScreen() {
|
||||
StopWebServer(WebServerFlags::FILE_UPLOAD);
|
||||
}
|
||||
|
||||
void UploadScreen::CreateViews() {
|
||||
void UploadScreen::CreateDialogViews(UI::ViewGroup *root) {
|
||||
using namespace UI;
|
||||
auto n = GetI18NCategory(I18NCat::NETWORKING);
|
||||
root_ = new LinearLayout(ORIENT_VERTICAL);
|
||||
|
||||
root_->Add(new TopBar(""));
|
||||
|
||||
LinearLayout *container = new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(500, FILL_PARENT, 0.0f, UI::Gravity::G_HCENTER, Margins(10)));
|
||||
root_->Add(container);
|
||||
root->Add(container);
|
||||
|
||||
container->Add(new TextWithImage(ImageID("I_FOLDER_UPLOAD"), targetFolder_.ToVisualString()));
|
||||
container->Add(new Spacer(20.0f));
|
||||
|
||||
+3
-2
@@ -26,16 +26,17 @@
|
||||
#include "Common/UI/UIScreen.h"
|
||||
#include "Common/UI/ViewGroup.h"
|
||||
#include "UI/BaseScreens.h"
|
||||
#include "UI/SimpleDialogScreen.h"
|
||||
#include "Common/TimeUtil.h"
|
||||
|
||||
// Upload screen: Shows the user an ip address to go to in a web browser on the same network,
|
||||
// in order to upload game files to the current directory.
|
||||
|
||||
class UploadScreen : public UIBaseDialogScreen {
|
||||
class UploadScreen : public UISimpleBaseDialogScreen {
|
||||
public:
|
||||
UploadScreen(const Path &targetFolder);
|
||||
~UploadScreen();
|
||||
void CreateViews() override;
|
||||
void CreateDialogViews(UI::ViewGroup *parent) override;
|
||||
|
||||
protected:
|
||||
void update() override;
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
<ClCompile Include="..\..\UI\TabbedDialogScreen.cpp">
|
||||
<Filter>Screens</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\UI\SimpleDialogScreen.cpp">
|
||||
<ClCompile Include="..\..\UI\SimpleDialogScreen.cpp">
|
||||
<Filter>Screens</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\UI\TiltAnalogSettingsScreen.cpp">
|
||||
|
||||
Reference in New Issue
Block a user