File indexing completed on 2024-05-19 05:04:07

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