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
// Copyright (c) 2012-2017 VideoStitch SAS
// Copyright (c) 2018 stitchEm
#pragma once
#include "libvideostitch-gui/common.hpp"
#include "libvideostitch-gui/videostitcher/projectdefinition.hpp"
#include "libvideostitch/allocator.hpp"
#include "libvideostitch/input.hpp"
#include "libvideostitch-gui/widgets/singlevideowidget.hpp"
namespace Ui {
class CropWidget;
}
class ProjectDefinition;
class CropInputTab;
class QHBoxLayout;
/**
* @brief A widget to manager inputs crop edition.
*/
class VS_GUI_EXPORT CropWidget : public QWidget {
Q_OBJECT
public:
explicit CropWidget(QWidget* parent = nullptr);
/**
* @brief Constructor
* @param p A ProjectDefinition pointer.
* @param f An input format.
* @param parent A parent widget.
*/
explicit CropWidget(ProjectDefinition* p, InputLensClass::LensType t, const int extended, QWidget* parent = nullptr);
~CropWidget();
/**
* @brief Creates one tab per input and sets up the input extractors.
*/
void initializeTabs();
/**
* @brief Deletes tha tabs and removes the input extractors.
*/
void deinitializeTabs();
/**
* @brief Sets the current crop value.
*/
void applyCrop();
/**
* @brief Resets every input crop value.
*/
void setDefaultCrop();
void setProject(ProjectDefinition* p);
void setLensType(InputLensClass::LensType t);
void setWidgetExtension(int extended);
QHBoxLayout* getHorizontalLayout();
signals:
/**
* @brief Applies a list of crop values to the inputs.
* @param crops A list of crops. Should contain the same amount of elements than the inputs.
* @param lensType The lens type.
*/
void reqApplyCrops(const QVector<Crop>& crops, const InputLensClass::LensType lensType);
void reqRegisterRender(std::shared_ptr<VideoStitch::Core::SourceRenderer> renderer, const int inputId);
void reqUnregisterRender(const QString name, const int inputId);
void reextract(SignalCompressionCaps* = nullptr);
private slots:
/**
* @brief Locks or unlocks the current tab crop values into the other tabs.
* @param block True for blocking.
*/
void onCropLocked(const bool block);
void onTabChanged(const int index);
private:
void disconnectFrom(CropInputTab* mainInputTab);
void connectTo(CropInputTab* mainInputTab);
int getAvailableHeight() const;
CropInputTab* getTabWidget(const int index) const;
QVector<Crop> getCrops() const;
InputLensClass::LensType lensType;
QScopedPointer<Ui::CropWidget> ui;
ProjectDefinition* project;
int height;
int blockIndex;
int oldFrameAction;
};