Skip to content

Commit 5ce28a5

Browse files
committed
Improve table layout in Plugin Installer
* Increase row height and font size * Enable multi-line text for Developer and Description fields
1 parent 7f3fc7e commit 5ce28a5

2 files changed

Lines changed: 39 additions & 20 deletions

File tree

Source/UI/PluginInstaller.cpp

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ PluginInstaller::PluginInstaller (bool loadComponents)
280280

281281
if (loadComponents)
282282
{
283-
setSize (1140, 640);
283+
setSize (1180, 640);
284284

285285
if (auto window = getActiveTopLevelWindow())
286286
setCentrePosition (window->getScreenBounds().getCentre());
@@ -293,7 +293,7 @@ PluginInstaller::PluginInstaller (bool loadComponents)
293293
setContentOwned (new PluginInstallerComponent(), false);
294294
setVisible (true);
295295
setResizable (true, false); // useBottomCornerRisizer -- doesn't work very well
296-
setResizeLimits (1140, 640, 8192, 5120);
296+
setResizeLimits (1180, 640, 8192, 5120);
297297

298298
#ifdef __APPLE__
299299
File iconDir = File::getSpecialLocation (File::currentApplicationFile).getChildFile ("Contents/Resources");
@@ -749,7 +749,6 @@ class PluginNameCell : public Component
749749
}
750750

751751
private:
752-
753752
HyperlinkButton linkButton;
754753
String displayName;
755754
Font plainFont;
@@ -800,7 +799,7 @@ class PluginVersionCell : public Component
800799

801800
void resized() override
802801
{
803-
versionMenu.setBounds (getLocalBounds().reduced (2, 6));
802+
versionMenu.setBounds (getLocalBounds().reduced (2, 20));
804803
}
805804

806805
private:
@@ -871,7 +870,7 @@ class PluginIconButtonCell : public Component
871870

872871
void resized() override
873872
{
874-
button.setBounds (getLocalBounds().reduced (2, 4));
873+
button.setBounds (getLocalBounds().reduced (2, 18));
875874
}
876875

877876
private:
@@ -1043,13 +1042,13 @@ void PluginInstallerComponent::applyTableFilters()
10431042

