-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to download beatmaps from context menu of beatmap cards #31468
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using osu.Framework.Allocation; | ||
using osu.Framework.Bindables; | ||
using osu.Framework.Graphics; | ||
|
@@ -24,6 +25,8 @@ public abstract partial class BeatmapCard : OsuClickableContainer, IHasContextMe | |
|
||
protected const float WIDTH = 345; | ||
|
||
public CollapsibleButtonContainer ButtonContainer { get; set; } = null!; | ||
|
||
public IBindable<bool> Expanded { get; } | ||
|
||
public readonly APIBeatmapSet BeatmapSet; | ||
|
@@ -103,9 +106,19 @@ public static BeatmapCard Create(APIBeatmapSet beatmapSet, BeatmapCardSize size, | |
} | ||
} | ||
|
||
public MenuItem[] ContextMenuItems => new MenuItem[] | ||
public MenuItem[] ContextMenuItems | ||
{ | ||
new OsuMenuItem(ContextMenuStrings.ViewBeatmap, MenuItemType.Highlighted, Action), | ||
}; | ||
get | ||
{ | ||
var menuItems = new List<MenuItem>(); | ||
|
||
if (ButtonContainer.DownloadButton.Enabled.Value) | ||
menuItems.Add(new OsuMenuItem(ContextMenuStrings.DownloadBeatmap, MenuItemType.Highlighted, () => ButtonContainer.DownloadButton.TriggerClick())); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Never said this question, but what makes menu items highlighted? Relevant search: https://github.com/search?q=repo%3Appy%2Fosu%20MenuItemType.Highlighted&type=code I thought the highlighting was to indicate the left-click behavior, but this makes it more inconsistent right now. The "play" button on beatmap panels in song select was a precedent to these "view" items that I made. Other menus that don't show the left-click menu item highlight something else. |
||
|
||
menuItems.Add(new OsuMenuItem(ContextMenuStrings.ViewBeatmap, MenuItemType.Standard, Action)); | ||
|
||
return menuItems.ToArray(); | ||
} | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really really dislike this. This is how multiplayer ended up in the place it currently is, where random things are exposed for the purpose of inheriting screens setting them that eventually goes completely out of control.
Let's not make the same mistake again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it's not 100% optimal, but also can't read your mind 😅.
I also tried an
Action RequestDownload
kinda flow but it felt way too verbose for what this is. Would that work better?What's your preference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@smoogipoo prod on this one, need some direction before attempting something else that doesn't work for you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I thought your reply was in response to the comment below.
Here's two suggestions:
ContextMenuItems
virtual and duplicate the implementation.DownloadButton? GetDownloadButton()
and implement in every place.