TTKMusicPlayer  4.1.3.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
musicapplication.h
Go to the documentation of this file.
1 #ifndef MUSICAPPLICATION_H
2 #define MUSICAPPLICATION_H
3 
4 /***************************************************************************
5  * This file is part of the TTK Music Player project
6  * Copyright (C) 2015 - 2025 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 "musicobject.h"
24 
25 class MusicPlayer;
26 class MusicPlaylist;
28 class MusicTopAreaWidget;
33 
35 
36 namespace Ui {
37 class MusicApplication;
38 }
39 
44 {
45  Q_OBJECT
47 public:
51  explicit MusicApplication(QWidget *parent = nullptr);
56 
60  static MusicApplication *instance();
61 
65  QString currentFileName() const;
69  QString currentFilePath() const;
70 
74  bool checkMusicListCurrentIndex() const;
78  void loadCurrentSongLrc();
79 
83  void importSongsByOutside(const QString &path, bool play);
84 
88  QString containsDownloadItem(bool &contains) const;
92  bool containsLovestItem() const;
96  bool containsLovestItem(int index) const;
100  void updateCurrentArtist();
101 
105  bool isPlaying() const;
109  qint64 duration() const;
113  TTK::PlayMode playMode() const;
114 
115 public Q_SLOTS:
119  void quitWindow();
123  void positionChanged(qint64 position);
127  void durationChanged(qint64 duration);
131  void playerStateChanged(TTK::PlayState state);
135  void showCurrentSong();
139  void switchToPlayState();
143  void switchToStopState();
147  void playPrevious();
151  void playNext();
155  void playOrder();
159  void playRandom();
163  void playlistLoop();
167  void playOneLoop();
171  void playOnce();
172 
176  void volumeMute();
180  void volumeChanged(int volume);
184  void importSongsPopup();
188  void importSongsByFiles(int index = TTK_LOW_LEVEL);
192  void importSongsByDir(int index = TTK_LOW_LEVEL);
196  void importSongsByUrl();
200  void importSongsItemList();
204  void exportSongsItem(int index);
208  void exportSongsItemList();
212  void playSortBy(int row);
216  void playedIndexBy(int row);
220  void playIndexBy(int row);
224  void playIndexBy(int row, int column);
228  void playIndexClicked(int row, int column);
232  void playAnyTimeAt(int time);
236  void volumeDown();
240  void volumeUp();
244  void showSettingWidget();
248  void currentPlayLocation();
252  void addSongToLovestList(bool state = true);
256  void windowConciseChanged();
260  void enhancedSongChanged(int type);
264  void createRightMenu();
268  void applyParameter();
272  void removeLoveItemAt(const QString &path, bool current);
276  void removeItemAt(const QStringList &path, bool remove, bool current, int playlistRow);
280  void currentLrcUpdated();
284  void resetCurrentSongLrcIndex();
288  void updateCurrentTime(qint64 pos);
292  void setPlaySongChanged(int index);
296  void currentPlaylist(QStringList &list);
297 
298 private:
302  virtual void resizeEvent(QResizeEvent *event) override final;
303  virtual void closeEvent(QCloseEvent *event) override final;
304  virtual void contextMenuEvent(QContextMenuEvent *event) override final;
305  virtual void enterEvent(QtEnterEvent *event) override final;
306  virtual void leaveEvent(QEvent *event) override final;
307  virtual void mouseMoveEvent(QMouseEvent *event) override final;
308  virtual void mouseReleaseEvent(QMouseEvent *event) override final;
309  virtual void mouseDoubleClickEvent(QMouseEvent *event) override final;
310  virtual bool eventFilter(QObject *object, QEvent *event) override final;
311 
315  void setPlayIndex();
319  void readSystemConfigFromFile();
323  void writeSystemConfigToFile();
324 
325 private:
326  Ui::MusicApplication *m_ui;
337 
338  friend class MusicMPRISPlayerCore;
340 
341 };
342 
343 #endif // MUSICAPPLICATION_H
The class of the app mpris player object.
MusicBottomAreaWidget * m_bottomAreaWidget
#define QtEnterEvent
Event enter.
Definition: ttkqtcompat.h:160
#define TTK_MODULE_EXPORT
The class of the songs container widget.
The class of the app top area widget.
The class of the app object module.
PlayState
Definition: musicobject.h:166
#define TTK_LOW_LEVEL
Definition: ttkglobal.h:258
The class of the ttk moving resize widget base.
The class of the app main widget.
MusicPlayer * m_player
virtual void mouseMoveEvent(QMouseEvent *event) override
The class of the music player.
Definition: musicplayer.h:31
virtual bool eventFilter(QObject *object, QEvent *event) override
Ui::MusicApplication * m_ui
MusicTopAreaWidget * m_topAreaWidget
MusicRightAreaWidget * m_rightAreaWidget
MusicSongsContainerWidget * m_songTreeWidget
PlayMode
Definition: musicobject.h:173
MusicPlaylist * m_playlist
#define TTK_DECLARE_MODULE(Class)
Definition: ttkqtglobal.h:168
virtual void mouseReleaseEvent(QMouseEvent *event) override
MusicLeftAreaWidget * m_leftAreaWidget
The class of the app left area widget.
The class of the app bottom area widget.
static MusicApplication * m_instance
The class of the music play list.
Definition: musicplaylist.h:63
The class of the app right area widget.
state
Definition: http_parser.c:279
MusicApplicationModule * m_applicationModule