SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
complexfactorgui.cpp
Go to the documentation of this file.
1 // Copyright (C) 2018 Edouard Griffiths, F4EXB //
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 as 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 V3 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/>. //
17 
18 #include "ui_complexfactorgui.h"
19 #include "complexfactorgui.h"
20 
22  QWidget(parent),
23  ui(new Ui::ComplexFactorGUI)
24 {
25  ui->setupUi(this);
26  ui->automatic->setChecked(false);
27 }
28 
30 {
31  delete ui;
32 }
33 
35 {
36  return ui->module->value() / 100.0;
37 }
38 
40 {
41  return ui->arg->value() * 1.0;
42 }
43 
45 {
46  return ui->automatic->isChecked();
47 }
48 
49 void ComplexFactorGUI::setModule(double value)
50 {
51  double modValue = value < -1.0 ? -1.0 : value > 1.0 ? 1.0 : value;
52  ui->module->setValue((int) modValue*100.0f);
53  ui->moduleText->setText(tr("%1").arg(modValue, 0, 'f', 2));
54 }
55 
57 {
58  int argValue = (int) (value < -180.0 ? -180.0 : value > 180.0 ? 180.0 : value);
59  ui->arg->setValue(argValue);
60  ui->argText->setText(tr("%1").arg(value));
61 }
62 
63 void ComplexFactorGUI::setAutomatic(bool automatic)
64 {
65  ui->automatic->setChecked(automatic);
66 }
67 
69 {
70  ui->automatic->setEnabled(enable);
71 }
72 
73 void ComplexFactorGUI::setLabel(const QString& text)
74 {
75  ui->label->setText(text);
76 }
77 
78 void ComplexFactorGUI::setToolTip(const QString& text)
79 {
80  ui->label->setToolTip(text);
81 }
82 
84 {
85  ui->module->setEnabled(!set);
86  ui->arg->setEnabled(!set);
87  emit automaticChanged(set);
88 }
89 
91 {
92  ui->moduleText->setText(tr("%1").arg(value/100.0f, 0, 'f', 2));
93  emit moduleChanged(value/100.0f);
94 }
95 
97 {
98  ui->argText->setText(tr("%1").arg(value));
99  emit argumentChanged(value);
100 }
Ui::ComplexFactorGUI * ui
bool getAutomatic() const
double getModule() const
void moduleChanged(double value)
Fixed< IntType, IntBits > arg(const std::complex< Fixed< IntType, IntBits > > &val)
Definition: fixed.h:2401
void setArgument(double value)
void setAutomatic(bool automatic)
void setLabel(const QString &text)
void setAutomaticEnable(bool enable)
ComplexFactorGUI(QWidget *parent=0)
void on_module_valueChanged(int value)
double getArgument() const
void on_automatic_toggled(bool set)
void setModule(double value)
void setToolTip(const QString &text)
void automaticChanged(bool value)
void on_arg_valueChanged(int value)
void argumentChanged(double value)