QtFileDialog Class Reference

#include <QtFileDialog.h>

Collaboration diagram for QtFileDialog:

Collaboration graph
[legend]
List of all members.

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 <xiefang@stanford.edu>

Paul F. Kunz <Paul_Kunz@slac.stanford.edu>

Definition at line 49 of file QtFileDialog.h.

Public Member Functions

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

Static Public Member Functions

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

Private Member Functions

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

Static Private Attributes

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


Constructor & Destructor Documentation

QtFileDialog (  ) 

The constructor.

Definition at line 52 of file QtFileDialog.cxx.


Member Function Documentation

void checkDuplicateLabels ( const DataSource source,
QWidget  
) [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().

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

const string & createBrowseFilter (  )  [static]

Creates the open file filter.

Definition at line 140 of file QtFileDialog.cxx.

References QtFileDialog::s_doc_suffix, and QtFileDialog::s_open_filter.

Referenced by CanvasWindow::fileBrowse().

const string & createDocumentFilter (  )  [static]

Creates a filter for saving a document.

Definition at line 285 of file QtFileDialog.cxx.

References QtFileDialog::s_doc_suffix, and QtFileDialog::s_open_filter.

Referenced by CanvasWindow::getSaveDocFilename().

const string & createExportFilter (  )  [static]

Creates a filter for exporting DataSource to file.

Definition at line 110 of file QtFileDialog.cxx.

References QtFileDialog::s_open_filter.

Referenced by QtFileDialog::getExportTupleFilename().

const string & createOpenFilter (  )  [static]

Creates the open file filter.

Definition at line 58 of file QtFileDialog.cxx.

References QtFileDialog::s_doc_suffix, and QtFileDialog::s_open_filter.

Referenced by CanvasWindow::fileOpen().

const std::string & getDocSuffix (  )  [static]

Returns the suffix for a document.

Definition at line 169 of file QtFileDialog.cxx.

References QtFileDialog::s_doc_suffix.

Referenced by CanvasWindow::getSaveDocFilename(), and CanvasWindow::saveAllAs().

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::createExportFilter(), QString::endsWith(), QFileInfo::exists(), QFileDialog::getSaveFileName(), QString::latin1(), and QMessageBox::warning().

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

const std::string & getTextSuffix (  )  [static]

Returns the suffix for a text data source files.

Definition at line 176 of file QtFileDialog.cxx.

References QtFileDialog::s_data_suffix.

Referenced by CanvasWindow::saveAllAs().

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::s_doc_suffix.

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

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

Returns true if the file filename is a FITS file.

Definition at line 321 of file QtFileDialog.cxx.

References FitsController::instance(), and FitsController::openFile().

Referenced by CanvasWindow::fileExportTextTuple(), and CanvasWindow::fileOpen().

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

Returns true if suffix is one corresponding to FITS DataSource file.

Definition at line 204 of file QtFileDialog.cxx.

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

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.

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

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

Returns true if suffix is one corresponding to text NTuple file.

Definition at line 190 of file QtFileDialog.cxx.

References QtFileDialog::s_data_suffix.

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

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.

Referenced by CanvasWindow::fileExportTextTuple().

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

Opens a FITS DataSource file.

Definition at line 362 of file QtFileDialog.cxx.

References QtFileDialog::checkDuplicateLabels(), QMessageBox::information(), and FitsController::instance().

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

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

Opens a ROOT DataSource file.

Definition at line 407 of file QtFileDialog.cxx.

References QtFileDialog::checkDuplicateLabels(), QMessageBox::information(), and RootController::instance().

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

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

Opens a text NTuple file.

Definition at line 297 of file QtFileDialog.cxx.

References QString::append(), QMessageBox::critical(), and NTupleController::instance().

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

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(), and FitsController::writeNTupleToFile().

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

Save a text file.

Definition at line 483 of file QtFileDialog.cxx.

References QMessageBox::critical(), NTupleController::instance(), WindowController::instance(), and NTupleController::writeNTupleToFile().


Member Data Documentation

const string s_data_suffix = ".tnt" [static, private]

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().

const string s_doc_suffix = ".hpo" [static, private]

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().

string s_open_filter = "" [static, private]

The open file filter.

Definition at line 66 of file QtFileDialog.h.

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


The documentation for this class was generated from the following files:
Generated for HippoDraw Class Library by doxygen