2016-05-26 02:15:41 +02:00
|
|
|
#ifndef KNOWNFIELDMODEL_H
|
|
|
|
#define KNOWNFIELDMODEL_H
|
2015-04-22 19:33:53 +02:00
|
|
|
|
2016-07-27 18:31:42 +02:00
|
|
|
#if defined(GUI_QTWIDGETS) || defined(GUI_QTQUICK)
|
|
|
|
# include <qtutilities/models/checklistmodel.h>
|
|
|
|
# include <QAbstractListModel>
|
|
|
|
# include <QList>
|
|
|
|
#else
|
|
|
|
# include <c++utilities/application/global.h>
|
|
|
|
# define Q_OBJECT
|
|
|
|
#endif
|
2015-04-22 19:33:53 +02:00
|
|
|
|
|
|
|
namespace Media {
|
2016-07-11 21:34:05 +02:00
|
|
|
DECLARE_ENUM_CLASS(KnownField, unsigned int);
|
2015-04-22 19:33:53 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace Settings {
|
|
|
|
|
2016-07-27 18:31:42 +02:00
|
|
|
class KnownFieldModel
|
|
|
|
#if defined(GUI_QTWIDGETS) || defined(GUI_QTQUICK)
|
|
|
|
: public Models::ChecklistModel
|
|
|
|
#endif
|
2015-04-22 19:33:53 +02:00
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
enum class DefaultSelection
|
|
|
|
{
|
|
|
|
None,
|
|
|
|
CommonFields
|
|
|
|
};
|
|
|
|
|
|
|
|
static const char *fieldName(Media::KnownField field);
|
2016-07-27 18:31:42 +02:00
|
|
|
|
|
|
|
#if defined(GUI_QTWIDGETS) || defined(GUI_QTQUICK)
|
2015-04-22 19:33:53 +02:00
|
|
|
static QString translatedFieldName(Media::KnownField field);
|
2016-03-03 22:21:15 +01:00
|
|
|
static Models::ChecklistItem mkItem(Media::KnownField field, Qt::CheckState checkState = Qt::Checked);
|
2015-04-22 19:33:53 +02:00
|
|
|
|
|
|
|
explicit KnownFieldModel(QObject *parent = nullptr, DefaultSelection defaultSelection = DefaultSelection::None);
|
2016-03-03 22:21:15 +01:00
|
|
|
explicit KnownFieldModel(const QList<Models::ChecklistItem> &items, QObject *parent = nullptr);
|
2015-04-22 19:33:53 +02:00
|
|
|
|
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
|
|
|
virtual QString labelForId(const QVariant &id) const;
|
2016-07-27 18:31:42 +02:00
|
|
|
#endif
|
2015-04-22 19:33:53 +02:00
|
|
|
};
|
|
|
|
|
2016-07-27 18:31:42 +02:00
|
|
|
#if defined(GUI_QTWIDGETS) || defined(GUI_QTQUICK)
|
2016-03-23 22:02:43 +01:00
|
|
|
inline Models::ChecklistItem KnownFieldModel::mkItem(Media::KnownField field, Qt::CheckState checkState)
|
|
|
|
{
|
|
|
|
return Models::ChecklistItem(static_cast<int>(field), translatedFieldName(field), checkState);
|
|
|
|
}
|
2016-07-27 18:31:42 +02:00
|
|
|
#endif
|
2016-03-23 22:02:43 +01:00
|
|
|
|
2015-04-22 19:33:53 +02:00
|
|
|
}
|
|
|
|
|
2016-05-26 02:15:41 +02:00
|
|
|
#endif // KNOWNFIELDMODEL_H
|