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);
 
   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) &&
 
  111      dir = fname.expanded();
 
  113    else if(p_ui->
ParamPath(p_group, p_param).length() > 0) {
 
  115      dir = fname.expanded();
 
  119    QString filter = p_ui->
ParamFilter(p_group, p_param);
 
  120    if(filter.isEmpty()) {
 
  124      filter += 
";;Any(*)";
 
  128    QString fnameQString;
 
  131      fnameQString = QFileDialog::getOpenFileName(p_fileButton, 
"Select file", dir, filter);
 
  142      QFlags<QFileDialog::Option> options(QFileDialog::DontConfirmOverwrite);
 
  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.
 
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.
 
QWidget * AddHelpers(QObject *lo)
Sets up helper button.
 
Command Line and Xml loader, validation, and access.
 
int HelpersSize(const int &group, const int ¶m) const
Returns the number of helpers the parameter has.
 
QString ParamFilter(const int &group, const int ¶m) const
Returns the parameter filter for a parameter in a specified group.
 
QString ParamInternalDefault(const int &group, const int ¶m) const
Returns the internal default for a parameter in a specified group.
 
QString ParamFileMode(const int &group, const int ¶m) const
Returns the file mode 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.
 
This is free and unencumbered software released into the public domain.