Skip to content

Commit

Permalink
Show more store item information
Browse files Browse the repository at this point in the history
timothyschoen committed Dec 3, 2024

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent bd47f8b commit a9c01dc
Showing 3 changed files with 39 additions and 1 deletion.
Binary file modified Resources/Fonts/IconFont.ttf
Binary file not shown.
3 changes: 3 additions & 0 deletions Source/Constants.h
Original file line number Diff line number Diff line change
@@ -104,6 +104,9 @@ struct Icons {
inline static String const Duplicate = "2";
inline static String const Cut = "3";

inline static String const Storage = CharPointer_UTF8 ("\xc3\x90");
inline static String const Money = CharPointer_UTF8 ("\xc3\x91");
inline static String const Time = CharPointer_UTF8 ("\xc3\x92");
inline static String const Store = CharPointer_UTF8 ("\xc3\x8f");
inline static String const PanelExpand = CharPointer_UTF8("\xc3\x8d");
inline static String const PanelContract = CharPointer_UTF8("\xc3\x8c");
37 changes: 36 additions & 1 deletion Source/Dialogs/PatchStore.h
Original file line number Diff line number Diff line change
@@ -234,6 +234,7 @@ class PatchInfo {
String description;
String price;
String thumbnailUrl;
String size;

PatchInfo() = default;

@@ -711,6 +712,40 @@ class PatchFullDisplay : public Component, public DownloadPool::DownloadListener

layout.draw(g, contentArea.removeFromTop(30).toFloat());

auto extraInfoBounds = contentArea.removeFromTop(66).reduced(0, 8).translated(0, -4);
Path p;
p.addRoundedRectangle(extraInfoBounds, Corners::largeCornerRadius);
StackShadow::renderDropShadow(hash("patch_extra_info"), g, p, Colour(0, 0, 0).withAlpha(0.1f), 7, { 0, 1 });

g.setColour(findColour(PlugDataColour::panelForegroundColourId));
g.fillPath(p); // Adjust the thickness as needed

g.setColour(findColour(PlugDataColour::outlineColourId));
g.strokePath(p, PathStrokeType(0.5f)); // Adjust the thickness as needed

auto hasSizeInfo = currentPatch.size.isNotEmpty();
int extraInfoItemWidth = getWidth() / (hasSizeInfo ? 3 : 2);
auto drawExtraInfo = [this, extraInfoItemWidth, &extraInfoBounds](Graphics& g, String const& icon, String const& label, String const& value) mutable {
auto infoBounds = extraInfoBounds.removeFromLeft(extraInfoItemWidth).withSizeKeepingCentre(110, 32).translated(-12, 0);

g.setColour(findColour(PlugDataColour::panelTextColourId));
g.setFont(Fonts::getIconFont().withHeight(15));
g.drawText(icon, infoBounds.removeFromLeft(24), Justification::centredLeft);

g.setFont(Fonts::getBoldFont().withHeight(15));
g.drawText(label, infoBounds.removeFromTop(16), Justification::centredLeft);

g.setFont(Fonts::getDefaultFont().withHeight(15));
g.drawText(value, infoBounds, Justification::centredLeft);
};

if(hasSizeInfo)
{
drawExtraInfo(g, Icons::Storage, "Size", currentPatch.size);
}
drawExtraInfo(g, Icons::Money, "Price", currentPatch.price);
drawExtraInfo(g, Icons::Time, "Release date", currentPatch.releaseDate);

auto imageBounds = contentArea.removeFromTop(500).withSizeKeepingCentre(getWidth(), 500);
g.setColour(findColour(PlugDataColour::panelBackgroundColourId));
g.fillRect(imageBounds);
@@ -728,7 +763,7 @@ class PatchFullDisplay : public Component, public DownloadPool::DownloadListener
void resized() override
{
auto b = getLocalBounds().reduced(12);
auto buttonBounds = b.removeFromTop(130).removeFromTop(40).translated(-24, 12);
auto buttonBounds = b.removeFromTop(196).removeFromTop(40).translated(-24, 12);

image.setBounds(b.removeFromTop(500).withSizeKeepingCentre(460, 450));

0 comments on commit a9c01dc

Please sign in to comment.