annotate widgets/CSVFormatDialog.h @ 1612:129c704566ff csv-import-headers

Support column headers, with user toggle; also distinguish visibly between tab and general whitespace delimiters
author Chris Cannam
date Thu, 18 Jun 2020 11:52:29 +0100
parents 0930a27ebea2
children
rev   line source
Chris@378 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@378 2
Chris@378 3 /*
Chris@378 4 Sonic Visualiser
Chris@378 5 An audio file viewer and annotation editor.
Chris@378 6 Centre for Digital Music, Queen Mary, University of London.
Chris@378 7 This file copyright 2006 Chris Cannam.
Chris@378 8
Chris@378 9 This program is free software; you can redistribute it and/or
Chris@378 10 modify it under the terms of the GNU General Public License as
Chris@378 11 published by the Free Software Foundation; either version 2 of the
Chris@378 12 License, or (at your option) any later version. See the file
Chris@378 13 COPYING included with this distribution for more information.
Chris@378 14 */
Chris@378 15
Chris@1312 16 #ifndef SV_CSV_FORMAT_DIALOG_H
Chris@1312 17 #define SV_CSV_FORMAT_DIALOG_H
Chris@378 18
Chris@378 19 #include "data/fileio/CSVFormat.h"
Chris@378 20
Chris@378 21 class QTableWidget;
Chris@378 22 class QComboBox;
Chris@378 23 class QLabel;
Chris@1413 24 class QFrame;
Chris@1612 25 class QCheckBox;
Chris@378 26
Chris@378 27 #include <QDialog>
Chris@378 28
Chris@378 29 class CSVFormatDialog : public QDialog
Chris@378 30 {
Chris@378 31 Q_OBJECT
Chris@378 32
Chris@378 33 public:
Chris@1318 34 CSVFormatDialog(QWidget *parent,
Chris@1318 35 CSVFormat initialFormat,
Chris@1413 36 int maxDisplayCols);
Chris@1413 37
Chris@1413 38 CSVFormatDialog(QWidget *parent,
Chris@1413 39 QString csvFilePath, // to guess format of
Chris@1413 40 sv_samplerate_t referenceSampleRate,
Chris@1413 41 int maxDisplayCols);
Chris@1413 42
Chris@378 43 ~CSVFormatDialog();
Chris@378 44
Chris@378 45 CSVFormat getFormat() const;
Chris@378 46
Chris@378 47 protected slots:
Chris@1612 48 void headerChanged(bool);
Chris@1413 49 void separatorChanged(QString);
Chris@378 50 void timingTypeChanged(int type);
Chris@378 51 void sampleRateChanged(QString);
Chris@378 52 void windowSizeChanged(QString);
Chris@560 53 void columnPurposeChanged(int purpose);
Chris@959 54
Chris@959 55 void updateFormatFromDialog();
Chris@561 56 void updateModelLabel();
Chris@378 57
Chris@378 58 protected:
Chris@1413 59 QString m_csvFilePath;
Chris@1413 60 sv_samplerate_t m_referenceSampleRate;
Chris@560 61 CSVFormat m_format;
Chris@581 62 int m_maxDisplayCols;
Chris@1318 63
Chris@959 64 enum TimingOption {
Chris@959 65 TimingExplicitSeconds = 0,
Chris@959 66 TimingExplicitMsec,
Chris@959 67 TimingExplicitSamples,
Chris@959 68 TimingImplicit
Chris@959 69 };
Chris@959 70 std::map<TimingOption, QString> m_timingLabels;
Chris@959 71 TimingOption m_initialTimingOption;
Chris@959 72
Chris@1413 73 void init();
Chris@1413 74 void repopulate();
Chris@1318 75 void columnPurposeChangedForAnnotationType(QComboBox *, int purpose);
Chris@959 76 void updateComboVisibility();
Chris@959 77 void applyStartTimePurpose();
Chris@959 78 void removeStartTimePurpose();
Chris@1413 79
Chris@1612 80 QString m_tabText;
Chris@1612 81 QString m_whitespaceText;
Chris@1612 82
Chris@1413 83 QFrame *m_exampleFrame;
Chris@1413 84 int m_exampleFrameRow;
Chris@1612 85
Chris@1612 86 QCheckBox *m_headerCheckBox;
Chris@1413 87 QComboBox *m_separatorCombo;
Chris@378 88 QComboBox *m_timingTypeCombo;
Chris@378 89 QLabel *m_sampleRateLabel;
Chris@378 90 QComboBox *m_sampleRateCombo;
Chris@378 91 QLabel *m_windowSizeLabel;
Chris@378 92 QComboBox *m_windowSizeCombo;
Chris@561 93 QLabel *m_modelLabel;
Chris@378 94
Chris@560 95 QList<QComboBox *> m_columnPurposeCombos;
Chris@581 96 int m_fuzzyColumn;
Chris@378 97 };
Chris@378 98
Chris@378 99 #endif