Commit 0738cdd7 authored by cyrush's avatar cyrush
Browse files

ported TraceHistory Gui to Qt4

git-svn-id: http://visit.ilight.com/svn/visit/trunk/src@5767 18c085ea-50e0-402c-830e-de6fd14e8384
parent 798bbf15
......@@ -41,13 +41,14 @@
#include <TraceHistoryAttributes.h>
#include <ViewerProxy.h>
#include <QCheckBox.h>
#include <QLabel.h>
#include <QLayout.h>
#include <QLineEdit.h>
#include <QSpinBox.h>
#include <QButtonGroup.h>
#include <QRadioButton.h>
#include <QCheckBox>
#include <QLabel>
#include <QLayout>
#include <QLineEdit>
#include <QSpinBox>
#include <QButtonGroup>
#include <QRadioButton>
#include <QvisColorTableButton.h>
#include <QvisOpacitySlider.h>
#include <QvisColorButton.h>
......@@ -115,45 +116,48 @@ QvisTraceHistoryWindow::~QvisTraceHistoryWindow()
// Brad Whitlock, Thu Apr 24 15:56:45 PDT 2008
// Added tr()'s
//
// Cyrus Harrison, Fri Dec 5 09:19:42 PST 2008
// Initial Qt4 Port.
//
// ****************************************************************************
void
QvisTraceHistoryWindow::CreateWindowContents()
{
QGridLayout *mainLayout = new QGridLayout(topLayout, 4,2, 10, "mainLayout");
QGridLayout *mainLayout = new QGridLayout();
topLayout->addLayout(mainLayout);
varsButton = new QvisVariableButton(true, false, true, -1,
central, "varsButton");
varsButton = new QvisVariableButton(true, false, true, -1,central);
varsButton->setText(tr("Variables"));
varsButton->setChangeTextOnVariableChange(false);
connect(varsButton, SIGNAL(activated(const QString &)),
this, SLOT(addVariable(const QString &)));
mainLayout->addWidget(varsButton, 0, 0);
varsLineEdit = new QLineEdit(central, "varsLineEdit");
varsLineEdit = new QLineEdit(central);
varsLineEdit->setText("");
connect(varsLineEdit, SIGNAL(returnPressed()),
this, SLOT(variableProcessText()));
mainLayout->addWidget(varsLineEdit, 0, 1);
displacementLabel = new QLabel(tr("Displacement variable"), central, "displacementLabel");
displacementLabel = new QLabel(tr("Displacement variable"), central);
mainLayout->addWidget(displacementLabel,1,0);
int displacementMask = QvisVariableButton::Vectors;
displacement = new QvisVariableButton(true, true, true, displacementMask, central, "displacement");
displacement = new QvisVariableButton(true, true, true, displacementMask, central);
connect(displacement, SIGNAL(activated(const QString&)),
this, SLOT(displacementChanged(const QString&)));
mainLayout->addWidget(displacement, 1,1);
numiterLabel = new QLabel(tr("Number of iterations"), central, "numiterLabel");
numiterLabel = new QLabel(tr("Number of iterations"), central);
mainLayout->addWidget(numiterLabel,2,0);
numiter = new QLineEdit(central, "numiter");
numiter = new QLineEdit(central);
connect(numiter, SIGNAL(returnPressed()),
this, SLOT(numiterProcessText()));
mainLayout->addWidget(numiter, 2,1);
outputLabel = new QLabel(tr("Output file"), central, "outputLabel");
outputLabel = new QLabel(tr("Output file"), central);
mainLayout->addWidget(outputLabel,3,0);
output = new QLineEdit(central, "output");
output = new QLineEdit(central);
connect(output, SIGNAL(returnPressed()),
this, SLOT(outputProcessText()));
mainLayout->addWidget(output, 3,1);
......@@ -174,6 +178,9 @@ QvisTraceHistoryWindow::CreateWindowContents()
// Kathleen Bonnell, Mon Jun 30 15:16:12 PDT 2008
// Removed unreferenced variables.
//
// Cyrus Harrison, Fri Dec 5 09:19:42 PST 2008
// Initial Qt4 Port.
//
// ****************************************************************************
void
......@@ -194,34 +201,31 @@ QvisTraceHistoryWindow::UpdateWindow(bool doAll)
switch(i)
{
case 0: //vars
case 0: //vars
{
str[0] = '\0';
for (int j = 0 ; j < atts->GetVars().size() ; j++)
sprintf(str + strlen(str), "%s%s", (j == 0 ? "" : " "),
atts->GetVars()[j].c_str());
temp = str;
varsLineEdit->setText(temp);
temp = "";
for (int j = 0 ; j < atts->GetVars().size() ; j++)
temp += QString(atts->GetVars()[j].c_str()) + QString(" ");
varsLineEdit->setText(temp);
}
break;
case 1: //displacement
displacement->blockSignals(true);
displacement->setText(atts->GetDisplacement().c_str());
displacement->blockSignals(false);
break;
case 2: //numiter
numiter->blockSignals(true);
temp.sprintf("%d", atts->GetNumiter());
numiter->setText(temp);
numiter->blockSignals(false);
break;
case 3: //output
temp = atts->GetOutput().c_str();
output->blockSignals(true);
output->setText(temp);
output->blockSignals(false);
break;
case 1: //displacement
displacement->blockSignals(true);
displacement->setText(atts->GetDisplacement().c_str());
displacement->blockSignals(false);
break;
case 2: //numiter
numiter->blockSignals(true);
temp.sprintf("%d", atts->GetNumiter());
numiter->setText(temp);
numiter->blockSignals(false);
break;
case 3: //output
temp = atts->GetOutput().c_str();
output->blockSignals(true);
output->setText(temp);
output->blockSignals(false);
break;
}
}
}
......@@ -237,7 +241,9 @@ QvisTraceHistoryWindow::UpdateWindow(bool doAll)
// Creation: Sun Apr 8 17:04:23 PST 2007
//
// Modifications:
//
// Cyrus Harrison, Fri Dec 5 09:19:42 PST 2008
// Initial Qt4 Port.
//
// ****************************************************************************
void
......@@ -250,16 +256,12 @@ QvisTraceHistoryWindow::GetCurrentValues(int which_widget)
if(which_widget == 0 || doAll)
{
stringVector userVars;
temp = varsLineEdit->displayText().simplifyWhiteSpace();
QStringList lst(QStringList::split(" ", temp));
QStringList::Iterator it;
for (it = lst.begin(); it != lst.end(); ++it)
{
userVars.push_back((*it).latin1());
}
temp = varsLineEdit->text().simplified();
QStringList lst = temp.split(" ",QString::SkipEmptyParts);
QStringListIterator it(lst);
while(it.hasNext())
userVars.push_back(it.next().toStdString());
atts->SetVars(userVars);
}
......@@ -272,21 +274,14 @@ QvisTraceHistoryWindow::GetCurrentValues(int which_widget)
// Do numiter
if(which_widget == 2 || doAll)
{
temp = numiter->displayText().simplifyWhiteSpace();
okay = !temp.isEmpty();
if(okay)
int val;
if(LineEditGetInt(numiter, val))
atts->SetNumiter(val);
else
{
int val = temp.toInt(&okay);
if(okay)
atts->SetNumiter(val);
}
if(!okay)
{
msg = tr("The value of numiter was invalid. "
"Resetting to the last good value of %1.").
arg(atts->GetNumiter());
Message(msg);
ResettingError(tr("number of iterations"),
IntToQString(atts->GetNumiter()));
atts->SetNumiter(atts->GetNumiter());
}
}
......@@ -294,19 +289,15 @@ QvisTraceHistoryWindow::GetCurrentValues(int which_widget)
// Do output
if(which_widget == 3 || doAll)
{
temp = output->displayText();
okay = !temp.isEmpty();
if(okay)
temp = output->text();
if(!temp.isEmpty())
{
atts->SetOutput(temp.latin1());
atts->SetOutput(temp.toStdString());
}
if(!okay)
else
{
msg = tr("The value of output was invalid. "
"Resetting to the last good value of %1.").
arg(atts->GetOutput().c_str());
Message(msg);
ResettingError(tr("output"),
atts->GetOutput().c_str());
atts->SetOutput(atts->GetOutput());
}
}
......@@ -325,7 +316,7 @@ QvisTraceHistoryWindow::GetCurrentValues(int which_widget)
void
QvisTraceHistoryWindow::displacementChanged(const QString &varName)
{
atts->SetDisplacement(varName.latin1());
atts->SetDisplacement(varName.toStdString());
SetUpdate(false);
Apply();
}
......@@ -372,6 +363,8 @@ QvisTraceHistoryWindow::variableProcessText()
// Creation: April 8, 2007
//
// Modifications:
// Cyrus Harrison, Fri Dec 5 09:19:42 PST 2008
// Initial Qt4 Port.
//
// ****************************************************************************
......@@ -379,7 +372,7 @@ void
QvisTraceHistoryWindow::addVariable(const QString &var)
{
// Add the new variable to the pick variable line edit.
QString varString(varsLineEdit->displayText());
QString varString(varsLineEdit->text());
if(varString.length() > 0)
varString += " ";
varString += var;
......
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