TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
musiccutsliderwidget.h
Go to the documentation of this file.
1 #ifndef MUSICCUTSLIDERWIDGET_H
2 #define MUSICCUTSLIDERWIDGET_H
3 
4 /***************************************************************************
5  * This file is part of the TTK Music Player project
6  * Copyright (C) 2015 - 2024 Greedysky Studio
7 
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or
11  * (at your option) any later version.
12 
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17 
18  * You should have received a copy of the GNU General Public License along
19  * with this program; If not, see <http://www.gnu.org/licenses/>.
20  ***************************************************************************/
21 
22 #include <QPushButton>
23 #include "musicglobaldefine.h"
24 
28 class TTK_MODULE_EXPORT MusicMoveButton : public QPushButton
29 {
30  Q_OBJECT
32 public:
36  explicit MusicMoveButton(QWidget *parent = nullptr);
37 
38 Q_SIGNALS:
42  void moveChanged();
46  void buttonRelease();
47 
48 private:
52  virtual void mousePressEvent(QMouseEvent *event) override final;
53  virtual void mouseMoveEvent(QMouseEvent *event) override final;
54  virtual void mouseReleaseEvent(QMouseEvent *event) override final;
55 
56  QPoint m_pressAt;
58 
59 };
60 
61 
66 {
67  Q_OBJECT
69 public:
73  explicit MusicCutSliderWidget(QWidget *parent = nullptr);
78 
82  void setPosition(qint64 position);
86  void setDuration(qint64 duration);
90  void resizeGeometry(int width, int height);
91 
92 Q_SIGNALS:
96  void posChanged(qint64 start, qint64 end);
100  void buttonReleaseChanged(qint64 pos);
101 
102 public Q_SLOTS:
106  void buttonMoveUpdate();
110  void buttonReleaseLeft();
114  void buttonReleaseRight();
115 
116 private:
120  virtual void paintEvent(QPaintEvent *event) override final;
121  virtual void mousePressEvent(QMouseEvent *event) override final;
122  virtual void mouseMoveEvent(QMouseEvent *event) override final;
123  virtual void mouseReleaseEvent(QMouseEvent *event) override final;
124 
125  MusicMoveButton *m_leftControl, *m_rightControl;
126  int m_width, m_height;
127  qint64 m_duration, m_position;
128 
129 };
130 
131 #endif // MUSICCUTSLIDERWIDGET_H
#define TTK_MODULE_EXPORT
MusicMoveButton * m_rightControl
The class of the move button.
#define TTK_DECLARE_MODULE(Class)
Definition: ttkqtglobal.h:152
The class of the cut slider widget.