Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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!
  • Loading branch information
nirvn committed Jan 18, 2019
1 parent 22418b4 commit 1a8537a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
22 changes: 14 additions & 8 deletions src/app/qgswelcomepage.cpp
Expand Up @@ -21,12 +21,14 @@
#include "qgssettings.h"
#include "qgsgui.h"
#include "qgsnative.h"
#include "qgsstringutils.h"
#include "qgsfileutils.h"

#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QListView>
#include <QDesktopServices>
#include <QTextBrowser>

QgsWelcomePage::QgsWelcomePage( bool skipVersionCheck, QWidget *parent )
: QWidget( parent )
Expand Down Expand Up @@ -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 );

Expand Down Expand Up @@ -105,13 +115,9 @@ void QgsWelcomePage::versionInfoReceived()
if ( versionInfo->newVersionAvailable() )
{
mVersionInformation->setVisible( true );
mVersionInformation->setText( QStringLiteral( "<b>%1</b>: %2" )
.arg( tr( "There is a new QGIS version available" ),
versionInfo->downloadInfo() ) );
mVersionInformation->setStyleSheet( "QLabel{"
" background-color: #dddd00;"
" padding: 5px;"
"}" );
mVersionInformation->setText( QStringLiteral( "<style> a, a:visited, a:hover { color:#268300; } </style><b>%1</b>: %2" )
.arg( tr( "New QGIS version available" ),
QgsStringUtils::insertLinks( versionInfo->downloadInfo() ) ) );
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/qgswelcomepage.h
Expand Up @@ -17,7 +17,7 @@
#define QGSWELCOMEDIALOG_H

#include <QWidget>
#include <QLabel>
#include <QTextBrowser>

#include "qgswelcomepageitemsmodel.h"

Expand Down Expand Up @@ -47,7 +47,7 @@ class QgsWelcomePage : public QWidget

private:
QgsWelcomePageItemsModel *mModel = nullptr;
QLabel *mVersionInformation = nullptr;
QTextBrowser *mVersionInformation = nullptr;
QgsVersionInfo *mVersionInfo = nullptr;
QListView *mRecentProjectsListView = nullptr;
};
Expand Down

0 comments on commit 1a8537a

Please sign in to comment.