24 #include <QFileDialog>
25 #include <QFontMetrics>
26 #include <QHBoxLayout>
46 int group,
int param) :
48 connect(p_lineEdit, SIGNAL(textChanged(
const QString &)),
this, SIGNAL(ValueChanged()));
49 grid->addWidget(p_lineEdit, param, 2);
51 grid->addWidget(p_fileButton, param, 3);
54 QString file =
FileName(
"$ISIS3DATA/base/icons/view_tree.png").expanded();
55 action->setIcon(QPixmap(file));
56 connect(action, SIGNAL(triggered(
bool)),
this, SLOT(
SelectFile()));
58 p_fileButton->setIconSize(QSize(22, 22));
59 p_fileButton->setIcon(QPixmap(file));
60 p_fileButton->setDefaultAction(action);
61 p_fileButton->setToolTip(
"Select file");
62 QString fileButtonWhatsThisText =
"<p><b>Function:</b> \
63 Opens a file chooser window to select a file from</p>";
64 p_fileButton->setWhatsThis(fileButtonWhatsThisText);
67 grid->addWidget(
AddHelpers(p_lineEdit), param, 4);
73 p_type = FileNameWidget;
89 p_lineEdit->setText(newValue);
99 return p_lineEdit->text();
124 if((p_lineEdit->text().length() > 0) &&
127 dir = fname.expanded();
129 else if(p_ui->
ParamPath(p_group, p_param).length() > 0) {
131 dir = fname.expanded();
135 QString filter = p_ui->
ParamFilter(p_group, p_param);
136 if(filter.isEmpty()) {
140 filter +=
";;Any(*)";
144 QString fnameQString;
147 fnameQString = QFileDialog::getOpenFileName(p_fileButton,
"Select file", dir, filter);
159 fnameQString = QFileDialog::getSaveFileName(p_fileButton,
"Select file", dir, filter, 0, options);
161 if(fnameQString !=
"") {
163 if(fname.dir() == QDir::currentPath()) {
164 fnameQString = fname.name();
virtual void SelectFile()
Gets an input/output file from a GUI filechooser or typed in filename.
QString ParamPath(const int &group, const int ¶m) const
Returns the default path for a filename/cube parameter.
QString ParamFilter(const int &group, const int ¶m) const
Returns the parameter filter for a parameter in a specified group.
File name manipulation and expansion.
int HelpersSize(const int &group, const int ¶m) const
Returns the number of helpers the parameter has.
QWidget * AddHelpers(QObject *lo)
Sets up helper button.
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.
GuiFileNameParameter(QGridLayout *grid, UserInterface &ui, int group, int param)
Construct a GuiFileNameParameter object.
QString ParamFileMode(const int &group, const int ¶m) const
Returns the file mode for a parameter in a specified group.
Command Line and Xml loader, validation, and access.
QString ParamInternalDefault(const int &group, const int ¶m) const
Returns the internal default for a parameter in a specified group.
void RememberWidget(QWidget *w)
Add widgets to a list for enabling/disabling.
~GuiFileNameParameter()
Destructor of GuiFileNameParameter object.