Add src/xmbmodel.h
This commit is contained in:
parent
1aa795ebf7
commit
54410d36bf
31
src/xmbmodel.h
Normal file
31
src/xmbmodel.h
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
#pragma once
|
||||||
|
#include <QObject>
|
||||||
|
#include <QVariantList>
|
||||||
|
#include "xmbconfig.h"
|
||||||
|
|
||||||
|
class XmbModel : public QObject {
|
||||||
|
Q_OBJECT
|
||||||
|
Q_PROPERTY(QVariantList categories READ categories NOTIFY categoriesChanged)
|
||||||
|
Q_PROPERTY(int categoryCount READ categoryCount NOTIFY categoriesChanged)
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit XmbModel(QObject* parent=nullptr);
|
||||||
|
|
||||||
|
Q_INVOKABLE QVariantList itemsForCategory(int idx) const;
|
||||||
|
Q_INVOKABLE QString assetUrl(const QString& rel) const;
|
||||||
|
Q_INVOKABLE QString bootQml() const;
|
||||||
|
|
||||||
|
QVariantList categories() const { return m_categories; }
|
||||||
|
int categoryCount() const { return m_categories.size(); }
|
||||||
|
|
||||||
|
Q_INVOKABLE void reload();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void categoriesChanged();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void build();
|
||||||
|
|
||||||
|
XmbConfig m_cfg;
|
||||||
|
QVariantList m_categories; // each: { title, icon, items: [entryMaps...] }
|
||||||
|
};
|
||||||
Loading…
x
Reference in New Issue
Block a user