TTKMusicPlayer  4.2.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
musicsongscontainerwidget.h
Go to the documentation of this file.
1 #ifndef MUSICSONGSCONTAINERWIDGET_H
2 #define MUSICSONGSCONTAINERWIDGET_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 "musicsearchinterface.h"
25 
27 class MusicSongsListWidget;
29 
34 {
35  Q_OBJECT
37 public:
41  explicit MusicSongsContainerWidget(QWidget *parent = nullptr);
46 
50  static MusicSongsContainerWidget *instance();
51 
55  void updateSongItem(const MusicSongItem &item);
59  bool addSongItemList(const MusicSongItemList &items);
63  void appendSongItemList(const MusicSongItemList &items);
67  inline const MusicSongItemList& items() const noexcept { return m_containerItems; }
68 
72  void importSongsByUrl(const QString &path, int playlistRow);
76  void importSongsByPath(const QStringList &files, int playlistRow);
77 
81  QStringList songsFileName(int index) const;
85  QStringList songsFilePath(int index) const;
89  int mapSongIndexByFilePath(int playlistRow, const QString &path) const;
93  QString mapFilePathBySongIndex(int playlistRow, int index) const;
94 
98  void removeSearchResult(int &row);
99 
103  inline int playRowIndex() const noexcept { return m_playRowIndex; }
107  void setPlayRowIndex(int index);
108 
112  void playLocation(int index);
116  void selectRow(int index);
120  void updateDurationLabel(const QString &current, const QString &total) const;
121 
122 public Q_SLOTS:
126  void addNewRowItem();
130  void deleteRowItem(int index);
134  void deleteRowItems();
138  void deleteAllItems(int index);
142  void changRowItemName(int index, const QString &name);
146  void swapDragItemIndex(int start, int end);
150  void addToPlayLater(int index);
154  void addToPlayedList(int index);
158  void importSongsByFiles(int index = TTK_LOW_LEVEL);
162  void importSongsByDir(int index = TTK_LOW_LEVEL);
166  void showSongCheckToolsWidget();
170  void showLrcDownloadBatchWidget();
174  void searchResultChanged(int row, int column);
175 
179  void updateCurrentIndex();
183  void songToLovestListAt(bool state, int row);
187  void addSongToLovestList(bool state, int row);
191  void addSongBufferToPlaylist(const MusicResultDataItem &item);
195  void addSongToPlaylist(const QStringList &items);
199  void removeItemAt(const TTKIntList &del, bool fileRemove);
203  void itemIndexSwaped(int start, int end, int play, MusicSongList &songs);
207  void isCurrentPlaylistRow(bool &state);
211  void isSearchedResultEmpty(bool &empty);
215  void setSongPlayCount(int index);
219  void appendRecentSongs(int index);
223  void querySongItemList(MusicSongItemList &songs);
227  void updateCurrentArtist();
231  void showFloatWidget();
235  void songListSortBy(int index);
236 
237 private Q_SLOTS:
241  void showSearchWidget();
245  void sliderValueChanaged(int value);
249  void deleteFunctionWidget();
250 
251 private:
255  virtual void resizeEvent(QResizeEvent *event) override final;
256  virtual void contextMenuEvent(QContextMenuEvent *event) override final;
257  virtual void dragEnterEvent(QDragEnterEvent *event) override final;
258  virtual void dragMoveEvent(QDragMoveEvent *event) override final;
259  virtual void dropEvent(QDropEvent *event) override final;
263  inline bool isSearchedPlayIndex() const noexcept { return m_lastSearchIndex == m_currentIndex; }
267  void closeSearchWidget();
271  void closeSearchWidgetInNeed();
275  void checkTitleNameValid(QString &name);
279  void createWidgetItem(MusicSongItem *item);
283  MusicSongItem* createContainerItem(const MusicSongItem &item);
287  void setItemTitle(MusicSongItem *item);
291  void setInputModule(QObject *object) const;
295  void resizeWindow();
299  void updatePlayedList(int start, int end);
300 
304 
308 
310 
311 };
312 
313 #endif // MUSICSONGSCONTAINERWIDGET_H
#define TTK_MODULE_EXPORT
The class of the songs container widget.
The class of the search result data item.
The class of the item search interface.
#define TTK_LOW_LEVEL
Definition: ttkglobal.h:332
MusicSongSearchDialog * m_songSearchWidget
The class of the tool box mask widget.
MusicSongsListFunctionWidget * m_functionWidget
const MusicSongItemList & items() const noexcept
The class of the songs list function widget.
QList< int > TTKIntList
Definition: ttkqtglobal.h:200
const char * name
Definition: http_parser.c:458
MusicSongsToolBoxMaskWidget * m_topMaskWidget
#define TTK_DECLARE_MODULE(Class)
Definition: ttkqtglobal.h:164
The class of the tool box widget.
The class of the music song item.
Definition: musicsong.h:161
The class of the song search widget.
static MusicSongsContainerWidget * m_instance
#define const
Definition: zconf.h:233
bool isSearchedPlayIndex() const noexcept
state
Definition: http_parser.c:279