CSVExportDialog.h
Go to the documentation of this file.
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 {
32  layerName(""),
33  fileExtension("csv"),
34  isDense(false),
35  haveView(false),
36  haveSelection(false) { }
37 
41  QString layerName;
42 
46  QString fileExtension;
47 
52  bool isDense;
53 
60  bool haveView;
61 
67  };
68 
69  CSVExportDialog(Configuration config, QWidget *parent);
70 
76  QString getDelimiter() const;
77 
82  bool shouldIncludeHeader() const;
83 
89  bool shouldIncludeTimestamps() const;
90 
95  bool shouldWriteTimeInFrames() const;
96 
102  bool shouldConstrainToViewHeight() const;
103 
108  bool shouldConstrainToSelection() const;
109 
110 private:
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
bool shouldIncludeHeader() const
Return true if we should include a header row at the top of the exported file.
QRadioButton * m_selectionOnly
bool shouldConstrainToSelection() const
Return true if we should export the selected time range(s) only.
bool shouldConstrainToViewHeight() const
Return true if we should constrain the vertical range to the visible area only.
bool haveView
True if we have a view that provides a vertical scale range, so we may want to offer a choice between...
bool shouldIncludeTimestamps() const
Return true if we should write a timestamp column.
Configuration m_config
bool shouldWriteTimeInFrames() const
Return true if we should use sample frames rather than seconds for the timestamp column (and duration...
QCheckBox * m_header
QString getDelimiter() const
Return the column delimiter to use in the exported file.
bool haveSelection
True if there is a selection current that the user may want to constrain export to.
QCheckBox * m_timestamps
QRadioButton * m_seconds
QString fileExtension
Extension of file being exported into.
void timestampsToggled(bool)
bool isDense
True if the model is a dense type for which timestamps are not written by default.
QRadioButton * m_frames
QComboBox * m_separatorCombo
QString layerName
Presentation name of the layer being exported.
QRadioButton * m_viewOnly
CSVExportDialog(Configuration config, QWidget *parent)
!! todo: remember & re-apply last set of options chosen for this layer type