forked from teamnwah/openmw-tes3coop
moved ColumnBase and Column struct into a separate translation unit
parent
f95e72166c
commit
77852439ce
@ -0,0 +1,13 @@
|
||||
|
||||
#include "columnbase.hpp"
|
||||
|
||||
CSMWorld::ColumnBase::ColumnBase (const std::string& title, int flags)
|
||||
: mTitle (title), mFlags (flags)
|
||||
{}
|
||||
|
||||
CSMWorld::ColumnBase::~ColumnBase() {}
|
||||
|
||||
bool CSMWorld::ColumnBase::isUserEditable() const
|
||||
{
|
||||
return isEditable();
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
#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
|
||||
{
|
||||
Role_Flags = Qt::UserRole
|
||||
};
|
||||
|
||||
enum Flags
|
||||
{
|
||||
Flag_Table = 1, // column should be displayed in table view
|
||||
Flag_Dialogue = 2 // column should be displayed in dialogue view
|
||||
};
|
||||
|
||||
std::string mTitle;
|
||||
int mFlags;
|
||||
|
||||
ColumnBase (const std::string& title, int flag);
|
||||
|
||||
virtual ~ColumnBase();
|
||||
|
||||
virtual bool isEditable() const = 0;
|
||||
|
||||
virtual bool isUserEditable() const;
|
||||
///< Can this column be edited directly by the user?
|
||||
};
|
||||
|
||||
template<typename ESXRecordT>
|
||||
struct Column : public ColumnBase
|
||||
{
|
||||
std::string mTitle;
|
||||
int mFlags;
|
||||
|
||||
Column (const std::string& title, int flags = Flag_Table | Flag_Dialogue)
|
||||
: ColumnBase (title, flags) {}
|
||||
|
||||
virtual QVariant get (const Record<ESXRecordT>& record) const = 0;
|
||||
|
||||
virtual void set (Record<ESXRecordT>& record, const QVariant& data)
|
||||
{
|
||||
throw std::logic_error ("Column " + mTitle + " is not editable");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
@ -1,17 +1,6 @@
|
||||
|
||||
#include "idcollection.hpp"
|
||||
|
||||
CSMWorld::ColumnBase::ColumnBase (const std::string& title, int flags)
|
||||
: mTitle (title), mFlags (flags)
|
||||
{}
|
||||
|
||||
CSMWorld::ColumnBase::~ColumnBase() {}
|
||||
|
||||
bool CSMWorld::ColumnBase::isUserEditable() const
|
||||
{
|
||||
return isEditable();
|
||||
}
|
||||
|
||||
CSMWorld::IdCollectionBase::IdCollectionBase() {}
|
||||
|
||||
CSMWorld::IdCollectionBase::~IdCollectionBase() {}
|
Loading…
Reference in New Issue