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_) {
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;
h += pad_ * 2.0f;
if (bullet_) {
@ -1074,7 +1080,13 @@ void TextView::Draw(UIContext &dc) {
style.background.color &= 0x7fffffff;
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_;
@ -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(pad_, pad_), textColor, textAlign_);
if (small_) {
if (small_ || big_) {
// If we changed font style, reset it.
dc.SetFontStyle(dc.theme->uiFont);
}

View File

@ -93,7 +93,7 @@ struct FontStyle {
struct Theme {
FontStyle uiFont;
FontStyle uiFontSmall;
FontStyle uiFontSmaller;
FontStyle uiFontBig;
ImageID checkOn;
ImageID checkOff;
@ -982,10 +982,10 @@ private:
class TextView : public InertView {
public:
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)
: 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 Draw(UIContext &dc) override;
@ -994,6 +994,7 @@ public:
const std::string &GetText() const { return text_; }
std::string DescribeText() const override { return GetText(); }
void SetSmall(bool small) { small_ = small; }
void SetBig(bool big) { big_ = big; }
void SetTextColor(uint32_t color) { textColor_ = color; hasTextColor_ = true; }
void SetShadow(bool shadow) { shadow_ = shadow; }
void SetFocusable(bool focusable) { focusable_ = focusable; }
@ -1009,9 +1010,10 @@ private:
uint32_t textColor_;
bool hasTextColor_ = false;
bool small_;
bool shadow_;
bool focusable_;
bool clip_;
bool big_ = false;
bool shadow_ = false;
bool focusable_ = false;
bool clip_ = true;
bool bullet_ = false;
float pad_ = 0.0f;
};

View File

@ -288,7 +288,7 @@ void ProductView::CreateViews() {
if (!entry_.iconURL.empty()) {
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));
auto st = GetI18NCategory(I18NCat::STORE);
@ -313,7 +313,7 @@ void ProductView::CreateViews() {
g_GameManager.UninstallGameOnThread(entry_.file);
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")));
@ -334,8 +334,8 @@ void ProductView::CreateViews() {
if (!entry_.license.empty()) {
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 Button(di->T("More information...")))->OnClick.Add([this](UI::EventParams) {
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..."), 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());
System_LaunchUrl(LaunchUrlType::BROWSER_URL, url.c_str());
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)
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.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
ui_theme.uiFont = UI::FontStyle(FontID("UBUNTU24"), "", 20);
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
ui_theme.checkOn = ImageID("I_CHECKEDBOX");

View File

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