Treat RadioServices' parents differently to the model
This commit is contained in:
parent
5eb38504a7
commit
92ee1d3158
|
@ -8704,9 +8704,9 @@ if (_wrapper) {
|
|||
}
|
||||
RadioService::timerEvent(arg__1);
|
||||
}
|
||||
RadioService* PythonQtWrapper_RadioService::new_RadioService(const QString& name, RadioModel* model)
|
||||
RadioService* PythonQtWrapper_RadioService::new_RadioService(const QString& name, RadioModel* model, QObject* parent)
|
||||
{
|
||||
return new PythonQtShell_RadioService(name, model); }
|
||||
return new PythonQtShell_RadioService(name, model, parent); }
|
||||
|
||||
QWidget* PythonQtWrapper_RadioService::HeaderWidget(RadioService* theWrappedObject) const
|
||||
{
|
||||
|
|
|
@ -881,6 +881,10 @@ class PythonQtWrapper_PlaylistItemPtr : public QObject
|
|||
public:
|
||||
public slots:
|
||||
PlaylistItemPtr* new_PlaylistItemPtr();
|
||||
PlaylistItemPtr* new_PlaylistItemPtr(const PlaylistItemPtr& other) {
|
||||
PythonQtShell_PlaylistItemPtr* a = new PythonQtShell_PlaylistItemPtr();
|
||||
*((PlaylistItemPtr*)a) = other;
|
||||
return a; }
|
||||
void delete_PlaylistItemPtr(PlaylistItemPtr* obj) { delete obj; }
|
||||
};
|
||||
|
||||
|
@ -1214,7 +1218,7 @@ void delete_RadioModel(RadioModel* obj) { delete obj; }
|
|||
class PythonQtShell_RadioService : public RadioService
|
||||
{
|
||||
public:
|
||||
PythonQtShell_RadioService(const QString& name, RadioModel* model):RadioService(name, model),_wrapper(NULL) {};
|
||||
PythonQtShell_RadioService(const QString& name, RadioModel* model, QObject* parent = NULL):RadioService(name, model, parent),_wrapper(NULL) {};
|
||||
|
||||
virtual QStandardItem* CreateRootItem();
|
||||
virtual QModelIndex GetCurrentIndex();
|
||||
|
@ -1246,7 +1250,7 @@ class PythonQtWrapper_RadioService : public QObject
|
|||
{ Q_OBJECT
|
||||
public:
|
||||
public slots:
|
||||
RadioService* new_RadioService(const QString& name, RadioModel* model);
|
||||
RadioService* new_RadioService(const QString& name, RadioModel* model, QObject* parent = NULL);
|
||||
void delete_RadioService(RadioService* obj) { delete obj; }
|
||||
QWidget* HeaderWidget(RadioService* theWrappedObject) const;
|
||||
QString Icon(RadioService* theWrappedObject);
|
||||
|
|
|
@ -44,7 +44,7 @@ const char* IcecastService::kDirectoryUrl = "http://data.clementine-player.org/i
|
|||
const char* IcecastService::kHomepage = "http://dir.xiph.org/";
|
||||
|
||||
IcecastService::IcecastService(RadioModel* parent)
|
||||
: RadioService(kServiceName, parent),
|
||||
: RadioService(kServiceName, parent, parent),
|
||||
network_(new NetworkAccessManager(this)),
|
||||
context_menu_(NULL),
|
||||
backend_(NULL),
|
||||
|
|
|
@ -67,7 +67,7 @@ const int JamendoService::kBatchSize = 10000;
|
|||
const int JamendoService::kApproxDatabaseSize = 300000;
|
||||
|
||||
JamendoService::JamendoService(RadioModel* parent)
|
||||
: RadioService(kServiceName, parent),
|
||||
: RadioService(kServiceName, parent, parent),
|
||||
network_(new NetworkAccessManager(this)),
|
||||
context_menu_(NULL),
|
||||
library_backend_(NULL),
|
||||
|
|
|
@ -66,7 +66,7 @@ const char* LastFMService::kTitleTag = QT_TR_NOOP("Last.fm Tag Radio: %1");
|
|||
const char* LastFMService::kTitleCustom = QT_TR_NOOP("Last.fm Custom Radio: %1");
|
||||
|
||||
LastFMService::LastFMService(RadioModel* parent)
|
||||
: RadioService(kServiceName, parent),
|
||||
: RadioService(kServiceName, parent, parent),
|
||||
url_handler_(new LastFMUrlHandler(this, this)),
|
||||
scrobbler_(NULL),
|
||||
already_scrobbled_(false),
|
||||
|
|
|
@ -62,7 +62,7 @@ const char* MagnatuneService::kPartnerId = "clementine";
|
|||
const char* MagnatuneService::kDownloadUrl = "http://download.magnatune.com/buy/membership_free_dl_xml";
|
||||
|
||||
MagnatuneService::MagnatuneService(RadioModel* parent)
|
||||
: RadioService(kServiceName, parent),
|
||||
: RadioService(kServiceName, parent, parent),
|
||||
url_handler_(new MagnatuneUrlHandler(this, this)),
|
||||
context_menu_(NULL),
|
||||
root_(NULL),
|
||||
|
|
|
@ -94,8 +94,8 @@ void RadioModel::RemoveService(RadioService* service) {
|
|||
|
||||
// Find and remove the root item that this service created
|
||||
for (int i=0 ; i<invisibleRootItem()->rowCount() ; ++i) {
|
||||
if (invisibleRootItem()->child(i)->data(Role_Service).value<RadioService*>()
|
||||
== service) {
|
||||
QStandardItem* item = invisibleRootItem()->child(i);
|
||||
if (!item || item->data(Role_Service).value<RadioService*>() == service) {
|
||||
invisibleRootItem()->removeRow(i);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -17,14 +17,15 @@
|
|||
|
||||
#include "radioservice.h"
|
||||
#include "radiomodel.h"
|
||||
#include "core/logging.h"
|
||||
#include "core/mergedproxymodel.h"
|
||||
#include "core/mimedata.h"
|
||||
#include "ui/iconloader.h"
|
||||
|
||||
#include <QMenu>
|
||||
|
||||
RadioService::RadioService(const QString& name, RadioModel* model)
|
||||
: QObject(model),
|
||||
RadioService::RadioService(const QString& name, RadioModel* model, QObject* parent)
|
||||
: QObject(parent),
|
||||
model_(model),
|
||||
name_(name),
|
||||
append_to_playlist_(NULL),
|
||||
|
|
|
@ -36,7 +36,7 @@ class RadioService : public QObject {
|
|||
public:
|
||||
// Constructs a new radio service with the given name and model. The name
|
||||
// should be user-friendly (like 'DigitallyImported' or 'Last.fm').
|
||||
RadioService(const QString& name, RadioModel* model);
|
||||
RadioService(const QString& name, RadioModel* model, QObject* parent = NULL);
|
||||
virtual ~RadioService() {}
|
||||
|
||||
QString name() const { return name_; }
|
||||
|
|
|
@ -28,7 +28,7 @@ const char* SavedRadio::kServiceName = "SavedRadio";
|
|||
const char* SavedRadio::kSettingsGroup = "SavedRadio";
|
||||
|
||||
SavedRadio::SavedRadio(RadioModel* parent)
|
||||
: RadioService(kServiceName, parent),
|
||||
: RadioService(kServiceName, parent, parent),
|
||||
context_menu_(NULL),
|
||||
root_(NULL)
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@ const char* SomaFMService::kChannelListUrl = "http://somafm.com/channels.xml";
|
|||
const char* SomaFMService::kHomepage = "http://somafm.com";
|
||||
|
||||
SomaFMService::SomaFMService(RadioModel* parent)
|
||||
: RadioService(kServiceName, parent),
|
||||
: RadioService(kServiceName, parent, parent),
|
||||
url_handler_(new SomaFMUrlHandler(this, this)),
|
||||
root_(NULL),
|
||||
context_menu_(NULL),
|
||||
|
|
|
@ -35,7 +35,7 @@ const char* SpotifyService::kBlobDownloadUrl = "http://spotify.clementine-player
|
|||
const int SpotifyService::kSearchDelayMsec = 400;
|
||||
|
||||
SpotifyService::SpotifyService(TaskManager* task_manager, RadioModel* parent)
|
||||
: RadioService(kServiceName, parent),
|
||||
: RadioService(kServiceName, parent, parent),
|
||||
server_(NULL),
|
||||
url_handler_(new SpotifyUrlHandler(this, this)),
|
||||
blob_process_(NULL),
|
||||
|
|
Loading…
Reference in New Issue