Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[FEATURE] Add welcome screen with recent projects
Refs #7626
- Loading branch information
Showing
8 changed files
with
295 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/*************************************************************************** | ||
---------------------------------------------------- | ||
date : 18.8.2015 | ||
copyright : (C) 2015 by Matthias Kuhn | ||
email : matthias (at) opengis.ch | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgswelcomedialog.h" | ||
#include "qgsproject.h" | ||
#include "qgisapp.h" | ||
|
||
#include <QHBoxLayout> | ||
#include <QListView> | ||
#include <QSettings> | ||
|
||
QgsWelcomeDialog::QgsWelcomeDialog() | ||
{ | ||
QHBoxLayout* layout = new QHBoxLayout(); | ||
setLayout( layout ); | ||
|
||
QListView* welcomeScreenListView = new QListView(); | ||
mModel = new QgsWelcomePageItemsModel(); | ||
welcomeScreenListView->setModel( mModel ); | ||
layout->addWidget( welcomeScreenListView ); | ||
|
||
setWindowTitle( tr( "Recent Projects..." ) ); | ||
|
||
QSettings settings; | ||
restoreGeometry( settings.value( "/Windows/WelcomeDialog/geometry" ).toByteArray() ); | ||
|
||
connect( welcomeScreenListView, SIGNAL( doubleClicked( QModelIndex ) ), this, SLOT( itemDoubleClicked( QModelIndex ) ) ); | ||
} | ||
|
||
void QgsWelcomeDialog::setRecentProjects(const QList<QgsWelcomePageItemsModel::RecentProjectData>& recentProjects) | ||
{ | ||
mModel->setRecentProjects( recentProjects ); | ||
} | ||
|
||
void QgsWelcomeDialog::itemDoubleClicked( const QModelIndex& index ) | ||
{ | ||
QgisApp::instance()->openProject( mModel->data( index, Qt::ToolTipRole ).toString() ); | ||
accept(); | ||
} | ||
|
||
|
||
void QgsWelcomeDialog::done( int result ) | ||
{ | ||
QDialog::done( result ); | ||
QSettings settings; | ||
settings.setValue( "/Windows/WelcomeDialog/geometry", saveGeometry() ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/*************************************************************************** | ||
---------------------------------------------------- | ||
date : 18.8.2015 | ||
copyright : (C) 2015 by Matthias Kuhn | ||
email : matthias (at) opengis.ch | ||
*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSWELCOMEDIALOG_H | ||
#define QGSWELCOMEDIALOG_H | ||
|
||
#include <QDialog> | ||
|
||
#include "qgswelcomepageitemsmodel.h" | ||
|
||
class QgsWelcomeDialog : public QDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
QgsWelcomeDialog(); | ||
|
||
void setRecentProjects( const QList<QgsWelcomePageItemsModel::RecentProjectData>& recentProjects ); | ||
|
||
private slots: | ||
void itemDoubleClicked(const QModelIndex& index ); | ||
|
||
private: | ||
QgsWelcomePageItemsModel* mModel; | ||
|
||
public slots: | ||
void done( int result ); | ||
}; | ||
|
||
#endif // QGSWELCOMEDIALOG_H |
Oops, something went wrong.