Store: Minor layout fixes, bigger title text

This commit is contained in:
Henrik Rydgård 2024-09-02 17:09:41 +02:00
parent f0c8d078de
commit ba9ee8c42c
5 changed files with 30 additions and 16 deletions

View File

@ -1043,7 +1043,13 @@ void TextView::GetContentDimensionsBySpec(const UIContext &dc, MeasureSpec horiz
if (bullet_) { if (bullet_) {
bounds.w -= bulletOffset; bounds.w -= bulletOffset;
} }
dc.MeasureTextRect(small_ ? dc.theme->uiFontSmall : dc.theme->uiFont, 1.0f, 1.0f, text_, bounds, &w, &h, textAlign_); const FontStyle *style = &dc.theme->uiFont;
if (small_) {
style = &dc.theme->uiFontSmall;
} else if (big_) {
style = &dc.theme->uiFontBig;
}
dc.MeasureTextRect(*style, 1.0f, 1.0f, text_, bounds, &w, &h, textAlign_);
w += pad_ * 2.0f; w += pad_ * 2.0f;
h += pad_ * 2.0f; h += pad_ * 2.0f;
if (bullet_) { if (bullet_) {
@ -1074,7 +1080,13 @@ void TextView::Draw(UIContext &dc) {
style.background.color &= 0x7fffffff; style.background.color &= 0x7fffffff;
dc.FillRect(style.background, bounds_); dc.FillRect(style.background, bounds_);
} }
dc.SetFontStyle(small_ ? dc.theme->uiFontSmall : dc.theme->uiFont); const FontStyle *style = &dc.theme->uiFont;
if (small_) {
style = &dc.theme->uiFontSmall;
} else if (big_) {
style = &dc.theme->uiFontBig;
}
dc.SetFontStyle(*style);
Bounds textBounds = bounds_; Bounds textBounds = bounds_;
@ -1094,7 +1106,7 @@ void TextView::Draw(UIContext &dc) {
dc.DrawTextRect(text_, textBounds.Offset(1.0f + pad_, 1.0f + pad_), shadowColor, textAlign_); dc.DrawTextRect(text_, textBounds.Offset(1.0f + pad_, 1.0f + pad_), shadowColor, textAlign_);
} }
dc.DrawTextRect(text_, textBounds.Offset(pad_, pad_), textColor, textAlign_); dc.DrawTextRect(text_, textBounds.Offset(pad_, pad_), textColor, textAlign_);
if (small_) { if (small_ || big_) {
// If we changed font style, reset it. // If we changed font style, reset it.
dc.SetFontStyle(dc.theme->uiFont); dc.SetFontStyle(dc.theme->uiFont);
} }

View File

@ -93,7 +93,7 @@ struct FontStyle {
struct Theme { struct Theme {
FontStyle uiFont; FontStyle uiFont;
FontStyle uiFontSmall; FontStyle uiFontSmall;
FontStyle uiFontSmaller; FontStyle uiFontBig;
ImageID checkOn; ImageID checkOn;
ImageID checkOff; ImageID checkOff;
@ -982,10 +982,10 @@ private:
class TextView : public InertView { class TextView : public InertView {
public: public:
TextView(std::string_view text, LayoutParams *layoutParams = 0) TextView(std::string_view text, LayoutParams *layoutParams = 0)
: InertView(layoutParams), text_(text), textAlign_(0), textColor_(0xFFFFFFFF), small_(false), shadow_(false), focusable_(false), clip_(true) {} : InertView(layoutParams), text_(text), textAlign_(0), textColor_(0xFFFFFFFF), small_(false) {}
TextView(std::string_view text, int textAlign, bool small, LayoutParams *layoutParams = 0) TextView(std::string_view text, int textAlign, bool small, LayoutParams *layoutParams = 0)
: InertView(layoutParams), text_(text), textAlign_(textAlign), textColor_(0xFFFFFFFF), small_(small), shadow_(false), focusable_(false), clip_(true) {} : InertView(layoutParams), text_(text), textAlign_(textAlign), textColor_(0xFFFFFFFF), small_(small) {}
void GetContentDimensionsBySpec(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert, float &w, float &h) const override; void GetContentDimensionsBySpec(const UIContext &dc, MeasureSpec horiz, MeasureSpec vert, float &w, float &h) const override;
void Draw(UIContext &dc) override; void Draw(UIContext &dc) override;
@ -994,6 +994,7 @@ public:
const std::string &GetText() const { return text_; } const std::string &GetText() const { return text_; }
std::string DescribeText() const override { return GetText(); } std::string DescribeText() const override { return GetText(); }
void SetSmall(bool small) { small_ = small; } void SetSmall(bool small) { small_ = small; }
void SetBig(bool big) { big_ = big; }
void SetTextColor(uint32_t color) { textColor_ = color; hasTextColor_ = true; } void SetTextColor(uint32_t color) { textColor_ = color; hasTextColor_ = true; }
void SetShadow(bool shadow) { shadow_ = shadow; } void SetShadow(bool shadow) { shadow_ = shadow; }
void SetFocusable(bool focusable) { focusable_ = focusable; } void SetFocusable(bool focusable) { focusable_ = focusable; }
@ -1009,9 +1010,10 @@ private:
uint32_t textColor_; uint32_t textColor_;
bool hasTextColor_ = false; bool hasTextColor_ = false;
bool small_; bool small_;
bool shadow_; bool big_ = false;
bool focusable_; bool shadow_ = false;
bool clip_; bool focusable_ = false;
bool clip_ = true;
bool bullet_ = false; bool bullet_ = false;
float pad_ = 0.0f; float pad_ = 0.0f;
}; };

View File

@ -288,7 +288,7 @@ void ProductView::CreateViews() {
if (!entry_.iconURL.empty()) { if (!entry_.iconURL.empty()) {
Add(new HttpImageFileView(&g_DownloadManager, ResolveUrl(StoreBaseUrl(), entry_.iconURL), IS_FIXED))->SetFixedSize(144, 88); Add(new HttpImageFileView(&g_DownloadManager, ResolveUrl(StoreBaseUrl(), entry_.iconURL), IS_FIXED))->SetFixedSize(144, 88);
} }
Add(new TextView(entry_.name)); Add(new TextView(entry_.name))->SetBig(true);
Add(new TextView(entry_.author)); Add(new TextView(entry_.author));
auto st = GetI18NCategory(I18NCat::STORE); auto st = GetI18NCategory(I18NCat::STORE);
@ -313,7 +313,7 @@ void ProductView::CreateViews() {
g_GameManager.UninstallGameOnThread(entry_.file); g_GameManager.UninstallGameOnThread(entry_.file);
return UI::EVENT_DONE; return UI::EVENT_DONE;
}); });
Add(new TextView(st->T("Installed"))); // Add(new TextView(st->T("Installed"))); // Not really needed
} }
cancelButton_ = Add(new Button(di->T("Cancel"))); cancelButton_ = Add(new Button(di->T("Cancel")));
@ -334,8 +334,8 @@ void ProductView::CreateViews() {
if (!entry_.license.empty()) { if (!entry_.license.empty()) {
LinearLayout *horiz = Add(new LinearLayout(ORIENT_HORIZONTAL)); LinearLayout *horiz = Add(new LinearLayout(ORIENT_HORIZONTAL));
horiz->Add(new TextView(StringFromFormat("%s: %s", st->T_cstr("License"), entry_.license.c_str()))); horiz->Add(new TextView(StringFromFormat("%s: %s", st->T_cstr("License"), entry_.license.c_str()), new LinearLayoutParams(0.0, G_VCENTER)));
horiz->Add(new Button(di->T("More information...")))->OnClick.Add([this](UI::EventParams) { horiz->Add(new Button(di->T("More information..."), new LinearLayoutParams(0.0, G_VCENTER)))->OnClick.Add([this](UI::EventParams) {
std::string url = StringFromFormat("https://www.ppsspp.org/docs/reference/homebrew-store-distribution/#%s", entry_.file.c_str()); std::string url = StringFromFormat("https://www.ppsspp.org/docs/reference/homebrew-store-distribution/#%s", entry_.file.c_str());
System_LaunchUrl(LaunchUrlType::BROWSER_URL, url.c_str()); System_LaunchUrl(LaunchUrlType::BROWSER_URL, url.c_str());
return UI::EVENT_DONE; return UI::EVENT_DONE;

View File

@ -197,11 +197,11 @@ void UpdateTheme(UIContext *ctx) {
#if defined(USING_WIN_UI) || PPSSPP_PLATFORM(UWP) || defined(USING_QT_UI) #if defined(USING_WIN_UI) || PPSSPP_PLATFORM(UWP) || defined(USING_QT_UI)
ui_theme.uiFont = UI::FontStyle(FontID("UBUNTU24"), g_Config.sFont.c_str(), 22); ui_theme.uiFont = UI::FontStyle(FontID("UBUNTU24"), g_Config.sFont.c_str(), 22);
ui_theme.uiFontSmall = UI::FontStyle(FontID("UBUNTU24"), g_Config.sFont.c_str(), 17); ui_theme.uiFontSmall = UI::FontStyle(FontID("UBUNTU24"), g_Config.sFont.c_str(), 17);
ui_theme.uiFontSmaller = UI::FontStyle(FontID("UBUNTU24"), g_Config.sFont.c_str(), 13); ui_theme.uiFontBig = UI::FontStyle(FontID("UBUNTU24"), g_Config.sFont.c_str(), 28);
#else #else
ui_theme.uiFont = UI::FontStyle(FontID("UBUNTU24"), "", 20); ui_theme.uiFont = UI::FontStyle(FontID("UBUNTU24"), "", 20);
ui_theme.uiFontSmall = UI::FontStyle(FontID("UBUNTU24"), "", 15); ui_theme.uiFontSmall = UI::FontStyle(FontID("UBUNTU24"), "", 15);
ui_theme.uiFontSmaller = UI::FontStyle(FontID("UBUNTU24"), "", 12); ui_theme.uiFontBig = UI::FontStyle(FontID("UBUNTU24"), "", 26);
#endif #endif
ui_theme.checkOn = ImageID("I_CHECKEDBOX"); ui_theme.checkOn = ImageID("I_CHECKEDBOX");

View File

@ -1168,7 +1168,7 @@ Connection Error = 网络错误
Install = 安装 Install = 安装
Installed = 已安装 Installed = 已安装
Launch Game = 开始游戏 Launch Game = 开始游戏
License = License License = 软件许可证
Loading... = 载入中… Loading... = 载入中…
MB = MB MB = MB
Size = 大小 Size = 大小