mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-16 17:19: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),
|
||||
mNumChecked(0),
|
||||
mMode(Mode_None),
|
||||
mData(document.getData())
|
||||
mData(document.getData()),
|
||||
mEditLock(false)
|
||||
{
|
||||
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");
|
||||
mSelectedIds = selectedIds;
|
||||
mCommandDispatcher->setSelection(mSelectedIds);
|
||||
|
||||
setupCheckBoxes(mCommandDispatcher->getExtendedTypes());
|
||||
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;
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
std::vector<CSMWorld::UniversalId> types;
|
||||
|
|
|
@ -48,8 +48,11 @@ namespace CSVWorld
|
|||
CSMWorld::Data &mData;
|
||||
std::vector<std::string> mSelectedIds;
|
||||
|
||||
bool mEditLock;
|
||||
|
||||
void setupGroupLayout();
|
||||
void setupCheckBoxes(const std::vector<CSMWorld::UniversalId> &types);
|
||||
void lockWidgets(bool locked);
|
||||
|
||||
public:
|
||||
ExtendedCommandConfigurator(CSMDoc::Document &document,
|
||||
|
@ -57,6 +60,7 @@ namespace CSVWorld
|
|||
QWidget *parent = 0);
|
||||
|
||||
void configure(Mode mode, const std::vector<std::string> &selectedIds);
|
||||
void setEditLock(bool locked);
|
||||
|
||||
protected:
|
||||
virtual void resizeEvent(QResizeEvent *event);
|
||||
|
|
|
@ -123,6 +123,7 @@ void CSVWorld::TableBottomBox::setEditLock (bool locked)
|
|||
{
|
||||
if (mCreator)
|
||||
mCreator->setEditLock (locked);
|
||||
mExtendedConfigurator->setEditLock (locked);
|
||||
}
|
||||
|
||||
CSVWorld::TableBottomBox::~TableBottomBox()
|
||||
|
|
Loading…
Reference in a new issue