You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
openmw/apps/opencs/view/world/bodypartcreator.cpp

54 lines
1.1 KiB
C++

#include "bodypartcreator.hpp"
#include <QCheckBox>
#include "../../model/world/data.hpp"
#include "../../model/world/universalid.hpp"
#include <apps/opencs/view/world/genericcreator.hpp>
std::string CSVWorld::BodyPartCreator::getId() const
{
std::string id = CSVWorld::GenericCreator::getId();
if (mFirstPerson->isChecked())
{
id += ".1st";
}
return id;
}
CSVWorld::BodyPartCreator::BodyPartCreator(CSMWorld::Data& data, QUndoStack& undoStack, const CSMWorld::UniversalId& id)
: GenericCreator(data, undoStack, id)
{
mFirstPerson = new QCheckBox("First Person", this);
insertBeforeButtons(mFirstPerson, false);
connect(mFirstPerson, &QCheckBox::clicked, this, &BodyPartCreator::checkboxClicked);
}
std::string CSVWorld::BodyPartCreator::getErrors() const
{
std::string errors;
std::string id = getId();
if (getData().hasId(id))
{
errors = "ID is already in use";
}
return errors;
}
void CSVWorld::BodyPartCreator::reset()
{
CSVWorld::GenericCreator::reset();
mFirstPerson->setChecked(false);
}
void CSVWorld::BodyPartCreator::checkboxClicked()
{
update();
}