QT6 Apparently means a lot of changes, these are the changes I've found to make at least CPP build. The problem is we just got rid of a lot of CPP and I don't know if the application will work. On the other hand, the QML isn't finished yet either, but this is the start of updating the application for QT6 and using MpvQt which is being built and maintained by KDE. This will be better as they'll keep the library updated for future QT updates so long as I still track with Kirigami.
101 lines
3.6 KiB
C++
101 lines
3.6 KiB
C++
#ifndef SERVICEITEMMODEL_H
|
|
#define SERVICEITEMMODEL_H
|
|
|
|
#include "serviceitem.h"
|
|
#include "slidemodel.h"
|
|
#include <QAbstractListModel>
|
|
#include <qabstractitemmodel.h>
|
|
#include <qnamespace.h>
|
|
#include <qobjectdefs.h>
|
|
#include <qsize.h>
|
|
|
|
#include "cxx-qt-gen/service_item_model.cxxqt.h"
|
|
|
|
class ServiceItemModelCpp : public QAbstractListModel {
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit ServiceItemModelCpp(QObject *parent = nullptr);
|
|
|
|
enum Roles {
|
|
NameRole = Qt::UserRole,
|
|
TypeRole,
|
|
BackgroundRole,
|
|
BackgroundTypeRole,
|
|
TextRole,
|
|
AudioRole,
|
|
FontRole,
|
|
FontSizeRole,
|
|
SlideNumberRole,
|
|
ActiveRole,
|
|
SelectedRole,
|
|
LoopRole
|
|
};
|
|
|
|
// Basic functionality:
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
// int columnCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
QVariant data(const QModelIndex &index,
|
|
int role = Qt::DisplayRole) const override;
|
|
QHash<int, QByteArray> roleNames() const override;
|
|
|
|
// Q_INVOKABLE int index(int row, int column,
|
|
// const QModelIndex &parent = QModelIndex()) const override;
|
|
// Q_INVOKABLE QModelIndex parent(const QModelIndex &index) const override;
|
|
|
|
// Editable:
|
|
bool setData(const QModelIndex &index, const QVariant &value,
|
|
int role = Qt::EditRole) override;
|
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
|
|
|
// Helper methods
|
|
void addItem(ServiceItem *item);
|
|
void insertItem(const int &index, ServiceItem *item);
|
|
Q_INVOKABLE void addItem(const QString &name, const QString &type,
|
|
const QString &background,
|
|
const QString &backgroundType,
|
|
const QStringList &text, const QString &audio,
|
|
const QString &font, const int &fontSize,
|
|
const int &slideNumber, const bool &loop);
|
|
Q_INVOKABLE void insertItem(const int &index, const QString &name,
|
|
const QString &type, const QString &background,
|
|
const QString &backgroundType, const QStringList &text,
|
|
const QString &audio, const QString &font,
|
|
const int &fontSize, const int &slideNumber,
|
|
const bool &loop);
|
|
Q_INVOKABLE void removeItem(int index);
|
|
Q_INVOKABLE void removeItems();
|
|
Q_INVOKABLE bool moveRows(int sourceIndex, int destIndex, int count);
|
|
Q_INVOKABLE bool moveRowsRust(int source, int dest, int count, ServiceItemModel *rustModel);
|
|
Q_INVOKABLE bool moveDown(int index);
|
|
Q_INVOKABLE bool moveUp(int index);
|
|
Q_INVOKABLE bool select(int id);
|
|
Q_INVOKABLE bool selectItems(QVariantList items);
|
|
Q_INVOKABLE bool activate(int id);
|
|
Q_INVOKABLE bool deactivate(int id);
|
|
Q_INVOKABLE QVariantMap getItem(int index) const;
|
|
Q_INVOKABLE QVariantMap getRust(int index, ServiceItemModel *rustModel) const;
|
|
Q_INVOKABLE QVariantList getItems();
|
|
Q_INVOKABLE void clearAll();
|
|
|
|
// Q_INVOKABLE bool save(QUrl file);
|
|
// Q_INVOKABLE bool load(QUrl file);
|
|
Q_INVOKABLE bool loadLastSaved();
|
|
|
|
signals:
|
|
void itemAdded(const int &, const ServiceItem &);
|
|
void itemAddedRust(const int &, const QVariantMap &);
|
|
void itemInserted(const int &, const ServiceItem &);
|
|
void itemInsertedRust(const int &, const QVariantMap &);
|
|
void rowMoved(const int &, const int &, const ServiceItem &);
|
|
void rowMovedRust(const int &, const int &, const QVariantMap &);
|
|
void rowRemoved(const int &, const ServiceItem &);
|
|
void rowRemovedRust(const int &, const QVariantMap &);
|
|
void allRemoved();
|
|
|
|
private:
|
|
|
|
QList<ServiceItem *> m_items;
|
|
};
|
|
|
|
#endif // SERVICEITEMMODEL_H
|