Skip to content

Commit 8200bc1

Browse files
committed
Update refresh plugins button to use ShapeButton
1 parent 9e835a8 commit 8200bc1

2 files changed

Lines changed: 31 additions & 18 deletions

File tree

Source/UI/PluginInstaller.cpp

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,8 @@ class PluginIconButton : public Button
615615
const auto enabled = isEnabled();
616616

617617
auto background = findColour (ThemeColours::widgetBackground);
618-
auto outline = findColour (ThemeColours::outline).withAlpha (enabled ? 0.9f : 0.4f);
618+
auto outline = hasKeyboardFocus (false) ? findColour (ThemeColours::highlightedFill) : findColour (ThemeColours::outline);
619+
outline = outline.withAlpha (enabled ? 0.9f : 0.4f);
619620
auto iconColour = Colours::dodgerblue;
620621

621622
if (icon == IconType::install)
@@ -771,9 +772,17 @@ PluginInstallerComponent::PluginInstallerComponent()
771772
installedButton.setRadioGroupId (101, dontSendNotification);
772773
installedButton.addListener (this);
773774

774-
addAndMakeVisible (updatesButton);
775-
updatesButton.setButtonText ("Refresh Plugins");
776-
updatesButton.addListener (this);
775+
updatesButton = std::make_unique<ShapeButton> ("Refresh Plugins",
776+
Colours::transparentBlack,
777+
Colours::transparentBlack,
778+
Colours::transparentBlack);
779+
String reloadIconPath = "M19.933 13.041a8 8 0 1 1 -9.925 -8.788c3.899 -1 7.935 1.007 9.425 4.747 M20 4v5h-5";
780+
updatesButton->setShape (Drawable::parseSVGPath (reloadIconPath).createPathWithRoundedCorners(2.0f), true, true, false);
781+
updatesButton->setOutline (findColour (ThemeColours::defaultText), 2.0f);
782+
updatesButton->setMouseCursor (MouseCursor::PointingHandCursor);
783+
updatesButton->setTooltip ("Refresh Plugins");
784+
updatesButton->addListener (this);
785+
addAndMakeVisible (updatesButton.get());
777786

778787
addAndMakeVisible (typeLabel);
779788
typeLabel.setFont (font);
@@ -825,14 +834,14 @@ void PluginInstallerComponent::resized()
825834
sinkType.setBounds (785, 10, 65, 28);
826835
otherType.setBounds (855, 10, 75, 28);
827836

828-
updatesButton.setBounds (getWidth() - 155, 10, 135, 28);
837+
updatesButton->setBounds (getWidth() - 44, 10, 20, 20);
829838

830839
pluginListAndInfo.setBounds (10, 64, getWidth() - 20, getHeight() - 94);
831840
}
832841

833842
void PluginInstallerComponent::buttonClicked (Button* button)
834843
{
835-
if (button == &updatesButton)
844+
if (button == updatesButton.get())
836845
{
837846
MouseCursor::showWaitCursor();
838847
pluginListAndInfo.refreshCatalog();
@@ -842,6 +851,11 @@ void PluginInstallerComponent::buttonClicked (Button* button)
842851
applyTableFilters();
843852
}
844853

854+
void PluginInstallerComponent::colourChanged()
855+
{
856+
updatesButton->setOutline (findColour (ThemeColours::defaultText), 2.0f);
857+
}
858+
845859
void PluginInstallerComponent::applyTableFilters()
846860
{
847861
pluginListAndInfo.setSearchText (searchEditor.getText());
@@ -863,24 +877,24 @@ PluginListBoxComponent::PluginListBoxComponent()
863877
pluginTable.setModel (this);
864878
pluginTable.setRowHeight (38);
865879
pluginTable.setHeaderHeight (30);
866-
pluginTable.setMultipleSelectionEnabled (false);
867-
pluginTable.getViewport()->setScrollBarThickness (10);
880+
pluginTable.getViewport()->setScrollBarThickness (12);
881+
pluginTable.grabKeyboardFocus();
868882

869883
auto& header = pluginTable.getHeader();
870884
constexpr int sortableColumnFlags = TableHeaderComponent::visible | TableHeaderComponent::resizable | TableHeaderComponent::sortable;
871885
constexpr int regularColumnFlags = TableHeaderComponent::visible | TableHeaderComponent::resizable;
872886

873887
header.addColumn ("Plugin", displayNameColumn, 180, 120, -1, sortableColumnFlags);
874-
header.addColumn ("Type", typeColumn, 95, 75, 160, regularColumnFlags);
888+
header.addColumn ("Type", typeColumn, 90, 90, 90, TableHeaderComponent::visible);
875889
header.addColumn ("Developers", developersColumn, 150, 100, 280, regularColumnFlags);
876-
header.addColumn ("Installed", installedVersionColumn, 100, 100, 100, TableHeaderComponent::visible);
890+
header.addColumn ("Installed", installedVersionColumn, 80, 80, 80, TableHeaderComponent::visible);
877891
header.addColumn ("Updated", updatedColumn, 90, 90, 90, TableHeaderComponent::visible);
878892
header.addColumn ("Description", descriptionColumn, 250, 180, 420, regularColumnFlags);
879893
header.addColumn ("Dependencies", dependenciesColumn, 120, 120, 120, TableHeaderComponent::appearsOnColumnMenu);
880-
header.addColumn ("Version", versionSelectorColumn, 130, 130, 220, regularColumnFlags);
881-
header.addColumn ("Docs", documentationColumn, 70, 70, 70, TableHeaderComponent::visible);
882-
header.addColumn ("Install", installColumn, 70, 70, 70, TableHeaderComponent::visible);
883-
header.addColumn ("Remove", uninstallColumn, 70, 70, 70, TableHeaderComponent::visible);
894+
header.addColumn ("Version", versionSelectorColumn, 120, 120, 220, regularColumnFlags);
895+
header.addColumn ("Docs", documentationColumn, 60, 60, 60, TableHeaderComponent::visible);
896+
header.addColumn ("Install", installColumn, 60, 60, 60, TableHeaderComponent::visible);
897+
header.addColumn ("Remove", uninstallColumn, 60, 60, 60, TableHeaderComponent::visible);
884898
header.setSortColumnId (displayNameColumn, true);
885899

886900
tableDropShadower.setOwner (&pluginTable);
@@ -904,9 +918,6 @@ void PluginListBoxComponent::paintRowBackground (Graphics& g, int rowNumber, int
904918
? findColour (ThemeColours::componentBackground)
905919
: findColour (ThemeColours::componentBackground).darker (0.12f);
906920

907-
if (rowIsSelected)
908-
background = findColour (ThemeColours::defaultFill).withAlpha (0.2f);
909-
910921
g.fillAll (background);
911922

912923
if (pluginInfo->hasUpdate)

Source/UI/PluginInstaller.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,8 @@ class PluginInstallerComponent : public Component,
255255

256256
void buttonClicked (Button* button) override;
257257

258+
void colourChanged() override;
259+
258260
private:
259261
PluginListBoxComponent pluginListAndInfo;
260262

@@ -263,7 +265,7 @@ class PluginInstallerComponent : public Component,
263265

264266
Label viewLabel;
265267
ToggleButton allButton, installedButton;
266-
TextButton updatesButton;
268+
std::unique_ptr<ShapeButton> updatesButton;
267269

268270
Label typeLabel;
269271
ToggleButton filterType, sourceType, sinkType, otherType;

0 commit comments

Comments
 (0)