File indexing completed on 2024-05-12 04:52:54

0001 /*
0002     SPDX-FileCopyrightText: 2008 Marco Gittler <g.marco@freenet.de>
0003     SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0004 */
0005 
0006 #pragma once
0007 
0008 #include "abstractparamwidget.hpp"
0009 #include "utils/timecode.h"
0010 #include <QWidget>
0011 
0012 class QSlider;
0013 class TimecodeDisplay;
0014 
0015 /** @brief This class is used to display a parameter with time value */
0016 class PositionEditWidget : public AbstractParamWidget
0017 {
0018     Q_OBJECT
0019 public:
0020     /** @brief Sets up the parameter's GUI.*/
0021     explicit PositionEditWidget(std::shared_ptr<AssetParameterModel> model, QModelIndex index, QWidget *parent = nullptr);
0022     ~PositionEditWidget() override;
0023     /** @brief get current position
0024      */
0025     int getPosition() const;
0026     /** @brief set position
0027      */
0028     void setPosition(int pos);
0029 
0030     /** @brief checks that the allowed time interval is valid
0031      */
0032     bool isValid() const;
0033 
0034 public Q_SLOTS:
0035     /** @brief Toggle the comments on or off
0036      */
0037     void slotShowComment(bool show) override;
0038 
0039     /** @brief refresh the properties to reflect changes in the model
0040      */
0041     void slotRefresh() override;
0042 
0043 private:
0044     TimecodeDisplay *m_display;
0045     QSlider *m_slider;
0046     bool m_inverted;
0047     bool m_toTime;
0048 
0049 private Q_SLOTS:
0050     void slotUpdatePosition();
0051 
0052 Q_SIGNALS:
0053     void valueChanged();
0054 };