mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-05-07 03:03:57 +03:00
Imported Upstream version 0.26.0
This commit is contained in:
commit
9a2b6c69b6
1398 changed files with 212217 additions and 0 deletions
104
apps/opencs/model/world/commands.hpp
Normal file
104
apps/opencs/model/world/commands.hpp
Normal file
|
@ -0,0 +1,104 @@
|
|||
#ifndef CSM_WOLRD_COMMANDS_H
|
||||
#define CSM_WOLRD_COMMANDS_H
|
||||
|
||||
#include "record.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include <QVariant>
|
||||
#include <QUndoCommand>
|
||||
#include <QModelIndex>
|
||||
|
||||
#include "universalid.hpp"
|
||||
|
||||
class QModelIndex;
|
||||
class QAbstractItemModel;
|
||||
|
||||
namespace CSMWorld
|
||||
{
|
||||
class IdTable;
|
||||
class IdTable;
|
||||
class RecordBase;
|
||||
|
||||
class ModifyCommand : public QUndoCommand
|
||||
{
|
||||
QAbstractItemModel& mModel;
|
||||
QModelIndex mIndex;
|
||||
QVariant mNew;
|
||||
QVariant mOld;
|
||||
|
||||
public:
|
||||
|
||||
ModifyCommand (QAbstractItemModel& model, const QModelIndex& index, const QVariant& new_,
|
||||
QUndoCommand *parent = 0);
|
||||
|
||||
virtual void redo();
|
||||
|
||||
virtual void undo();
|
||||
};
|
||||
|
||||
class CreateCommand : public QUndoCommand
|
||||
{
|
||||
IdTable& mModel;
|
||||
std::string mId;
|
||||
UniversalId::Type mType;
|
||||
std::map<int, QVariant> mValues;
|
||||
|
||||
public:
|
||||
|
||||
CreateCommand (IdTable& model, const std::string& id, QUndoCommand *parent = 0);
|
||||
|
||||
void setType (UniversalId::Type type);
|
||||
|
||||
void addValue (int column, const QVariant& value);
|
||||
|
||||
virtual void redo();
|
||||
|
||||
virtual void undo();
|
||||
};
|
||||
|
||||
class RevertCommand : public QUndoCommand
|
||||
{
|
||||
IdTable& mModel;
|
||||
std::string mId;
|
||||
RecordBase *mOld;
|
||||
|
||||
// not implemented
|
||||
RevertCommand (const RevertCommand&);
|
||||
RevertCommand& operator= (const RevertCommand&);
|
||||
|
||||
public:
|
||||
|
||||
RevertCommand (IdTable& model, const std::string& id, QUndoCommand *parent = 0);
|
||||
|
||||
virtual ~RevertCommand();
|
||||
|
||||
virtual void redo();
|
||||
|
||||
virtual void undo();
|
||||
};
|
||||
|
||||
class DeleteCommand : public QUndoCommand
|
||||
{
|
||||
IdTable& mModel;
|
||||
std::string mId;
|
||||
RecordBase *mOld;
|
||||
|
||||
// not implemented
|
||||
DeleteCommand (const DeleteCommand&);
|
||||
DeleteCommand& operator= (const DeleteCommand&);
|
||||
|
||||
public:
|
||||
|
||||
DeleteCommand (IdTable& model, const std::string& id, QUndoCommand *parent = 0);
|
||||
|
||||
virtual ~DeleteCommand();
|
||||
|
||||
virtual void redo();
|
||||
|
||||
virtual void undo();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue