File indexing completed on 2024-04-14 04:38:30
0001 /* 0002 Copyright (C) 2006-2008 Matthias Kretz <kretz@kde.org> 0003 Copyright (C) 2011 Casian Andrei <skeletk13@gmail.com> 0004 0005 This program is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU Library General Public 0007 License as published by the Free Software Foundation; either 0008 version 2 of the License, or (at your option) version 3. 0009 0010 This library is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 Library General Public License for more details. 0014 0015 You should have received a copy of the GNU Library General Public License 0016 along with this library; see the file COPYING.LIB. If not, write to 0017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0018 Boston, MA 02110-1301, USA. 0019 */ 0020 0021 #ifndef DEVICEPREFERENCE_H_STUPID_UIC 0022 #define DEVICEPREFERENCE_H_STUPID_UIC 0023 0024 #include "ui_devicepreference.h" 0025 0026 #include <QMap> 0027 #include <QStandardItem> 0028 0029 #include <phonon/objectdescription.h> 0030 #include <phonon/objectdescriptionmodel.h> 0031 0032 namespace Phonon { 0033 0034 class MediaObject; 0035 class AudioOutput; 0036 class VideoWidget; 0037 0038 class DevicePreference : public QWidget, private Ui::DevicePreference 0039 { 0040 Q_OBJECT 0041 public: 0042 explicit DevicePreference(QWidget *parent = nullptr); 0043 ~DevicePreference() override; 0044 0045 void load(); 0046 void save(); 0047 void defaults(); 0048 void pulseAudioEnabled(); 0049 0050 Q_SIGNALS: 0051 void changed(); 0052 0053 protected: 0054 void changeEvent(QEvent *) override; 0055 0056 private Q_SLOTS: 0057 void on_preferButton_clicked(); 0058 void on_deferButton_clicked(); 0059 void on_showAdvancedDevicesCheckBox_toggled(); 0060 void on_applyPreferencesButton_clicked(); 0061 void on_testPlaybackButton_toggled(bool down); 0062 void updateButtonsEnabled(); 0063 void updateDeviceList(); 0064 void updateAudioOutputDevices(); 0065 void updateAudioCaptureDevices(); 0066 void updateVideoCaptureDevices(); 0067 0068 private: 0069 enum DeviceType {dtInvalidDevice, dtAudioOutput, dtAudioCapture, dtVideoCapture}; 0070 0071 private: 0072 template<ObjectDescriptionType T> void removeDevice(const ObjectDescription<T> &deviceToRemove, 0073 QMap<int, ObjectDescriptionModel<T> *> *modelMap); 0074 void loadCategoryDevices(); 0075 QList<AudioOutputDevice> availableAudioOutputDevices() const; 0076 QList<AudioCaptureDevice> availableAudioCaptureDevices() const; 0077 QList<VideoCaptureDevice> availableVideoCaptureDevices() const; 0078 DeviceType shownModelType() const; 0079 0080 private: 0081 QMap<int, AudioOutputDeviceModel *> m_audioOutputModel; 0082 QMap<int, AudioCaptureDeviceModel *> m_audioCaptureModel; 0083 QMap<int, VideoCaptureDeviceModel *> m_videoCaptureModel; 0084 QStandardItemModel m_categoryModel; 0085 QStandardItemModel m_headerModel; 0086 DeviceType m_testingType; 0087 0088 MediaObject *m_media; 0089 AudioOutput *m_audioOutput; 0090 VideoWidget *m_videoWidget; 0091 }; 0092 0093 } // namespace Phonon 0094 0095 #endif // DEVICEPREFERENCE_H_STUPID_UIC