comparison 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
comparison
equal deleted inserted replaced
1412:79032214f79d 1413:0930a27ebea2
19 #include "data/fileio/CSVFormat.h" 19 #include "data/fileio/CSVFormat.h"
20 20
21 class QTableWidget; 21 class QTableWidget;
22 class QComboBox; 22 class QComboBox;
23 class QLabel; 23 class QLabel;
24 class QFrame;
24 25
25 #include <QDialog> 26 #include <QDialog>
26 27
27 class CSVFormatDialog : public QDialog 28 class CSVFormatDialog : public QDialog
28 { 29 {
29 Q_OBJECT 30 Q_OBJECT
30 31
31 public: 32 public:
32 CSVFormatDialog(QWidget *parent, 33 CSVFormatDialog(QWidget *parent,
33 CSVFormat initialFormat, 34 CSVFormat initialFormat,
34 int maxDisplayCols = 5); 35 int maxDisplayCols);
36
37 CSVFormatDialog(QWidget *parent,
38 QString csvFilePath, // to guess format of
39 sv_samplerate_t referenceSampleRate,
40 int maxDisplayCols);
41
35 ~CSVFormatDialog(); 42 ~CSVFormatDialog();
36 43
37 CSVFormat getFormat() const; 44 CSVFormat getFormat() const;
38 45
39 protected slots: 46 protected slots:
47 void separatorChanged(QString);
40 void timingTypeChanged(int type); 48 void timingTypeChanged(int type);
41 void sampleRateChanged(QString); 49 void sampleRateChanged(QString);
42 void windowSizeChanged(QString); 50 void windowSizeChanged(QString);
43 void columnPurposeChanged(int purpose); 51 void columnPurposeChanged(int purpose);
44 52
45 void updateFormatFromDialog(); 53 void updateFormatFromDialog();
46 void updateModelLabel(); 54 void updateModelLabel();
47 55
48 protected: 56 protected:
57 QString m_csvFilePath;
58 sv_samplerate_t m_referenceSampleRate;
49 CSVFormat m_format; 59 CSVFormat m_format;
50 int m_maxDisplayCols; 60 int m_maxDisplayCols;
51 61
52 enum TimingOption { 62 enum TimingOption {
53 TimingExplicitSeconds = 0, 63 TimingExplicitSeconds = 0,
56 TimingImplicit 66 TimingImplicit
57 }; 67 };
58 std::map<TimingOption, QString> m_timingLabels; 68 std::map<TimingOption, QString> m_timingLabels;
59 TimingOption m_initialTimingOption; 69 TimingOption m_initialTimingOption;
60 70
71 void init();
72 void repopulate();
61 void columnPurposeChangedForAnnotationType(QComboBox *, int purpose); 73 void columnPurposeChangedForAnnotationType(QComboBox *, int purpose);
62 void updateComboVisibility(); 74 void updateComboVisibility();
63 void applyStartTimePurpose(); 75 void applyStartTimePurpose();
64 void removeStartTimePurpose(); 76 void removeStartTimePurpose();
77
78 QFrame *m_exampleFrame;
79 int m_exampleFrameRow;
65 80
81 QComboBox *m_separatorCombo;
66 QComboBox *m_timingTypeCombo; 82 QComboBox *m_timingTypeCombo;
67 QLabel *m_sampleRateLabel; 83 QLabel *m_sampleRateLabel;
68 QComboBox *m_sampleRateCombo; 84 QComboBox *m_sampleRateCombo;
69 QLabel *m_windowSizeLabel; 85 QLabel *m_windowSizeLabel;
70 QComboBox *m_windowSizeCombo; 86 QComboBox *m_windowSizeCombo;