From 4575547f656142f600dbff2a2af4994d74a594b0 Mon Sep 17 00:00:00 2001 From: Mathieu Pellerin Date: Fri, 18 Jan 2019 09:05:21 +0700 Subject: [PATCH] Fix/improve visual look of new version notification - Set a better background color (yellow feels like a negative warning) - Set text color to black to play nice with themes - Make the hyperlink clickable, we want people to update! --- src/app/qgswelcomepage.cpp | 22 ++++++++++++++-------- src/app/qgswelcomepage.h | 4 ++-- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/app/qgswelcomepage.cpp b/src/app/qgswelcomepage.cpp index 9bb61895848..9c0df78bde2 100644 --- a/src/app/qgswelcomepage.cpp +++ b/src/app/qgswelcomepage.cpp @@ -21,12 +21,14 @@ #include "qgssettings.h" #include "qgsgui.h" #include "qgsnative.h" +#include "qgsstringutils.h" #include "qgsfileutils.h" #include #include #include #include +#include QgsWelcomePage::QgsWelcomePage( bool skipVersionCheck, QWidget *parent ) : QWidget( parent ) @@ -67,7 +69,15 @@ QgsWelcomePage::QgsWelcomePage( bool skipVersionCheck, QWidget *parent ) layout->addWidget( recentProjectsContainer ); - mVersionInformation = new QLabel; + mVersionInformation = new QTextBrowser; + mVersionInformation->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Maximum ); + mVersionInformation->setReadOnly( true ); + mVersionInformation->setOpenExternalLinks( true ); + mVersionInformation->setStyleSheet( "QTextEdit { background-color: #dff0d8; border: 1px solid #8e998a; padding-top: 0.25em; max-height: 1.75em; min-height: 1.75em; } " + "QScrollBar { background-color: rgba(0,0,0,0); } " + "QScrollBar::add-page,QScrollBar::sub-page,QScrollBar::handle { background-color: rgba(0,0,0,0); color: rgba(0,0,0,0); } " + "QScrollBar::up-arrow,QScrollBar::down-arrow { color: rgb(0,0,0); } " ); + mainLayout->addWidget( mVersionInformation ); mVersionInformation->setVisible( false ); @@ -105,13 +115,9 @@ void QgsWelcomePage::versionInfoReceived() if ( versionInfo->newVersionAvailable() ) { mVersionInformation->setVisible( true ); - mVersionInformation->setText( QStringLiteral( "%1: %2" ) - .arg( tr( "There is a new QGIS version available" ), - versionInfo->downloadInfo() ) ); - mVersionInformation->setStyleSheet( "QLabel{" - " background-color: #dddd00;" - " padding: 5px;" - "}" ); + mVersionInformation->setText( QStringLiteral( "%1: %2" ) + .arg( tr( "New QGIS version available" ), + QgsStringUtils::insertLinks( versionInfo->downloadInfo() ) ) ); } } diff --git a/src/app/qgswelcomepage.h b/src/app/qgswelcomepage.h index 4e5f3c0819b..61e849c3276 100644 --- a/src/app/qgswelcomepage.h +++ b/src/app/qgswelcomepage.h @@ -17,7 +17,7 @@ #define QGSWELCOMEDIALOG_H #include -#include +#include #include "qgswelcomepageitemsmodel.h" @@ -47,7 +47,7 @@ class QgsWelcomePage : public QWidget private: QgsWelcomePageItemsModel *mModel = nullptr; - QLabel *mVersionInformation = nullptr; + QTextBrowser *mVersionInformation = nullptr; QgsVersionInfo *mVersionInfo = nullptr; QListView *mRecentProjectsListView = nullptr; };