TTKMusicPlayer  4.2.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
musicabstractsongslisttablewidget.cpp
Go to the documentation of this file.
2 #include "musicurlutils.h"
3 #include "musictoastlabel.h"
5 #include "musicrightareawidget.h"
7 #include "musicdownloadwidget.h"
8 #include "musicapplication.h"
9 
12  m_playlistRow(-1),
13  m_playRowIndex(-1),
14  m_songs(nullptr)
15 {
16 
17 }
18 
20 {
21 
22 }
23 
25 {
26  m_songs = songs;
27  updateSongsList(*songs);
28 }
29 
31 {
32  Q_UNUSED(songs);
33 }
34 
36 {
37  MusicSmoothMovingTableWidget::selectRow(index);
38 }
39 
41 {
42 
43 }
44 
46 {
47  if(!isValid())
48  {
49  return;
50  }
51 
52  Q_EMIT cellDoubleClicked(currentRow(), 0);
53 }
54 
56 {
57  selectAll();
58  removeItemAt();
59 
60  bool state = false;
61  Q_EMIT isCurrentPlaylistRow(state);
62 
63  if(rowCount() == 0 && state)
64  {
66  }
67 }
68 
70 {
71  if(!isValid())
72  {
73  return;
74  }
75 
76  const QString &path = currentSongPath();
78  {
79  TTK_INFO_STREAM("Current song path is url stream");
80  return;
81  }
82 
84  {
85  MusicToastLabel::popup(tr("The file has been moved or does not exist"));
86  }
87 }
88 
90 {
91  if(!isValid())
92  {
93  return;
94  }
95 
97  widget.initialize(currentSongPath());
98  widget.exec();
99 }
100 
102 {
103  if(!isValid())
104  {
105  return;
106  }
107 
109 }
110 
112 {
113  if(!isValid())
114  {
115  return;
116  }
117 
119 }
120 
122 {
123  if(!isValid())
124  {
125  return;
126  }
127 
129 }
130 
132 {
133  if(!isValid())
134  {
135  return;
136  }
137 
139  item.m_name = currentSongName();
140 
141  MusicSongSharingWidget widget;
143  widget.exec();
144 }
145 
147 {
148  if(!isValid())
149  {
150  return;
151  }
152 
154  widget->initialize(currentSongName());
155  widget->show();
156 }
157 
159 {
160  if(!isValid())
161  {
162  return;
163  }
164 
166 }
167 
169 {
170  if(!isValid())
171  {
172  return;
173  }
174 
176 }
177 
179 {
180  if(!isValid())
181  {
182  return;
183  }
184 
187 
188  MusicSongSharingWidget widget;
190  widget.exec();
191 }
192 
194 {
195  int height = 0;
196  for(int i = 0; i < rowCount(); ++i)
197  {
198  height += rowHeight(i);
199  }
200  return height;
201 }
202 
204 {
205  menu->setStyleSheet(TTK::UI::MenuStyle02);
206  menu->addAction(QIcon(":/contextMenu/btn_similar"), tr("Similar"), this, SLOT(showSimilarQueryWidget()));
207  menu->addAction(QIcon(":/contextMenu/btn_share"), tr("Share"), this, SLOT(showSongSharedWidget()));
208 }
209 
211 {
212  return isValid() ? songPath(currentRow()) : QString();
213 }
214 
216 {
217  if(rowCount() == 0 || index < 0)
218  {
219  return {};
220  }
221 
222  return !m_songs->isEmpty() ? m_songs->at(index).path().trimmed() : QString();
223 }
224 
226 {
227  return isValid() ? songName(currentRow()) : QString();
228 }
229 
231 {
232  if(rowCount() == 0 || index < 0)
233  {
234  return {};
235  }
236 
237  return !m_songs->isEmpty() ? m_songs->at(index).name().trimmed() : QString();
238 }
static MusicRightAreaWidget * instance()
static MusicApplication * instance()
The class of the download widget.
TTK_MODULE_EXPORT QString trackRelatedPath(const QString &path)
Definition: musicsong.cpp:100
The class of the song share widget.
void initialize(Module type, const MusicSongSharingWidget::Item &data)
void playIndexBy(int row)
void initialize(const QString &name)
void showSimilarFound(const QString &text)
static void popup(const QString &text)
void initialize(const QString &name)
TTK_MODULE_EXPORT bool isNetworkUrl(const QString &path) noexcept
bool isValid() const noexcept
The class of the file information widget.
#define TTK_INFO_STREAM(msg)
Definition: ttklogger.h:74
virtual void setSongsList(MusicSongList *songs)
#define TTK_NORMAL_LEVEL
Definition: ttkglobal.h:333
virtual void updateSongsList(const MusicSongList &songs)
void showAlbumFound(const QString &text, const QString &id)
TTK_MODULE_EXPORT bool openUrl(const QString &path, bool local=true)
void isCurrentPlaylistRow(bool &state)
static const QString MenuStyle02
The class of the slider smooth moving table widget.
void showVideoSearchedFound(const QString &name, const QString &id)
state
Definition: http_parser.c:279