[license] Show filenames as filenames

- Use File: to display filenames, rather than URL: plus a file:-scheme
 - Document the change in CHANGES
This commit is contained in:
Adriaan de Groot 2019-12-09 20:47:32 +01:00
parent 41c506cacc
commit 7d88b6d0cd
3 changed files with 24 additions and 17 deletions

View File

@ -12,7 +12,9 @@ This release contains contributions from (alphabetically by first name):
- No changes to core functionality. - No changes to core functionality.
## Modules ## ## 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) # # 3.2.17.1 (2019-12-02) #

View File

@ -88,14 +88,7 @@ LicenseWidget::LicenseWidget( LicenseEntry entry, QWidget* parent )
if ( m_entry.isLocal() ) if ( m_entry.isLocal() )
{ {
m_fullTextContents = loadLocalFile( m_entry.m_url ); m_fullTextContents = loadLocalFile( m_entry.m_url );
if ( m_isExpanded ) showLocalLicenseText();
{
m_licenceTextLabel->setText( m_fullTextContents );
}
else
{
m_licenceTextLabel->setText( tr( "URL: %1" ).arg( m_entry.m_url.toDisplayString() ) );
}
connect( m_viewLicenseButton, &QAbstractButton::clicked, this, &LicenseWidget::expandClicked ); connect( m_viewLicenseButton, &QAbstractButton::clicked, this, &LicenseWidget::expandClicked );
} }
else else
@ -162,20 +155,31 @@ LicenseWidget::retranslateUi()
} }
void void
LicenseWidget::expandClicked() LicenseWidget::showLocalLicenseText()
{ {
m_isExpanded = !m_isExpanded;
// Show/hide based on the new arrow direction.
if ( !m_fullTextContents.isEmpty() )
{
if ( m_isExpanded ) if ( m_isExpanded )
{ {
m_licenceTextLabel->setText( m_fullTextContents ); m_licenceTextLabel->setText( m_fullTextContents );
} }
else else
{ {
m_licenceTextLabel->setText( tr( "URL: %1" ).arg( m_entry.m_url.toDisplayString() ) ); 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()
{
m_isExpanded = !m_isExpanded;
// Show/hide based on the new arrow direction.
if ( !m_fullTextContents.isEmpty() )
{
showLocalLicenseText();
} }
updateExpandToolTip(); updateExpandToolTip();

View File

@ -38,6 +38,7 @@ public:
void retranslateUi(); void retranslateUi();
private: private:
void showLocalLicenseText(); // Display (or hide) the local license text
void expandClicked(); // "slot" to toggle show/hide of local license text void expandClicked(); // "slot" to toggle show/hide of local license text
void viewClicked(); // "slot" to open link void viewClicked(); // "slot" to open link
void updateExpandToolTip(); void updateExpandToolTip();