Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Attributes | List of all members
QtFileDialog Class Reference

A class to handle various file types. More...

#include <QtFileDialog.h>

Collaboration diagram for QtFileDialog:
Collaboration graph
[legend]

Public Member Functions

void openFitsTuple (const std::string &filename, QWidget *parent)
 Opens a FITS DataSource file. More...
 
void openRootTuple (const std::string &filename, QWidget *parent)
 Opens a ROOT DataSource file. More...
 
 QtFileDialog ()
 The constructor. More...
 
void saveFitsTuple (const std::string &filename, QWidget *parent)
 Save a FITS file. More...
 
void saveTextTuple (const std::string &filename, QWidget *parent)
 Save a text file. More...
 

Static Public Member Functions

static const std::string & createBrowseFilter ()
 Creates the open file filter. More...
 
static const std::string & createDocumentFilter ()
 Creates a filter for saving a document. More...
 
static const std::string & createExportFilter ()
 Creates a filter for exporting DataSource to file. More...
 
static const std::string & createOpenFilter ()
 Creates the open file filter. More...
 
static const std::string & getDocSuffix ()
 Returns the suffix for a document. More...
 
static std::string getExportTupleFilename (QWidget *widget)
 Returns a filename for exporting a DataSource. More...
 
static const std::string & getTextSuffix ()
 Returns the suffix for a text data source files. More...
 
static bool isDocSuffix (const std::string &suffix)
 Returns true if suffix is one corresponding to document file. More...
 
static bool isFitsFile (const std::string &filename)
 Returns true if the file filename is a FITS file. More...
 
static bool isFitsSuffix (const std::string &suffix)
 Returns true if suffix is one corresponding to FITS DataSource file. More...
 
static bool isRootSuffix (const std::string &suffix)
 Returns true if suffix is one corresponding to ROOT DataSource files. More...
 
static bool isTextSuffix (const std::string &suffix)
 Returns true if suffix is one corresponding to text NTuple file. More...
 
static bool isZippedFitsSuffix (const std::string &suffix)
 Returns true if the file filename is a compressed FITS file. More...
 
static void openTextTuple (const std::string &filename)
 Opens a text NTuple file. More...
 

Private Member Functions

void checkDuplicateLabels (const DataSource *source, QWidget *)
 Checks for duplicate column labels in the DataSource source. More...
 

Static Private Attributes

static const std::string s_data_suffix = ".tnt"
 The file name suffix used for the application's text data source files. More...
 
static const std::string s_doc_suffix = ".hpo"
 The file name suffix used for the application's document files. More...
 
static std::string s_open_filter = ""
 The open file filter. More...
 

Detailed Description

A class to handle various file types.

Bug:
The dialog should remember the suffix of the last file selected.
Bug:
@@ Mac OS X only. Doesn't show the available file types and odesn't open SVAC ROOT file with Qt 4.3, ok with Qt 3.
Requests:
@@@ Make sure second use of this dialog, starts in previously used directory. Make sure previously selected file type is used on second use.
Requests:
@@ All file types should be shown and information dialog raised if application was not built to support it.
Author
Xie Fang xiefa.nosp@m.ng@s.nosp@m.tanfo.nosp@m.rd.e.nosp@m.du
Paul F. Kunz Paul_.nosp@m.Kunz.nosp@m.@slac.nosp@m..sta.nosp@m.nford.nosp@m..edu

Definition at line 49 of file QtFileDialog.h.

Constructor & Destructor Documentation

◆ QtFileDialog()

The constructor.

Definition at line 52 of file QtFileDialog.cxx.

References QtFileDialog::createOpenFilter().

Member Function Documentation

◆ checkDuplicateLabels()

void checkDuplicateLabels ( const DataSource source,
QWidget parent 
)
private

Checks for duplicate column labels in the DataSource source.

Brings up a information dialog if duplicate column labels are found.

Definition at line 341 of file QtFileDialog.cxx.

References QMessageBox::information(), and QtFileDialog::openFitsTuple().

Referenced by QtFileDialog::isFitsFile(), QtFileDialog::openFitsTuple(), and QtFileDialog::openRootTuple().

◆ createBrowseFilter()

const string & createBrowseFilter ( )
static

◆ createDocumentFilter()

const string & createDocumentFilter ( )
static

◆ createExportFilter()

const string & createExportFilter ( )
static

Creates a filter for exporting DataSource to file.

Definition at line 110 of file QtFileDialog.cxx.

References QtFileDialog::createBrowseFilter(), and QtFileDialog::s_open_filter.

