45 #include <QPushButton>
46 #include <QFileDialog>
47 #include <QMessageBox>
70 connect(
closeButton, SIGNAL(clicked(
bool)),
this, SLOT(hide()));
76 QGridLayout *layout =
new QGridLayout(
this);
86 setSizeGripEnabled(
true);
87 setWindowTitle(tr(
"Search..."));
92 -1, Qt::MatchWrap | Qt::MatchContains | Qt::MatchRecursive);
96 matchesLabel->setText(
"Matches ("+ QString::number(searchSize) +
")");
101 else if(searchSize == 1){
130 QModelIndexList toReturn;
131 for(QModelIndexList::iterator it = items.begin(); it != items.end(); ++it){
132 if(!
treeView->isRowHidden(it->row(), it->parent())){
133 toReturn.append(*it);
144 const std::string actionButtonText,
145 const std::string actionNoSaveButtonText)
147 model =
new TreeModel(validParameters, dependencySheet, fileName,
this);
174 const std::string actionButtonText,
175 const std::string actionNoSaveButtonText)
180 view->setEditTriggers(QAbstractItemView::DoubleClicked | QAbstractItemView::SelectedClicked);
185 if(actionButtonText !=
""){
187 new QPushButton(QString::fromStdString(actionButtonText),
this);
192 if(actionNoSaveButtonText !=
""){
193 actionNoSaveButton =
new QPushButton(QString::fromStdString(actionNoSaveButtonText),
this);
195 QWidget *centerWidget =
new QWidget(
this);
196 QGridLayout *centerWidgetLayout =
new QGridLayout(centerWidget);
197 centerWidgetLayout->addWidget(
view,0,0);
200 centerWidgetLayout->addWidget(
actionButton,1,0,Qt::AlignLeft);
205 centerWidgetLayout->addWidget(
actionButton,1,0,Qt::AlignRight);
206 centerWidget->setLayout(centerWidgetLayout);
207 setCentralWidget(centerWidget);
215 setWindowTitle(tr(
"Parameter Input"));
217 view->header()->resizeSections(QHeaderView::ResizeToContents);
218 view->header()->setMovable(
false);
226 fileMenu = menuBar()->addMenu(tr(
"File"));
235 helpMenu = menuBar()->addMenu(tr(
"Help"));
241 resetAct =
new QAction(tr(
"&Reset"),
this);
242 resetAct->setShortcut(tr(
"Ctrl+R"));
243 resetAct->setStatusTip(tr(
"Reset the list to its original state."));
246 saveAct =
new QAction(tr(
"&Save"),
this);
247 saveAct->setShortcut(tr(
"Ctrl+S"));
248 saveAct->setStatusTip(tr(
"Save the current file."));
251 saveAsAct =
new QAction(tr(
"Save As..."),
this);
252 saveAsAct->setStatusTip(tr(
"Save the current file to a specified file name."));
255 loadAct =
new QAction(tr(
"&Load"),
this);
256 loadAct->setShortcut(tr(
"Ctrl+L"));
257 loadAct->setStatusTip(tr(
"Load input file"));
260 quitAct =
new QAction(tr(
"&Quit"),
this);
261 quitAct->setShortcut(tr(
"Ctrl+Q"));
262 quitAct->setStatusTip(tr(
"Quit"));
263 connect(
quitAct, SIGNAL(triggered()),
this, SLOT(close()));
265 aboutAct =
new QAction(tr(
"About"),
this);
266 searchAct =
new QAction(tr(
"Search For Parameter/Parameter List"),
this);
267 searchAct->setToolTip(
"Search for a particular Parameter or ParameterList");
273 QString fileName = QFileDialog::getOpenFileName(
this, tr(
"Load..."),
currentLoadDir, tr(
"Xml (*.xml)"));
282 QSettings settings(QSettings::UserScope,
"Sandia",
"Optika");
287 resize(settings.value(
xresSetting(), width()).toInt(),
295 QSettings settings(QSettings::UserScope,
"Sandia",
"Optika");
317 QAction *recentDocAct =
new QAction(
recentDocsList.at(i).section(
"/",-1,-1),
this);
318 connect(recentDocAct, SIGNAL(triggered()),
this, SLOT(
loadRecentDoc()));
331 QString fileName = QFileDialog::getSaveFileName(
this, tr(
"Save To..."),
currentSaveDir, tr(
"XML (*.xml)"));
332 if(fileName.toStdString() !=
""){
333 if(!fileName.endsWith(
".xml")){
334 fileName = fileName.append(
".xml");
347 if(currentFileName !=
""){
364 QMessageBox saveQuestion(QMessageBox::Question,
366 tr(
"These choices have not been saved since you last made changes. Would you like to save them now?"),
367 QMessageBox::Yes | QMessageBox::No,
369 saveQuestion.setDefaultButton(QMessageBox::Yes);
370 int shouldSave = saveQuestion.exec();
371 if(shouldSave == QMessageBox::Yes){
378 QString docName =
dynamic_cast<QAction*
>(sender())->text();
393 QString aboutString =
aboutInfo +
"\nThis input obtainer was generated by Kurtis Nusbaum's Optika package, part of the Trilinos Project.\n\nVersion: " + QString::fromStdString(
Optika_Version()) +
"\nWebsite: trilinos.sandia.gov/packages/optika\nLicense: LGPL\nContact: klnusbaum@gmail.com";
394 QMessageBox::about(
this,
395 "Optika Input Obtainer\n",
void reset()
Resets all the inputs to their default values.
QString getSaveFileName()
Gets the name of the save file with which the TreeModel is associated.
void setIsSaved()
Set save state to true.
RCP< const ParameterList > getCurrentParameters()
Get a ParameterList containing all of the parameters at their current settings.
bool writeOutput(QString fileName)
Writes out the state of the current parameters in xml format.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
void readInput(QString fileName)
Reads an xml file that describes the state of current parameters in xml format.
Optika version information.
Class used to view TreeModels.
const int numRecentDocuments
bool isSaved()
Determines wether or not the current state of TreeModel has been saved.
std::string Optika_Version()
Return a string describing the version of Optika.
TreeModel is a type of QAbstractItemModel that has a Tree like structure.
The delegate used for the Optika package. For non-documented functions please refer to the Qt API...