summaryrefslogtreecommitdiffstats
path: root/kradio3/plugins/v4lradio/v4lradio-configuration.h
blob: bf41b5442a29ae2d59c336b953a886871147255e (plain)
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
143
144
145
146
147
/***************************************************************************
                          v4lradio-configuration.h  -  description
                             -------------------
    begin                : Fre Jun 20 2003
    copyright            : (C) 2003 by Martin Witte
    email                : witte@kawo1.rwth-aachen.de
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program 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 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/

#ifndef KRADIO_V4LRADIO_CONFIGURATION_H
#define KRADIO_V4LRADIO_CONFIGURATION_H

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include "../../src/include/radiodevice_interfaces.h"
#include "../../src/include/soundstreamclient_interfaces.h"
#include "../../src/include/gui_list_helper.h"

#include "v4lradio-configuration-ui.h"
#include "v4lcfg_interfaces.h"

class V4LRadio;
class QWidget;

class V4LRadioConfiguration : public V4LRadioConfigurationUI,
                              public IV4LCfgClient,
                              public IFrequencyRadioClient,
                              public ISoundStreamClient,
                              public IRadioDeviceClient
{
Q_OBJECT
public :
    V4LRadioConfiguration (QWidget *parent, SoundStreamID id);
    ~V4LRadioConfiguration ();

    bool connectI (Interface *i);
    bool disconnectI (Interface *i);

    void noticeConnectedSoundClient(ISoundStreamClient::thisInterface *i, bool pointer_valid);
    void noticeDisconnectedSoundClient(ISoundStreamClient::thisInterface *i, bool pointer_valid);

// IV4LCfgClient

RECEIVERS:
    bool noticeRadioDeviceChanged(const QString &s);
    bool noticePlaybackMixerChanged(const QString &soundStreamClientID, const QString &Channel);
    bool noticeCaptureMixerChanged (const QString &soundStreamClientID, const QString &Channel);
    bool noticeDeviceVolumeChanged(float v);
    bool noticeCapabilitiesChanged(const V4LCaps &c);
    bool noticeActivePlaybackChanged(bool a);
    bool noticeMuteOnPowerOffChanged(bool a);
    bool noticeVolumeZeroOnPowerOffChanged(bool a);

// IRadioDeviceClient

RECEIVERS:
    bool noticePowerChanged   (bool /*on*/, const IRadioDevice */*sender = NULL*/)          { return false; }
    bool noticeStationChanged (const RadioStation &, const IRadioDevice */*sender = NULL*/) { return false; }
    bool noticeDescriptionChanged (const QString &, const IRadioDevice *sender = NULL);

    bool noticeCurrentSoundStreamIDChanged(SoundStreamID /*id*/, const IRadioDevice */*sender*/) { return false; }

// IFrequencyRadioClient

RECEIVERS:
    bool noticeFrequencyChanged(float f, const RadioStation *s);
    bool noticeMinMaxFrequencyChanged(float min, float max);
    bool noticeDeviceMinMaxFrequencyChanged(float min, float max);
    bool noticeScanStepChanged(float s);

// ISoundStreamClient

RECEIVERS:
    void noticeConnectedI (ISoundStreamServer *s, bool pointer_valid);

    bool noticeTrebleChanged(SoundStreamID id, float t);
    bool noticeBassChanged(SoundStreamID id, float b);
    bool noticeBalanceChanged(SoundStreamID id, float b);
    bool noticeSignalMinQualityChanged(SoundStreamID id, float q);

    bool noticePlaybackChannelsChanged(const QString & /*client_id*/, const QStringList &/*channels*/);
    bool noticeCaptureChannelsChanged (const QString & /*client_id*/, const QStringList &/*channels*/);
    bool noticeSoundStreamCreated(SoundStreamID /*id*/);


protected:

    bool eventFilter(QObject *o, QEvent *e);

protected slots:

    void selectRadioDevice();
    void slotEditRadioDeviceChanged();
    void slotComboPlaybackMixerSelected(int idx);
    void slotComboCaptureMixerSelected(int idx);

    void slotOK();
    void slotCancel();

    void guiMinFrequencyChanged(int v);
    void guiMaxFrequencyChanged(int v);

    void slotDeviceVolumeChanged (double v); // for KDoubleNumInput,  0.0..1.0
    void slotTrebleChanged (double t);       // for KDoubleNumInput,  0.0..1.0
    void slotBassChanged   (double b);       // for KDoubleNumInput,  0.0..1.0
    void slotBalanceChanged(double b);       // for KDoubleNumInput, -1.0..1.0

    void slotDeviceVolumeChanged (int v);    // for slider, 0..65535
    void slotTrebleChanged (int t);          // for slider, 0..65535
    void slotBassChanged   (int b);          // for slider, 0..65535
    void slotBalanceChanged(int b);          // for slider, 0..65535
    void slotBalanceCenter ();

protected:

    SoundStreamID m_SoundStreamID;

    bool    m_ignoreGUIChanges;

    int     m_myControlChange;
    float   m_orgTreble,
            m_orgBass,
            m_orgBalance,
            m_orgDeviceVolume;

    V4LCaps m_caps;

    typedef GUIListHelper<QComboBox, QString>       StringListHelper;
    typedef GUISimpleListHelper<QComboBox>          ChannelListHelper;

    StringListHelper  m_PlaybackMixerHelper,
                      m_CaptureMixerHelper;
    ChannelListHelper m_PlaybackChannelHelper,
                      m_CaptureChannelHelper;
};

#endif