2015-08-18 00:31:12 +02:00
|
|
|
/***************************************************************************
|
|
|
|
|
|
|
|
----------------------------------------------------
|
|
|
|
date : 17.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 QGSWELCOMEPAGEITEMSMODEL_H
|
|
|
|
#define QGSWELCOMEPAGEITEMSMODEL_H
|
|
|
|
|
|
|
|
#include <QAbstractListModel>
|
|
|
|
#include <QStringList>
|
2015-09-06 11:18:48 +07:00
|
|
|
#include <QStyledItemDelegate>
|
|
|
|
|
2019-05-22 10:36:12 +02:00
|
|
|
class QgsMapCanvas;
|
|
|
|
|
2019-05-14 09:51:19 +02:00
|
|
|
class QgsRecentProjectItemsModel : public QAbstractListModel
|
2015-08-18 00:31:12 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2015-08-18 23:25:20 +02:00
|
|
|
struct RecentProjectData
|
|
|
|
{
|
2017-03-03 08:42:00 +01:00
|
|
|
bool operator==( const RecentProjectData &other ) const { return other.path == this->path; }
|
2015-08-18 23:25:20 +02:00
|
|
|
QString path;
|
|
|
|
QString title;
|
|
|
|
QString previewImagePath;
|
2015-09-11 09:31:12 +07:00
|
|
|
QString crs;
|
2017-10-27 11:08:37 +07:00
|
|
|
mutable bool pin = false;
|
2017-10-25 14:16:51 +10:00
|
|
|
mutable bool checkedExists = false;
|
|
|
|
mutable bool exists = false;
|
2015-08-18 00:31:12 +02:00
|
|
|
};
|
|
|
|
|
2019-05-14 09:51:19 +02:00
|
|
|
explicit QgsRecentProjectItemsModel( QObject *parent = nullptr );
|
2015-08-18 00:31:12 +02:00
|
|
|
|
2017-03-03 08:42:00 +01:00
|
|
|
void setRecentProjects( const QList<RecentProjectData> &recentProjects );
|
2015-08-18 00:31:12 +02:00
|
|
|
|
2019-05-22 11:51:49 +02:00
|
|
|
int rowCount( const QModelIndex &parent = QModelIndex() ) const override;
|
2017-03-03 08:42:00 +01:00
|
|
|
QVariant data( const QModelIndex &index, int role ) const override;
|
|
|
|
Qt::ItemFlags flags( const QModelIndex &index ) const override;
|
2015-08-18 00:31:12 +02:00
|
|
|
|
2017-10-27 11:08:37 +07:00
|
|
|
void pinProject( const QModelIndex &index );
|
|
|
|
void unpinProject( const QModelIndex &index );
|
2017-10-26 19:25:49 +07:00
|
|
|
void removeProject( const QModelIndex &index );
|
2017-10-25 14:16:51 +10:00
|
|
|
void recheckProject( const QModelIndex &index );
|
|
|
|
|
2015-08-18 00:31:12 +02:00
|
|
|
private:
|
|
|
|
QList<RecentProjectData> mRecentProjects;
|
|
|
|
};
|
|
|
|
|
2019-05-14 09:51:19 +02:00
|
|
|
#endif // QGSRECENTPROJECTITEMSMODEL_H
|