TTKMusicPlayer  4.3.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
musiclrccontainerfordesktop.h
Go to the documentation of this file.
1 #ifndef MUSICLRCCONTAINERFORDESKTOP_H
2 #define MUSICLRCCONTAINERFORDESKTOP_H
3 
4 /***************************************************************************
5  * This file is part of the TTK Music Player project
6  * Copyright (C) 2015 - 2026 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 "musiclrccontainer.h"
23 #include "musicwidgetheaders.h"
24 
25 static constexpr int TOOLBAR_MAIN_HEIGHT = 35;
26 static constexpr int TOOLBAR_HEIGHT = 23;
27 static constexpr int TOOLBAR_WIDTH = 31;
28 static constexpr int TOOLBAR_TEXT_LENGTH = 58;
29 
30 class MusicLRCManagerForDesktop;
31 
36 {
37  Q_OBJECT
38 public:
42  explicit MusicLrcContainerForDesktop(QWidget *parent = nullptr);
47 
51  virtual void start() override final;
55  virtual void stop() override final;
59  virtual void applyParameter() override final;
60 
64  virtual void initCurrentLrc() const;
65 
69  void setCurrentPlayState(bool state) const;
73  void updateCurrentLrc(const QString &first, const QString &second, qint64 time);
77  inline bool isVerticalWindowType() const noexcept { return m_verticalWindow; }
81  void statusCopyFrom(MusicLrcContainerForDesktop *other);
82 
83 Q_SIGNALS:
87  void setWindowLockedChanged(bool lock);
88 
89 public Q_SLOTS:
93  void setWindowLockedChanged();
97  void setLrcBiggerChanged();
101  void setLrcSmallerChanged();
105  void toolStyleChanged();
109  virtual void setSingleLineTypeChanged();
110 
111 protected:
115  void createColorMenu(QMenu *menu);
119  void setSelfPosition() const;
123  void creatToolBarWidget();
128  virtual void resizeLrcSizeArea() = 0;
132  void resizeLrcSizeArea(bool resize);
136  virtual void mousePressEvent(QMouseEvent *event) override final;
137  virtual void mouseMoveEvent(QMouseEvent *event) override final;
138  virtual void contextMenuEvent(QContextMenuEvent *event) override final;
139  virtual void enterEvent(QtEnterEvent *event) override final;
140  virtual void leaveEvent(QEvent *event) override final;
141  virtual void closeEvent(QCloseEvent *event) override final;
142 
143  bool m_verticalWindow, m_singleLine;
144  bool m_windowLocked, m_reverse;
145  int m_currentLrcFontSize, m_widgetWidth;
146  QPoint m_offset, m_geometry;
147 
148  QBoxLayout *m_toolBarLayout;
149  QWidget *m_toolBarWidget;
150  QToolButton *m_toolPlayButton;
151 
152 };
153 
154 
159 {
160  Q_OBJECT
161 public:
165  explicit MusicLrcContainerHorizontalDesktop(QWidget *parent = nullptr);
166 
170  virtual void initCurrentLrc() const override final;
171 
172 public Q_SLOTS:
176  virtual void setSingleLineTypeChanged() override final;
177 
178 private:
182  virtual void resizeLrcSizeArea() override final;
183 
184 };
185 
186 
191 {
192  Q_OBJECT
193 public:
197  explicit MusicLrcContainerVerticalDesktop(QWidget *parent = nullptr);
198 
202  virtual void initCurrentLrc() const override final;
203 
204 public Q_SLOTS:
208  virtual void setSingleLineTypeChanged() override final;
209 
210 private:
214  virtual void resizeLrcSizeArea() override final;
215 
216 };
217 
218 #endif // MUSICLRCCONTAINERFORDESKTOP_H
#define QtEnterEvent
Event enter.
Definition: ttkqtcompat.h:178
#define TTK_MODULE_EXPORT
bool isVerticalWindowType() const noexcept
static constexpr int TOOLBAR_TEXT_LENGTH
The class of the desktop vertical lrc container.
virtual void start()=0
The class of the lrc container base.
virtual void applyParameter()
The class of the desktop horizontal lrc container.
static constexpr int TOOLBAR_MAIN_HEIGHT
static constexpr int TOOLBAR_HEIGHT
virtual void resizeLrcSizeArea()=0
virtual void stop()=0
static constexpr int TOOLBAR_WIDTH
#define const
Definition: zconf.h:233
The class of the desktop lrc container.
state
Definition: http_parser.c:279