1
/****************************************************************************
2
* Copyright (C) 2013-2014 by Savoir-Faire Linux *
3
* Author : Emmanuel Lepage Vallee <emmanuel.lepage@savoirfairelinux.com> *
5
* This library is free software; you can redistribute it and/or *
6
* modify it under the terms of the GNU Lesser General Public *
7
* License as published by the Free Software Foundation; either *
8
* version 2.1 of the License, or (at your option) any later version. *
10
* This library is distributed in the hope that it will be useful, *
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
13
* Lesser General Public License for more details. *
15
* You should have received a copy of the GNU General Public License *
16
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
17
***************************************************************************/
18
#ifndef AUDIOSETTINGSMODEL_H
19
#define AUDIOSETTINGSMODEL_H
21
#include <QtCore/QObject>
22
#include <QtCore/QStringList>
23
#include <QtCore/QAbstractListModel>
27
class AlsaPluginModel ;
28
class InputDeviceModel ;
29
class OutputDeviceModel ;
30
class AudioManagerModel ;
31
class RingtoneDeviceModel;
34
* This class group all ComboBox models used by audio settings dialogs
36
class LIB_EXPORT AudioSettingsModel : public QObject {
46
virtual ~AudioSettingsModel();
47
static AudioSettingsModel* instance();
50
AlsaPluginModel* alsaPluginModel ();
51
InputDeviceModel* inputDeviceModel ();
52
OutputDeviceModel* outputDeviceModel ();
53
AudioManagerModel* audioManagerModel ();
54
RingtoneDeviceModel* ringtoneDeviceModel();
55
bool isRoomToneEnabled ();
56
bool isNoiseSuppressEnabled () const;
57
bool isPlaybackMuted() const;
58
bool isCaptureMuted () const;
59
bool areDTMFMuted () const;
60
int playbackVolume () const;
61
int captureVolume () const;
64
void setEnableRoomTone ( bool enable );
65
void setNoiseSuppressState( bool enabled );
75
constexpr static const char* CAPTURE = "mic" ;
76
constexpr static const char* PLAYBACK = "speaker";
80
ToneType playRoomTone() const;
81
void stopRoomTone() const;
85
void mutePlayback ( bool m );
86
void muteCapture ( bool m );
87
void setPlaybackVolume( int volume );
88
void setCaptureVolume ( int volume );
89
void setDTMFMuted ( bool muted );
92
void captureMuted(bool);
93
void playbackMuted(bool);
94
void playbackVolumeChanged(int);
95
void captureVolumeChanged(int);
96
void DTMFMutedChanged(bool);
100
explicit AudioSettingsModel();
103
AlsaPluginModel* m_pAlsaPluginModel ;
104
InputDeviceModel* m_pInputDeviceModel ;
105
OutputDeviceModel* m_pOutputDeviceModel ;
106
AudioManagerModel* m_pAudioManagerModel ;
107
RingtoneDeviceModel* m_pRingtoneDeviceModel;
108
bool m_EnableRoomTone ;
111
static AudioSettingsModel* m_spInstance;
114
class LIB_EXPORT AlsaPluginModel : public QAbstractListModel {
117
explicit AlsaPluginModel(QObject* parent);
118
virtual ~AlsaPluginModel();
121
virtual QVariant data ( const QModelIndex& index, int role = Qt::DisplayRole ) const;
122
virtual int rowCount( const QModelIndex& parent = QModelIndex() ) const;
123
virtual Qt::ItemFlags flags ( const QModelIndex& index ) const;
124
virtual bool setData ( const QModelIndex& index, const QVariant &value, int role);
127
QModelIndex currentPlugin() const;
130
void setCurrentPlugin(const QModelIndex& idx);
131
void setCurrentPlugin(int idx);
137
QStringList m_lDeviceList;
140
class LIB_EXPORT InputDeviceModel : public QAbstractListModel {
143
explicit InputDeviceModel(QObject* parent);
144
virtual ~InputDeviceModel();
147
virtual QVariant data ( const QModelIndex& index, int role = Qt::DisplayRole ) const;
148
virtual int rowCount( const QModelIndex& parent = QModelIndex() ) const;
149
virtual Qt::ItemFlags flags ( const QModelIndex& index ) const;
150
virtual bool setData ( const QModelIndex& index, const QVariant &value, int role);
153
QModelIndex currentDevice() const;
156
void setCurrentDevice(const QModelIndex& index);
157
void setCurrentDevice(int idx);
163
QStringList m_lDeviceList;
166
class LIB_EXPORT OutputDeviceModel : public QAbstractListModel {
169
explicit OutputDeviceModel(QObject* parent);
170
virtual ~OutputDeviceModel();
173
virtual QVariant data ( const QModelIndex& index, int role = Qt::DisplayRole ) const;
174
virtual int rowCount( const QModelIndex& parent = QModelIndex() ) const;
175
virtual Qt::ItemFlags flags ( const QModelIndex& index ) const;
176
virtual bool setData ( const QModelIndex& index, const QVariant &value, int role);
179
QModelIndex currentDevice() const;
182
void setCurrentDevice(const QModelIndex& index);
183
void setCurrentDevice(int idx);
189
QStringList m_lDeviceList;
192
class LIB_EXPORT AudioManagerModel : public QAbstractListModel {
195
explicit AudioManagerModel(QObject* parent);
196
virtual ~AudioManagerModel();
199
virtual QVariant data ( const QModelIndex& index, int role = Qt::DisplayRole ) const;
200
virtual int rowCount( const QModelIndex& parent = QModelIndex() ) const;
201
virtual Qt::ItemFlags flags ( const QModelIndex& index ) const;
202
virtual bool setData ( const QModelIndex& index, const QVariant &value, int role);
205
QModelIndex currentManager() const;
208
void setCurrentManager(const QModelIndex& index);
211
void setCurrentManager(int idx);
215
QStringList m_lDeviceList;
218
constexpr static const char* PULSEAUDIO = "pulseaudio";
219
constexpr static const char* ALSA = "alsa";
228
class LIB_EXPORT RingtoneDeviceModel: public QAbstractListModel {
231
explicit RingtoneDeviceModel(QObject* parent);
232
virtual ~RingtoneDeviceModel();
235
virtual QVariant data ( const QModelIndex& index, int role = Qt::DisplayRole ) const;
236
virtual int rowCount( const QModelIndex& parent = QModelIndex() ) const;
237
virtual Qt::ItemFlags flags ( const QModelIndex& index ) const;
238
virtual bool setData ( const QModelIndex& index, const QVariant &value, int role);
241
QModelIndex currentDevice() const;
244
void setCurrentDevice(const QModelIndex& index);
245
void setCurrentDevice(int idx);
251
QStringList m_lDeviceList;
254
#endif //AUDIOSETTINGSMODEL_H