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);
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) &&
129 else if(p_ui->
ParamPath(p_group, p_param).length() > 0) {
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.
File name manipulation and expansion.
QWidget * AddHelpers(QObject *lo)
Sets up helper button.
int HelpersSize(const int &group, const int ¶m) const
Returns the number of helpers the parameter has.
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.
QString name() const
Returns the name of the file excluding the path and the attributes in the file name.
GuiFileNameParameter(QGridLayout *grid, UserInterface &ui, int group, int param)
Construct a GuiFileNameParameter object.
QString ParamInternalDefault(const int &group, const int ¶m) const
Returns the internal default for a parameter in a specified group.
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.
QString expanded() const
Returns a QString of the full file name including the file path, excluding the attributes.
QDir dir() const
Returns the path of the file's parent directory as a QDir object.
QString ParamFileMode(const int &group, const int ¶m) const
Returns the file mode for a parameter in a specified group.
Namespace for ISIS/Bullet specific routines.
Command Line and Xml loader, validation, and access.
void RememberWidget(QWidget *w)
Add widgets to a list for enabling/disabling.
~GuiFileNameParameter()
Destructor of GuiFileNameParameter object.