src/platform/qt/LibraryModel.h (view raw)
1/* Copyright (c) 2013-2016 Jeffrey Pfau
2 *
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6#ifndef QGBA_LIBRARY_MODEL
7#define QGBA_LIBRARY_MODEL
8
9#include <QAbstractItemModel>
10
11#include <mgba/core/library.h>
12
13struct VDir;
14
15namespace QGBA {
16
17class LibraryModel : public QAbstractItemModel {
18Q_OBJECT
19
20public:
21 LibraryModel(QObject* parent = nullptr);
22 virtual ~LibraryModel();
23
24 void loadDirectory(VDir* dir);
25
26 const mLibraryEntry* entryAt(int row) const;
27
28 virtual QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
29 virtual QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
30
31 virtual QModelIndex index(int row, int column, const QModelIndex& parent) const override;
32 virtual QModelIndex parent(const QModelIndex& index) const override;
33
34 virtual int columnCount(const QModelIndex& parent = QModelIndex()) const override;
35 virtual int rowCount(const QModelIndex& parent = QModelIndex()) const override;
36
37private:
38 mLibrary m_library;
39
40};
41
42}
43
44#endif