Mercurial > hg > svgui
comparison widgets/CSVExportDialog.h @ 1569:b33b0b06133e
Merge from branch csv-export-dialog
author | Chris Cannam |
---|---|
date | Tue, 14 Jan 2020 15:48:44 +0000 |
parents | 3943553b95b0 |
children |
comparison
equal
deleted
inserted
replaced
1567:77ffd5421627 | 1569:b33b0b06133e |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 Sonic Visualiser | |
5 An audio file viewer and annotation editor. | |
6 Centre for Digital Music, Queen Mary, University of London. | |
7 | |
8 This program is free software; you can redistribute it and/or | |
9 modify it under the terms of the GNU General Public License as | |
10 published by the Free Software Foundation; either version 2 of the | |
11 License, or (at your option) any later version. See the file | |
12 COPYING included with this distribution for more information. | |
13 */ | |
14 | |
15 #ifndef SV_CSV_EXPORT_DIALOG_H | |
16 #define SV_CSV_EXPORT_DIALOG_H | |
17 | |
18 #include <QDialog> | |
19 #include <QString> | |
20 | |
21 class QComboBox; | |
22 class QCheckBox; | |
23 class QRadioButton; | |
24 | |
25 class CSVExportDialog : public QDialog | |
26 { | |
27 Q_OBJECT | |
28 | |
29 public: | |
30 struct Configuration { | |
31 Configuration() : | |
32 layerName(""), | |
33 fileExtension("csv"), | |
34 isDense(false), | |
35 haveView(false), | |
36 haveSelection(false) { } | |
37 | |
38 /** | |
39 * Presentation name of the layer being exported. | |
40 */ | |
41 QString layerName; | |
42 | |
43 /** | |
44 * Extension of file being exported into. | |
45 */ | |
46 QString fileExtension; | |
47 | |
48 /** | |
49 * True if the model is a dense type for which timestamps are | |
50 * not written by default. | |
51 */ | |
52 bool isDense; | |
53 | |
54 /** | |
55 * True if we have a view that provides a vertical scale | |
56 * range, so we may want to offer a choice between exporting | |
57 * only the visible range or exporting full height. This | |
58 * choice happens to be offered only if isDense is also true. | |
59 */ | |
60 bool haveView; | |
61 | |
62 /** | |
63 * True if there is a selection current that the user may want | |
64 * to constrain export to. | |
65 */ | |
66 bool haveSelection; | |
67 }; | |
68 | |
69 CSVExportDialog(Configuration config, QWidget *parent); | |
70 | |
71 /** | |
72 * Return the column delimiter to use in the exported file. Either | |
73 * the default for the supplied file extension, or some other | |
74 * option chosen by the user. | |
75 */ | |
76 QString getDelimiter() const; | |
77 | |
78 /** | |
79 * Return true if we should include a header row at the top of the | |
80 * exported file. | |
81 */ | |
82 bool shouldIncludeHeader() const; | |
83 | |
84 /** | |
85 * Return true if we should write a timestamp column. This is | |
86 * always true for non-dense models, but is a user option for | |
87 * dense ones. | |
88 */ | |
89 bool shouldIncludeTimestamps() const; | |
90 | |
91 /** | |
92 * Return true if we should use sample frames rather than seconds | |
93 * for the timestamp column (and duration where present). | |
94 */ | |
95 bool shouldWriteTimeInFrames() const; | |
96 | |
97 /** | |
98 * Return true if we should constrain the vertical range to the | |
99 * visible area only. Otherwise we should export the full vertical | |
100 * range of the model. | |
101 */ | |
102 bool shouldConstrainToViewHeight() const; | |
103 | |
104 /** | |
105 * Return true if we should export the selected time range(s) | |
106 * only. Otherwise we should export the full length of the model. | |
107 */ | |
108 bool shouldConstrainToSelection() const; | |
109 | |
110 private: | |
111 Configuration m_config; | |
112 | |
113 QComboBox *m_separatorCombo; | |
114 QCheckBox *m_header; | |
115 QCheckBox *m_timestamps; | |
116 QRadioButton *m_seconds; | |
117 QRadioButton *m_frames; | |
118 QRadioButton *m_selectionOnly; | |
119 QRadioButton *m_viewOnly; | |
120 | |
121 private slots: | |
122 void timestampsToggled(bool); | |
123 }; | |
124 | |
125 #endif |