mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-27 12:35:46 +00:00
ExtendedCommandConfigurator: disable the perform button when all tables are unchecked
This commit is contained in:
parent
260f6f22ae
commit
95d16b24c0
@ -28,6 +28,7 @@ CSVWorld::ExtendedCommandConfigurator::ExtendedCommandConfigurator(CSMDoc::Docum
|
|||||||
QWidget *parent)
|
QWidget *parent)
|
||||||
: QWidget(parent),
|
: QWidget(parent),
|
||||||
mNumUsedCheckBoxes(0),
|
mNumUsedCheckBoxes(0),
|
||||||
|
mNumChecked(0),
|
||||||
mMode(Mode_None)
|
mMode(Mode_None)
|
||||||
{
|
{
|
||||||
mCommandDispatcher = new CSMWorld::CommandDispatcher(document, id, this);
|
mCommandDispatcher = new CSMWorld::CommandDispatcher(document, id, this);
|
||||||
@ -125,7 +126,9 @@ void CSVWorld::ExtendedCommandConfigurator::setupCheckBoxes(const std::vector<CS
|
|||||||
{
|
{
|
||||||
for (int i = numTypes - numCheckBoxes; i > 0; --i)
|
for (int i = numTypes - numCheckBoxes; i > 0; --i)
|
||||||
{
|
{
|
||||||
mTypeCheckBoxes.insert(std::make_pair(new QCheckBox(mTypeGroup), CSMWorld::UniversalId::Type_None));
|
QCheckBox *checkBox = new QCheckBox(mTypeGroup);
|
||||||
|
connect(checkBox, SIGNAL(stateChanged(int)), this, SLOT(checkBoxStateChanged(int)));
|
||||||
|
mTypeCheckBoxes.insert(std::make_pair(checkBox, CSMWorld::UniversalId::Type_None));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -148,7 +151,7 @@ void CSVWorld::ExtendedCommandConfigurator::setupCheckBoxes(const std::vector<CS
|
|||||||
current->first->hide();
|
current->first->hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
mNumUsedCheckBoxes = numTypes;
|
mNumChecked = mNumUsedCheckBoxes = numTypes;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CSVWorld::ExtendedCommandConfigurator::performExtendedCommand()
|
void CSVWorld::ExtendedCommandConfigurator::performExtendedCommand()
|
||||||
@ -176,3 +179,20 @@ void CSVWorld::ExtendedCommandConfigurator::performExtendedCommand()
|
|||||||
}
|
}
|
||||||
emit done();
|
emit done();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CSVWorld::ExtendedCommandConfigurator::checkBoxStateChanged(int state)
|
||||||
|
{
|
||||||
|
switch (state)
|
||||||
|
{
|
||||||
|
case Qt::Unchecked:
|
||||||
|
--mNumChecked;
|
||||||
|
break;
|
||||||
|
case Qt::Checked:
|
||||||
|
++mNumChecked;
|
||||||
|
break;
|
||||||
|
case Qt::PartiallyChecked: // Not used
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
mPerformButton->setEnabled(mNumChecked > 0);
|
||||||
|
}
|
||||||
|
@ -40,6 +40,7 @@ namespace CSVWorld
|
|||||||
QGroupBox *mTypeGroup;
|
QGroupBox *mTypeGroup;
|
||||||
CheckBoxMap mTypeCheckBoxes;
|
CheckBoxMap mTypeCheckBoxes;
|
||||||
int mNumUsedCheckBoxes;
|
int mNumUsedCheckBoxes;
|
||||||
|
int mNumChecked;
|
||||||
|
|
||||||
Mode mMode;
|
Mode mMode;
|
||||||
CSMWorld::CommandDispatcher *mCommandDispatcher;
|
CSMWorld::CommandDispatcher *mCommandDispatcher;
|
||||||
@ -59,6 +60,7 @@ namespace CSVWorld
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void performExtendedCommand();
|
void performExtendedCommand();
|
||||||
|
void checkBoxStateChanged(int state);
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void done();
|
void done();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user