2012-12-16 11:52:23 +00:00
|
|
|
#ifndef CSM_WOLRD_COLUMNBASE_H
|
|
|
|
#define CSM_WOLRD_COLUMNBASE_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include <Qt>
|
|
|
|
#include <QVariant>
|
|
|
|
|
|
|
|
#include "record.hpp"
|
|
|
|
|
|
|
|
namespace CSMWorld
|
|
|
|
{
|
|
|
|
struct ColumnBase
|
|
|
|
{
|
|
|
|
enum Roles
|
|
|
|
{
|
2013-01-03 10:20:25 +00:00
|
|
|
Role_Flags = Qt::UserRole,
|
|
|
|
Role_Display = Qt::UserRole+1
|
2012-12-16 11:52:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
enum Flags
|
|
|
|
{
|
|
|
|
Flag_Table = 1, // column should be displayed in table view
|
|
|
|
Flag_Dialogue = 2 // column should be displayed in dialogue view
|
|
|
|
};
|
|
|
|
|
2013-01-03 10:20:25 +00:00
|
|
|
enum Display
|
|
|
|
{
|
2014-02-20 18:27:51 +00:00
|
|
|
Display_None, //Do not use
|
2013-01-03 10:20:25 +00:00
|
|
|
Display_String,
|
2014-02-12 08:04:52 +00:00
|
|
|
|
|
|
|
//CONCRETE TYPES STARTS HERE
|
|
|
|
Display_Skill,
|
|
|
|
Display_Class,
|
|
|
|
Display_Faction,
|
|
|
|
Display_Race,
|
|
|
|
Display_Sound,
|
|
|
|
Display_Region,
|
|
|
|
Display_Birthsign,
|
|
|
|
Display_Spell,
|
|
|
|
Display_Cell,
|
|
|
|
Display_Referenceable,
|
|
|
|
Display_Activator,
|
|
|
|
Display_Potion,
|
|
|
|
Display_Apparatus,
|
|
|
|
Display_Armor,
|
|
|
|
Display_Book,
|
|
|
|
Display_Clothing,
|
|
|
|
Display_Container,
|
|
|
|
Display_Creature,
|
|
|
|
Display_Door,
|
|
|
|
Display_Ingredient,
|
|
|
|
Display_CreatureLevelledList,
|
|
|
|
Display_ItemLevelledList,
|
|
|
|
Display_Light,
|
|
|
|
Display_Lockpick,
|
|
|
|
Display_Miscellaneous,
|
|
|
|
Display_Npc,
|
|
|
|
Display_Probe,
|
|
|
|
Display_Repair,
|
|
|
|
Display_Static,
|
|
|
|
Display_Weapon,
|
|
|
|
Display_Reference,
|
|
|
|
Display_Filter,
|
|
|
|
Display_Topic,
|
|
|
|
Display_Journal,
|
|
|
|
Display_TopicInfo,
|
|
|
|
Display_JournalInfo,
|
|
|
|
Display_Scene,
|
|
|
|
//CONCRETE TYPES ENDS HERE
|
|
|
|
|
2013-01-03 10:20:25 +00:00
|
|
|
Display_Integer,
|
2013-02-08 13:48:38 +00:00
|
|
|
Display_Float,
|
2013-02-17 16:27:25 +00:00
|
|
|
Display_Var,
|
2013-03-05 10:37:13 +00:00
|
|
|
Display_GmstVarType,
|
2013-03-23 12:13:53 +00:00
|
|
|
Display_GlobalVarType,
|
2013-03-24 14:50:29 +00:00
|
|
|
Display_Specialisation,
|
2013-03-26 08:51:39 +00:00
|
|
|
Display_Attribute,
|
2013-04-09 09:53:47 +00:00
|
|
|
Display_Boolean,
|
2013-04-10 18:14:10 +00:00
|
|
|
Display_SpellType,
|
2013-05-13 10:51:27 +00:00
|
|
|
Display_Script,
|
2013-05-14 12:21:30 +00:00
|
|
|
Display_ApparatusType,
|
2013-05-15 09:37:46 +00:00
|
|
|
Display_ArmorType,
|
2013-05-16 14:27:33 +00:00
|
|
|
Display_ClothingType,
|
2013-05-19 12:44:41 +00:00
|
|
|
Display_CreatureType,
|
2013-05-29 11:38:35 +00:00
|
|
|
Display_WeaponType,
|
2013-06-29 13:11:09 +00:00
|
|
|
Display_RecordState,
|
2013-10-20 15:26:09 +00:00
|
|
|
Display_RefRecordType,
|
2013-10-31 11:54:55 +00:00
|
|
|
Display_DialogueType,
|
2013-11-05 10:41:48 +00:00
|
|
|
Display_QuestStatusType,
|
|
|
|
Display_Gender
|
2013-01-03 10:20:25 +00:00
|
|
|
};
|
|
|
|
|
2013-08-07 07:36:05 +00:00
|
|
|
int mColumnId;
|
2012-12-16 11:52:23 +00:00
|
|
|
int mFlags;
|
2013-01-03 10:20:25 +00:00
|
|
|
Display mDisplayType;
|
2012-12-16 11:52:23 +00:00
|
|
|
|
2013-08-07 07:36:05 +00:00
|
|
|
ColumnBase (int columnId, Display displayType, int flag);
|
2012-12-16 11:52:23 +00:00
|
|
|
|
|
|
|
virtual ~ColumnBase();
|
|
|
|
|
|
|
|
virtual bool isEditable() const = 0;
|
|
|
|
|
|
|
|
virtual bool isUserEditable() const;
|
|
|
|
///< Can this column be edited directly by the user?
|
2013-01-03 10:20:25 +00:00
|
|
|
|
2013-08-07 07:36:05 +00:00
|
|
|
virtual std::string getTitle() const;
|
2014-03-08 14:27:43 +00:00
|
|
|
|
|
|
|
virtual int getId() const;
|
2012-12-16 11:52:23 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
template<typename ESXRecordT>
|
|
|
|
struct Column : public ColumnBase
|
|
|
|
{
|
|
|
|
int mFlags;
|
|
|
|
|
2013-08-07 07:36:05 +00:00
|
|
|
Column (int columnId, Display displayType, int flags = Flag_Table | Flag_Dialogue)
|
|
|
|
: ColumnBase (columnId, displayType, flags) {}
|
2012-12-16 11:52:23 +00:00
|
|
|
|
|
|
|
virtual QVariant get (const Record<ESXRecordT>& record) const = 0;
|
|
|
|
|
|
|
|
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
|
|
|
{
|
2013-08-07 07:36:05 +00:00
|
|
|
throw std::logic_error ("Column " + getTitle() + " is not editable");
|
2012-12-16 11:52:23 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|