Skip to content

Commit

Permalink
Welcomepage: Add loading indicator and allow keyboard for project sel…
Browse files Browse the repository at this point in the history
…ection
  • Loading branch information
m-kuhn committed Aug 19, 2015
1 parent c783f26 commit f955cf2
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 5 deletions.
62 changes: 60 additions & 2 deletions doc/whatsnew.html
Expand Up @@ -13,12 +13,15 @@
color: #08c;
}

.feed-element {
.#feed {
margin: 1em;
background-color: #eee;
background-color: white;
border-radius: 9px;
padding: 1em;
border: 1px solid #999;
}

.feed-element {
overflow: auto;
}

Expand All @@ -36,6 +39,50 @@
float: left;
margin-right: 1em;
}


/* Spinner from http://tobiasahlin.com/spinkit */
.spinner {
margin: 100px auto 0;
width: 70px;
text-align: center;
}

.spinner > div {
width: 18px;
height: 18px;
background-color: #333;

border-radius: 100%;
display: inline-block;
-webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;
animation: sk-bouncedelay 1.4s infinite ease-in-out both;
}

.spinner .bounce1 {
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}

.spinner .bounce2 {
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}

@-webkit-keyframes sk-bouncedelay {
0%, 80%, 100% { -webkit-transform: scale(0) }
40% { -webkit-transform: scale(1.0) }
}

@keyframes sk-bouncedelay {
0%, 80%, 100% {
-webkit-transform: scale(0);
transform: scale(0);
} 40% {
-webkit-transform: scale(1.0);
transform: scale(1.0);
}
}
</style>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
Expand All @@ -45,6 +92,8 @@
function initialize() {
var feed = new google.feeds.Feed('http://blog.qgis.org/feed/');
feed.load(function(result) {
var spinner = document.getElementById("loader");
spinner.parentNode.removeChild(spinner);
if (!result.error) {
var container = document.getElementById("feed");
result.feed.entries.forEach(
Expand Down Expand Up @@ -79,13 +128,22 @@
}
)
}
else {
container.innerHTML="<h1>No News</h1><p>Sorry, it seems that the news feed is unavailable. This indicates problems with the internet connection.</p>";
}
});
}
google.setOnLoadCallback(initialize);

</script>
</head>
<body>
<div id="loader" class="spinner">
<div class="bounce1"></div>
<div class="bounce2"></div>
<div class="bounce3"></div>
</div>

<div id="feed"></div>
</body>
</html>
6 changes: 4 additions & 2 deletions src/app/qgswelcomepage.cpp
Expand Up @@ -74,6 +74,8 @@ QgsWelcomePage::QgsWelcomePage( QWidget* parent )
whatsNewPage->page()->setLinkDelegationPolicy( QWebPage::DelegateAllLinks );
whatsNewPage->setContextMenuPolicy( Qt::NoContextMenu );
whatsNewPage->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Expanding );
whatsNewPage->setStyleSheet( "background:transparent" );
whatsNewPage->setAttribute( Qt::WA_TranslucentBackground );

whatsNewContainer->layout()->addWidget( whatsNewPage );
whatsNewContainer->setMaximumWidth( 250 );
Expand All @@ -90,15 +92,15 @@ QgsWelcomePage::QgsWelcomePage( QWidget* parent )
connect( versionInfo, SIGNAL( versionInfoAvailable() ), this, SLOT( versionInfoReceived() ) );
versionInfo->checkVersion();

connect( recentProjectsListView, SIGNAL( doubleClicked( QModelIndex ) ), this, SLOT( itemDoubleClicked( QModelIndex ) ) );
connect( recentProjectsListView, SIGNAL( activated( QModelIndex ) ), this, SLOT( itemActivated( QModelIndex ) ) );
}

void QgsWelcomePage::setRecentProjects( const QList<QgsWelcomePageItemsModel::RecentProjectData>& recentProjects )
{
mModel->setRecentProjects( recentProjects );
}

void QgsWelcomePage::itemDoubleClicked( const QModelIndex& index )
void QgsWelcomePage::itemActivated( const QModelIndex& index )
{
QgisApp::instance()->openProject( mModel->data( index, Qt::ToolTipRole ).toString() );
}
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgswelcomepage.h
Expand Up @@ -31,7 +31,7 @@ class QgsWelcomePage : public QWidget
void setRecentProjects( const QList<QgsWelcomePageItemsModel::RecentProjectData>& recentProjects );

private slots:
void itemDoubleClicked( const QModelIndex& index );
void itemActivated( const QModelIndex& index );
void versionInfoReceived();
void whatsNewLinkClicked( const QUrl& url );

Expand Down

0 comments on commit f955cf2

Please sign in to comment.