Commit f6d1fe58 authored by allens's avatar allens
Browse files

added the ability to disable buttons without hiding the text

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@27829 18c085ea-50e0-402c-830e-de6fd14e8384
parent 2fb8e688
......@@ -160,14 +160,14 @@ QvisSimulationCommandWindow::setButtonCommand(int index, const QString &cmd)
}
bool
QvisSimulationCommandWindow::setButtonEnabled(int index, bool enabled)
QvisSimulationCommandWindow::setButtonEnabled(int index, bool enabled, bool clearText)
{
bool added = false;
if(EnsureButtonExists(index, added))
{
QAbstractButton *b = commandGroup->buttons().at(index);
b->setEnabled(enabled);
if(!enabled)
if(!enabled && clearText)
b->setText("");
}
return added;
......
......@@ -75,7 +75,7 @@ public:
int numCommandButtons() const;
bool setButtonCommand(int index, const QString &cmd);
bool setButtonEnabled(int index, bool);
bool setButtonEnabled(int index, bool enabled, bool clearText);
void setCustomButtonEnabled(bool);
void setTimeValues(bool timeRanging,
const QString &start,
......
......@@ -810,10 +810,10 @@ QvisSimulationWindow::UpdateUIComponent(QWidget *window, const QString &name,
else
newItem->setFlags(Qt::NoItemFlags);
if( ((QTableWidget*)ui)->rowCount() < row )
if( ((QTableWidget*)ui)->rowCount() <= row )
((QTableWidget*)ui)->setRowCount(row+1);
if( ((QTableWidget*)ui)->columnCount() < column )
if( ((QTableWidget*)ui)->columnCount() <= column )
((QTableWidget*)ui)->setColumnCount(column+1);
((QTableWidget*)ui)->setItem(row, column, newItem);
......@@ -1049,6 +1049,42 @@ QvisSimulationWindow::UpdateWindow(bool doAll)
}
}
if(uiValues->GetName() == "ENABLE_BUTTON")
{
// Use activeEngine to get the metadata
SimulationMetaDataMap::Iterator pos;
if ((pos = metadataMap.find(activeEngine)) != metadataMap.end())
{
const avtDatabaseMetaData *md = pos.value();
// Loop through all of the buttons to find the one being
// enabled/disabled.
int nButtons = simCommands->numCommandButtons();
for (int c=0; c<nButtons; c++)
{
avtSimulationCommandSpecification cmd =
md->GetSimInfo().GetGenericCommands(c);
avtSimulationCommandSpecification::CommandArgumentType t =
cmd.GetArgumentType();
if (t == avtSimulationCommandSpecification::CmdArgNone)
{
QString bName = QString(cmd.GetName().c_str());
if( bName == QString(uiValues->GetSvalue().c_str() ) )
{
bool enabled = uiValues->GetEnabled();
simCommands->setButtonEnabled(c, enabled, false);
}
}
}
}
}
if(uiValues->GetName() == "SIMULATION_MODE")
{
QString mode = QString(uiValues->GetSvalue().c_str());
......@@ -1233,7 +1269,7 @@ QvisSimulationWindow::UpdateInformation()
simInfo->setEnabled(false);
for (int c=0; c<simCommands->numCommandButtons(); c++)
{
simCommands->setButtonEnabled(c, false);
simCommands->setButtonEnabled(c, false, true);
}
}
else
......@@ -1322,7 +1358,7 @@ QvisSimulationWindow::UpdateInformation()
{
if (c >= md->GetSimInfo().GetNumGenericCommands())
{
updateSize |= simCommands->setButtonEnabled(c, false);
updateSize |= simCommands->setButtonEnabled(c, false, true);
}
else
{
......@@ -1341,11 +1377,11 @@ QvisSimulationWindow::UpdateInformation()
// << std::endl;
updateSize |= simCommands->setButtonCommand(c, bName);
simCommands->setButtonEnabled(c, e);
simCommands->setButtonEnabled(c, e, false);
}
else
{
updateSize |= simCommands->setButtonEnabled(c, false);
updateSize |= simCommands->setButtonEnabled(c, false, true);
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment