Unity 8
PageList.h
1 /*
2  * Copyright (C) 2014 Canonical Ltd.
3  *
4  * This program is free software: you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License version 3, as published
6  * by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranties of
10  * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
11  * PURPOSE. See the GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License along
14  * with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef WIZARD_PAGELIST_H
18 #define WIZARD_PAGELIST_H
19 
20 #include <QMap>
21 #include <QObject>
22 #include <QString>
23 
24 class PageList : public QObject
25 {
26  Q_OBJECT
27  Q_PROPERTY(int index READ index NOTIFY indexChanged)
28  Q_PROPERTY(int numPages READ numPages NOTIFY numPagesChanged)
29 
30 public:
31  explicit PageList(QObject *parent = 0);
32 
33  QStringList entries() const;
34  QStringList paths() const;
35  int index() const;
36  int numPages() const;
37 
38 public Q_SLOTS:
39  QString prev();
40  QString next();
41 
42 Q_SIGNALS:
43  void indexChanged();
44  void numPagesChanged(); // never emitted, just here to quiet Qml warnings
45 
46 private:
47  int setIndex(int index);
48 
49  int m_index;
50  QMap<QString, QString> m_pages;
51 };
52 
53 #endif // WIZARD_PAGELIST_H