ImportASCIIDialog.h

Go to the documentation of this file.
00001 /***************************************************************************
00002     File                 : ImportASCIIDialog.h
00003     Project              : QtiPlot
00004     --------------------------------------------------------------------
00005     Copyright            : (C) 2006,2007 by Ion Vasilief, Knut Franke
00006     Email (use @ for *)  : ion_vasilief*yahoo.fr, knut.franke*gmx.de
00007     Description          : Import ASCII file(s) dialog
00008 
00009  ***************************************************************************/
00010 
00011 /***************************************************************************
00012  *                                                                         *
00013  *  This program is free software; you can redistribute it and/or modify   *
00014  *  it under the terms of the GNU General Public License as published by   *
00015  *  the Free Software Foundation; either version 2 of the License, or      *
00016  *  (at your option) any later version.                                    *
00017  *                                                                         *
00018  *  This program is distributed in the hope that it will be useful,        *
00019  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
00020  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
00021  *  GNU General Public License for more details.                           *
00022  *                                                                         *
00023  *   You should have received a copy of the GNU General Public License     *
00024  *   along with this program; if not, write to the Free Software           *
00025  *   Foundation, Inc., 51 Franklin Street, Fifth Floor,                    *
00026  *   Boston, MA  02110-1301  USA                                           *
00027  *                                                                         *
00028  ***************************************************************************/
00029 #ifndef IMPORTFILESDIALOG_H
00030 #define IMPORTFILESDIALOG_H
00031 
00032 #include "ExtensibleFileDialog.h"
00033 
00034 #include <QComboBox>
00035 #include <QCheckBox>
00036 #include <QSpinBox>
00037 #include <QLineEdit>
00038 
00039 class Table;
00040 class QGroupBox;
00041 class QPushButton;
00042 
00044 class ImportASCIIDialog: public ExtensibleFileDialog
00045 {
00046     Q_OBJECT
00047 
00048 public:
00050 
00053     enum ImportMode {
00054         NewTables, 
00055         NewColumns, 
00056         NewRows, 
00057         Overwrite 
00058     };
00059 
00061 
00067     ImportASCIIDialog(bool importModeEnabled, QWidget * parent = 0, bool extended = true, Qt::WFlags flags = 0 );
00068 
00070 
00073     ImportMode importMode() const { return (ImportMode) d_import_mode->currentIndex(); }
00075     const QString columnSeparator() const;
00077     int ignoredLines() const { return d_ignored_lines->value(); }
00079     bool renameColumns() const { return d_rename_columns->isChecked(); }
00081     bool simplifySpaces() const { return d_simplify_spaces->isChecked(); }
00083     bool stripSpaces() const { return d_strip_spaces->isChecked(); }
00085     bool readOnly() const {return d_read_only->isChecked(); }
00086 
00088     void setColumnSeparator(const QString &sep);
00089 
00091     QLocale decimalSeparators();
00093     bool updateDecimalSeparators() const { return d_import_dec_separators->isChecked(); };
00094 
00096     QString commentString(){return d_comment_string->text();};
00097 
00099     bool importComments(){return d_import_comments->isChecked();};
00100 
00101 private slots:
00103     void displayHelp();
00105     void updateImportMode(int mode);
00106     void preview();
00107     void changePreviewFile(const QString& path);
00108 
00109 private:
00110     void closeEvent(QCloseEvent*);
00112     void initAdvancedOptions();
00113 
00115     QGroupBox *d_advanced_options;
00116     QCheckBox *d_read_only, *d_import_dec_separators;
00117     QPushButton *d_help_button;
00118     // the actual options
00119     QComboBox *d_import_mode, *d_column_separator, *boxDecimalSeparator;
00120     QSpinBox *d_ignored_lines, *d_preview_lines_box;
00121     QCheckBox *d_rename_columns, *d_simplify_spaces, *d_strip_spaces, *d_import_comments;
00122     QLineEdit *d_comment_string;
00123     Table *d_preview_table;
00124     QCheckBox *d_preview_button;
00125 
00126     QString d_current_path;
00127 };
00128 
00129 #endif

Generated on Thu Feb 7 13:59:27 2008 for QtiPlot by  doxygen 1.5.4