[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:
parent
41c506cacc
commit
7d88b6d0cd
4
CHANGES
4
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) #
|
||||
|
@ -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
|
||||
@ -162,20 +155,31 @@ LicenseWidget::retranslateUi()
|
||||
}
|
||||
|
||||
void
|
||||
LicenseWidget::expandClicked()
|
||||
LicenseWidget::showLocalLicenseText()
|
||||
{
|
||||
m_isExpanded = !m_isExpanded;
|
||||
// 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() ) );
|
||||
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();
|
||||
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user