1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-20 07:53:51 +00:00

Disable reference creator widget when in the clone mode.

This commit is contained in:
Marek Kochanowicz 2014-01-23 16:17:04 +01:00
parent dda7ddb6f8
commit c87d9ff38d
3 changed files with 28 additions and 4 deletions

View file

@ -29,11 +29,13 @@ namespace CSVWorld
std::string mErrors;
QHBoxLayout *mLayout;
bool mLocked;
bool mCloneMode;
std::string mClonedId;
CSMWorld::UniversalId::Type mClonedType;
CSMWorld::UniversalId::ArgumentType mArgumentType;
protected:
bool mCloneMode;
protected:
void update();

View file

@ -49,6 +49,11 @@ std::string CSVWorld::ReferenceCreator::getErrors() const
{
std::string errors = GenericCreator::getErrors();
if (mCloneMode)
{
return errors;
}
std::string cell = mCell->text().toUtf8().constData();
if (cell.empty())
@ -73,3 +78,15 @@ void CSVWorld::ReferenceCreator::cellChanged()
{
update();
}
void CSVWorld::ReferenceCreator::toggleWidgets(bool active)
{
CSVWorld::GenericCreator::toggleWidgets(active);
mCell->setEnabled(active);
}
void CSVWorld::ReferenceCreator::cloneMode(const std::string& originid, const CSMWorld::UniversalId::Type type, const CSMWorld::UniversalId::ArgumentType argumentType)
{
CSVWorld::GenericCreator::cloneMode(originid, type, argumentType);
cellChanged(); //otherwise ok button will remain disabled
}

View file

@ -25,7 +25,12 @@ namespace CSVWorld
ReferenceCreator (CSMWorld::Data& data, QUndoStack& undoStack,
const CSMWorld::UniversalId& id);
virtual void cloneMode(const std::string& originid,
const CSMWorld::UniversalId::Type type,
const CSMWorld::UniversalId::ArgumentType argumentType);
virtual void reset();
virtual void toggleWidgets(bool active = true);
virtual std::string getErrors() const;
///< Return formatted error descriptions for the current state of the creator. if an empty