2012-11-26 11:29:22 +00:00
|
|
|
#ifndef CSM_WOLRD_COLUMNS_H
|
|
|
|
#define CSM_WOLRD_COLUMNS_H
|
|
|
|
|
|
|
|
#include "idcollection.hpp"
|
|
|
|
|
|
|
|
namespace CSMWorld
|
|
|
|
{
|
|
|
|
template<typename ESXRecordT>
|
|
|
|
struct FloatValueColumn : public Column<ESXRecordT>
|
|
|
|
{
|
|
|
|
FloatValueColumn() : Column<ESXRecordT> ("Value") {}
|
|
|
|
|
|
|
|
virtual QVariant get (const Record<ESXRecordT>& record) const
|
|
|
|
{
|
|
|
|
return record.get().mValue;
|
|
|
|
}
|
2012-11-29 13:45:34 +00:00
|
|
|
|
|
|
|
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
|
|
|
{
|
|
|
|
ESXRecordT base = record.getBase();
|
|
|
|
base.mValue = data.toFloat();
|
|
|
|
record.setModified (base);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool isEditable() const
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
2012-11-26 11:29:22 +00:00
|
|
|
};
|
|
|
|
|
2012-11-29 17:56:28 +00:00
|
|
|
template<typename ESXRecordT>
|
|
|
|
struct StringIdColumn : public Column<ESXRecordT>
|
|
|
|
{
|
|
|
|
StringIdColumn() : Column<ESXRecordT> ("ID") {}
|
|
|
|
|
|
|
|
virtual QVariant get (const Record<ESXRecordT>& record) const
|
|
|
|
{
|
|
|
|
return record.get().mId.c_str();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool isEditable() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2012-12-01 12:42:12 +00:00
|
|
|
template<typename ESXRecordT>
|
|
|
|
struct RecordStateColumn : public Column<ESXRecordT>
|
|
|
|
{
|
|
|
|
RecordStateColumn() : Column<ESXRecordT> ("*") {}
|
|
|
|
|
|
|
|
virtual QVariant get (const Record<ESXRecordT>& record) const
|
|
|
|
{
|
2012-12-03 12:56:02 +00:00
|
|
|
if (record.mState==Record<ESXRecordT>::State_Erased)
|
|
|
|
return static_cast<int> (Record<ESXRecordT>::State_Deleted);
|
|
|
|
|
2012-12-01 12:42:12 +00:00
|
|
|
return static_cast<int> (record.mState);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual bool isEditable() const
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
};
|
2012-11-26 11:29:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|