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