File indexing completed on 2024-05-12 16:27:16

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 "libruqolawidgets_private_export.h"
0010 #include <QMediaPlayer>
0011 #include <QWidget>
0012 class QPushButton;
0013 class QSlider;
0014 class QLabel;
0015 class QToolButton;
0016 class KMessageWidget;
0017 class QComboBox;
0018 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
0019 class QAudioOutput;
0020 #endif
0021 class RocketChatAccount;
0022 class LIBRUQOLAWIDGETS_TESTS_EXPORT ShowVideoWidget : public QWidget
0023 {
0024     Q_OBJECT
0025 public:
0026     explicit ShowVideoWidget(RocketChatAccount *account, QWidget *parent = nullptr);
0027     ~ShowVideoWidget() override;
0028 
0029     void setVideoPath(const QString &videoPath);
0030 
0031     [[nodiscard]] QUrl videoUrl() const;
0032 
0033 Q_SIGNALS:
0034     void updateTitle(const QUrl &url);
0035 
0036 private:
0037 #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
0038     LIBRUQOLAWIDGETS_NO_EXPORT void mediaStateChanged(QMediaPlayer::State state);
0039 #else
0040     LIBRUQOLAWIDGETS_NO_EXPORT void mediaStateChanged(QMediaPlayer::PlaybackState state);
0041 #endif
0042     LIBRUQOLAWIDGETS_NO_EXPORT void slotPositionChanged(qint64 position);
0043     LIBRUQOLAWIDGETS_NO_EXPORT void slotDurationChanged(qint64 duration);
0044     LIBRUQOLAWIDGETS_NO_EXPORT void updateDurationInfo(qint64 currentInfo);
0045     LIBRUQOLAWIDGETS_NO_EXPORT void slotMuteChanged(bool state);
0046     LIBRUQOLAWIDGETS_NO_EXPORT void slotVolumeChanged(int position);
0047     LIBRUQOLAWIDGETS_NO_EXPORT void setPosition(int position);
0048     LIBRUQOLAWIDGETS_NO_EXPORT void handleError();
0049     LIBRUQOLAWIDGETS_NO_EXPORT void play();
0050     LIBRUQOLAWIDGETS_NO_EXPORT void initializeAudioOutput();
0051     LIBRUQOLAWIDGETS_NO_EXPORT void audioOutputChanged(int index);
0052     LIBRUQOLAWIDGETS_NO_EXPORT void slotAttachmentFileDownloadDone(const QString &url);
0053 
0054     qint64 mDuration;
0055     QMediaPlayer *const mMediaPlayer;
0056     QPushButton *const mPlayButton;
0057     QSlider *const mPositionSlider;
0058     KMessageWidget *const mMessageWidget;
0059     QToolButton *const mSoundButton;
0060     QSlider *const mSoundSlider;
0061     QLabel *const mLabelDuration;
0062     QLabel *const mLabelPercentSound;
0063 #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
0064     QAudioOutput *const mAudioOutput;
0065     QComboBox *const mSoundDeviceComboBox;
0066 #endif
0067     RocketChatAccount *const mRocketChatAccount;
0068 };