File indexing completed on 2024-10-13 04:24:05
0001 /* 0002 SPDX-FileCopyrightText: 2008 Marco Gittler <g.marco@freenet.de> 0003 0004 SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #pragma once 0008 0009 #include "utils/timecode.h" 0010 #include <QString> 0011 #include <QWidget> 0012 0013 class QSlider; 0014 class TimecodeDisplay; 0015 0016 /** @brief This class is used to display a parameter with time value */ 0017 class PositionWidget : public QWidget 0018 { 0019 Q_OBJECT 0020 public: 0021 /** @brief Sets up the parameter's GUI. 0022 * @param name Name of the parameter 0023 * @param pos Initial position (in time) 0024 * @param min Minimum time value 0025 * @param max maximum time value 0026 * @param tc Timecode object to define time format 0027 * @param comment (optional) A comment explaining the parameter. Will be shown in a tooltip. 0028 * @param parent (optional) Parent Widget */ 0029 explicit PositionWidget(const QString &name, int pos, int min, int max, const QString &comment = QString(), QWidget *parent = nullptr); 0030 ~PositionWidget() override; 0031 /** @brief get current position 0032 */ 0033 int getPosition() const; 0034 /** @brief set position 0035 */ 0036 void setPosition(int pos); 0037 /** @brief checks that the allowed time interval is valid 0038 */ 0039 bool isValid() const; 0040 0041 public Q_SLOTS: 0042 /** @brief change the range of the widget 0043 @param min New minimum value 0044 @param max New maximum value 0045 @param absolute If true, the range is shifted to start in 0 0046 */ 0047 void setRange(int min, int max, bool absolute = false); 0048 0049 void slotShowComment(bool show); 0050 0051 private: 0052 TimecodeDisplay *m_display; 0053 QSlider *m_slider; 0054 0055 private Q_SLOTS: 0056 void slotUpdatePosition(); 0057 0058 Q_SIGNALS: 0059 void valueChanged(); 0060 };