Merge pull request #20859 from hrydgard/pin-icon

Replaces '+'/'-' with pin/unpin icons. Thanks Nabn00b.
This commit is contained in:
Henrik Rydgård authored and GitHub committed 2025-10-08 06:51:19 -06:00
commit e53d6e405a
3 files changed
+61 -20

No files matched your search

+17 -8
View File
@@ -78,7 +78,7 @@ bool MainScreen::showHomebrewTab = false;
static void LaunchFile(ScreenManager *screenManager, Screen *currentScreen, const Path &path) {
if (path.GetFileExtension() == ".zip") {
// If it's a zip file, we have a screen for that.
// If is a zip file, we have a screen for that.
screenManager->push(new InstallZipScreen(path));
} else {
if (currentScreen) {
@@ -447,10 +447,15 @@ public:
return absolute_;
}
void SetPinned(bool pin) {
pinned_ = pin;
}
private:
Path path_;
bool gridStyle_;
bool absolute_;
bool pinned_ = false;
};
void DirButton::Draw(UIContext &dc) {
@@ -465,7 +470,7 @@ void DirButton::Draw(UIContext &dc) {
std::string_view text(GetText());
ImageID image = ImageID("I_FOLDER");
ImageID image = ImageID(pinned_ ? "I_FOLDER_PINNED" : "I_FOLDER");
if (text == "..") {
image = ImageID("I_UP_DIRECTORY");
}
@@ -481,7 +486,7 @@ void DirButton::Draw(UIContext &dc) {
if (compact) {
// No icon, except "up"
dc.PushScissor(bounds_);
if (image == ImageID("I_FOLDER")) {
if (image == ImageID("I_FOLDER") || image == ImageID("I_FOLDER_PINNED")) {
dc.DrawText(text, bounds_.x + 5, bounds_.centerY(), style.fgColor, ALIGN_VCENTER);
} else {
dc.Draw()->DrawImage(image, bounds_.centerX(), bounds_.centerY(), gridStyle_ ? g_Config.fGameGridScale : 1.0, style.fgColor, ALIGN_CENTER);
@@ -912,9 +917,12 @@ void GameBrowser::Refresh() {
// Add any pinned paths before other directories.
auto pinnedPaths = GetPinnedPaths();
for (auto it = pinnedPaths.begin(), end = pinnedPaths.end(); it != end; ++it) {
gameList_->Add(new DirButton(*it, GetBaseName((*it).ToString()), *gridStyle_, new UI::LinearLayoutParams(UI::FILL_PARENT, UI::FILL_PARENT)))->
OnClick.Handle(this, &GameBrowser::NavigateClick);
DirButton *pinnedDir = gameList_->Add(new DirButton(*it, GetBaseName((*it).ToString()), *gridStyle_, new UI::LinearLayoutParams(UI::FILL_PARENT, UI::FILL_PARENT)));
pinnedDir->OnClick.Handle(this, &GameBrowser::NavigateClick);
pinnedDir->SetPinned(true);
}
// Add a separator?
}
if (listingPending_) {
@@ -938,12 +946,13 @@ void GameBrowser::Refresh() {
// Show a button to toggle pinning at the very end.
if ((browseFlags_ & BrowseFlags::PIN) && !path_.GetPath().empty()) {
std::string caption = IsCurrentPathPinned() ? "-" : "+";
std::string caption = ""; // IsCurrentPathPinned() ? "-" : "+";
if (!*gridStyle_) {
caption = IsCurrentPathPinned() ? mm->T("UnpinPath", "Unpin") : mm->T("PinPath", "Pin");
}
gameList_->Add(new UI::Button(caption, new UI::LinearLayoutParams(UI::FILL_PARENT, UI::FILL_PARENT)))->
OnClick.Handle(this, &GameBrowser::PinToggleClick);
UI::Button *pinButton = gameList_->Add(new UI::Button(caption, new UI::LinearLayoutParams(UI::FILL_PARENT, UI::FILL_PARENT)));
pinButton->OnClick.Handle(this, &GameBrowser::PinToggleClick);
pinButton->SetImageID(ImageID(IsCurrentPathPinned() ? "I_UNPIN" : "I_PIN"));
}
if (path_.GetPath().empty()) {
+3
View File
@@ -116,6 +116,9 @@ static const std::string imageIDs[] = {
"I_SPEAKER_OFF",
"I_WINNER_CUP",
"I_EMPTY",
"I_PIN",
"I_UNPIN",
"I_FOLDER_PINNED",
};
static std::string PNGNameFromID(std::string_view id) {
+41 -12
View File
@@ -7,7 +7,7 @@
viewBox="0 0 158.75 158.75"
version="1.1"
id="svg1"
inkscape:version="1.4.2 (f4327f4, 2025-05-13)"
inkscape:version="1.4 (86a8ad7, 2024-10-11)"
sodipodi:docname="images.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
@@ -3741,17 +3741,6 @@
d="M -23.732181,30.229779 V 49.775586 H -4.4463411 V 30.229779 Z m 2.49666,2.529991 H -6.9405211 V 47.245604 H -21.235521 Z"
style="fill:#ffffff;fill-opacity:1;stroke:none"
transform="matrix(0.38768981,0,0,0.38768981,58.043664,46.774929)" />
<text
xml:space="preserve"
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:11.28888889px;line-height:0%;font-family:Tahoma;-inkscape-font-specification:'Tahoma, Normal';letter-spacing:0px;word-spacing:0px;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.397773;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal"
x="67.799965"
y="13.749043"
id="text3261"><tspan
sodipodi:role="line"
id="tspan3263"
x="67.799965"
y="13.749043"
style="font-size:11.28888889px;line-height:1.25;stroke-width:0.397773;-inkscape-font-specification:'Tahoma, Normal';font-family:Tahoma;font-weight:normal;font-style:normal;font-stretch:normal;font-variant:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal"> </tspan></text>
<path
style="font-size:11.2889px;line-height:125%;font-family:Tahoma;-inkscape-font-specification:'Tahoma, Normal';letter-spacing:0px;word-spacing:0px;fill:#ffffff;stroke-width:0.397773px"
d="m 64.549735,11.853782 h -4.001822 v -0.837848 h 1.488281 V 5.514806 H 60.547913 V 4.7651532 q 0.843359,0 1.240234,-0.2370226 0.402387,-0.2425347 0.451996,-0.9095052 h 0.854384 v 7.3973086 h 1.455208 z"
@@ -4627,5 +4616,45 @@
id="I_LOGO"
style="font-size:15.328px;font-family:Zrnic;-inkscape-font-specification:'Zrnic, Normal';fill:#ffffff;stroke-width:1.36904"
aria-label="PPSSPP" />
<g
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:none;stroke:#ffffff;stroke-width:1.02393;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
id="I_PIN"
transform="matrix(0.51679723,0,0,0.51679723,120.60057,-50.151167)">
<path
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:none;fill-opacity:0.670213;fill-rule:nonzero;stroke:#ffffff;stroke-width:1.02393;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
d="m 22.77994,139.40953 -2.559837,-2.55984 h 2.559837 l 5.119674,-5.11967 v -2.55984 l 5.119674,5.11968 h -2.559837 l -5.119674,5.11967 v 2.55984 l -2.559837,-2.55984 -5.119674,5.11968 z"
id="path56"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccccccc" />
</g>
<g
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:none;stroke:#ffffff;stroke-width:1.02393;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
id="I_UNPIN"
transform="matrix(0.51679723,0,0,0.51679723,132.35601,-50.151167)">
<path
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:none;fill-opacity:0.670213;fill-rule:nonzero;stroke:#ffffff;stroke-width:1.02393;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
d="m 22.77994,139.40953 -2.559837,-2.55984 h 2.559837 l 5.119674,-5.11967 v -2.55977 l 5.119627,5.11961 h -2.55979 l -5.119674,5.11967 v 2.55984 l -2.559837,-2.55984 -5.119721,5.11975 z"
id="path57"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccccccc" />
<path
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:none;fill-opacity:0.670213;fill-rule:nonzero;stroke:#ffffff;stroke-width:1.02393;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
d="M 33.019241,144.52928 17.660219,129.17025 Z"
id="path58"
inkscape:connector-curvature="0"
sodipodi:nodetypes="ccc" />
</g>
<g id="I_FOLDER_PINNED">
<path
style="baseline-shift:baseline;display:inline;overflow:visible;vector-effect:none;fill:#ffffff;marker:none;enable-background:accumulate;stop-color:#000000"
d="m 85.961696,41.562602 -1.12305,2.205078 v 8.189453 h 11.54883 v -8.34375 l -0.50391,-0.347656 h -4.51757 l -0.83594,-1.703125 z m 0.35742,0.583984 h 3.84766 l 0.83398,1.705078 h 4.70117 l 0.10157,0.06836 v 7.451172 h -10.37891 v -7.466797 z"
id="path59"/>
<path
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:none;fill-opacity:0.670213;fill-rule:nonzero;stroke:#ffffff;stroke-width:0.529164;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
d="m 89.391353,48.970898 -1.32292,-1.322918 h 1.32292 l 2.64583,-2.645832 V 43.67923 l 2.64584,2.645837 h -1.32292 l -2.64583,2.645831 v 1.322918 l -1.32292,-1.322918 -2.64583,2.645836 z"
id="path60"
inkscape:connector-curvature="0"
sodipodi:nodetypes="cccccccccccc" />
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 176 KiB

After

Width:  |  Height:  |  Size: 178 KiB