TTKMusicPlayer  4.3.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 - 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 "musicsearchinterface.h"
25 
27 class MusicSongsListWidget;
29 
34 {
35  Q_OBJECT
36 public:
40  explicit MusicSongsContainerWidget(QWidget *parent = nullptr);
45 
49  static MusicSongsContainerWidget *instance();
50 
54  void updateSongItem(const MusicSongItem &item);
58  bool addSongItemList(const MusicSongItemList &items);
62  void appendSongItemList(const MusicSongItemList &items);
66  inline const MusicSongItemList& items() const noexcept { return m_containerItems; }
67 
71  void importSongsByUrl(const QString &path, int playlistRow);
75  void importSongsByPath(const QStringList &files, int playlistRow);
76 
80  QStringList songsFileName(int index) const;
84  QStringList songsFilePath(int index) const;
88  int mapSongIndexByFilePath(int playlistRow, const QString &path) const;
92  QString mapFilePathBySongIndex(int playlistRow, int index) const;
93 
97  void removeSearchResult(int &row);
98 
102  inline int playRowIndex() const noexcept { return m_playRowIndex; }
106  void setPlayRowIndex(int index);
107 
111  void playLocation(int index);
115  void selectRow(int index);
119  void updateDurationLabel(const QString &current, const QString &total) const;
120 
121 public Q_SLOTS:
125  void addNewRowItem();
129  void deleteRowItem(int index);
133  void deleteRowItems();
137  void deleteAllItems(int index);
141  void changRowItemName(int index, const QString &name);
145  void swapDragItemIndex(int start, int end);
149  void addToPlayLater(int index);
153  void addToPlayedList(int index);
157  void importSongsByFiles(int index = TTK_LOW_LEVEL);
161  void importSongsByDir(int index = TTK_LOW_LEVEL);
165  void showSongCheckToolsWidget();
169  void showLrcDownloadBatchWidget();
173  void searchResultChanged(int row, int column);
174 
178  void updateCurrentIndex();
182  void songToLovestListAt(bool state, int row);
186  void addSongToLovestList(bool state, int row);
190  void addSongBufferToPlaylist(const MusicResultDataItem &item);
194  void addSongToPlaylist(const QStringList &items);
198  void removeItemAt(const TTKIntList &rows, bool fileRemove);
202  void itemRowSwaped(int start, int end, int play, MusicSongList &songs);
206  void isCurrentPlaylistRow(bool &state);
210  void isSearchedResultEmpty(bool &empty);
214  void setSongPlayCount(int index);
218  void appendRecentSongs(int index);
222  void querySongItemList(MusicSongItemList &songs);
226  void updateCurrentArtist();
230  void showFloatWidget();
234  void songListSortBy(int index);
235 
236 private Q_SLOTS:
240  void showSearchWidget();
244  void sliderValueChanaged(int value);
248  void deleteFunctionWidget();
249 
250 private:
254  virtual void resizeEvent(QResizeEvent *event) override final;
255  virtual void contextMenuEvent(QContextMenuEvent *event) override final;
256  virtual void dragEnterEvent(QDragEnterEvent *event) override final;
257  virtual void dragMoveEvent(QDragMoveEvent *event) override final;
258  virtual void dropEvent(QDropEvent *event) override final;
262  inline bool isSearchedPlayIndex() const noexcept { return m_lastSearchIndex == m_currentIndex; }
266  void closeSearchWidget();
270  void closeSearchWidgetInNeed();
274  void checkTitleNameValid(QString &name);
278  void createWidgetItem(MusicSongItem *item);
282  MusicSongItem* createContainerItem(const MusicSongItem &item);
286  void setItemTitle(MusicSongItem *item);
290  void setInputModule(QObject *object) const;
294  void resizeGeometry();
298  void updatePlayedRows(int start, int end);
302  void importSongsWithProgress(QWidget *progress, int offset, const QStringList &files, int playlistRow);
303 
307 
311 
313 
314 };
315 
316 #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
voidpf uLong offset
Definition: ioapi.h:142
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
The class of the tool box widget.
The class of the music song item.
Definition: musicsong.h:160
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