2010-05-08 22:56:39 +02:00
|
|
|
/* This file is part of Clementine.
|
2010-11-20 14:27:10 +01:00
|
|
|
Copyright 2010, David Sansome <me@davidsansome.com>
|
2010-05-08 22:56:39 +02:00
|
|
|
|
|
|
|
Clementine is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Clementine is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Clementine. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2010-06-09 16:02:26 +02:00
|
|
|
#include "magnatunedownloaddialog.h"
|
2010-05-10 23:50:31 +02:00
|
|
|
#include "magnatuneplaylistitem.h"
|
2010-05-08 22:56:39 +02:00
|
|
|
#include "magnatuneservice.h"
|
2011-04-28 17:10:28 +02:00
|
|
|
#include "magnatuneurlhandler.h"
|
2011-07-15 15:27:50 +02:00
|
|
|
#include "internetmodel.h"
|
2012-02-12 14:41:50 +01:00
|
|
|
#include "core/application.h"
|
|
|
|
#include "core/database.h"
|
2011-04-22 18:50:29 +02:00
|
|
|
#include "core/logging.h"
|
2010-05-10 23:50:31 +02:00
|
|
|
#include "core/mergedproxymodel.h"
|
2010-10-16 19:20:54 +02:00
|
|
|
#include "core/network.h"
|
2011-04-28 17:10:28 +02:00
|
|
|
#include "core/player.h"
|
2010-05-10 23:50:31 +02:00
|
|
|
#include "core/song.h"
|
2010-06-23 15:21:30 +02:00
|
|
|
#include "core/taskmanager.h"
|
2011-11-28 14:51:35 +01:00
|
|
|
#include "core/timeconstants.h"
|
2011-11-06 00:22:25 +01:00
|
|
|
#include "globalsearch/globalsearch.h"
|
|
|
|
#include "globalsearch/librarysearchprovider.h"
|
2010-05-10 23:50:31 +02:00
|
|
|
#include "library/librarymodel.h"
|
|
|
|
#include "library/librarybackend.h"
|
|
|
|
#include "library/libraryfilterwidget.h"
|
2010-05-19 17:45:29 +02:00
|
|
|
#include "ui/iconloader.h"
|
2010-06-09 16:02:26 +02:00
|
|
|
#include "ui/settingsdialog.h"
|
2010-05-08 22:56:39 +02:00
|
|
|
|
2010-07-11 14:02:30 +02:00
|
|
|
#include "qtiocompressor.h"
|
|
|
|
|
2010-05-08 22:56:39 +02:00
|
|
|
#include <QNetworkAccessManager>
|
|
|
|
#include <QNetworkRequest>
|
|
|
|
#include <QNetworkReply>
|
|
|
|
#include <QXmlStreamReader>
|
2010-05-09 18:53:35 +02:00
|
|
|
#include <QSortFilterProxyModel>
|
2010-05-09 20:36:10 +02:00
|
|
|
#include <QMenu>
|
|
|
|
#include <QDesktopServices>
|
2010-05-10 23:50:31 +02:00
|
|
|
#include <QCoreApplication>
|
2010-06-09 00:56:31 +02:00
|
|
|
#include <QSettings>
|
2010-05-08 22:56:39 +02:00
|
|
|
|
|
|
|
#include <QtDebug>
|
|
|
|
|
2010-05-10 16:19:43 +02:00
|
|
|
using boost::shared_ptr;
|
|
|
|
|
2010-05-08 22:56:39 +02:00
|
|
|
const char* MagnatuneService::kServiceName = "Magnatune";
|
2010-05-09 22:18:05 +02:00
|
|
|
const char* MagnatuneService::kSettingsGroup = "Magnatune";
|
2010-05-09 19:19:48 +02:00
|
|
|
const char* MagnatuneService::kSongsTable = "magnatune_songs";
|
2010-06-20 18:30:10 +02:00
|
|
|
const char* MagnatuneService::kFtsTable = "magnatune_songs_fts";
|
2010-06-09 16:02:26 +02:00
|
|
|
|
2010-05-09 20:36:10 +02:00
|
|
|
const char* MagnatuneService::kHomepage = "http://magnatune.com";
|
2010-06-09 16:02:26 +02:00
|
|
|
const char* MagnatuneService::kDatabaseUrl = "http://magnatune.com/info/song_info_xml.gz";
|
2010-06-09 00:56:31 +02:00
|
|
|
const char* MagnatuneService::kStreamingHostname = "streaming.magnatune.com";
|
|
|
|
const char* MagnatuneService::kDownloadHostname = "download.magnatune.com";
|
2010-05-08 22:56:39 +02:00
|
|
|
|
2010-06-09 18:05:59 +02:00
|
|
|
const char* MagnatuneService::kPartnerId = "clementine";
|
2010-06-09 16:02:26 +02:00
|
|
|
const char* MagnatuneService::kDownloadUrl = "http://download.magnatune.com/buy/membership_free_dl_xml";
|
|
|
|
|
2012-02-12 14:41:50 +01:00
|
|
|
MagnatuneService::MagnatuneService(Application* app, InternetModel* parent)
|
|
|
|
: InternetService(kServiceName, app, parent, parent),
|
2011-04-28 17:10:28 +02:00
|
|
|
url_handler_(new MagnatuneUrlHandler(this, this)),
|
2010-08-27 17:20:52 +02:00
|
|
|
context_menu_(NULL),
|
2011-01-09 19:27:41 +01:00
|
|
|
root_(NULL),
|
2010-06-02 17:58:07 +02:00
|
|
|
library_backend_(NULL),
|
|
|
|
library_model_(NULL),
|
2010-06-09 17:38:00 +02:00
|
|
|
library_filter_(NULL),
|
2010-05-09 18:53:35 +02:00
|
|
|
library_sort_model_(new QSortFilterProxyModel(this)),
|
2010-06-23 15:21:30 +02:00
|
|
|
load_database_task_id_(0),
|
2010-06-09 00:56:31 +02:00
|
|
|
membership_(Membership_None),
|
2010-06-09 01:18:20 +02:00
|
|
|
format_(Format_Ogg),
|
2010-05-09 18:53:35 +02:00
|
|
|
total_song_count_(0),
|
2010-10-16 19:20:54 +02:00
|
|
|
network_(new NetworkAccessManager(this))
|
2010-05-08 22:56:39 +02:00
|
|
|
{
|
2010-06-02 17:58:07 +02:00
|
|
|
// Create the library backend in the database thread
|
2010-08-27 20:36:30 +02:00
|
|
|
library_backend_ = new LibraryBackend;
|
2012-02-12 14:41:50 +01:00
|
|
|
library_backend_->moveToThread(app_->database()->thread());
|
|
|
|
library_backend_->Init(app_->database(), kSongsTable,
|
2010-06-20 18:30:10 +02:00
|
|
|
QString::null, QString::null, kFtsTable);
|
2012-02-12 14:41:50 +01:00
|
|
|
library_model_ = new LibraryModel(library_backend_, app_, this);
|
2010-06-02 17:58:07 +02:00
|
|
|
|
2010-05-09 18:53:35 +02:00
|
|
|
connect(library_backend_, SIGNAL(TotalSongCountUpdated(int)),
|
|
|
|
SLOT(UpdateTotalSongCount(int)));
|
|
|
|
|
|
|
|
library_sort_model_->setSourceModel(library_model_);
|
|
|
|
library_sort_model_->setSortRole(LibraryModel::Role_SortText);
|
|
|
|
library_sort_model_->setDynamicSortFilter(true);
|
2013-02-05 12:17:09 +01:00
|
|
|
library_sort_model_->setSortLocaleAware(true);
|
2010-05-09 18:53:35 +02:00
|
|
|
library_sort_model_->sort(0);
|
2011-04-28 17:10:28 +02:00
|
|
|
|
2012-02-12 14:41:50 +01:00
|
|
|
app_->player()->RegisterUrlHandler(url_handler_);
|
|
|
|
app_->global_search()->AddProvider(new LibrarySearchProvider(
|
2011-11-06 00:22:25 +01:00
|
|
|
library_backend_,
|
|
|
|
tr("Magnatune"),
|
|
|
|
"magnatune",
|
|
|
|
QIcon(":/providers/magnatune.png"),
|
2012-02-13 21:44:04 +01:00
|
|
|
true, app_, this));
|
2010-05-08 22:56:39 +02:00
|
|
|
}
|
|
|
|
|
2010-05-09 20:36:10 +02:00
|
|
|
MagnatuneService::~MagnatuneService() {
|
|
|
|
delete context_menu_;
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:56:31 +02:00
|
|
|
void MagnatuneService::ReloadSettings() {
|
|
|
|
QSettings s;
|
|
|
|
s.beginGroup(kSettingsGroup);
|
|
|
|
|
|
|
|
membership_ = MembershipType(s.value("membership", Membership_None).toInt());
|
|
|
|
username_ = s.value("username").toString();
|
|
|
|
password_ = s.value("password").toString();
|
2010-06-09 01:18:20 +02:00
|
|
|
format_ = PreferredFormat(s.value("format", Format_Ogg).toInt());
|
2010-06-09 00:56:31 +02:00
|
|
|
}
|
|
|
|
|
2011-01-09 19:27:41 +01:00
|
|
|
QStandardItem* MagnatuneService::CreateRootItem() {
|
|
|
|
root_ = new QStandardItem(QIcon(":/providers/magnatune.png"), kServiceName);
|
2011-07-15 15:27:50 +02:00
|
|
|
root_->setData(true, InternetModel::Role_CanLazyLoad);
|
2010-05-08 22:56:39 +02:00
|
|
|
return root_;
|
|
|
|
}
|
|
|
|
|
2011-01-09 19:27:41 +01:00
|
|
|
void MagnatuneService::LazyPopulate(QStandardItem* item) {
|
2011-07-15 15:27:50 +02:00
|
|
|
switch (item->data(InternetModel::Role_Type).toInt()) {
|
|
|
|
case InternetModel::Type_Service:
|
2010-08-27 20:47:10 +02:00
|
|
|
library_model_->Init();
|
2013-01-21 00:31:47 +01:00
|
|
|
if (total_song_count_ == 0 && !load_database_task_id_) {
|
|
|
|
ReloadDatabase();
|
|
|
|
}
|
2011-01-09 19:27:41 +01:00
|
|
|
model()->merged_model()->AddSubModel(item->index(), library_sort_model_);
|
2010-05-08 22:56:39 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-12-11 16:07:39 +01:00
|
|
|
void MagnatuneService::UpdateTotalSongCount(int count) {
|
|
|
|
total_song_count_ = count;
|
|
|
|
}
|
|
|
|
|
2010-05-08 22:56:39 +02:00
|
|
|
void MagnatuneService::ReloadDatabase() {
|
|
|
|
QNetworkRequest request = QNetworkRequest(QUrl(kDatabaseUrl));
|
2010-11-27 17:14:09 +01:00
|
|
|
request.setAttribute(QNetworkRequest::CacheLoadControlAttribute,
|
|
|
|
QNetworkRequest::AlwaysNetwork);
|
2010-05-08 22:56:39 +02:00
|
|
|
|
|
|
|
QNetworkReply* reply = network_->get(request);
|
|
|
|
connect(reply, SIGNAL(finished()), SLOT(ReloadDatabaseFinished()));
|
|
|
|
|
2010-06-23 15:21:30 +02:00
|
|
|
if (!load_database_task_id_)
|
2012-02-12 14:41:50 +01:00
|
|
|
load_database_task_id_ = app_->task_manager()->StartTask(
|
2010-06-23 15:21:30 +02:00
|
|
|
tr("Downloading Magnatune catalogue"));
|
2010-05-08 22:56:39 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void MagnatuneService::ReloadDatabaseFinished() {
|
|
|
|
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
|
|
|
|
|
2012-02-12 14:41:50 +01:00
|
|
|
app_->task_manager()->SetTaskFinished(load_database_task_id_);
|
2010-06-23 15:21:30 +02:00
|
|
|
load_database_task_id_ = 0;
|
|
|
|
|
2010-05-08 22:56:39 +02:00
|
|
|
if (reply->error() != QNetworkReply::NoError) {
|
|
|
|
// TODO: Error handling
|
2011-04-22 18:50:29 +02:00
|
|
|
qLog(Error) << reply->errorString();
|
2010-05-08 22:56:39 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-01-09 19:27:41 +01:00
|
|
|
if (root_->hasChildren())
|
|
|
|
root_->removeRows(0, root_->rowCount());
|
2010-05-08 22:56:39 +02:00
|
|
|
|
2010-05-09 23:31:52 +02:00
|
|
|
// The XML file is compressed
|
2010-05-08 22:56:39 +02:00
|
|
|
QtIOCompressor gzip(reply);
|
|
|
|
gzip.setStreamFormat(QtIOCompressor::GzipFormat);
|
|
|
|
if (!gzip.open(QIODevice::ReadOnly)) {
|
2011-04-22 18:50:29 +02:00
|
|
|
qLog(Warning) << "Error opening gzip stream";
|
2010-05-08 22:56:39 +02:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-05-09 23:31:52 +02:00
|
|
|
// Remove all existing songs in the database
|
2010-11-26 00:05:37 +01:00
|
|
|
library_backend_->DeleteAll();
|
2010-05-09 18:53:35 +02:00
|
|
|
|
2010-05-09 23:31:52 +02:00
|
|
|
// Parse the XML we got from Magnatune
|
2010-05-08 22:56:39 +02:00
|
|
|
QXmlStreamReader reader(&gzip);
|
2010-11-26 00:05:37 +01:00
|
|
|
SongList songs;
|
2010-05-08 22:56:39 +02:00
|
|
|
while (!reader.atEnd()) {
|
|
|
|
reader.readNext();
|
|
|
|
|
|
|
|
if (reader.tokenType() == QXmlStreamReader::StartElement &&
|
|
|
|
reader.name() == "Track") {
|
2010-05-09 18:53:35 +02:00
|
|
|
songs << ReadTrack(reader);
|
2010-05-08 22:56:39 +02:00
|
|
|
}
|
|
|
|
}
|
2010-05-09 18:53:35 +02:00
|
|
|
|
2010-05-09 23:31:52 +02:00
|
|
|
// Add the songs to the database
|
2010-05-09 18:53:35 +02:00
|
|
|
library_backend_->AddOrUpdateSongs(songs);
|
2013-01-18 11:34:17 +01:00
|
|
|
library_model_->Reset();
|
2010-05-08 22:56:39 +02:00
|
|
|
}
|
|
|
|
|
2010-05-09 18:53:35 +02:00
|
|
|
Song MagnatuneService::ReadTrack(QXmlStreamReader& reader) {
|
2010-05-08 22:56:39 +02:00
|
|
|
Song song;
|
2010-05-09 20:50:54 +02:00
|
|
|
|
|
|
|
while (!reader.atEnd()) {
|
|
|
|
reader.readNext();
|
|
|
|
|
|
|
|
if (reader.tokenType() == QXmlStreamReader::EndElement)
|
|
|
|
break;
|
|
|
|
|
|
|
|
if (reader.tokenType() == QXmlStreamReader::StartElement) {
|
2010-06-09 16:02:26 +02:00
|
|
|
QStringRef name = reader.name();
|
2010-05-10 12:58:02 +02:00
|
|
|
QString value = ReadElementText(reader);
|
|
|
|
|
2010-06-09 16:02:26 +02:00
|
|
|
if (name == "artist") song.set_artist(value);
|
|
|
|
if (name == "albumname") song.set_album(value);
|
|
|
|
if (name == "trackname") song.set_title(value);
|
|
|
|
if (name == "tracknum") song.set_track(value.toInt());
|
|
|
|
if (name == "year") song.set_year(value.toInt());
|
|
|
|
if (name == "magnatunegenres") song.set_genre(value.section(',', 0, 0));
|
2011-02-14 20:34:37 +01:00
|
|
|
if (name == "seconds") song.set_length_nanosec(value.toInt() * kNsecPerSec);
|
2010-06-09 16:02:26 +02:00
|
|
|
if (name == "cover_small") song.set_art_automatic(value);
|
|
|
|
if (name == "albumsku") song.set_comment(value);
|
2011-04-28 17:10:28 +02:00
|
|
|
if (name == "url") {
|
2011-12-26 18:15:35 +01:00
|
|
|
QUrl url;
|
|
|
|
// Magnatune's URLs are already encoded
|
|
|
|
url.setEncodedUrl(value.toLocal8Bit());
|
2011-04-28 17:10:28 +02:00
|
|
|
url.setScheme("magnatune");
|
|
|
|
song.set_url(url);
|
|
|
|
}
|
2010-05-09 20:50:54 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
song.set_valid(true);
|
2010-05-09 19:32:07 +02:00
|
|
|
song.set_filetype(Song::Type_Stream);
|
2010-05-08 22:56:39 +02:00
|
|
|
|
2010-05-09 18:53:35 +02:00
|
|
|
// We need to set these to satisfy the database constraints
|
|
|
|
song.set_directory_id(0);
|
|
|
|
song.set_mtime(0);
|
|
|
|
song.set_ctime(0);
|
|
|
|
song.set_filesize(0);
|
|
|
|
|
|
|
|
return song;
|
2010-05-08 22:56:39 +02:00
|
|
|
}
|
2010-05-09 19:53:27 +02:00
|
|
|
|
2010-05-10 12:58:02 +02:00
|
|
|
// TODO: Replace with readElementText(SkipChildElements) in Qt 4.6
|
|
|
|
QString MagnatuneService::ReadElementText(QXmlStreamReader& reader) {
|
|
|
|
int level = 1;
|
|
|
|
QString ret;
|
|
|
|
while (!reader.atEnd()) {
|
|
|
|
switch (reader.readNext()) {
|
|
|
|
case QXmlStreamReader::StartElement: level++; break;
|
|
|
|
case QXmlStreamReader::EndElement: level--; break;
|
|
|
|
case QXmlStreamReader::Characters:
|
|
|
|
ret += reader.text().toString().trimmed();
|
|
|
|
break;
|
|
|
|
default: break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (level == 0)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2010-08-27 17:20:52 +02:00
|
|
|
void MagnatuneService::EnsureMenuCreated() {
|
|
|
|
if (context_menu_)
|
|
|
|
return;
|
|
|
|
|
|
|
|
context_menu_ = new QMenu;
|
|
|
|
|
2011-02-10 23:24:17 +01:00
|
|
|
context_menu_->addActions(GetPlaylistActions());
|
2010-08-27 17:20:52 +02:00
|
|
|
download_ = context_menu_->addAction(
|
|
|
|
IconLoader::Load("download"), tr("Download this album"), this, SLOT(Download()));
|
|
|
|
context_menu_->addSeparator();
|
2011-11-23 23:53:55 +01:00
|
|
|
context_menu_->addAction(IconLoader::Load("download"), tr("Open %1 in browser").arg("magnatune.com"), this, SLOT(Homepage()));
|
2010-08-27 17:20:52 +02:00
|
|
|
context_menu_->addAction(IconLoader::Load("view-refresh"), tr("Refresh catalogue"), this, SLOT(ReloadDatabase()));
|
|
|
|
QAction* config_action = context_menu_->addAction(IconLoader::Load("configure"), tr("Configure Magnatune..."), this, SLOT(ShowConfig()));
|
|
|
|
|
2010-08-27 20:36:30 +02:00
|
|
|
library_filter_ = new LibraryFilterWidget(0);
|
|
|
|
library_filter_->SetSettingsGroup(kSettingsGroup);
|
|
|
|
library_filter_->SetLibraryModel(library_model_);
|
|
|
|
library_filter_->SetFilterHint(tr("Search Magnatune"));
|
|
|
|
library_filter_->SetAgeFilterEnabled(false);
|
2010-08-27 17:20:52 +02:00
|
|
|
library_filter_->AddMenuAction(config_action);
|
2011-11-05 20:09:02 +01:00
|
|
|
|
|
|
|
context_menu_->addSeparator();
|
|
|
|
context_menu_->addMenu(library_filter_->menu());
|
2010-08-27 17:20:52 +02:00
|
|
|
}
|
|
|
|
|
2012-03-11 15:44:43 +01:00
|
|
|
void MagnatuneService::ShowContextMenu(const QPoint& global_pos) {
|
2010-08-27 17:20:52 +02:00
|
|
|
EnsureMenuCreated();
|
|
|
|
|
2012-03-11 15:44:43 +01:00
|
|
|
const bool is_valid = model()->current_index().model() == library_sort_model_;
|
2010-05-09 20:36:10 +02:00
|
|
|
|
2012-03-11 15:44:43 +01:00
|
|
|
GetAppendToPlaylistAction()->setEnabled(is_valid);
|
|
|
|
GetReplacePlaylistAction()->setEnabled(is_valid);
|
|
|
|
GetOpenInNewPlaylistAction()->setEnabled(is_valid);
|
|
|
|
download_->setEnabled(is_valid && membership_ == Membership_Download);
|
2010-05-09 20:36:10 +02:00
|
|
|
context_menu_->popup(global_pos);
|
|
|
|
}
|
|
|
|
|
|
|
|
void MagnatuneService::Homepage() {
|
|
|
|
QDesktopServices::openUrl(QUrl(kHomepage));
|
2010-05-09 19:53:27 +02:00
|
|
|
}
|
2010-05-09 22:18:05 +02:00
|
|
|
|
2010-06-09 00:56:31 +02:00
|
|
|
QUrl MagnatuneService::ModifyUrl(const QUrl& url) const {
|
|
|
|
QUrl ret(url);
|
2011-04-28 17:10:28 +02:00
|
|
|
ret.setScheme("http");
|
2010-06-09 00:56:31 +02:00
|
|
|
|
|
|
|
switch(membership_) {
|
|
|
|
case Membership_None:
|
2010-06-09 01:29:50 +02:00
|
|
|
return ret; // Use the URL as-is
|
|
|
|
|
|
|
|
// Otherwise add the hostname
|
2010-06-09 00:56:31 +02:00
|
|
|
case Membership_Streaming:
|
|
|
|
ret.setHost(kStreamingHostname);
|
|
|
|
break;
|
|
|
|
case Membership_Download:
|
|
|
|
ret.setHost(kDownloadHostname);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2010-06-09 01:29:50 +02:00
|
|
|
// Add the credentials
|
2010-06-09 00:56:31 +02:00
|
|
|
ret.setUserName(username_);
|
|
|
|
ret.setPassword(password_);
|
2010-06-09 01:29:50 +02:00
|
|
|
|
|
|
|
// And remove the commercial
|
|
|
|
QString path = ret.path();
|
|
|
|
path.insert(path.lastIndexOf('.'), "_nospeech");
|
|
|
|
ret.setPath(path);
|
|
|
|
|
2010-06-09 00:56:31 +02:00
|
|
|
return ret;
|
|
|
|
}
|
2010-06-09 16:02:26 +02:00
|
|
|
|
|
|
|
void MagnatuneService::ShowConfig() {
|
2012-12-05 10:36:22 +01:00
|
|
|
app_->OpenSettingsDialogAtPage(SettingsDialog::Page_Magnatune);
|
2010-06-09 16:02:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void MagnatuneService::Download() {
|
2012-03-11 15:44:43 +01:00
|
|
|
QModelIndex index = library_sort_model_->mapToSource(model()->current_index());
|
2010-06-09 16:02:26 +02:00
|
|
|
SongList songs = library_model_->GetChildSongs(index);
|
|
|
|
|
|
|
|
MagnatuneDownloadDialog* dialog = new MagnatuneDownloadDialog(this, 0);
|
|
|
|
dialog->setAttribute(Qt::WA_DeleteOnClose);
|
|
|
|
dialog->Show(songs);
|
2010-06-12 22:43:07 +02:00
|
|
|
|
|
|
|
connect(dialog, SIGNAL(Finished(QStringList)), SIGNAL(DownloadFinished(QStringList)));
|
2010-06-09 16:02:26 +02:00
|
|
|
}
|
2010-06-09 17:38:00 +02:00
|
|
|
|
|
|
|
QWidget* MagnatuneService::HeaderWidget() const {
|
2010-08-27 17:20:52 +02:00
|
|
|
const_cast<MagnatuneService*>(this)->EnsureMenuCreated();
|
2010-06-09 17:38:00 +02:00
|
|
|
return library_filter_;
|
|
|
|
}
|