CAVAPA-GUI  30.5.2014
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
userinterface.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 USERINTERFACE_H
31 #define USERINTERFACE_H
32 
33 #include <QObject>
34 
35 #include "cavapa/cavapa.h"
36 #include "common.h"
37 #include "generalsettings.h"
38 #include "metadata.h"
39 #include "results.h"
40 #include "sourcesettings.h"
41 
42 using cavapa::CalibrationPoint;
43 
44 namespace cavapa_gui
45 {
53 {
54  friend class Controller;
55 private:
63  virtual void addSource(SourceID source, SourceType type, FrameTime length,
64  const std::string& path) = 0;
65 
71  virtual bool askConfirmation(const std::string& question) = 0;
72 
76  virtual void calculationCanceled() = 0;
77 
81  virtual void calculationCompleted() = 0;
82 
86  virtual void calculationContinued() = 0;
87 
91  virtual void calculationPaused() = 0;
92 
96  virtual void calculationStarted() = 0;
97 
101  virtual void calculationStopped() = 0;
102 
107  virtual std::vector<std::string> getMarkerHistory() = 0;
108 
113  virtual void newMeasurement() = 0;
114 
118  virtual void openMeasurement() = 0;
119 
124  virtual void removeSource(SourceID source) = 0;
125 
131  virtual void setCalibrationPoints(
132  SourceID source,
133  const std::vector<CalibrationPoint>& points) = 0;
134 
139  virtual void setCanPause(bool flag) = 0;
140 
145  virtual void setCanSaveVideos(bool flag) = 0;
146 
151  virtual void setMarkerHistory(const std::vector<std::string>& history) = 0;
152 
159  virtual void setSize(int width, int height, bool fullscreen) = 0;
160 
166  virtual void setLocation(int x, int y) = 0;
167 
173  virtual void showMessage(const std::string& message,
174  ErrorLevel level) = 0;
175 
180  virtual void sourcePaused(SourceID source) = 0;
181 
186  virtual void sourcePlayStarted(SourceID source) = 0;
187 
191  virtual void startInterface() = 0;
192 
197  virtual void updateCalculation(const FrameStats& statistics) = 0;
198 
204  virtual void updateFrame(const FrameCapture& frame) = 0;
205 
210  virtual void updateGeneralSettings(const GeneralSettings& settings) = 0;
211 
216  virtual void updateMarkers(const std::vector<GraphMarker>& markers) = 0;
217 
222  virtual void updateMetadata(const Metadata& metadata) = 0;
223 
230  virtual void updateSourceSettings(SourceID source,
231  const SourceSettings& settings) = 0;
232 
238  virtual void updateStatistics(const std::vector<FrameStats>& stats) = 0;
239 
240 protected:
241  /*
242  * In a derived class, the following functions are supposed
243  * to be declared as signals:
244  */
245 
249  virtual void calculationCancelRequested() = 0;
250 
254  virtual void calculationContinueRequested() = 0;
255 
259  virtual void calculationPauseRequested() = 0;
260 
264  virtual void calculationStartRequested() = 0;
265 
269  virtual void calculationStopRequested() = 0;
270 
275  virtual void calibrationPointsReady(
276  const std::vector<CalibrationPoint>& points) = 0;
277 
282  virtual void exportRequested(const ExportOptions& options) = 0;
283 
288  virtual void generalSettingsChanged(const GeneralSettings& settings) = 0;
289 
294  virtual void graphPositionSelected(FrameTime time) = 0;
295 
301  virtual void locationChanged(int x, int y) = 0;
302 
309  virtual void markersReady(const std::vector<GraphMarker>& markers) = 0;
310 
315  virtual void metadataOpened(const std::string& path) = 0;
316 
321  virtual void metadataReady(const Metadata& metadata) = 0;
322 
326  virtual void newMeasurementRequested() = 0;
327 
332  virtual void openMeasurementRequested(const std::string& path) = 0;
333 
337  virtual void redoMeasurementRequested() = 0;
338 
342  virtual void refreshRequested() = 0;
343 
350  virtual void sizeChanged(int width, int height, bool fullscreen) = 0;
351 
356  virtual void sourceAddRequested(const std::string& path) = 0;
357 
362  virtual void sourcePauseRequested(SourceID source) = 0;
363 
368  virtual void sourcePlayRequested(SourceID source) = 0;
369 
376  virtual void sourceSeekRequested(SourceID source, FrameTime position) = 0;
377 
382  virtual void sourceRemoveRequested(SourceID source) = 0;
383 
389  virtual void sourceSettingsChanged(SourceID source,
390  const SourceSettings& settings) = 0;
391 
396  virtual void sourceStepBackward(SourceID source) = 0;
397 
402  virtual void sourceStepForward(SourceID source) = 0;
403 
410  virtual void statisticsRequested(FrameTime start,
411  FrameTime stop, int points) = 0;
412 
416  virtual void interfaceClosed() = 0;
417 };
418 } //namespace cavapa_gui
419 
420 #endif // USERINTERFACE_H
virtual void sourcePlayRequested(SourceID source)=0
Emitted when the user requests to play a source.
virtual void calibrationPointsReady(const std::vector< CalibrationPoint > &points)=0
Emitted when the user has set all the calibration points.
virtual void calculationContinueRequested()=0
Emitted when the user requests to continue the calculation.
virtual void sourceStepForward(SourceID source)=0
Emitted when the user steps a video one frame forward.
virtual void calculationPauseRequested()=0
Emitted when the user requests to pause the calculation.
virtual void redoMeasurementRequested()=0
Emitted when the user wants to redo the measurement.
Structure for holding frame statistics on activity.
Definition: common.h:285
unsigned int SourceID
Used to indicate unique source ID-numbers.
Definition: common.h:229
virtual void metadataOpened(const std::string &path)=0
Emitted when the user requests to open a metadata file.
virtual void sourcePauseRequested(SourceID source)=0
Emitted when the user requests to pause a source.
The Controller class handles the messages between UserInterface and AnalysisController.
Definition: controller.h:68
virtual void locationChanged(int x, int y)=0
Emitted when the interface is moved.
virtual void refreshRequested()=0
Emitted when the user requests to refresh cameras.
Represents the metadata associated with a measurement.
Definition: metadata.h:91
virtual void newMeasurementRequested()=0
Emitted when the user wants to start a new measurement.
virtual void calculationStartRequested()=0
Emitted when the user requests to start the calculation.
Represents the settings for a video source.
Definition: sourcesettings.h:46
SourceType
Available source types are the following ones: CAMERA = hardware or network camera, NOTHING = not a working source, STREAM = network stream, VIDEO = video file and VIDEOSET = set of multiple files.
Definition: common.h:68
virtual void exportRequested(const ExportOptions &options)=0
Emitted when the user requests to export data from the graph.
virtual void sourceAddRequested(const std::string &path)=0
Emitted when the user adds a new video source.
Represents the general settings of the application.
Definition: generalsettings.h:43
virtual void sourceSettingsChanged(SourceID source, const SourceSettings &settings)=0
Emitted when the user changes a setting for a source.
std::uint64_t FrameTime
Used to store milliseconds interval in frame times.
Definition: common.h:138
virtual void statisticsRequested(FrameTime start, FrameTime stop, int points)=0
Emitted when the user wants the frame statistics to be retrieved.
The structure is used for storing a single source frame.
Definition: common.h:241
virtual void interfaceClosed()=0
Emitted when the user closes the interface.
virtual void calculationStopRequested()=0
Emitted when the user requests to stop the calculation.
The structure holds CSV export options.
Definition: common.h:183
virtual void sizeChanged(int width, int height, bool fullscreen)=0
Emitted when the size of the interface changes.
virtual void sourceStepBackward(SourceID source)=0
Emitted when the user steps a video one frame back.
virtual void sourceSeekRequested(SourceID source, FrameTime position)=0
Emitted when the user requests to seek a source to a certain position.
virtual void sourceRemoveRequested(SourceID source)=0
Emitted when the user removes a source.
virtual void generalSettingsChanged(const GeneralSettings &settings)=0
Emitted when the user changes a general setting.
virtual void openMeasurementRequested(const std::string &path)=0
Emitted when the user wants to open an existing measurement.
virtual void calculationCancelRequested()=0
Emitted when the user requests to cancel the calculation.
virtual void markersReady(const std::vector< GraphMarker > &markers)=0
Emitted when the user has placed all the markers.
ErrorLevel
Error level indicator.
Definition: common.h:77
virtual void graphPositionSelected(FrameTime time)=0
Emitted when the user selects a position in the activity graph.
The UserInterface class defines the methods and signals that a user interface needs to have...
Definition: userinterface.h:52
virtual void metadataReady(const Metadata &metadata)=0
Emitted when the user has input all the metadata.