TTKMusicPlayer  4.1.3.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 {
13 
14 }
15 
18  m_playlistRow(index),
19  m_playRowIndex(-1),
20  m_songs(nullptr)
21 {
22 
23 }
24 
26 {
27 
28 }
29 
31 {
32  m_songs = songs;
33  updateSongsList(*songs);
34 }
35 
37 {
38  Q_UNUSED(songs);
39 }
40 
42 {
43  MusicSmoothMovingTableWidget::selectRow(index);
44 }
45 
47 {
48  int height = 0;
49  for(int i = 0; i < rowCount(); ++i)
50  {
51  height += rowHeight(i);
52  }
53  return height;
54 }
55 
57 {
58  m_playlistRow = index;
59 }
60 
62 {
63 
64 }
65 
67 {
68  if(!isValid())
69  {
70  return;
71  }
72 
73  Q_EMIT cellDoubleClicked(currentRow(), 0);
74 }
75 
77 {
78  selectAll();
79  removeItemAt();
80 
81  bool state = false;
82  Q_EMIT isCurrentPlaylistRow(state);
83 
84  if(rowCount() == 0 && state)
85  {
87  }
88 }
89 
91 {
92  if(!isValid())
93  {
94  return;
95  }
96 
97  const QString &path = !m_songs->isEmpty() ? m_songs->at(currentRow()).path() : QString();
98  if(!TTK::Url::openUrl(QFileInfo(path).absoluteFilePath()))
99  {
100  MusicToastLabel::popup(tr("The file has been moved or does not exist"));
101  }
102 }
103 
105 {
106  if(!isValid())
107  {
108  return;
109  }
110 
112  widget.initialize(currentSongPath());
113  widget.exec();
114 }
115 
117 {
118  if(!isValid())
119  {
120  return;
121  }
122 
124 }
125 
127 {
128  if(!isValid())
129  {
130  return;
131  }
132 
134 }
135 
137 {
138  if(!isValid())
139  {
140  return;
141  }
142 
144 }
145 
147 {
148  if(!isValid())
149  {
150  return;
151  }
152 
154  item.m_name = currentSongName();
155 
156  MusicSongSharingWidget widget;
158  widget.exec();
159 }
160 
162 {
163  if(!isValid())
164  {
165  return;
166  }
167 
169  widget->initialize(currentSongName());
170  widget->show();
171 }
172 
174 {
175  if(!isValid())
176  {
177  return;
178  }
179 
181 }
182 
184 {
185  if(!isValid())
186  {
187  return;
188  }
189 
191 }
192 
194 {
195  if(!isValid())
196  {
197  return;
198  }
199 
202 
203  MusicSongSharingWidget widget;
205  widget.exec();
206 }
207 
209 {
210  menu->setStyleSheet(TTK::UI::MenuStyle02);
211  menu->addAction(QIcon(":/contextMenu/btn_similar"), tr("Similar"), this, SLOT(showSimilarQueryWidget()));
212  menu->addAction(QIcon(":/contextMenu/btn_share"), tr("Share"), this, SLOT(showSongSharedWidget()));
213 }
214 
216 {
217  return isValid() ? songPath(currentRow()) : QString();
218 }
219 
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.
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)
The class of the file information widget.
virtual void setSongsList(MusicSongList *songs)
#define TTK_NORMAL_LEVEL
Definition: ttkglobal.h:259
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