TTKMusicPlayer  3.7.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 - 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 "musicobject.h"
24 
25 class MusicPlayer;
26 class MusicPlaylist;
28 class MusicTopAreaWidget;
33 
36 
37 namespace Ui {
38 class MusicApplication;
39 }
40 
45 {
46  Q_OBJECT
48 public:
52  explicit MusicApplication(QWidget *parent = nullptr);
57 
61  static MusicApplication *instance();
62 
66  QString currentFileName() const;
70  QString currentFilePath() const;
71 
75  bool checkMusicListCurrentIndex() const;
79  void loadCurrentSongLrc();
80 
84  void importSongsByOutside(const QString &path, bool play);
85 
89  QString containsDownloadItem(bool &contains) const;
93  bool containsLovestItem() const;
97  bool containsLovestItem(int index) const;
101  void updateCurrentArtist();
102 
106  bool isPlaying() const;
110  qint64 duration() const;
114  TTK::PlayMode playMode() const;
115 
116 public Q_SLOTS:
120  void quitWindow();
124  void positionChanged(qint64 position);
128  void durationChanged(qint64 duration);
132  void playerStateChanged(TTK::PlayState state);
136  void showCurrentSong();
140  void switchToPlayState();
144  void switchToStopState();
148  void playPrevious();
152  void playNext();
156  void playOrder();
160  void playRandom();
164  void playlistLoop();
168  void playOneLoop();
172  void playOnce();
173 
177  void volumeMute();
181  void volumeChanged(int volume);
185  void importSongsPopup();
189  void importSongsByFiles(int index = TTK_LOW_LEVEL);
193  void importSongsByDir(int index = TTK_LOW_LEVEL);
197  void importSongsByUrl();
201  void importSongsItemList();
205  void exportSongsItemList(int index);
209  void playSortBy(int row);
213  void playedIndexBy(int row);
217  void playIndexBy(int row);
221  void playIndexBy(int row, int column);
225  void playIndexClicked(int row, int column);
229  void playAnyTimeAt(int time);
233  void volumeDown();
237  void volumeUp();
241  void showSettingWidget();
245  void currentPlayLocation();
249  void addSongToLovestList(bool state = true);
253  void windowConciseChanged();
257  void enhancedMusicChanged(int type);
261  void createRightMenu();
265  void applyParameter();
269  void removeLoveItemAt(const QString &path, bool current);
273  void removeItemAt(const QStringList &path, bool remove, bool current, int playlistRow);
277  void currentLrcUpdated();
281  void resetCurrentSongLrcIndex();
285  void updateCurrentTime(qint64 pos);
289  void setPlaySongChanged(int index);
293  void currentPlaylist(QStringList &list);
294 
295 private:
299  virtual void resizeEvent(QResizeEvent *event) override final;
300  virtual void closeEvent(QCloseEvent *event) override final;
301  virtual void contextMenuEvent(QContextMenuEvent *event) override final;
302  virtual void enterEvent(QtEnterEvent *event) override final;
303  virtual void leaveEvent(QEvent *event) override final;
304  virtual void mouseReleaseEvent(QMouseEvent *event) override final;
305  virtual void mouseDoubleClickEvent(QMouseEvent *event) override final;
306  virtual bool eventFilter(QObject *object, QEvent *event) override final;
307 
311  void setPlayIndex();
315  void readSystemConfigFromFile();
319  void writeSystemConfigToFile();
320 
321 private:
322  Ui::MusicApplication *m_ui;
333 
334  friend class MusicMPRISPlayerCore;
337 
338 };
339 
340 #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 widget.
PlayState
Definition: musicobject.h:164
#define TTK_LOW_LEVEL
Definition: ttkglobal.h:253
The class of the ttk moving resize widget base.
The class of the app main widget.
MusicPlayer * m_player
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
MusicApplicationModule * m_applicationObject
PlayMode
Definition: musicobject.h:171
The class of the playlist backup module.
MusicPlaylist * m_playlist
#define TTK_DECLARE_MODULE(Class)
Definition: ttkqtglobal.h:152
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