10441043
PluginListBoxComponent::PluginListBoxComponent()
10451044
{
1046-
tableFont = FontOptions ("Inter", "Regular", 14.0f);
1047-
headerFont = FontOptions ("Inter", "Semi Bold", 15.0f);
1045+
tableFont = FontOptions ("Inter", "Regular", 17.0f);
1046+
nameFont = FontOptions ("Inter", "Semi Bold", 17.0f);
10481047

10491048
pluginTable = std::make_unique<TableListBox>();
10501049
pluginTable->setModel (this);
1051-
pluginTable->setRowHeight (38);
1052-
pluginTable->setHeaderHeight (30);
1050+
pluginTable->setRowHeight (70);
1051+
pluginTable->setHeaderHeight (36);
10531052
pluginTable->getViewport()->setScrollBarThickness (12);
10541053
addAndMakeVisible (pluginTable.get());
10551054

@@ -1058,15 +1057,15 @@ PluginListBoxComponent::PluginListBoxComponent()
10581057
constexpr int regularColumnFlags = TableHeaderComponent::visible | TableHeaderComponent::resizable;
10591058

10601059
header.addColumn ("Plugin", displayNameColumn, 180, 120, -1, sortableColumnFlags);
1061-
header.addColumn ("Type", typeColumn, 90, 90, 90, TableHeaderComponent::visible);
1060+
header.addColumn ("Type", typeColumn, 80, 80, 80, TableHeaderComponent::visible);
10621061
header.addColumn ("Developers", developersColumn, 150, 100, 280, regularColumnFlags);
1063-
header.addColumn ("Updated", updatedColumn, 90, 90, 90, TableHeaderComponent::visible);
1062+
header.addColumn ("Updated", updatedColumn, 100, 100, 100, TableHeaderComponent::visible);
10641063
header.addColumn ("Description", descriptionColumn, 310, 180, -1, regularColumnFlags);
10651064
header.addColumn ("Dependencies", dependenciesColumn, 120, 120, 120, TableHeaderComponent::appearsOnColumnMenu);
1066-
header.addColumn ("Installed", installedVersionColumn, 60, 60, 60, TableHeaderComponent::visible);
1065+
header.addColumn ("Installed", installedVersionColumn, 75, 75, 75, TableHeaderComponent::visible);
10671066
header.addColumn ("Version", versionSelectorColumn, 80, 80, 120, regularColumnFlags);
10681067
header.addColumn ("Action", installColumn, 60, 60, 60, TableHeaderComponent::visible);
1069-
header.addColumn ("Remove", uninstallColumn, 60, 60, 60, TableHeaderComponent::visible);
1068+
header.addColumn ("Delete", uninstallColumn, 60, 60, 60, TableHeaderComponent::visible);
10701069
header.setSortColumnId (displayNameColumn, true);
10711070

10721071
tableDropShadower = std::make_unique<DropShadower> (DropShadow (Colours::black.withAlpha (0.5f), 6, { 2, 2 }));
@@ -1113,8 +1112,12 @@ void PluginListBoxComponent::paintCell (Graphics& g,
11131112

11141113
g.setFont (tableFont);
11151114

1116-
juce::Rectangle<int> textBounds (5, 0, width - 10, height);
1115+
juce::Rectangle<int> textBounds (5, 5, width - 10, height - 10);
11171116
String text;
1117+
AttributedString attributedStr;
1118+
TextLayout layout;
1119+
attributedStr.setJustification (Justification::centredLeft);
1120+
attributedStr.setWordWrap (AttributedString::WordWrap::byWord);
11181121

11191122
switch (columnId)
11201123
{
@@ -1127,15 +1130,31 @@ void PluginListBoxComponent::paintCell (Graphics& g,
11271130

11281131
case developersColumn:
11291132
text = pluginInfo->developers;
1130-
break;
1133+
attributedStr.append (text, tableFont, findColour (ThemeColours::defaultText));
1134+
layout.createLayout (attributedStr, textBounds.getWidth());
1135+
if (layout.getNumLines() > 3)
1136+
{
1137+
attributedStr.setJustification (Justification::topLeft);
1138+
layout.createLayout (attributedStr, textBounds.getWidth());
1139+
}
1140+
layout.draw (g, textBounds.toFloat());
1141+
return;
11311142

11321143
case updatedColumn:
11331144
text = pluginInfo->lastUpdated;
11341145
break;
11351146

11361147
case descriptionColumn:
11371148
text = pluginInfo->description;
1138-
break;
1149+
attributedStr.append (text, tableFont.withHeight (15.0f), findColour (ThemeColours::defaultText));
1150+
layout.createLayout (attributedStr, textBounds.getWidth());
1151+
if (layout.getNumLines() > 4)
1152+
{
1153+
attributedStr.setJustification (Justification::topLeft);
1154+
layout.createLayout (attributedStr, textBounds.getWidth());
1155+
}
1156+
layout.draw (g, textBounds.toFloat());
1157+
return;
11391158

11401159
case dependenciesColumn:
11411160
text = getDependenciesText (*pluginInfo);
@@ -1203,7 +1222,7 @@ Component* PluginListBoxComponent::refreshComponentForCell (int rowNumber,
12031222
if (nameCell == nullptr)
12041223
nameCell = new PluginNameCell();
12051224

1206-
nameCell->update (*pluginInfo, headerFont);
1225+
nameCell->update (*pluginInfo, nameFont);
12071226
return nameCell;
12081227
}
12091228

@@ -1281,11 +1300,11 @@ int PluginListBoxComponent::getColumnAutoSizeWidth (int columnId)
12811300
if (columnId != displayNameColumn)
12821301
return 0;
12831302

1284-
auto maxWidth = GlyphArrangement::getStringWidthInt (Font (headerFont), pluginTable->getHeader().getColumnName (displayNameColumn));
1303+
auto maxWidth = GlyphArrangement::getStringWidthInt (Font (nameFont), pluginTable->getHeader().getColumnName (displayNameColumn));
12851304

12861305
for (const auto& pluginInfo : allPlugins)
12871306
maxWidth = jmax (maxWidth,
1288-
GlyphArrangement::getStringWidthInt (Font (headerFont), pluginInfo.displayName + ""));
1307+
GlyphArrangement::getStringWidthInt (Font (nameFont), pluginInfo.displayName + ""));
12891308

12901309
return maxWidth + 28;
12911310
}

Source/UI/PluginInstaller.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ class PluginListBoxComponent : public Component,
229229
std::vector<SelectedPluginInfo> allPlugins;
230230
std::vector<int> visibleRows;
231231
String searchText;
232-
FontOptions tableFont, headerFont;
232+
FontOptions tableFont, nameFont;
233233
bool showInstalledOnly = false;
234234
bool showSources = true;
235235
bool showFilters = true;

0 commit comments

Comments
 (0)