mirror of
https://github.com/MultiMC/MultiMC5.git
synced 2024-11-20 08:10:11 +00:00
253067c782
Also, implemented some basic modlist logic, to be wired up.
44 lines
1.1 KiB
C++
44 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <QAbstractListModel>
|
|
#include "categorizedsortfilterproxymodel.h"
|
|
#include "logic/lists/InstanceList.h"
|
|
#include <QIcon>
|
|
|
|
class InstanceModel : public QAbstractListModel
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
enum AdditionalRoles
|
|
{
|
|
InstancePointerRole = 0x34B1CB48 ///< Return pointer to real instance
|
|
};
|
|
explicit InstanceModel ( const InstanceList& instances,
|
|
QObject *parent = 0 );
|
|
|
|
QModelIndex index ( int row, int column = 0,
|
|
const QModelIndex& parent = QModelIndex() ) const;
|
|
int rowCount ( const QModelIndex& parent = QModelIndex() ) const;
|
|
QVariant data ( const QModelIndex& index, int role ) const;
|
|
Qt::ItemFlags flags ( const QModelIndex& index ) const;
|
|
|
|
public slots:
|
|
void onInstanceAdded(int index);
|
|
void onInstanceChanged(int index);
|
|
void onInvalidated();
|
|
|
|
private:
|
|
const InstanceList* m_instances;
|
|
int currentInstancesNumber;
|
|
};
|
|
|
|
class InstanceProxyModel : public KCategorizedSortFilterProxyModel
|
|
{
|
|
public:
|
|
explicit InstanceProxyModel ( QObject *parent = 0 );
|
|
|
|
protected:
|
|
virtual bool subSortLessThan ( const QModelIndex& left, const QModelIndex& right ) const;
|
|
};
|
|
|