]> git.mxchange.org Git - flightgear.git/blob - src/GUI/CatalogListModel.hxx
Basics on catalog list model in the GUI.
[flightgear.git] / src / GUI / CatalogListModel.hxx
1 // CatalogListModel.hxx - part of GUI launcher using Qt5
2 //
3 // Written by James Turner, started March 2015.
4 //
5 // Copyright (C) 2015 James Turner <zakalawe@mac.com>
6 //
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
11 //
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 // General Public License for more details.
16 //
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20
21 #ifndef FG_GUI_CATALOG_LIST_MODEL
22 #define FG_GUI_CATALOG_LIST_MODEL
23
24 #include <QAbstractListModel>
25 #include <QDateTime>
26 #include <QDir>
27 #include <QPixmap>
28 #include <QStringList>
29
30 #include <simgear/package/Root.hxx>
31 #include <simgear/package/Catalog.hxx>
32
33 const int CatalogUrlRole = Qt::UserRole + 1;
34 const int CatalogIdRole = Qt::UserRole + 2;
35
36 class CatalogListModel : public QAbstractListModel
37 {
38     Q_OBJECT
39 public:
40     CatalogListModel(QObject* pr, simgear::pkg::RootRef& root);
41
42     ~CatalogListModel();
43
44     virtual int rowCount(const QModelIndex& parent) const;
45
46     virtual QVariant data(const QModelIndex& index, int role) const;
47     
48     virtual bool setData(const QModelIndex &index, const QVariant &value, int role);
49
50 private slots:
51
52
53 private:
54     simgear::pkg::RootRef m_packageRoot;
55 };
56
57 #endif // of FG_GUI_CATALOG_LIST_MODEL