[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.
## 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) #

View File

@ -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();

View File

@ -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();