TTKMusicPlayer  3.7.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 - 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 "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
39 public:
43  explicit MusicLrcContainerForDesktop(QWidget *parent = nullptr);
48 
52  virtual void startDrawLrc() override final;
56  virtual void stopDrawLrc() override final;
60  virtual void applyParameter() override final;
61 
65  virtual void initCurrentLrc() const;
66 
70  void setCurrentPlayState(bool state) const;
74  void updateCurrentLrc(const QString &first, const QString &second, qint64 time);
78  inline bool isVerticalWindowType() const { return m_verticalWindow; }
82  void statusCopyFrom(MusicLrcContainerForDesktop *other);
83 
84 Q_SIGNALS:
88  void setWindowLockedChanged(bool lock);
89 
90 public Q_SLOTS:
94  void setWindowLockedChanged();
98  void setLrcBiggerChanged();
102  void setLrcSmallerChanged();
106  void toolStyleChanged();
110  virtual void setSingleLineTypeChanged();
111 
112 protected:
116  void createColorMenu(QMenu &menu);
120  void setSelfPosition() const;
124  void creatToolBarWidget();
129  virtual void resizeLrcSizeArea() = 0;
133  void resizeLrcSizeArea(bool resize);
137  virtual void mousePressEvent(QMouseEvent *event) override final;
138  virtual void mouseMoveEvent(QMouseEvent *event) override final;
139  virtual void contextMenuEvent(QContextMenuEvent *event) override final;
140  virtual void enterEvent(QtEnterEvent *event) override final;
141  virtual void leaveEvent(QEvent *event) override final;
142  virtual void closeEvent(QCloseEvent *event) override final;
143 
144  bool m_verticalWindow, m_singleLineType;
145  bool m_windowLocked, m_reverse;
146  int m_currentLrcFontSize, m_widgetWidth;
147  QPoint m_offset, m_geometry;
148 
149  QBoxLayout *m_toolBarLayout;
150  QWidget *m_toolBarWidget;
151  QToolButton *m_toolPlayButton;
152 
153 };
154 
155 
160 {
161  Q_OBJECT
163 public:
167  explicit MusicLrcContainerHorizontalDesktop(QWidget *parent = nullptr);
168 
172  virtual void initCurrentLrc() const override final;
173 
174 public Q_SLOTS:
178  virtual void setSingleLineTypeChanged() override final;
179 
180 private:
184  virtual void resizeLrcSizeArea() override final;
185 
186 };
187 
188 
193 {
194  Q_OBJECT
196 public:
200  explicit MusicLrcContainerVerticalDesktop(QWidget *parent = nullptr);
201 
205  virtual void initCurrentLrc() const override final;
206 
207 public Q_SLOTS:
211  virtual void setSingleLineTypeChanged() override final;
212 
213 private:
217  virtual void resizeLrcSizeArea() override final;
218 
219 };
220 
221 #endif // MUSICLRCCONTAINERFORDESKTOP_H
#define QtEnterEvent
Event enter.
Definition: ttkqtcompat.h:160
#define TTK_MODULE_EXPORT
static constexpr int TOOLBAR_TEXT_LENGTH
The class of the desktop vertical lrc container.
The class of the lrc container base.
virtual void stopDrawLrc()=0
virtual void applyParameter()
#define TTK_DECLARE_MODULE(Class)
Definition: ttkqtglobal.h:152
The class of the desktop horizontal lrc container.
static constexpr int TOOLBAR_MAIN_HEIGHT
static constexpr int TOOLBAR_HEIGHT
virtual void resizeLrcSizeArea()=0
static constexpr int TOOLBAR_WIDTH
The class of the desktop lrc container.
state
Definition: http_parser.c:279
virtual void startDrawLrc()=0