diff widgets/CSVFormatDialog.h @ 1413:0930a27ebea2

Support changing the separator (if more than one plausible one is found) and repopulating the dialog
author Chris Cannam
date Wed, 09 Jan 2019 14:41:52 +0000
parents fbda05431ce0
children 129c704566ff
line wrap: on
line diff
--- a/widgets/CSVFormatDialog.h	Wed Dec 19 10:40:17 2018 +0000
+++ b/widgets/CSVFormatDialog.h	Wed Jan 09 14:41:52 2019 +0000
@@ -21,6 +21,7 @@
 class QTableWidget;
 class QComboBox;
 class QLabel;
+class QFrame;
     
 #include <QDialog>
 
@@ -31,12 +32,19 @@
 public:
     CSVFormatDialog(QWidget *parent,
                     CSVFormat initialFormat,
-                    int maxDisplayCols = 5);
+                    int maxDisplayCols);
+
+    CSVFormatDialog(QWidget *parent,
+                    QString csvFilePath, // to guess format of
+                    sv_samplerate_t referenceSampleRate,
+                    int maxDisplayCols);
+
     ~CSVFormatDialog();
 
     CSVFormat getFormat() const;
     
 protected slots:
+    void separatorChanged(QString);
     void timingTypeChanged(int type);
     void sampleRateChanged(QString);
     void windowSizeChanged(QString);
@@ -46,6 +54,8 @@
     void updateModelLabel();
 
 protected:
+    QString m_csvFilePath;
+    sv_samplerate_t m_referenceSampleRate;
     CSVFormat m_format;
     int m_maxDisplayCols;
     
@@ -58,11 +68,17 @@
     std::map<TimingOption, QString> m_timingLabels;
     TimingOption m_initialTimingOption;
 
+    void init();
+    void repopulate();
     void columnPurposeChangedForAnnotationType(QComboBox *, int purpose);
     void updateComboVisibility();
     void applyStartTimePurpose();
     void removeStartTimePurpose();
+
+    QFrame *m_exampleFrame;
+    int m_exampleFrameRow;
     
+    QComboBox *m_separatorCombo;
     QComboBox *m_timingTypeCombo;
     QLabel *m_sampleRateLabel;
     QComboBox *m_sampleRateCombo;