File indexing completed on 2024-05-19 05:04:05
0001 /* 0002 SPDX-FileCopyrightText: 2020-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <QMediaPlayer> 0010 #include <QWidget> 0011 0012 #include "libruqolawidgets_private_export.h" 0013 class QPushButton; 0014 class QToolButton; 0015 class QSlider; 0016 class QLabel; 0017 class QComboBox; 0018 class KMessageWidget; 0019 class RocketChatAccount; 0020 class QAudioOutput; 0021 class LIBRUQOLAWIDGETS_TESTS_EXPORT PlaySoundWidget : public QWidget 0022 { 0023 Q_OBJECT 0024 public: 0025 explicit PlaySoundWidget(RocketChatAccount *account, QWidget *parent = nullptr); 0026 ~PlaySoundWidget() override; 0027 0028 void setAudioPath(const QString &url); 0029 [[nodiscard]] QUrl audioUrl() const; 0030 0031 Q_SIGNALS: 0032 void updateTitle(const QUrl &url); 0033 0034 private: 0035 LIBRUQOLAWIDGETS_NO_EXPORT void play(); 0036 LIBRUQOLAWIDGETS_NO_EXPORT void muteChanged(bool state); 0037 LIBRUQOLAWIDGETS_NO_EXPORT void setPosition(int position); 0038 LIBRUQOLAWIDGETS_NO_EXPORT void slotPositionChanged(qint64 progress); 0039 LIBRUQOLAWIDGETS_NO_EXPORT void slotDurationChanged(qint64 duration); 0040 LIBRUQOLAWIDGETS_NO_EXPORT void updateDurationInfo(qint64 currentInfo); 0041 LIBRUQOLAWIDGETS_NO_EXPORT void slotVolumeChanged(int position); 0042 LIBRUQOLAWIDGETS_NO_EXPORT void handleError(); 0043 LIBRUQOLAWIDGETS_NO_EXPORT void initializeAudioOutput(); 0044 LIBRUQOLAWIDGETS_NO_EXPORT void audioOutputChanged(int index); 0045 LIBRUQOLAWIDGETS_NO_EXPORT void mediaStateChanged(QMediaPlayer::PlaybackState state); 0046 void slotAttachmentFileDownloadDone(const QString &url); 0047 qint64 mDuration; 0048 QMediaPlayer *const mMediaPlayer; 0049 QPushButton *const mPlayButton; 0050 QToolButton *const mSoundButton; 0051 QSlider *const mSoundSlider; 0052 QSlider *const mPositionSlider; 0053 QLabel *const mLabelDuration; 0054 KMessageWidget *const mMessageWidget; 0055 QLabel *const mLabelPercentSound; 0056 QAudioOutput *const mAudioOutput; 0057 QComboBox *const mDeviceComboBox; 0058 RocketChatAccount *const mRocketChatAccount; 0059 };