@@ -122,11 +122,19 @@ PatchBrowser::PatchBrowser() : Component("patch_browser") {
122122 selectedFilesChanged (banks_model_);
123123 selectedFilesChanged (folders_model_);
124124
125- license_link_ = new HyperlinkButton (" CC-BY" , URL (" https://creativecommons.org/licenses/by/4.0/" ));
126- license_link_->setFont (Fonts::getInstance ()->monospace ().withPointHeight (12 .0f ),
127- false , Justification::centredLeft);
128- license_link_->setColour (HyperlinkButton::textColourId, Colour (0xffffd740 ));
129- addAndMakeVisible (license_link_);
125+ cc_license_link_ = new HyperlinkButton (" CC-BY" ,
126+ URL (" https://creativecommons.org/licenses/by/4.0/" ));
127+ cc_license_link_->setFont (Fonts::getInstance ()->monospace ().withPointHeight (12 .0f ),
128+ false , Justification::centredLeft);
129+ cc_license_link_->setColour (HyperlinkButton::textColourId, Colour (0xffffd740 ));
130+ addAndMakeVisible (cc_license_link_);
131+
132+ gpl_license_link_ = new HyperlinkButton (" GPL-3" ,
133+ URL (" http://www.gnu.org/licenses/gpl-3.0.en.html" ));
134+ gpl_license_link_->setFont (Fonts::getInstance ()->monospace ().withPointHeight (12 .0f ),
135+ false , Justification::centredLeft);
136+ gpl_license_link_->setColour (HyperlinkButton::textColourId, Colour (0xffffd740 ));
137+ addAndMakeVisible (gpl_license_link_);
130138
131139 save_as_button_ = new TextButton (TRANS (" Save As" ));
132140 save_as_button_->addListener (this );
@@ -158,7 +166,8 @@ void PatchBrowser::paint(Graphics& g) {
158166 g.fillRect (data_rect);
159167
160168 if (isPatchSelected ()) {
161- float data_x = BROWSE_PADDING + 2 .0f * getNarrowWidth () + getWideWidth () + 3 .0f * BROWSE_PADDING;
169+ float data_x = BROWSE_PADDING + 2 .0f * getNarrowWidth () +
170+ getWideWidth () + 3 .0f * BROWSE_PADDING;
162171 float division = 90 .0f ;
163172 float buffer = 20 .0f ;
164173
@@ -217,8 +226,10 @@ void PatchBrowser::resized() {
217226
218227 float data_x = start_x + 2 .0f * width1 + width2 + 3 .0f * BROWSE_PADDING;
219228 float data_widget_buffer_x = 12 .0f ;
220- license_link_->setBounds (data_x + 108 .0f , BROWSE_PADDING + 160 .0f ,
221- 200 .0f , 20 .0f );
229+ cc_license_link_->setBounds (data_x + 108 .0f , BROWSE_PADDING + 160 .0f ,
230+ 200 .0f , 20 .0f );
231+ gpl_license_link_->setBounds (data_x + 108 .0f , BROWSE_PADDING + 160 .0f ,
232+ 200 .0f , 20 .0f );
222233
223234 float button_width = (width2 - 3 .0f * data_widget_buffer_x) / 2 .0f ;
224235 save_as_button_->setBounds (data_x + data_widget_buffer_x, height - 30 .0f ,
@@ -235,7 +246,10 @@ void PatchBrowser::visibilityChanged() {
235246 if (isVisible ()) {
236247 search_box_->setText (" " );
237248 search_box_->grabKeyboardFocus ();
238- license_link_->setVisible (isPatchSelected ());
249+
250+ bool is_cc = license_.contains (" creativecommons" );
251+ cc_license_link_->setVisible (isPatchSelected () && is_cc);
252+ gpl_license_link_->setVisible (isPatchSelected () && !is_cc);
239253 }
240254}
241255
@@ -253,8 +267,10 @@ void PatchBrowser::selectedFilesChanged(FileListBoxModel* model) {
253267 if (listener_)
254268 listener_->newPatchSelected (patch);
255269 }
256- else
257- license_link_->setVisible (false );
270+ else {
271+ cc_license_link_->setVisible (false );
272+ gpl_license_link_->setVisible (false );
273+ }
258274 repaint ();
259275 }
260276}
@@ -345,9 +361,12 @@ void PatchBrowser::loadFromFile(File& patch) {
345361 parent->setPatchName (patch.getFileNameWithoutExtension ());
346362 parent->setFolderName (patch.getParentDirectory ().getFileName ());
347363 author_ = LoadSave::getAuthor (parsed_json_state);
364+ license_ = LoadSave::getLicense (parsed_json_state);
348365 parent->setAuthor (author_);
349366
350- license_link_->setVisible (true );
367+ bool is_cc = license_.contains (" creativecommons" );
368+ cc_license_link_->setVisible (is_cc);
369+ gpl_license_link_->setVisible (!is_cc);
351370 }
352371}
353372
0 commit comments