1 /*
2  * Copyright (c) 2019 Meltytech, LLC
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 3 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef VIDEOZOOMSCOPEWIDGET_H
19 #define VIDEOZOOMSCOPEWIDGET_H
20 
21 #include "scopewidget.h"
22 #include "widgets/screenselector.h"
23 
24 #include <QMutex>
25 #include <QPoint>
26 #include <QString>
27 
28 class QLabel;
29 class QToolButton;
30 class VideoZoomWidget;
31 
32 class VideoZoomScopeWidget Q_DECL_FINAL : public ScopeWidget
33 {
34     Q_OBJECT
35 
36 public:
37     explicit VideoZoomScopeWidget();
38     QString getTitle() Q_DECL_OVERRIDE;
39 
40 private slots:
41     void onScreenSelectStarted();
42     void onLockToggled(bool enabled);
43     void onScreenRectSelected(const QRect& rect);
44     void onScreenPointSelected(const QPoint& point);
45     void onPixelSelected(const QPoint& pixel);
46     void onZoomChanged(int zoom);
47 
48 private:
49     // Called from the scope thread
50     void refreshScope(const QSize& size, bool full) Q_DECL_OVERRIDE;
51 
52     // Called from UI thread
53     Q_INVOKABLE void updateLabels();
54 
55     VideoZoomWidget* m_zoomWidget;
56     ScreenSelector m_selector;
57     QLabel* m_zoomLabel;
58     QLabel* m_pixelXLabel;
59     QLabel* m_pixelYLabel;
60     QLabel* m_rLabel;
61     QLabel* m_gLabel;
62     QLabel* m_bLabel;
63     QLabel* m_yLabel;
64     QLabel* m_uLabel;
65     QLabel* m_vLabel;
66     QToolButton* m_lockButton;
67 };
68 
69 #endif // VIDEOZOOMSCOPEWIDGET_H
70