File: dockinputctl.h

package info (click to toggle)
gqrx-sdr 2.6-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 3,700 kB
  • ctags: 2,724
  • sloc: cpp: 22,413; ansic: 564; xml: 25; makefile: 4
file content (142 lines) | stat: -rw-r--r-- 4,257 bytes parent folder | download | duplicates (2)
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
138
139
140
141
142
/* -*- c++ -*- */
/*
 * Gqrx SDR: Software defined radio receiver powered by GNU Radio and Qt
 *           http://gqrx.dk/
 *
 * Copyright 2011-2013 Alexandru Csete OZ9AEC.
 *
 * Gqrx 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, or (at your option)
 * any later version.
 *
 * Gqrx 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 Gqrx; see the file COPYING.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street,
 * Boston, MA 02110-1301, USA.
 */
#ifndef DOCKINPUTCTL_H
#define DOCKINPUTCTL_H

#include <vector>
#include <string>

#include <QDockWidget>
#include <QGridLayout>
#include <QLabel>
#include <QList>
#include <QSettings>
#include <QSlider>
#include <QMap>
#include <QString>
#include <QVariant>


/*! \brief Structure describing a gain parameter with its range. */
typedef struct
{
    std::string name;   /*!< The name of this gain stage. */
    double      value;  /*!< Initial value. */
    double      start;  /*!< The lower limit. */
    double      stop;   /*!< The uppewr limit. */
    double      step;   /*!< The resolution/step. */
} gain_t;

/*! \brief A vector with gain parameters.
 *
 * This data structure is used for transfering
 * information about available gain stages.
 */
typedef std::vector<gain_t> gain_list_t;


namespace Ui {
    class DockInputCtl;
}

class DockInputCtl : public QDockWidget
{
    Q_OBJECT

public:
    explicit DockInputCtl(QWidget * parent = 0);
    ~DockInputCtl();

    void    readSettings(QSettings * settings);
    void    saveSettings(QSettings * settings);

    void    setLnbLo(double freq_mhz);
    double  lnbLo();
    void    readLnbLoFromSettings(QSettings * settings);

    void    setGain(QString &name, double value);
    double  gain(QString &name);

    void    setAgc(bool enabled);
    bool    agc();

    void    setFreqCorr(double corr);
    double  freqCorr();

    void    setIqSwap(bool reversed);
    bool    iqSwap(void);

    void    setDcCancel(bool enabled);
    bool    dcCancel(void);

    void    setIqBalance(bool enabled);
    bool    iqBalance(void);

    void    setIgnoreLimits(bool reversed);
    bool    ignoreLimits(void);

    void    setAntennas(std::vector<std::string> &antennas);
    void    setAntenna(const QString &antenna);

    void    setGainStages(gain_list_t &gain_list);
    void    restoreManualGains(QSettings *settings);

signals:
    void gainChanged(QString name, double value);
    void autoGainChanged(bool enabled);
    void freqCorrChanged(double value);
    void lnbLoChanged(double freq_mhz);
    void iqSwapChanged(bool reverse);
    void dcCancelChanged(bool enabled);
    void iqBalanceChanged(bool enabled);
    void ignoreLimitsChanged(bool ignore);
    void antennaSelected(QString antenna);

private slots:
    void on_lnbSpinBox_valueChanged(double value);
    void on_agcButton_toggled(bool checked);
    void on_freqCorrSpinBox_valueChanged(double value);
    void on_iqSwapButton_toggled(bool checked);
    void on_dcCancelButton_toggled(bool checked);
    void on_iqBalanceButton_toggled(bool checked);
    void on_ignoreButton_toggled(bool checked);
    void on_antSelector_currentIndexChanged(const QString &antenna);

    void sliderValueChanged(int value);

private:
    void clearWidgets();
    void updateLabel(int idx, double value);
    void getGains(QMap<QString, QVariant> * gains);
    void setGains(QMap<QString, QVariant> * gains);

private:
    QList<QSlider *>  gain_sliders; /*!< A list containing the gain sliders. */
    QList<QLabel *>   gain_labels;  /*!< A list containing the gain labels. */
    QList<QLabel *>   value_labels; /*!< A list containing labels showing the current gain value. */

    Ui::DockInputCtl *ui;           /*!< User interface. */
    QGridLayout      *gainLayout;   /*!< Grid layout containing gain controls and labels. */
};

#endif // DOCKINPUTCTL_H