TTKMusicPlayer  3.7.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 #include "musicleftareawidget.h"
10 
13 {
14 
15 }
16 
19  m_playlistRow(index),
20  m_playRowIndex(-1),
21  m_songs(nullptr)
22 {
23 
24 }
25 
27 {
28 
29 }
30 
32 {
33  m_songs = songs;
34  updateSongsList(*songs);
35 }
36 
38 {
39  Q_UNUSED(songs);
40 }
41 
43 {
44  MusicSmoothMovingTableWidget::selectRow(index);
45 }
46 
48 {
49  int height = 0;
50  for(int i = 0; i < rowCount(); ++i)
51  {
52  height += rowHeight(i);
53  }
54  return height;
55 }
56 
58 {
59  m_playlistRow = index;
60 }
61 
63 {
64 
65 }
66 
68 {
69  if(!isValid())
70  {
71  return;
72  }
73 
74  Q_EMIT cellDoubleClicked(currentRow(), 0);
75 }
76 
78 {
79  selectAll();
80  removeItemAt();
81 
82  bool state = false;
83  Q_EMIT isCurrentPlaylistRow(state);
84 
85  if(rowCount() == 0 && state)
86  {
88  }
89 }
90 
92 {
93  if(!isValid())
94  {
95  return;
96  }
97 
98  const QString &path = !m_songs->isEmpty() ? m_songs->at(currentRow()).path() : QString();
99  if(!TTK::Url::openUrl(QFileInfo(path).absoluteFilePath()))
100  {
101  MusicToastLabel::popup(tr("The file has been moved or does not exist"));
102  }
103 }
104 
106 {
107  if(!isValid())
108  {
109  return;
110  }
111 
113  widget.initialize(currentSongPath());
114  widget.exec();
115 }
116 
118 {
119  if(!isValid())
120  {
121  return;
122  }
123 
125 }
126 
128 {
129  if(!isValid())
130  {
131  return;
132  }
133 
135 }
136 
138 {
139  if(!isValid())
140  {
141  return;
142  }
143 
145 }
146 
148 {
149  if(!isValid())
150  {
151  return;
152  }
153 
155  item.m_name = currentSongName();
156 
157  MusicSongSharingWidget widget;
159  widget.exec();
160 }
161 
163 {
164  if(!isValid())
165  {
166  return;
167  }
168 
171  widget->show();
172 }
173 
175 {
176  if(!isValid())
177  {
178  return;
179  }
180 
182 }
183 
185 {
186  if(!isValid())
187  {
188  return;
189  }
190 
192 }
193 
195 {
196  if(!isValid())
197  {
198  return;
199  }
200 
203 
204  MusicSongSharingWidget widget;
206  widget.exec();
207 }
208 
210 {
211  menu->setStyleSheet(TTK::UI::MenuStyle02);
212  menu->addAction(QIcon(":/contextMenu/btn_similar"), tr("Similar"), this, SLOT(showSimilarQueryWidget()));
213  menu->addAction(QIcon(":/contextMenu/btn_share"), tr("Share"), this, SLOT(showSongSharedWidget()));
214 }
215 
217 {
218  return isValid() ? songPath(currentRow()) : QString();
219 }
220 
222 {
223  return !m_songs->isEmpty() ? m_songs->at(index).path().trimmed() : QString();
224 }
225 
227 {
228  return isValid() ? songName(currentRow()) : QString();
229 }
230 
232 {
233  if(rowCount() == 0 || index < 0)
234  {
235  return {};
236  }
237 
238  return !m_songs->isEmpty() ? m_songs->at(index).name().trimmed() : QString();
239 }
static MusicRightAreaWidget * instance()
static MusicApplication * instance()
The class of the download widget.
void initialize(MusicAbstractQueryRequest *request, int row)
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)
The class of the file information widget.
virtual void setSongsList(MusicSongList *songs)
#define TTK_NORMAL_LEVEL
Definition: ttkglobal.h:254
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)
The class of the songs list abstract table widget.
state
Definition: http_parser.c:279