File indexing completed on 2024-05-12 12:21:06
0001 // SPDX-FileCopyrightText: 2021 The KPhotoAlbum Development Team 0002 // SPDX-FileCopyrightText: 2022 Johannes Zarl-Zierl <johannes@zarl-zierl.at> 0003 // 0004 // SPDX-License-Identifier: GPL-2.0-or-later 0005 0006 #pragma once 0007 0008 #include <QWidget> 0009 class Slider; 0010 class QLabel; 0011 class QToolButton; 0012 class QSlider; 0013 0014 namespace Viewer 0015 { 0016 0017 class VideoToolBar : public QWidget 0018 { 0019 Q_OBJECT 0020 public: 0021 explicit VideoToolBar(QWidget *parent = nullptr); 0022 void setRange(int min, int max); 0023 int maximum() const; 0024 0025 void setPosition(qint64 value); 0026 0027 /** 0028 * @brief volume 0029 * @return the audio volume in percent, between 0% and 100% 0030 */ 0031 int volume() const; 0032 /** 0033 * @brief setVolume sets the audio volume 0034 * @param volume in percent, between 0 and 100 0035 */ 0036 void setVolume(int volume); 0037 bool isMuted() const; 0038 void setMuted(bool b); 0039 0040 virtual void closePreview() { } 0041 0042 protected: 0043 virtual void onTimeSliderHover(const QPoint &pos, int value); 0044 void setSeekSliderEnabled(bool b); 0045 0046 Q_SIGNALS: 0047 void positionChanged(int value); 0048 void volumeChanged(int volume); 0049 void muted(bool muted); 0050 0051 private: 0052 QString format() const; 0053 0054 QLabel *m_currentOffset = nullptr; 0055 Slider *m_offsetSlider = nullptr; 0056 QLabel *m_totalTime = nullptr; 0057 QToolButton *m_muteButton = nullptr; 0058 QSlider *m_volumeSlider = nullptr; 0059 QLabel *m_percentageLabel = nullptr; 0060 bool m_isMuted = false; 0061 }; 0062 0063 } // namespace Viewer