Mercurial > hg > svcore
diff data/fileio/CSVFileReader.h @ 392:183ee2a55fc7
* More work to abstract out interactive components used in the data library,
so that it does not need to depend on QtGui.
author | Chris Cannam |
---|---|
date | Fri, 14 Mar 2008 17:14:21 +0000 |
parents | 5858cc462d0a |
children | 3a5ee4b6c9ad |
line wrap: on
line diff
--- a/data/fileio/CSVFileReader.h Thu Mar 13 14:06:03 2008 +0000 +++ b/data/fileio/CSVFileReader.h Fri Mar 14 17:14:21 2008 +0000 @@ -18,20 +18,17 @@ #include "DataFileReader.h" +#include "CSVFormat.h" + #include <QList> #include <QStringList> -#include <QDialog> class QFile; -class QTableWidget; -class QComboBox; -class QLabel; - class CSVFileReader : public DataFileReader { public: - CSVFileReader(QString path, size_t mainModelSampleRate); + CSVFileReader(QString path, CSVFormat format, size_t mainModelSampleRate); virtual ~CSVFileReader(); virtual bool isOK() const; @@ -39,77 +36,12 @@ virtual Model *load() const; protected: + CSVFormat m_format; QFile *m_file; QString m_error; size_t m_mainModelSampleRate; }; -class CSVFormatDialog : public QDialog -{ - Q_OBJECT - -public: - CSVFormatDialog(QWidget *parent, QFile *file, size_t defaultSampleRate); - - ~CSVFormatDialog(); - - enum ModelType { - OneDimensionalModel, - TwoDimensionalModel, - ThreeDimensionalModel - }; - - enum TimingType { - ExplicitTiming, - ImplicitTiming - }; - - enum TimeUnits { - TimeSeconds, - TimeAudioFrames, - TimeWindows - }; - - ModelType getModelType() const { return m_modelType; } - TimingType getTimingType() const { return m_timingType; } - TimeUnits getTimeUnits() const { return m_timeUnits; } - QString getSeparator() const { return m_separator; } - size_t getSampleRate() const { return m_sampleRate; } - size_t getWindowSize() const { return m_windowSize; } - - QString::SplitBehavior getSplitBehaviour() const { return m_behaviour; } - -protected slots: - void modelTypeChanged(int type); - void timingTypeChanged(int type); - void sampleRateChanged(QString); - void windowSizeChanged(QString); - -protected: - ModelType m_modelType; - TimingType m_timingType; - TimeUnits m_timeUnits; - QString m_separator; - size_t m_sampleRate; - size_t m_windowSize; - - QString::SplitBehavior m_behaviour; - - QList<QStringList> m_example; - int m_maxExampleCols; - QTableWidget *m_exampleWidget; - - QComboBox *m_modelTypeCombo; - QComboBox *m_timingTypeCombo; - QLabel *m_sampleRateLabel; - QComboBox *m_sampleRateCombo; - QLabel *m_windowSizeLabel; - QComboBox *m_windowSizeCombo; - - bool guessFormat(QFile *file); - void populateExample(); -}; - #endif