2016-05-26 02:15:41 +02:00
|
|
|
#ifndef TARGETLEVELMODEL_H
|
|
|
|
#define TARGETLEVELMODEL_H
|
|
|
|
|
|
|
|
#include <qtutilities/models/checklistmodel.h>
|
|
|
|
|
|
|
|
#include <QAbstractListModel>
|
|
|
|
#include <QList>
|
|
|
|
|
2018-03-06 23:10:13 +01:00
|
|
|
namespace TagParser {
|
2016-07-11 21:34:05 +02:00
|
|
|
DECLARE_ENUM_CLASS(TagTargetLevel, unsigned char);
|
2016-05-26 02:15:41 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
namespace Settings {
|
|
|
|
|
2018-03-11 18:58:50 +01:00
|
|
|
class TargetLevelModel : public Models::ChecklistModel {
|
2016-05-26 02:15:41 +02:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
2018-03-11 18:58:50 +01:00
|
|
|
enum class DefaultSelection { None, MostUsefulTargets };
|
2016-05-26 02:15:41 +02:00
|
|
|
|
2018-03-06 23:10:13 +01:00
|
|
|
static const char *fieldName(TagParser::TagTargetLevel targetLevel);
|
|
|
|
static QString translatedFieldName(TagParser::TagTargetLevel targetLevel);
|
|
|
|
static Models::ChecklistItem mkItem(TagParser::TagTargetLevel targetLevel, Qt::CheckState checkState = Qt::Checked);
|
2016-05-26 02:15:41 +02:00
|
|
|
|
|
|
|
explicit TargetLevelModel(QObject *parent = nullptr, DefaultSelection defaultSelection = DefaultSelection::None);
|
|
|
|
explicit TargetLevelModel(const QList<Models::ChecklistItem> &items, QObject *parent = nullptr);
|
|
|
|
|
|
|
|
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const;
|
|
|
|
virtual QString labelForId(const QVariant &id) const;
|
|
|
|
};
|
|
|
|
|
2018-03-06 23:10:13 +01:00
|
|
|
inline Models::ChecklistItem TargetLevelModel::mkItem(TagParser::TagTargetLevel field, Qt::CheckState checkState)
|
2016-05-26 02:15:41 +02:00
|
|
|
{
|
|
|
|
return Models::ChecklistItem(static_cast<int>(field), translatedFieldName(field), checkState);
|
|
|
|
}
|
|
|
|
|
2018-03-11 18:58:50 +01:00
|
|
|
} // namespace Settings
|
2016-05-26 02:15:41 +02:00
|
|
|
|
|
|
|
#endif // TARGETLEVELMODEL_H
|