1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Copyright (c) 2012-2017 VideoStitch SAS
// Copyright (c) 2018 stitchEm
#pragma once
#include "stylablewidget.hpp"
#include "libvideostitch/config.hpp"
namespace Ui {
class TimeWidget;
}
class QKeyEvent;
class VS_GUI_EXPORT TimeWidget : public QWidget {
Q_PROPERTY(bool timecodeVisibility READ getTimecodeVisibility WRITE setTimecodeVisibility DESIGNABLE true)
Q_PROPERTY(bool framenumberVisibility READ getFramenumberVisibility WRITE setFramenumberVisibility DESIGNABLE true)
Q_OBJECT
public:
explicit TimeWidget(QWidget *parent = nullptr);
~TimeWidget();
/**
* @brief Sets the timecode editable/ not editable.
* @param True = the use can edit the timecode, false, the edits are readOnly.
*/
void setEditable(bool editable);
/**
* @brief Gets the editable status.
* @return True, the user can edit the timecode, false, the edits are readOnly.
*/
bool isEditable() const;
/**
* @brief Resets the timecode to an empty string.
*/
void reset();
/**
* @brief Updates the input mask depending on the input time format.
* @param moreThanOneHour True if the format contains hour value.
* @param threeDigitsFps True if the framerate is over 99 fps.
*/
void updateInputMask(bool moreThanOneHour, bool threeDigitsFps);
/**
* @brief Sets the maximum frame that can be displayed.
* @param max Maximum frame.
*/
void setMaxFrame(const frameid_t max);
/**
* Properties
*/
bool getTimecodeVisibility() const;
bool getFramenumberVisibility() const;
void setTimecodeVisibility(bool visible);
void setFramenumberVisibility(bool visible);
public slots:
/**
* @brief Sets the value of the timecode and frame to the given frame. The framerate is used to compute the timecode.
* @param frame Frame used to set the timecode/frame.
*/
void setFrame(frameid_t frameId);
signals:
/**
* @brief Signal emitted when the frame number has been changed.
* @param frameId New frame.
*/
void frameChanged(frameid_t frameId);
/**
* @brief Signal emitted when the timecode has been changed.
* @param frameId New frame.
*/
void frameChangedFromTimeCode(frameid_t frameId);
private:
/**
* @brief Overloaded mouse double click event to toggle on/off the editable status.
* @param e Mouse Event.
*/
virtual void mouseDoubleClickEvent(QMouseEvent *e) override;
/**
* @brief Overloaded keyboard event. May be used to apply the changes when the user will hit enter.
* @param e Keyboard event.
*/
virtual void keyPressEvent(QKeyEvent *e) override;
Ui::TimeWidget *ui;
bool editable;
frameid_t maxFrame;
frameid_t defaultFrame;
};