2013-07-26 12:34:30 +02:00
|
|
|
#ifndef CSV_WORLD_GENERICCREATOR_H
|
|
|
|
#define CSV_WORLD_GENERICCREATOR_H
|
|
|
|
|
2014-01-19 11:44:47 +01:00
|
|
|
class QString;
|
2013-07-28 13:43:16 +02:00
|
|
|
class QPushButton;
|
|
|
|
class QLineEdit;
|
2013-07-28 18:08:57 +02:00
|
|
|
class QHBoxLayout;
|
2013-07-28 13:43:16 +02:00
|
|
|
|
2013-07-26 12:34:30 +02:00
|
|
|
#include "creator.hpp"
|
|
|
|
|
2013-07-28 13:43:16 +02:00
|
|
|
#include "../../model/world/universalid.hpp"
|
|
|
|
|
2013-07-30 10:27:17 +02:00
|
|
|
namespace CSMWorld
|
|
|
|
{
|
|
|
|
class CreateCommand;
|
|
|
|
}
|
|
|
|
|
2013-07-26 12:34:30 +02:00
|
|
|
namespace CSVWorld
|
|
|
|
{
|
|
|
|
class GenericCreator : public Creator
|
|
|
|
{
|
2013-07-26 21:09:23 +02:00
|
|
|
Q_OBJECT
|
|
|
|
|
2013-07-28 13:43:16 +02:00
|
|
|
CSMWorld::Data& mData;
|
|
|
|
QUndoStack& mUndoStack;
|
|
|
|
CSMWorld::UniversalId mListId;
|
|
|
|
QPushButton *mCreate;
|
|
|
|
QLineEdit *mId;
|
|
|
|
std::string mErrors;
|
2013-07-28 18:08:57 +02:00
|
|
|
QHBoxLayout *mLayout;
|
2013-07-28 14:51:47 +02:00
|
|
|
bool mLocked;
|
2014-01-19 11:44:47 +01:00
|
|
|
std::string mClonedId;
|
|
|
|
CSMWorld::UniversalId::Type mClonedType;
|
2014-01-20 13:59:00 +01:00
|
|
|
CSMWorld::UniversalId::ArgumentType mArgumentType;
|
2014-01-23 16:17:04 +01:00
|
|
|
|
|
|
|
protected:
|
|
|
|
bool mCloneMode;
|
|
|
|
|
2013-07-28 18:08:57 +02:00
|
|
|
protected:
|
2013-07-28 13:43:16 +02:00
|
|
|
|
|
|
|
void update();
|
|
|
|
|
2013-07-28 18:08:57 +02:00
|
|
|
virtual void setManualEditing (bool enabled);
|
|
|
|
///< Enable/disable manual ID editing (enabled by default).
|
|
|
|
|
|
|
|
void insertAtBeginning (QWidget *widget, bool stretched);
|
|
|
|
|
2013-07-30 10:27:17 +02:00
|
|
|
void insertBeforeButtons (QWidget *widget, bool stretched);
|
|
|
|
|
2013-07-28 18:08:57 +02:00
|
|
|
virtual std::string getId() const;
|
|
|
|
|
2013-07-30 10:27:17 +02:00
|
|
|
virtual void configureCreateCommand (CSMWorld::CreateCommand& command) const;
|
2014-01-23 16:00:44 +01:00
|
|
|
|
2013-08-08 12:49:30 +02:00
|
|
|
CSMWorld::Data& getData() const;
|
2013-07-30 12:53:03 +02:00
|
|
|
|
2013-08-08 12:49:30 +02:00
|
|
|
const CSMWorld::UniversalId& getCollectionId() const;
|
2013-07-30 12:53:03 +02:00
|
|
|
|
2013-07-26 12:34:30 +02:00
|
|
|
public:
|
2013-07-26 21:09:23 +02:00
|
|
|
|
2013-07-28 13:43:16 +02:00
|
|
|
GenericCreator (CSMWorld::Data& data, QUndoStack& undoStack,
|
2013-10-22 11:08:37 +02:00
|
|
|
const CSMWorld::UniversalId& id, bool relaxedIdRules = false);
|
2013-07-26 21:09:23 +02:00
|
|
|
|
2013-07-28 14:51:47 +02:00
|
|
|
virtual void setEditLock (bool locked);
|
|
|
|
|
2013-07-26 21:09:23 +02:00
|
|
|
virtual void reset();
|
2014-01-23 16:00:44 +01:00
|
|
|
|
|
|
|
virtual void toggleWidgets (bool active = true);
|
2013-07-28 13:43:16 +02:00
|
|
|
|
2014-01-20 13:59:00 +01:00
|
|
|
virtual void cloneMode(const std::string& originid,
|
2014-01-27 13:08:14 +01:00
|
|
|
const CSMWorld::UniversalId::Type type);
|
2014-01-19 11:44:47 +01:00
|
|
|
|
2013-07-28 13:43:16 +02:00
|
|
|
virtual std::string getErrors() const;
|
|
|
|
///< Return formatted error descriptions for the current state of the creator. if an empty
|
|
|
|
/// string is returned, there is no error.
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
|
|
|
void textChanged (const QString& text);
|
|
|
|
|
|
|
|
void create();
|
2013-07-26 12:34:30 +02:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|