mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 19:49:56 +00:00
Add edit locking to ExtendedCommandConfigurator
This commit is contained in:
parent
6033e67b4a
commit
9a936046f6
3 changed files with 30 additions and 1 deletions
|
@ -20,7 +20,8 @@ CSVWorld::ExtendedCommandConfigurator::ExtendedCommandConfigurator(CSMDoc::Docum
|
||||||
mNumUsedCheckBoxes(0),
|
mNumUsedCheckBoxes(0),
|
||||||
mNumChecked(0),
|
mNumChecked(0),
|
||||||
mMode(Mode_None),
|
mMode(Mode_None),
|
||||||
mData(document.getData())
|
mData(document.getData()),
|
||||||
|
mEditLock(false)
|
||||||
{
|
{
|
||||||
mCommandDispatcher = new CSMWorld::CommandDispatcher(document, id, this);
|
mCommandDispatcher = new CSMWorld::CommandDispatcher(document, id, this);
|
||||||
|
|
||||||
|
@ -58,8 +59,19 @@ void CSVWorld::ExtendedCommandConfigurator::configure(CSVWorld::ExtendedCommandC
|
||||||
mPerformButton->setText((mMode == Mode_Delete) ? "Extended Delete" : "Extended Revert");
|
mPerformButton->setText((mMode == Mode_Delete) ? "Extended Delete" : "Extended Revert");
|
||||||
mSelectedIds = selectedIds;
|
mSelectedIds = selectedIds;
|
||||||
mCommandDispatcher->setSelection(mSelectedIds);
|
mCommandDispatcher->setSelection(mSelectedIds);
|
||||||
|
|
||||||
setupCheckBoxes(mCommandDispatcher->getExtendedTypes());
|
setupCheckBoxes(mCommandDispatcher->getExtendedTypes());
|
||||||
setupGroupLayout();
|
setupGroupLayout();
|
||||||
|
lockWidgets(mEditLock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CSVWorld::ExtendedCommandConfigurator::setEditLock(bool locked)
|
||||||
|
{
|
||||||
|
if (mEditLock != locked)
|
||||||
|
{
|
||||||
|
mEditLock = locked;
|
||||||
|
lockWidgets(mEditLock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,6 +156,18 @@ void CSVWorld::ExtendedCommandConfigurator::setupCheckBoxes(const std::vector<CS
|
||||||
mNumChecked = mNumUsedCheckBoxes = numTypes;
|
mNumChecked = mNumUsedCheckBoxes = numTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVWorld::ExtendedCommandConfigurator::lockWidgets(bool locked)
|
||||||
|
{
|
||||||
|
mPerformButton->setEnabled(!mEditLock && mNumChecked > 0);
|
||||||
|
|
||||||
|
CheckBoxMap::const_iterator current = mTypeCheckBoxes.begin();
|
||||||
|
CheckBoxMap::const_iterator end = mTypeCheckBoxes.end();
|
||||||
|
for (int i = 0; current != end && i < mNumUsedCheckBoxes; ++current, ++i)
|
||||||
|
{
|
||||||
|
current->first->setEnabled(!mEditLock);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CSVWorld::ExtendedCommandConfigurator::performExtendedCommand()
|
void CSVWorld::ExtendedCommandConfigurator::performExtendedCommand()
|
||||||
{
|
{
|
||||||
std::vector<CSMWorld::UniversalId> types;
|
std::vector<CSMWorld::UniversalId> types;
|
||||||
|
|
|
@ -48,8 +48,11 @@ namespace CSVWorld
|
||||||
CSMWorld::Data &mData;
|
CSMWorld::Data &mData;
|
||||||
std::vector<std::string> mSelectedIds;
|
std::vector<std::string> mSelectedIds;
|
||||||
|
|
||||||
|
bool mEditLock;
|
||||||
|
|
||||||
void setupGroupLayout();
|
void setupGroupLayout();
|
||||||
void setupCheckBoxes(const std::vector<CSMWorld::UniversalId> &types);
|
void setupCheckBoxes(const std::vector<CSMWorld::UniversalId> &types);
|
||||||
|
void lockWidgets(bool locked);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ExtendedCommandConfigurator(CSMDoc::Document &document,
|
ExtendedCommandConfigurator(CSMDoc::Document &document,
|
||||||
|
@ -57,6 +60,7 @@ namespace CSVWorld
|
||||||
QWidget *parent = 0);
|
QWidget *parent = 0);
|
||||||
|
|
||||||
void configure(Mode mode, const std::vector<std::string> &selectedIds);
|
void configure(Mode mode, const std::vector<std::string> &selectedIds);
|
||||||
|
void setEditLock(bool locked);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void resizeEvent(QResizeEvent *event);
|
virtual void resizeEvent(QResizeEvent *event);
|
||||||
|
|
|
@ -123,6 +123,7 @@ void CSVWorld::TableBottomBox::setEditLock (bool locked)
|
||||||
{
|
{
|
||||||
if (mCreator)
|
if (mCreator)
|
||||||
mCreator->setEditLock (locked);
|
mCreator->setEditLock (locked);
|
||||||
|
mExtendedConfigurator->setEditLock (locked);
|
||||||
}
|
}
|
||||||
|
|
||||||
CSVWorld::TableBottomBox::~TableBottomBox()
|
CSVWorld::TableBottomBox::~TableBottomBox()
|
||||||
|
|
Loading…
Reference in a new issue