mirror of
https://github.com/clementine-player/Clementine
synced 2024-12-16 19:31:02 +01:00
Add simple context menu to soundcloud items
This commit is contained in:
parent
f13e7d1e69
commit
26908ed718
@ -149,7 +149,8 @@ void SoundCloudService::DoSearch() {
|
||||
}
|
||||
|
||||
void SoundCloudService::SearchFinished(QNetworkReply* reply, int task_id) {
|
||||
qLog(Debug) << task_id;
|
||||
reply->deleteLater();
|
||||
|
||||
SongList songs = ExtractSongs(ExtractResult(reply));
|
||||
// Fill results list
|
||||
foreach (const Song& song, songs) {
|
||||
@ -178,10 +179,29 @@ int SoundCloudService::SimpleSearch(const QString& text) {
|
||||
}
|
||||
|
||||
void SoundCloudService::SimpleSearchFinished(QNetworkReply* reply, int id) {
|
||||
reply->deleteLater();
|
||||
|
||||
SongList songs = ExtractSongs(ExtractResult(reply));
|
||||
emit SimpleSearchResults(id, songs);
|
||||
}
|
||||
|
||||
void SoundCloudService::EnsureMenuCreated() {
|
||||
if(!context_menu_) {
|
||||
context_menu_ = new QMenu;
|
||||
context_menu_->addActions(GetPlaylistActions());
|
||||
context_menu_->addSeparator();
|
||||
context_menu_->addAction(IconLoader::Load("download"),
|
||||
tr("Open %1 in browser").arg("soundcloud.com"),
|
||||
this, SLOT(Homepage()));
|
||||
}
|
||||
}
|
||||
|
||||
void SoundCloudService::ShowContextMenu(const QPoint& global_pos) {
|
||||
EnsureMenuCreated();
|
||||
|
||||
context_menu_->popup(global_pos);
|
||||
}
|
||||
|
||||
QNetworkReply* SoundCloudService::CreateRequest(
|
||||
const QString& ressource_name,
|
||||
const QList<Param>& params) {
|
||||
|
@ -39,7 +39,7 @@ class SoundCloudService : public InternetService {
|
||||
|
||||
// TODO
|
||||
//QList<QAction*> playlistitem_actions(const Song& song);
|
||||
//void ShowContextMenu(const QPoint& global_pos);
|
||||
void ShowContextMenu(const QPoint& global_pos);
|
||||
QWidget* HeaderWidget() const;
|
||||
|
||||
int SimpleSearch(const QString& query);
|
||||
@ -61,6 +61,7 @@ class SoundCloudService : public InternetService {
|
||||
private:
|
||||
void ClearSearchResults();
|
||||
void EnsureItemsCreated();
|
||||
void EnsureMenuCreated();
|
||||
QNetworkReply* CreateRequest(const QString& ressource_name,
|
||||
const QList<QPair<QString, QString> >& params);
|
||||
// Convenient function for extracting result from reply
|
||||
|
Loading…
Reference in New Issue
Block a user