TTKMusicPlayer  4.3.0.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 - 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 "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
46 public:
50  explicit MusicApplication(QWidget *parent = nullptr);
55 
59  static MusicApplication *instance();
60 
64  QString currentFileName() const;
68  QString currentFilePath() const;
69 
73  bool checkMusicListCurrentIndex() const;
77  void loadCurrentSongLrc();
78 
82  void importSongsByOutside(const QString &path, bool play);
83 
87  QString containsDownloadMedia(bool &contains) const;
91  bool containsLovestMedia() const;
95  bool containsLovestMedia(int index) const;
99  void updateCurrentArtist();
100 
104  bool isPlaying() const;
108  qint64 duration() const;
112  TTK::PlayMode playMode() const noexcept;
113 
114 public Q_SLOTS:
118  void quitWindow();
122  void positionChanged(qint64 position);
126  void durationChanged(qint64 duration);
130  void playerStateChanged(TTK::PlayState state);
134  void showCurrentSong();
138  void switchToPlayState();
142  void switchToStopState();
146  void playPrevious();
150  void playNext();
154  void playOrder();
158  void playRandom();
162  void playlistLoop();
166  void playOneLoop();
170  void playOnce();
171 
175  void volumeDown();
179  void volumeUp();
183  void volumeMute();
187  void volumeChanged(int volume);
188 
192  void importSongsPopup();
196  void importSongsByUrl();
200  void importSongsItemList();
204  void exportSongsItem(int index);
208  void exportSongsItemList();
209 
213  void playSortBy(int row);
217  void playedIndexBy(int row);
221  void playIndexBy(int row);
225  void playIndexBy(int row, int column);
229  void playIndexClicked(int row, int column);
233  void playTimePosition(int time);
234 
238  void showSettingWidget();
242  void currentPlayLocation();
246  void addSongToLovestList(bool state = true);
250  void windowConciseChanged();
254  void enhancedSongChanged(int type);
258  void createRightMenu();
262  void applyParameter();
266  void removeLoveItemAt(const QString &path, bool current);
270  void removeItemAt(const QStringList &path, bool remove, bool current, int playlistRow);
274  void currentLrcUpdated();
278  void resetCurrentSongLrcIndex();
282  void updateCurrentTime(qint64 pos);
286  void setPlaySongChanged(int index);
290  void currentPlaylist(QStringList &list);
291 
292 private:
296  virtual void resizeEvent(QResizeEvent *event) override final;
297  virtual void closeEvent(QCloseEvent *event) override final;
298  virtual void contextMenuEvent(QContextMenuEvent *event) override final;
299  virtual void enterEvent(QtEnterEvent *event) override final;
300  virtual void leaveEvent(QEvent *event) override final;
301  virtual void mouseMoveEvent(QMouseEvent *event) override final;
302  virtual void mouseReleaseEvent(QMouseEvent *event) override final;
303  virtual void mouseDoubleClickEvent(QMouseEvent *event) override final;
304  virtual bool eventFilter(QObject *object, QEvent *event) override final;
305 
309  void generatePlaylistItems();
313  void readSystemConfigFromFile();
317  void writeSystemConfigToFile();
318 
319 private:
320  Ui::MusicApplication *m_ui;
321 
332 
333  friend class MusicMPRISPlayerCore;
335 
336 };
337 
338 #endif // MUSICAPPLICATION_H
The class of the app mpris player object.
MusicBottomAreaWidget * m_bottomAreaWidget
#define QtEnterEvent
Event enter.
Definition: ttkqtcompat.h:178
#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:183
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:46
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:190
MusicPlaylist * m_playlist
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