Referenced by QtFileDialog::createOpenFilter(), and QtFileDialog::getExportTupleFilename().

◆ createOpenFilter()

const string & createOpenFilter ( )
static

◆ getDocSuffix()

const std::string & getDocSuffix ( )
static

◆ getExportTupleFilename()

std::string getExportTupleFilename ( QWidget widget)
static

Returns a filename for exporting a DataSource.

Displays a file dialog for the user to select a filename for exporting a ntuple. The QFileDialog will be child of widget.

Definition at line 218 of file QtFileDialog.cxx.

References QFileInfo::absFilePath(), QtFileDialog::createDocumentFilter(), QtFileDialog::createExportFilter(), QString::endsWith(), QFileInfo::exists(), QFileDialog::getSaveFileName(), QString::latin1(), and QMessageBox::warning().

Referenced by CreateNTuple::createFileButtonClicked(), CanvasWindow::fileExportTextTuple(), and QtFileDialog::isZippedFitsSuffix().

◆ getTextSuffix()

const std::string & getTextSuffix ( )
static

Returns the suffix for a text data source files.

Definition at line 176 of file QtFileDialog.cxx.

References QtFileDialog::isDocSuffix(), and QtFileDialog::s_data_suffix.

Referenced by QtFileDialog::getDocSuffix(), and CanvasWindow::saveAllAs().

◆ isDocSuffix()

bool isDocSuffix ( const std::string &  suffix)
static

Returns true if suffix is one corresponding to document file.

Definition at line 183 of file QtFileDialog.cxx.

References QtFileDialog::isTextSuffix(), and QtFileDialog::s_doc_suffix.

Referenced by CanvasWindow::fileBrowse(), CanvasWindow::fileOpen(), QtFileDialog::getTextSuffix(), and QtApp::tryOpenFile().

◆ isFitsFile()

bool isFitsFile ( const std::string &  filename)
static

◆ isFitsSuffix()

bool isFitsSuffix ( const std::string &  suffix)
static

◆ isRootSuffix()

bool isRootSuffix ( const std::string &  suffix)
static

Returns true if suffix is one corresponding to ROOT DataSource files.

Definition at line 197 of file QtFileDialog.cxx.

References QtFileDialog::isFitsSuffix().

Referenced by CanvasWindow::fileOpen(), QtFileDialog::isTextSuffix(), CanvasWindow::openRecentFile(), and QtApp::tryOpenFile().

◆ isTextSuffix()

bool isTextSuffix ( const std::string &  suffix)
static

◆ isZippedFitsSuffix()

bool isZippedFitsSuffix ( const std::string &  suffix)
static

Returns true if the file filename is a compressed FITS file.

Definition at line 211 of file QtFileDialog.cxx.

References QtFileDialog::getExportTupleFilename().

Referenced by CanvasWindow::fileExportTextTuple(), and QtFileDialog::isFitsSuffix().

◆ openFitsTuple()

void openFitsTuple ( const std::string &  filename,
QWidget parent 
)

◆ openRootTuple()

void openRootTuple ( const std::string &  filename,
QWidget parent 
)

◆ openTextTuple()

void openTextTuple ( const std::string &  filename)
static

◆ saveFitsTuple()

void saveFitsTuple ( const std::string &  filename,
QWidget parent 
)

Save a FITS file.

Note
This method is only available if application is built with optional FITS support.

Definition at line 457 of file QtFileDialog.cxx.

References QMessageBox::critical(), FitsController::instance(), WindowController::instance(), QtFileDialog::saveTextTuple(), and FitsController::writeNTupleToFile().

Referenced by QtFileDialog::openRootTuple().

◆ saveTextTuple()

void saveTextTuple ( const std::string &  filename,
QWidget parent 
)

Member Data Documentation

◆ s_data_suffix

const string s_data_suffix = ".tnt"
staticprivate

The file name suffix used for the application's text data source files.

Definition at line 62 of file QtFileDialog.h.

Referenced by QtFileDialog::getTextSuffix(), and QtFileDialog::isTextSuffix().

◆ s_doc_suffix

const string s_doc_suffix = ".hpo"
staticprivate

The file name suffix used for the application's document files.

Definition at line 57 of file QtFileDialog.h.

Referenced by QtFileDialog::createBrowseFilter(), QtFileDialog::createDocumentFilter(), QtFileDialog::createOpenFilter(), QtFileDialog::getDocSuffix(), and QtFileDialog::isDocSuffix().

◆ s_open_filter

string s_open_filter = ""
staticprivate

The documentation for this class was generated from the following files:

Generated for HippoDraw Class Library by doxygen