File indexing completed on 2024-12-08 05:00:55

0001 /*
0002     SPDX-FileCopyrightText: 2014-2015 Harald Sitter <sitter@kde.org>
0003     SPDX-FileCopyrightText: 2021 Nicolas Fella
0004 
0005     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0006 */
0007 
0008 #pragma once
0009 
0010 #include "sink.h"
0011 
0012 #include <QObject>
0013 
0014 class SoundThemeConfig;
0015 
0016 class SpeakerTest : public QObject
0017 {
0018     Q_OBJECT
0019     Q_PROPERTY(QPulseAudio::Sink *sink READ sink WRITE setSink NOTIFY sinkChanged)
0020     Q_PROPERTY(QStringList playingChannels READ playingChannels NOTIFY playingChannelsChanged)
0021 public:
0022     explicit SpeakerTest(QObject *parent = nullptr);
0023 
0024     QPulseAudio::Sink *sink() const;
0025     void setSink(QPulseAudio::Sink *sink);
0026     Q_SIGNAL void sinkChanged();
0027 
0028     QStringList playingChannels() const;
0029     Q_SIGNAL void playingChannelsChanged();
0030     void playingFinished(const QString &name, int errorCode);
0031 
0032     Q_INVOKABLE void testChannel(const QString &name);
0033     Q_SIGNAL void showErrorMessage(const QString &message);
0034 
0035 private:
0036     QPulseAudio::Sink *m_sink;
0037     QStringList m_playingChannels;
0038     SoundThemeConfig *m_config = nullptr;
0039 };