[license] Make local and external links more consistent

- Capitalization of message
 - Add a right-pointing "open" button to external links as well
This commit is contained in:
Adriaan de Groot 2019-04-23 04:10:43 -04:00
parent c696b5c19d
commit ddf541774b
2 changed files with 19 additions and 3 deletions

View file

@ -21,6 +21,7 @@
#include "LicenseWidget.h"
#include <QDesktopServices>
#include <QHBoxLayout>
#include <QLabel>
#include <QToolButton>
@ -61,8 +62,16 @@ LicenseWidget::LicenseWidget( LicenseEntry entry, QWidget* parent )
connect( m_expandLicenseButton, &QAbstractButton::clicked, this, &LicenseWidget::expandClicked );
}
else
m_viewLicenseLabel->setOpenExternalLinks( true );
{
auto* button = new QToolButton( this );
button->setArrowType( Qt::RightArrow );
wiLayout->addWidget( button );
connect( button, &QAbstractButton::clicked, this, &LicenseWidget::viewClicked );
// Normally setOpenExternalLinks( true ) would do, but we need the
// open code anyway for the toolbutton, let's share it.
connect( m_viewLicenseLabel, &QLabel::linkActivated, this, &LicenseWidget::viewClicked );
}
retranslateUi();
}
@ -122,7 +131,7 @@ void LicenseWidget::retranslateUi()
updateExpandToolTip();
}
else
m_viewLicenseLabel->setText( tr( "<a href=\"%1\">view license agreement</a>" )
m_viewLicenseLabel->setText( tr( "<a href=\"%1\">View license agreement</a>" )
.arg( m_entry.m_url.toString() ) );
}
@ -152,3 +161,9 @@ LicenseWidget::updateExpandToolTip()
: tr( "Hide license text" )
) ;
}
void
LicenseWidget::viewClicked()
{
QDesktopServices::openUrl( m_entry.m_url );
}

View file

@ -38,7 +38,8 @@ public:
void retranslateUi();
private:
void expandClicked();
void expandClicked(); // "slot" to toggle show/hide of local license text
void viewClicked(); // "slot" to open link
void updateExpandToolTip();
LicenseEntry m_entry;