mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-08 09:37:53 +00:00
50 lines
1.4 KiB
C++
50 lines
1.4 KiB
C++
|
|
#include "referenceablecreator.hpp"
|
|
|
|
#include <QComboBox>
|
|
#include <QLabel>
|
|
|
|
#include "../../model/world/universalid.hpp"
|
|
#include "../../model/world/commands.hpp"
|
|
|
|
void CSVWorld::ReferenceableCreator::configureCreateCommand (CSMWorld::CreateCommand& command) const
|
|
{
|
|
command.setType (
|
|
static_cast<CSMWorld::UniversalId::Type> (mType->itemData (mType->currentIndex()).toInt()));
|
|
}
|
|
|
|
CSVWorld::ReferenceableCreator::ReferenceableCreator (CSMWorld::Data& data, QUndoStack& undoStack,
|
|
const CSMWorld::UniversalId& id)
|
|
: GenericCreator (data, undoStack, id)
|
|
{
|
|
QLabel *label = new QLabel ("Type", this);
|
|
insertBeforeButtons (label, false);
|
|
|
|
std::vector<CSMWorld::UniversalId::Type> types = CSMWorld::UniversalId::listReferenceableTypes();
|
|
|
|
mType = new QComboBox (this);
|
|
|
|
for (std::vector<CSMWorld::UniversalId::Type>::const_iterator iter (types.begin());
|
|
iter!=types.end(); ++iter)
|
|
{
|
|
CSMWorld::UniversalId id (*iter, "");
|
|
|
|
mType->addItem (QIcon (id.getIcon().c_str()), id.getTypeName().c_str(),
|
|
static_cast<int> (id.getType()));
|
|
}
|
|
|
|
insertBeforeButtons (mType, false);
|
|
}
|
|
|
|
void CSVWorld::ReferenceableCreator::reset()
|
|
{
|
|
mType->setCurrentIndex (0);
|
|
GenericCreator::reset();
|
|
}
|
|
|
|
void CSVWorld::ReferenceableCreator::toggleWidgets(bool active)
|
|
{
|
|
CSVWorld::GenericCreator::toggleWidgets(active);
|
|
mType->setEnabled(active);
|
|
}
|