1/*
2 Copyright (C) 2006-2008 Matthias Kretz <kretz@kde.org>
3 Copyright (C) 2011 Casian Andrei <skeletk13@gmail.com>
4
5 This program is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) version 3.
9
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 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#ifndef DEVICEPREFERENCE_H_STUPID_UIC
22#define DEVICEPREFERENCE_H_STUPID_UIC
23
24#include "ui_devicepreference.h"
25
26#include <QMap>
27#include <QStandardItem>
28
29#include <phonon/objectdescription.h>
30#include <phonon/objectdescriptionmodel.h>
31
32namespace Phonon {
33
34class MediaObject;
35class AudioOutput;
36class VideoWidget;
37
38class DevicePreference : public QWidget, private Ui::DevicePreference
39{
40 Q_OBJECT
41public:
42 explicit DevicePreference(QWidget *parent = nullptr);
43 ~DevicePreference() override;
44
45 void load();
46 void save();
47 void defaults();
48 void pulseAudioEnabled();
49
50Q_SIGNALS:
51 void changed();
52
53protected:
54 void changeEvent(QEvent *) override;
55
56private Q_SLOTS:
57 void on_preferButton_clicked();
58 void on_deferButton_clicked();
59 void on_showAdvancedDevicesCheckBox_toggled();
60 void on_applyPreferencesButton_clicked();
61 void on_testPlaybackButton_toggled(bool down);
62 void updateButtonsEnabled();
63 void updateDeviceList();
64 void updateAudioOutputDevices();
65 void updateAudioCaptureDevices();
66 void updateVideoCaptureDevices();
67
68private:
69 enum DeviceType {dtInvalidDevice, dtAudioOutput, dtAudioCapture, dtVideoCapture};
70
71private:
72 template<ObjectDescriptionType T> void removeDevice(const ObjectDescription<T> &deviceToRemove,
73 QMap<int, ObjectDescriptionModel<T> *> *modelMap);
74 void loadCategoryDevices();
75 QList<AudioOutputDevice> availableAudioOutputDevices() const;
76 QList<AudioCaptureDevice> availableAudioCaptureDevices() const;
77 QList<VideoCaptureDevice> availableVideoCaptureDevices() const;
78 DeviceType shownModelType() const;
79
80private:
81 QMap<int, AudioOutputDeviceModel *> m_audioOutputModel;
82 QMap<int, AudioCaptureDeviceModel *> m_audioCaptureModel;
83 QMap<int, VideoCaptureDeviceModel *> m_videoCaptureModel;
84 QStandardItemModel m_categoryModel;
85 QStandardItemModel m_headerModel;
86 DeviceType m_testingType;
87
88 MediaObject *m_media;
89 AudioOutput *m_audioOutput;
90 VideoWidget *m_videoWidget;
91};
92
93} // namespace Phonon
94
95#endif // DEVICEPREFERENCE_H_STUPID_UIC
96

source code of phonon/settings/devicepreference.h