-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalibrationwindow.cpp
130 lines (97 loc) · 3.19 KB
/
calibrationwindow.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
#include "calibrationwindow.h"
#include "ui_calibrationwindow.h"
#include "logcategories.h"
calibrationWindow::calibrationWindow(QWidget *parent) :
QDialog(parent),
ui(new Ui::calibrationWindow)
{
ui->setupUi(this);
ui->calCourseSlider->setDisabled(true);
ui->calCourseSpinbox->setDisabled(true);
ui->calFineSlider->setDisabled(true);
ui->calFineSpinbox->setDisabled(true);
}
calibrationWindow::~calibrationWindow()
{
delete ui;
}
void calibrationWindow::handleCurrentFreq(double tunedFreq)
{
(void)tunedFreq;
}
void calibrationWindow::handleSpectrumPeak(double peakFreq)
{
(void)peakFreq;
}
void calibrationWindow::handleRefAdjustCourse(unsigned char value)
{
ui->calCourseSlider->setDisabled(false);
ui->calCourseSpinbox->setDisabled(false);
ui->calCourseSlider->blockSignals(true);
ui->calCourseSpinbox->blockSignals(true);
ui->calCourseSlider->setValue((int) value);
ui->calCourseSpinbox->setValue((int) value);
ui->calCourseSlider->blockSignals(false);
ui->calCourseSpinbox->blockSignals(false);
}
void calibrationWindow::handleRefAdjustFine(unsigned char value)
{
ui->calFineSlider->setDisabled(false);
ui->calFineSpinbox->setDisabled(false);
ui->calFineSlider->blockSignals(true);
ui->calFineSpinbox->blockSignals(true);
ui->calFineSlider->setValue((int) value);
ui->calFineSpinbox->setValue((int) value);
ui->calFineSlider->blockSignals(false);
ui->calFineSpinbox->blockSignals(false);
}
void calibrationWindow::on_calReadRigCalBtn_clicked()
{
emit requestRefAdjustCourse();
emit requestRefAdjustFine();
}
void calibrationWindow::on_calCourseSlider_valueChanged(int value)
{
ui->calCourseSpinbox->blockSignals(true);
ui->calCourseSpinbox->setValue((int) value);
ui->calCourseSpinbox->blockSignals(false);
emit setRefAdjustCourse((unsigned char) value);
}
void calibrationWindow::on_calFineSlider_valueChanged(int value)
{
ui->calFineSpinbox->blockSignals(true);
ui->calFineSpinbox->setValue((int) value);
ui->calFineSpinbox->blockSignals(false);
emit setRefAdjustFine((unsigned char) value);
}
void calibrationWindow::on_calCourseSpinbox_valueChanged(int value)
{
// this one works with the up and down arrows,
// however, if typing in a value, say "128",
// this will get called three times with these values:
// 1
// 12
// 128
//int value = ui->calFineSpinbox->value();
ui->calCourseSlider->blockSignals(true);
ui->calCourseSlider->setValue(value);
ui->calCourseSlider->blockSignals(false);
emit setRefAdjustCourse((unsigned char) value);
}
void calibrationWindow::on_calFineSpinbox_valueChanged(int value)
{
//int value = ui->calFineSpinbox->value();
ui->calFineSlider->blockSignals(true);
ui->calFineSlider->setValue(value);
ui->calFineSlider->blockSignals(false);
emit setRefAdjustFine((unsigned char) value);
}
void calibrationWindow::on_calFineSpinbox_editingFinished()
{
}
void calibrationWindow::on_calCourseSpinbox_editingFinished()
{
// This function works well for typing in values
// but the up and down arrows on the spinbox will not
// trigger this function, until the enter key is pressed.
}