mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-11-13 09:39:33 +01:00
Prettify some popups.
This commit is contained in:
1 parent
8587463502
commit
1ef159f3e4
4 files changed
+17
-24
No files matched your search
@@ -238,7 +238,6 @@ void PopupScreen::CreateViews() {
|
||||
box_->Add(buttonRow);
|
||||
}
|
||||
|
||||
box_->SetRoundCorners(RoundCorners::All);
|
||||
// Rounds the top of the header and the bottom of the last view, to match the box.
|
||||
box_->SetRoundCorners(RoundCorners::All);
|
||||
}
|
||||
|
||||
@@ -853,6 +853,7 @@ void LinearLayout::Layout() {
|
||||
// Applies rounding to the corners of the child views, based on their position in the layout and the orientation. Masked by the outerCorners.
|
||||
// Ignores invisible views.
|
||||
void LinearLayout::SetRoundCorners(RoundCorners outerCorners) {
|
||||
roundCorners_ = outerCorners;
|
||||
// Easy case first: There's spacing, just apply round corners to all subviews.
|
||||
if (spacing_ > 0.0f) {
|
||||
for (View *view : views_) {
|
||||
|
||||
+16
-22
@@ -217,12 +217,12 @@ private:
|
||||
};
|
||||
|
||||
AdhocServerCompactInfo::AdhocServerCompactInfo(const AdhocServerListEntry &entry, UI::LayoutParams *layoutParams)
|
||||
: UI::LinearLayout(ORIENT_HORIZONTAL, new UI::LinearLayoutParams(UI::FILL_PARENT, UI::WRAP_CONTENT, UI::Margins(5.0f, 0.0f))), entry_(entry) {
|
||||
: UI::LinearLayout(ORIENT_HORIZONTAL, new UI::LinearLayoutParams(UI::FILL_PARENT, UI::WRAP_CONTENT)), entry_(entry) {
|
||||
using namespace UI;
|
||||
|
||||
SetSpacing(5.0f);
|
||||
|
||||
LinearLayout *lines = Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(Margins(5, 5))));
|
||||
LinearLayout *lines = Add(new LinearLayout(ORIENT_VERTICAL));
|
||||
lines->SetSpacing(0.0f);
|
||||
TextView *name = lines->Add(new TextView(entry.name));
|
||||
|
||||
@@ -234,10 +234,10 @@ AdhocServerCompactInfo::AdhocServerCompactInfo(const AdhocServerListEntry &entry
|
||||
|
||||
lines->Add(new TextView(secondLine))->SetTextSize(TextSize::Small)->SetWordWrap();
|
||||
|
||||
Add(new Spacer(0.0f, new LinearLayoutParams(1.0f, Margins(0.0f, 5.0f))));
|
||||
Add(new Spacer(0.0f, new LinearLayoutParams(1.0f)));
|
||||
|
||||
if (entry.mode == AdhocDataMode::AemuPostoffice) {
|
||||
TextView *relay = Add(new TextView(n->T("Relay"), new LinearLayoutParams(WRAP_CONTENT, WRAP_CONTENT, Gravity::G_VCENTER, Margins(10.0))));
|
||||
TextView *relay = Add(new TextView(n->T("Relay"), new LinearLayoutParams(WRAP_CONTENT, WRAP_CONTENT, Gravity::G_VCENTER, Margins(0.0))));
|
||||
}
|
||||
|
||||
Add(new Choice(ImageID("I_FILE_COPY"), new LinearLayoutParams(WRAP_CONTENT, WRAP_CONTENT)))->OnClick.Add([host = entry_.host](UI::EventParams &) {
|
||||
@@ -245,12 +245,6 @@ AdhocServerCompactInfo::AdhocServerCompactInfo(const AdhocServerListEntry &entry
|
||||
});
|
||||
}
|
||||
|
||||
void AdhocServerCompactInfo::Draw(UIContext &dc) {
|
||||
UI::LinearLayout::Draw(dc);
|
||||
// Underline
|
||||
dc.Draw()->DrawImageCenterTexel(dc.GetTheme().whiteImage, bounds_.x, bounds_.y2() - 2, bounds_.x2(), bounds_.y2(), dc.GetTheme().popupTitleStyle.fgColor);
|
||||
}
|
||||
|
||||
static UI::View *CreateInfoItemWithButton(std::string_view text, ImageID buttonImage, std::function<void(UI::EventParams &)> onClick) {
|
||||
using namespace UI;
|
||||
LinearLayout *line = new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, Margins(12, 0)));
|
||||
@@ -372,22 +366,18 @@ void AdhocServerInfoScreen::CreatePopupContents(UI::ViewGroup *parent) {
|
||||
auto di = GetI18NCategory(I18NCat::DIALOG);
|
||||
auto ni = GetI18NCategory(I18NCat::NETWORKING);
|
||||
|
||||
Margins contentMargins(12, 0);
|
||||
|
||||
parent->Add(new AdhocServerCompactInfo(entry_, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, contentMargins)));
|
||||
parent->Add(new Spacer(5.0f));
|
||||
parent->Add(new AdhocServerCompactInfo(entry_, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)));
|
||||
|
||||
ScrollView *scroll = new ScrollView(ORIENT_VERTICAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, 1.0f));
|
||||
LinearLayout *content = new LinearLayout(ORIENT_VERTICAL);
|
||||
content->SetSpacing(6.0f);
|
||||
content->SetSpacing(8.0f);
|
||||
if (!entry_.ip.empty()) {
|
||||
content->Add(new InfoItem(entry_.ip, ""));
|
||||
}
|
||||
TextView *desc = content->Add(new TextView(entry_.description, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, contentMargins)));
|
||||
desc->SetTextSize(TextSize::Small);
|
||||
desc->SetWordWrap();
|
||||
InfoItem *desc = content->Add(new InfoItem(entry_.description, "", new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)));
|
||||
desc->SetRoundCorners();
|
||||
|
||||
LinearLayout *buttonStrip = content->Add(new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT, contentMargins)));
|
||||
LinearLayout *buttonStrip = content->Add(new LinearLayout(ORIENT_HORIZONTAL, new LinearLayoutParams(FILL_PARENT, WRAP_CONTENT)));
|
||||
buttonStrip->SetSpacing(8);
|
||||
if (!entry_.web.empty() || !entry_.discord.empty()) {
|
||||
if (!entry_.web.empty()) {
|
||||
@@ -412,6 +402,8 @@ void AdhocServerInfoScreen::CreatePopupContents(UI::ViewGroup *parent) {
|
||||
CreateAdhocServerGameList(content, games_, statusRequest_.get() ? true : false);
|
||||
}
|
||||
|
||||
buttonStrip->SetRoundCorners();
|
||||
|
||||
scroll->Add(content);
|
||||
parent->Add(scroll);
|
||||
}
|
||||
@@ -500,16 +492,17 @@ private:
|
||||
};
|
||||
|
||||
AdhocServerRow::AdhocServerRow(std::string *editValue, const AdhocServerListEntry &entry, bool showDeleteButton, ScreenManager *screenManager, UI::LayoutParams *layoutParams)
|
||||
: UI::LinearLayout(ORIENT_HORIZONTAL, new UI::LinearLayoutParams(UI::FILL_PARENT, UI::WRAP_CONTENT, UI::Margins(5.0f, 0.0f))), value_(editValue), entry_(entry) {
|
||||
: UI::LinearLayout(ORIENT_HORIZONTAL, new UI::LinearLayoutParams(UI::FILL_PARENT, UI::WRAP_CONTENT)), value_(editValue), entry_(entry) {
|
||||
using namespace UI;
|
||||
|
||||
SetSpacing(5.0f);
|
||||
SetPadding(Margins(10.0f, 2.0f, 0.0f, 2.0f));
|
||||
// Show as radio button to make it really clear that selection actually is the choice.
|
||||
int number = 0;
|
||||
Add(new ImageView([editValue, host = entry.host]() { return host == *editValue ? ImageID("I_RADIO_SELECTED") : ImageID("I_RADIO_EMPTY"); },
|
||||
new LinearLayoutParams(WRAP_CONTENT, WRAP_CONTENT, Gravity::G_VCENTER, Margins(5, 0, 0, 0))));
|
||||
new LinearLayoutParams(WRAP_CONTENT, WRAP_CONTENT, Gravity::G_VCENTER, Margins(0.0f, 0.0f, 6.0f, 0.0f))));
|
||||
|
||||
LinearLayout *lines = Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(Margins(5, 5))));
|
||||
LinearLayout *lines = Add(new LinearLayout(ORIENT_VERTICAL, new LinearLayoutParams(Margins(0.0f, 5))));
|
||||
lines->SetSpacing(0.0f);
|
||||
ClickableTextView *name = lines->Add(new ClickableTextView(entry.name));
|
||||
name->SetFocusable(true);
|
||||
@@ -547,6 +540,7 @@ AdhocServerRow::AdhocServerRow(std::string *editValue, const AdhocServerListEntr
|
||||
e.v = this;
|
||||
screenManager->push(new AdhocServerInfoScreen(copy));
|
||||
});
|
||||
infoButton->SetRoundCorners();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ struct AdhocGame {
|
||||
class AdhocServerCompactInfo : public UI::LinearLayout {
|
||||
public:
|
||||
AdhocServerCompactInfo(const AdhocServerListEntry &entry, UI::LayoutParams *layoutParams = nullptr);
|
||||
void Draw(UIContext &dc) override;
|
||||
void GetContentDimensions(const UIContext &dc, float &w, float &h) const override {
|
||||
w = 500; h = 100;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user