forked from mirror/openmw-tes3mp
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.2 KiB
C++
74 lines
2.2 KiB
C++
11 years ago
|
#ifndef CONTENTMODEL_HPP
|
||
|
#define CONTENTMODEL_HPP
|
||
|
|
||
|
#include <QAbstractTableModel>
|
||
11 years ago
|
#include <QStringList>
|
||
11 years ago
|
|
||
|
namespace ContentSelectorModel
|
||
11 years ago
|
{
|
||
|
class EsmFile;
|
||
|
|
||
|
typedef QList<EsmFile *> ContentFileList;
|
||
|
|
||
11 years ago
|
enum ContentType
|
||
|
{
|
||
|
ContentType_GameFile,
|
||
|
ContentType_Addon
|
||
|
};
|
||
|
|
||
11 years ago
|
class ContentModel : public QAbstractTableModel
|
||
|
{
|
||
|
Q_OBJECT
|
||
|
public:
|
||
|
explicit ContentModel(QObject *parent = 0);
|
||
|
|
||
11 years ago
|
//void setEncoding(const QString &encoding);
|
||
11 years ago
|
|
||
|
int rowCount(const QModelIndex &parent = QModelIndex()) const;
|
||
|
int columnCount(const QModelIndex &parent = QModelIndex()) const;
|
||
|
|
||
|
QVariant data(const QModelIndex &index, int role) const;
|
||
|
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||
|
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
|
||
|
|
||
|
bool insertRows(int position, int rows, const QModelIndex &index = QModelIndex());
|
||
|
bool removeRows(int position, int rows, const QModelIndex &index = QModelIndex());
|
||
|
|
||
|
Qt::DropActions supportedDropActions() const;
|
||
|
QStringList mimeTypes() const;
|
||
|
QMimeData *mimeData(const QModelIndexList &indexes) const;
|
||
|
bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
|
||
|
|
||
|
void addFiles(const QString &path);
|
||
|
|
||
11 years ago
|
QModelIndex indexFromItem(const EsmFile *item) const;
|
||
|
const EsmFile *findItem(const QString &name) const;
|
||
11 years ago
|
|
||
11 years ago
|
bool isChecked(const QString &name) const;
|
||
|
void setCheckState(const QString &name, bool isChecked);
|
||
11 years ago
|
ContentFileList checkedItems() const;
|
||
|
void uncheckAll();
|
||
11 years ago
|
|
||
11 years ago
|
private:
|
||
|
|
||
|
void addFile(EsmFile *file);
|
||
11 years ago
|
const EsmFile *item(int row) const;
|
||
|
EsmFile *item(int row);
|
||
11 years ago
|
bool canBeChecked(const EsmFile *file) const;
|
||
|
|
||
|
ContentFileList mFiles;
|
||
|
QHash<QString, Qt::CheckState> mCheckStates;
|
||
11 years ago
|
QTextCodec *mCodec;
|
||
11 years ago
|
|
||
11 years ago
|
public:
|
||
|
QString mMimeType;
|
||
|
QStringList mMimeTypes;
|
||
|
int mColumnCount;
|
||
|
Qt::ItemFlags mDragDropFlags;
|
||
|
Qt::ItemFlags mDefaultFlags;
|
||
|
Qt::DropActions mDropActions;
|
||
11 years ago
|
|
||
|
};
|
||
|
}
|
||
|
#endif // CONTENTMODEL_HPP
|