12#include "GuiFilenameParameter.h"
14#include "UserInterface.h"
30 int group,
int param) :
32 connect(p_lineEdit, SIGNAL(textChanged(
const QString &)),
this, SIGNAL(ValueChanged()));
33 grid->addWidget(p_lineEdit, param, 2);
35 grid->addWidget(p_fileButton, param, 3);
38 QString file =
FileName(
"$ISISROOT/appdata/images/icons/view_tree.png").
expanded();
39 action->setIcon(QPixmap(file));
40 connect(action, SIGNAL(triggered(
bool)),
this, SLOT(
SelectFile()));
42 p_fileButton->setIconSize(QSize(22, 22));
43 p_fileButton->setIcon(QPixmap(file));
44 p_fileButton->setDefaultAction(action);
45 p_fileButton->setToolTip(
"Select file");
46 QString fileButtonWhatsThisText =
"<p><b>Function:</b> \
47 Opens a file chooser window to select a file from</p>";
48 p_fileButton->setWhatsThis(fileButtonWhatsThisText);
50 if(p_ui->HelpersSize(group, param) != 0) {
51 grid->addWidget(
AddHelpers(p_lineEdit), param, 4);
57 p_type = FileNameWidget;
73 p_lineEdit->setText(newValue);
83 return p_lineEdit->text();
108 if((p_lineEdit->text().length() > 0) &&
109 (p_lineEdit->text() != p_ui->ParamInternalDefault(p_group, p_param))) {
113 else if(p_ui->ParamPath(p_group, p_param).length() > 0) {
119 QString filter = p_ui->ParamFilter(p_group, p_param);
120 if(filter.isEmpty()) {
124 filter +=
";;Any(*)";
128 QString fnameQString;
130 if(p_ui->ParamFileMode(p_group, p_param) ==
"input") {
131 fnameQString = QFileDialog::getOpenFileName(p_fileButton,
"Select file", dir, filter);
143 fnameQString = QFileDialog::getSaveFileName(p_fileButton,
"Select file", dir, filter, 0, options);
145 if(fnameQString !=
"") {
147 if(fname.
dir() == QDir::currentPath()) {
148 fnameQString = fname.
name();
File name manipulation and expansion.
QDir dir() const
Returns the path of the file's parent directory as a QDir object.
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
virtual void SelectFile()
Gets an input/output file from a GUI filechooser or typed in filename.
GuiFileNameParameter(QGridLayout *grid, UserInterface &ui, int group, int param)
Construct a GuiFileNameParameter object.
~GuiFileNameParameter()
Destructor of GuiFileNameParameter object.
QString Value()
Gets the value found in the line edit text box.
void Set(QString newValue)
Sets the line edit text box to value passed in by this method.
void RememberWidget(QWidget *w)
Add widgets to a list for enabling/disabling.
GuiParameter(QGridLayout *grid, UserInterface &ui, int group, int param)
Constructor.
QWidget * AddHelpers(QObject *lo)
Sets up helper button.
Command Line and Xml loader, validation, and access.
This is free and unencumbered software released into the public domain.