-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbaseconfigwidget.cpp
137 lines (116 loc) · 3.4 KB
/
baseconfigwidget.cpp
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
/* OpenCV Catalogue is a desktop GUI application to showcase some OpenCV functions
* and parameter adjustment using controls in GUI.
* Copyright (C) 2020 Jairaj Jangle
*
* This file is part of OpenCV Catalogue.
*
* OpenCV Catalogue 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 3 of the License, or
* (at your option) any later version.
*
* OpenCV Catalogue 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 OpenCV Catalogue. If not, see <https://www.gnu.org/licenses/>.
*/
#include "CustomWidgets/baseconfigwidget.h"
#include "Utils/constants.h"
void BaseConfigWidget::mouseLBClicked(QPoint point)
{
if(chainMenuWidget->getRadioButton()->isChecked())
begin = cv::Point(point.x(), point.y());
}
void BaseConfigWidget::mouseLBMoved(QPoint point)
{
qInfo() << "Mouse LB moved at: " << point;
}
void BaseConfigWidget::mouseLBReleased(QPoint point)
{
qInfo() << "Mouse LB released at: " << point;
}
BaseConfigWidget::BaseConfigWidget(){
begin =cv::Point(-1, -1);
end =cv::Point(-1, -1);
connect(chainMenuWidget, &ChainMenuWidget::radioButtonChecked,
this, [=]() {
emit operationSelected(paramAdjustWidget);
});
changeWidgetsStyleSheet(isDarkModeOn);
}
QWidget* BaseConfigWidget::getConfigWidget()
{
return wgtSub;
}
ChainMenuWidget* BaseConfigWidget::getChainMenuWidget()
{
chainMenuWidget->setCurrentOperation(operationName);
return chainMenuWidget;
}
ParamAdjustWidget* BaseConfigWidget::getParamAdjustWidget()
{
return paramAdjustWidget;
}
QMap<QString, cv::Mat> BaseConfigWidget::getExplodedViewMats()
{
return explodedView;
}
void BaseConfigWidget::changeWidgetsStyleSheet(bool isDarkMode)
{
paramAdjustWidget->setInfoIconStyleSheet(isDarkMode);
chainMenuWidget->setStyleSheet(isDarkMode);
}
QString BaseConfigWidget::getOperationName()
{
return operationName;
}
QString BaseConfigWidget::getInfoURL()
{
return moreInfoLink;
}
bool BaseConfigWidget::setExplodedView([[maybe_unused]] bool explodedViewEnabled)
{
/*
* If exploded == true:
* Should return true if exploded view is possible else false
* If exploded == false:
* Ignore return value
*/
return this->explodedViewEnabled;
}
bool BaseConfigWidget::isExplodedViewEnabled()
{
return explodedViewEnabled;
}
QUuid BaseConfigWidget::getUUID()
{
return uuid;
}
cv::Mat BaseConfigWidget::getProcessedImage(cv::Mat inputImage)try
{
/*
* Perform OpenCV operations here in derived classes
*/
return inputImage;
}
catch(cv::Exception& e){
throw e;
} catch(std::exception& e) {
throw e;
}
catch(...){
throw std::string("Unknown Exception in ")
+ std::string(typeid(this).name()); // Append class name
}
void BaseConfigWidget::initWidget()
{
// vBoxSub->setAlignment(Qt::AlignHCenter);
wgtSub->setMinimumWidth(370);
wgtSub->setMaximumWidth(420);
paramAdjustWidget->setContentLayout(wgtSub,
&operationName,
&moreInfoLink);
}