TTKMusicPlayer  4.2.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
musicbackgroundmanager.h
Go to the documentation of this file.
1 #ifndef MUSICBACKGROUNDMANAGER_H
2 #define MUSICBACKGROUNDMANAGER_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"
23 #include "ttksingleton.h"
24 
29 {
30  Q_OBJECT
33 public:
37  void setArtistName(const QString &name);
41  QString artistName() const noexcept;
42 
46  inline int currentIndex() const noexcept { return m_currentIndex; }
50  inline void setCurrentIndex(int index) noexcept { m_currentIndex = index; }
54  inline int count() const noexcept { return m_images.count(); }
58  inline bool isEmpty() const noexcept { return m_images.isEmpty(); }
59 
63  void imageNext() noexcept;
67  void imagePrevious() noexcept;
68 
72  QString artistImagePath() noexcept;
76  QString artistImageDefaultPath() const noexcept;
77 
81  void updateArtistImageList();
85  QStringList artistImageList() const noexcept;
89  void setArtistImageList(const QStringList &list) noexcept;
93  void setSelectArtistIndex(int index) noexcept;
94 
98  void addObserver(QObject *object);
102  void removeObserver(QObject *object);
103 
107  void setBackgroundUrl(const QString &path) noexcept;
111  QString backgroundUrl() const noexcept;
112 
113 Q_SIGNALS:
117  void artistChanged();
121  void backgroundChanged();
125  void selectIndexChanged();
126 
127 private:
131  MusicBackgroundManager() noexcept;
132 
133  int m_currentIndex;
134  QStringList m_images;
135  QObjectList m_observer;
136  QString m_currentArtistName, m_background;
137 
138 };
139 
140 #define G_BACKGROUND_PTR makeMusicBackgroundManager()
142 
143 #endif // MUSICBACKGROUNDMANAGER_H
#define TTK_MODULE_EXPORT
int count() const noexcept
int currentIndex() const noexcept
void setCurrentIndex(int index) noexcept
bool isEmpty() const noexcept
const char * name
Definition: http_parser.c:458
#define TTK_DECLARE_SINGLETON_CLASS(Class)
// Singleton Macro // //
Definition: ttksingleton.h:86
The class of the manager of dealing with artist pictures.
TTK_MODULE_EXPORT MusicBackgroundManager * makeMusicBackgroundManager()
#define TTK_DECLARE_MODULE(Class)
Definition: ttkqtglobal.h:164
#define const
Definition: zconf.h:233