forked from IENT/YUView
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdisplaysplitwidget.h
107 lines (80 loc) · 3.13 KB
/
displaysplitwidget.h
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
96
97
98
99
100
101
102
103
104
105
106
107
/* YUView - YUV player with advanced analytics toolset
* Copyright (C) 2015 Institut für Nachrichtentechnik
* RWTH Aachen University, GERMANY
*
* YUView is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* YUView is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with YUView. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DISPLAYSPLITWIDGET_H
#define DISPLAYSPLITWIDGET_H
#include <QObject>
#include <QSplitter>
#include "displaywidget.h"
#include "frameobject.h"
#define NUM_VIEWS 2
#define LEFT_VIEW 0
#define RIGHT_VIEW 1
enum ViewMode {SIDE_BY_SIDE, COMPARISON};
class DisplaySplitWidget : public QSplitter
{
Q_OBJECT
public:
DisplaySplitWidget(QWidget *parent);
~DisplaySplitWidget();
void setActiveDisplayObjects(DisplayObject *newPrimaryDisplayObject, DisplayObject *newSecondaryDisplayObject );
void setActiveStatisticsObjects( StatisticsObject* newPrimaryStatisticsObject, StatisticsObject* newSecondaryStatisticsObject );
// external draw methods for a particular index with the video
void drawFrame(unsigned int frameIdx);
void drawStatistics(unsigned int frameIdx);
void clear();
void setRegularGridParameters(bool show, int size, QColor color);
void setSplitEnabled(bool enableSplit);
void setZoomBoxEnabled(bool enabled);
ViewMode viewMode() {return viewMode_;}
void setViewMode(ViewMode viewMode) {viewMode_ = viewMode; updateView();}
QPixmap captureScreenshot();
public slots:
void splitterMovedTo(int pos, int);
void zoomIn(QPoint* to=NULL);
void zoomOut(QPoint* to=NULL);
void zoomToFit();
void zoomToStandard();
void updateView();
void resetViews();
private:
void zoomToPoint(DisplayWidget* targetWidget, QPoint zoomPoint, float zoomFactor, bool center);
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
virtual void mousePressEvent(QMouseEvent *e);
virtual void mouseMoveEvent(QMouseEvent *e);
virtual void mouseReleaseEvent(QMouseEvent *e);
virtual void wheelEvent (QWheelEvent *e);
virtual void resizeEvent(QResizeEvent *);
bool event(QEvent *event);
DisplayWidget* p_displayWidgets[NUM_VIEWS];
int p_LastSplitPos;
QPoint p_TouchPoint;
qreal p_TouchScale;
// Current rectangular selection
QPoint p_selectionStartPoint;
QPoint p_selectionEndPoint;
// Different selection modes
enum SelectionMode { NONE, SELECT, DRAG };
SelectionMode selectionMode_;
ViewMode viewMode_;
bool p_zoomBoxEnabled;
bool p_enableSplit;
DisplayObject* p_displayObjects[NUM_VIEWS];
StatisticsObject* p_overlayObjects[NUM_VIEWS];
};
#endif // DISPLAYSPLITWIDGET_H