diff --git a/CHANGES b/CHANGES index 1f721faca..b82024769 100644 --- a/CHANGES +++ b/CHANGES @@ -12,7 +12,9 @@ This release contains contributions from (alphabetically by first name): - No changes to core functionality. ## Modules ## - - No changes to modules. + - The *license* module has seen a significant change to its looks. + Actions are now labeled more clearly, and the URL (or filename) + for each license is displayed. # 3.2.17.1 (2019-12-02) # diff --git a/src/modules/license/LicenseWidget.cpp b/src/modules/license/LicenseWidget.cpp index b78972c00..09d2230e5 100644 --- a/src/modules/license/LicenseWidget.cpp +++ b/src/modules/license/LicenseWidget.cpp @@ -88,14 +88,7 @@ LicenseWidget::LicenseWidget( LicenseEntry entry, QWidget* parent ) if ( m_entry.isLocal() ) { m_fullTextContents = loadLocalFile( m_entry.m_url ); - if ( m_isExpanded ) - { - m_licenceTextLabel->setText( m_fullTextContents ); - } - else - { - m_licenceTextLabel->setText( tr( "URL: %1" ).arg( m_entry.m_url.toDisplayString() ) ); - } + showLocalLicenseText(); connect( m_viewLicenseButton, &QAbstractButton::clicked, this, &LicenseWidget::expandClicked ); } else @@ -161,6 +154,24 @@ LicenseWidget::retranslateUi() updateExpandToolTip(); } +void +LicenseWidget::showLocalLicenseText() +{ + if ( m_isExpanded ) + { + m_licenceTextLabel->setText( m_fullTextContents ); + } + else + { + QString fileName = m_entry.m_url.toDisplayString(); + if ( fileName.startsWith( "file:" ) ) + { + fileName = fileName.remove( 0, 5 ); + } + m_licenceTextLabel->setText( tr( "File: %1" ).arg( fileName ) ); + } +} + void LicenseWidget::expandClicked() { @@ -168,14 +179,7 @@ LicenseWidget::expandClicked() // Show/hide based on the new arrow direction. if ( !m_fullTextContents.isEmpty() ) { - if ( m_isExpanded ) - { - m_licenceTextLabel->setText( m_fullTextContents ); - } - else - { - m_licenceTextLabel->setText( tr( "URL: %1" ).arg( m_entry.m_url.toDisplayString() ) ); - } + showLocalLicenseText(); } updateExpandToolTip(); diff --git a/src/modules/license/LicenseWidget.h b/src/modules/license/LicenseWidget.h index ffbb9d3c3..a386ae353 100644 --- a/src/modules/license/LicenseWidget.h +++ b/src/modules/license/LicenseWidget.h @@ -38,6 +38,7 @@ public: void retranslateUi(); private: + void showLocalLicenseText(); // Display (or hide) the local license text void expandClicked(); // "slot" to toggle show/hide of local license text void viewClicked(); // "slot" to open link void updateExpandToolTip();