CAVAPA-GUI  30.5.2014
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
exportdialog.h
1 /****************************************************************************
2  * Copyright (c) 2014, Joel Kivelä, Erkki Koskenkorva, Oskari Leppäaho,
3  * Mika Lehtinen and Petri Partanen.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * * Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  * * Neither the name of the copyright holders nor the names of its
15  * contributors may be used to endorse or promote products derived from
16  * this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
22  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
25  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
26  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
28  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 ****************************************************************************/
30 #ifndef EXPORTDIALOG_H
31 #define EXPORTDIALOG_H
32 
33 #include <QDialog>
34 #include <QDateTime>
35 #include <QFileDialog>
36 #include "activitygraph.h"
37 #include <stdlib.h>
38 #include <algorithm>
39 #include "results.h"
40 
41 namespace Ui {
42  class ExportDialog;
43 }
44 
45 namespace cavapa_gui{
46 
54 class ExportDialog : public QDialog
55 {
56  Q_OBJECT
57 
58 public:
59  explicit ExportDialog(QWidget *parent = 0);
60  ~ExportDialog();
61 
62  void setTimeEdits(QDateTime start, QDateTime end);
63  void setMarkers(const std::vector<GraphMarker> markersfrom);
64 
65  void setBeginTimeFromMarker(int i);
66  void setEndTimeFromMarker(int i);
67 
68  void setBeginDateTime(QDateTime time);
69  void setBeginFrameTime(FrameTime frame);
70 
71  void setRelativeTime(bool relative);
72 
73 private:
74  Ui::ExportDialog *ui;
75 
76  // show time values as defined in the cavagraph
77  bool relativetime;
78  QDateTime zerotime;
79 
80  // bools for options edited with ui elements
81  bool comma;
82  bool append;
83  // copy of markers
84  std::vector<GraphMarker> markers;
85 
86  // time/frame values from cavapagrah
87  // presenting the first time/frame positions
88  // of calculation
89 
90  QDateTime begintime;
91  FrameTime beginframe;
92 
93  // path so save cvs
94  QString filepath;
95 
96  // export options edited with ui elements
97  int intervalrate;
98  int timeoffset;
99 
100 signals:
101 
102 
107  void sendTimeStart(QDateTime start);
108 
113  void sendTimeEnd(QDateTime end);
119  bool exportCommand(const ExportOptions& options);
120 
121 private slots:
122  void on_comboBoxStart_currentIndexChanged(int index);
123  void on_comboBoxEnd_currentIndexChanged(int index);
124  void on_radioButtonComma_clicked();
125  void on_radioButtonDot_clicked();
126  void on_pushButtonBrowse_clicked();
127  void sendExportCommand();
128  void on_checkBoxAppend_clicked();
129  void on_dateTimeEditStart_dateTimeChanged(const QDateTime &dateTime);
130  void on_dateTimeEditEnd_dateTimeChanged(const QDateTime &dateTime);
131  void on_pushButtonOk_clicked();
132  void on_lineEditPath_textEdited(const QString &arg1);
133 };
134 
135 
136 }
137 
138 
139 #endif // EXPORTDIALOG_H
void sendTimeStart(QDateTime start)
Send edited time selection start point to the parent.
void setBeginTimeFromMarker(int i)
Sets the begin time of exporting according to a selected marker from the combobox.
Definition: exportdialog.cpp:108
void sendTimeEnd(QDateTime end)
Send edited time selection end point to the parent.
void setBeginFrameTime(FrameTime frame)
Gets the very first frame of the calculation from the parent that is used in marker to QDateTime conv...
Definition: exportdialog.cpp:158
ExportDialog(QWidget *parent=0)
Constructs exporting dialog for the graph.
Definition: exportdialog.cpp:42
bool exportCommand(const ExportOptions &options)
Passes export command to parent.
void setBeginDateTime(QDateTime time)
Gets the starting time of the calculation from the parent that is used in marker position to QDateTim...
Definition: exportdialog.cpp:148
void setTimeEdits(QDateTime start, QDateTime end)
Sets export dialog's time points (start and end)
Definition: exportdialog.cpp:63
std::uint64_t FrameTime
Used to store milliseconds interval in frame times.
Definition: common.h:138
void setMarkers(const std::vector< GraphMarker > markersfrom)
Sets marker data into export dialog's comboboxes.
Definition: exportdialog.cpp:73
The structure holds CSV export options.
Definition: common.h:183
Class for export dialog of graphwidget.
Definition: exportdialog.h:54
void setRelativeTime(bool relative)
Sets time mode between relative and absolute.
Definition: exportdialog.cpp:245
void setEndTimeFromMarker(int i)
Sets the end time of exporting according to a selected marker from combobox.
Definition: exportdialog.cpp:130