Move TaskManager::Task and UrlHandler::LoadResult structs out of their parent classes - PythonQt doesn't understand nested structs.
This commit is contained in:
parent
1822f8b75f
commit
5234798a7f
@ -81,9 +81,9 @@ void Player::ReloadSettings() {
|
||||
engine_->ReloadSettings();
|
||||
}
|
||||
|
||||
void Player::HandleLoadResult(const UrlHandler::LoadResult& result) {
|
||||
void Player::HandleLoadResult(const UrlHandler_LoadResult& result) {
|
||||
switch (result.type_) {
|
||||
case UrlHandler::LoadResult::NoMoreTracks:
|
||||
case UrlHandler_LoadResult::NoMoreTracks:
|
||||
qLog(Debug) << "URL handler for" << result.original_url_
|
||||
<< "said no more tracks";
|
||||
|
||||
@ -91,7 +91,7 @@ void Player::HandleLoadResult(const UrlHandler::LoadResult& result) {
|
||||
NextItem(Engine::Auto);
|
||||
break;
|
||||
|
||||
case UrlHandler::LoadResult::TrackAvailable: {
|
||||
case UrlHandler_LoadResult::TrackAvailable: {
|
||||
// Might've been an async load, so check we're still on the same item
|
||||
int current_index = playlists_->active()->current_row();
|
||||
if (current_index == -1)
|
||||
@ -114,7 +114,7 @@ void Player::HandleLoadResult(const UrlHandler::LoadResult& result) {
|
||||
break;
|
||||
}
|
||||
|
||||
case UrlHandler::LoadResult::WillLoadAsynchronously:
|
||||
case UrlHandler_LoadResult::WillLoadAsynchronously:
|
||||
qLog(Debug) << "URL handler for" << result.original_url_
|
||||
<< "is loading asynchronously";
|
||||
|
||||
@ -450,16 +450,16 @@ void Player::TrackAboutToEnd() {
|
||||
|
||||
// Get the actual track URL rather than the stream URL.
|
||||
if (url_handlers_.contains(url.scheme())) {
|
||||
UrlHandler::LoadResult result = url_handlers_[url.scheme()]->LoadNext(url);
|
||||
UrlHandler_LoadResult result = url_handlers_[url.scheme()]->LoadNext(url);
|
||||
switch (result.type_) {
|
||||
case UrlHandler::LoadResult::NoMoreTracks:
|
||||
case UrlHandler_LoadResult::NoMoreTracks:
|
||||
return;
|
||||
|
||||
case UrlHandler::LoadResult::WillLoadAsynchronously:
|
||||
case UrlHandler_LoadResult::WillLoadAsynchronously:
|
||||
loading_async_ = url;
|
||||
return;
|
||||
|
||||
case UrlHandler::LoadResult::TrackAvailable:
|
||||
case UrlHandler_LoadResult::TrackAvailable:
|
||||
url = result.media_url_;
|
||||
break;
|
||||
}
|
||||
@ -493,8 +493,8 @@ void Player::RegisterUrlHandler(UrlHandler* handler) {
|
||||
qLog(Info) << "Registered URL handler for" << scheme;
|
||||
url_handlers_.insert(scheme, handler);
|
||||
connect(handler, SIGNAL(destroyed(QObject*)), SLOT(UrlHandlerDestroyed(QObject*)));
|
||||
connect(handler, SIGNAL(AsyncLoadComplete(UrlHandler::LoadResult)),
|
||||
SLOT(HandleLoadResult(UrlHandler::LoadResult)));
|
||||
connect(handler, SIGNAL(AsyncLoadComplete(UrlHandler_LoadResult)),
|
||||
SLOT(HandleLoadResult(UrlHandler_LoadResult)));
|
||||
}
|
||||
|
||||
void Player::UnregisterUrlHandler(UrlHandler* handler) {
|
||||
@ -508,8 +508,8 @@ void Player::UnregisterUrlHandler(UrlHandler* handler) {
|
||||
qLog(Info) << "Unregistered URL handler for" << scheme;
|
||||
url_handlers_.remove(scheme);
|
||||
disconnect(handler, SIGNAL(destroyed(QObject*)), this, SLOT(UrlHandlerDestroyed(QObject*)));
|
||||
disconnect(handler, SIGNAL(AsyncLoadComplete(UrlHandler::LoadResult)),
|
||||
this, SLOT(HandleLoadResult(UrlHandler::LoadResult)));
|
||||
disconnect(handler, SIGNAL(AsyncLoadComplete(UrlHandler_LoadResult)),
|
||||
this, SLOT(HandleLoadResult(UrlHandler_LoadResult)));
|
||||
}
|
||||
|
||||
void Player::UrlHandlerDestroyed(QObject* object) {
|
||||
|
@ -159,7 +159,7 @@ public slots:
|
||||
void InvalidSongRequested(const QUrl&);
|
||||
|
||||
void UrlHandlerDestroyed(QObject* object);
|
||||
void HandleLoadResult(const UrlHandler::LoadResult& result);
|
||||
void HandleLoadResult(const UrlHandler_LoadResult& result);
|
||||
|
||||
private:
|
||||
PlaylistManagerInterface* playlists_;
|
||||
|
@ -24,7 +24,7 @@ TaskManager::TaskManager(QObject *parent)
|
||||
}
|
||||
|
||||
int TaskManager::StartTask(const QString& name) {
|
||||
Task t;
|
||||
TaskManager_Task t;
|
||||
t.name = name;
|
||||
t.progress = 0;
|
||||
t.progress_max = 0;
|
||||
@ -40,8 +40,8 @@ int TaskManager::StartTask(const QString& name) {
|
||||
return t.id;
|
||||
}
|
||||
|
||||
QList<TaskManager::Task> TaskManager::GetTasks() {
|
||||
QList<TaskManager::Task> ret;
|
||||
QList<TaskManager_Task> TaskManager::GetTasks() {
|
||||
QList<TaskManager_Task> ret;
|
||||
|
||||
{
|
||||
QMutexLocker l(&mutex_);
|
||||
@ -57,7 +57,7 @@ void TaskManager::SetTaskBlocksLibraryScans(int id) {
|
||||
if (!tasks_.contains(id))
|
||||
return;
|
||||
|
||||
Task& t = tasks_[id];
|
||||
TaskManager_Task& t = tasks_[id];
|
||||
t.blocks_library_scans = true;
|
||||
}
|
||||
|
||||
@ -71,7 +71,7 @@ void TaskManager::SetTaskProgress(int id, int progress, int max) {
|
||||
if (!tasks_.contains(id))
|
||||
return;
|
||||
|
||||
Task& t = tasks_[id];
|
||||
TaskManager_Task& t = tasks_[id];
|
||||
t.progress = progress;
|
||||
if (max)
|
||||
t.progress_max = max;
|
||||
@ -90,7 +90,7 @@ void TaskManager::SetTaskFinished(int id) {
|
||||
|
||||
if (tasks_[id].blocks_library_scans) {
|
||||
resume_library_watchers = true;
|
||||
foreach (const Task& task, tasks_.values()) {
|
||||
foreach (const TaskManager_Task& task, tasks_.values()) {
|
||||
if (task.id != id && task.blocks_library_scans) {
|
||||
resume_library_watchers = false;
|
||||
break;
|
||||
|
@ -22,22 +22,22 @@
|
||||
#include <QMutex>
|
||||
#include <QObject>
|
||||
|
||||
struct TaskManager_Task {
|
||||
int id;
|
||||
QString name;
|
||||
int progress;
|
||||
int progress_max;
|
||||
bool blocks_library_scans;
|
||||
};
|
||||
|
||||
class TaskManager : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TaskManager(QObject* parent = 0);
|
||||
|
||||
struct Task {
|
||||
int id;
|
||||
QString name;
|
||||
int progress;
|
||||
int progress_max;
|
||||
bool blocks_library_scans;
|
||||
};
|
||||
|
||||
// Everything here is thread safe
|
||||
QList<Task> GetTasks();
|
||||
QList<TaskManager_Task> GetTasks();
|
||||
|
||||
int StartTask(const QString& name);
|
||||
void SetTaskBlocksLibraryScans(int id);
|
||||
@ -52,7 +52,7 @@ signals:
|
||||
|
||||
private:
|
||||
QMutex mutex_;
|
||||
QMap<int, Task> tasks_;
|
||||
QMap<int, TaskManager_Task> tasks_;
|
||||
int next_task_id_;
|
||||
};
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
#include "urlhandler.h"
|
||||
|
||||
UrlHandler::LoadResult::LoadResult(
|
||||
UrlHandler_LoadResult::UrlHandler_LoadResult(
|
||||
const QUrl& original_url, Type type, const QUrl& media_url)
|
||||
: original_url_(original_url), type_(type), media_url_(media_url)
|
||||
{
|
||||
|
@ -21,6 +21,37 @@
|
||||
#include <QObject>
|
||||
#include <QUrl>
|
||||
|
||||
// Returned by StartLoading() and LoadNext(), indicates what the player
|
||||
// should do when it wants to load a URL.
|
||||
struct UrlHandler_LoadResult {
|
||||
enum Type {
|
||||
// There wasn't a track available, and the player should move on to the
|
||||
// next playlist item.
|
||||
NoMoreTracks,
|
||||
|
||||
// There might be another track available but the handler needs to do some
|
||||
// work (eg. fetching a remote playlist) to find out. AsyncLoadComplete
|
||||
// will be emitted later with the same original_url.
|
||||
WillLoadAsynchronously,
|
||||
|
||||
// There was a track available. Its url is in media_url.
|
||||
TrackAvailable,
|
||||
};
|
||||
|
||||
UrlHandler_LoadResult(const QUrl& original_url = QUrl(),
|
||||
Type type = NoMoreTracks,
|
||||
const QUrl& media_url = QUrl());
|
||||
|
||||
// The url that the playlist item has in Url().
|
||||
// Might be something unplayable like lastfm://...
|
||||
QUrl original_url_;
|
||||
|
||||
Type type_;
|
||||
|
||||
// The actual url to something that gstreamer can play.
|
||||
QUrl media_url_;
|
||||
};
|
||||
|
||||
class UrlHandler : public QObject {
|
||||
Q_OBJECT
|
||||
|
||||
@ -30,47 +61,20 @@ public:
|
||||
// The URL scheme that this handler handles.
|
||||
virtual QString scheme() const = 0;
|
||||
|
||||
// Returned by StartLoading() and LoadNext(), indicates what the player
|
||||
// should do when it wants to load a URL.
|
||||
struct LoadResult {
|
||||
enum Type {
|
||||
// There wasn't a track available, and the player should move on to the
|
||||
// next playlist item.
|
||||
NoMoreTracks,
|
||||
|
||||
// There might be another track available but the handler needs to do some
|
||||
// work (eg. fetching a remote playlist) to find out. AsyncLoadComplete
|
||||
// will be emitted later with the same original_url.
|
||||
WillLoadAsynchronously,
|
||||
|
||||
// There was a track available. Its url is in media_url.
|
||||
TrackAvailable,
|
||||
};
|
||||
|
||||
LoadResult(const QUrl& original_url = QUrl(),
|
||||
Type type = NoMoreTracks,
|
||||
const QUrl& media_url = QUrl());
|
||||
|
||||
// The url that the playlist item has in Url().
|
||||
// Might be something unplayable like lastfm://...
|
||||
QUrl original_url_;
|
||||
|
||||
Type type_;
|
||||
|
||||
// The actual url to something that gstreamer can play.
|
||||
QUrl media_url_;
|
||||
};
|
||||
|
||||
// Called by the Player when a song starts loading - gives the handler
|
||||
// a chance to do something clever to get a playable track.
|
||||
virtual LoadResult StartLoading(const QUrl& url) { return LoadResult(url); }
|
||||
virtual UrlHandler_LoadResult StartLoading(const QUrl& url) {
|
||||
return UrlHandler_LoadResult(url);
|
||||
}
|
||||
|
||||
// Called by the player when a song finishes - gives the handler a chance to
|
||||
// get another track to play.
|
||||
virtual LoadResult LoadNext(const QUrl& url) { return LoadResult(url); }
|
||||
virtual UrlHandler_LoadResult LoadNext(const QUrl& url) {
|
||||
return UrlHandler_LoadResult(url);
|
||||
}
|
||||
|
||||
signals:
|
||||
void AsyncLoadComplete(const UrlHandler::LoadResult& result);
|
||||
void AsyncLoadComplete(const UrlHandler_LoadResult& result);
|
||||
};
|
||||
|
||||
#endif // URLHANDLER_H
|
||||
|
@ -686,10 +686,10 @@ void DeviceManager::DeviceTaskStarted(int id) {
|
||||
}
|
||||
|
||||
void DeviceManager::TasksChanged() {
|
||||
QList<TaskManager::Task> tasks = task_manager_->GetTasks();
|
||||
QList<TaskManager_Task> tasks = task_manager_->GetTasks();
|
||||
QList<QPersistentModelIndex> finished_tasks = active_tasks_.values();
|
||||
|
||||
foreach (const TaskManager::Task& task, tasks) {
|
||||
foreach (const TaskManager_Task& task, tasks) {
|
||||
if (!active_tasks_.contains(task.id))
|
||||
continue;
|
||||
|
||||
|
@ -3651,7 +3651,7 @@ TaskManager* PythonQtWrapper_TaskManager::new_TaskManager(QObject* parent)
|
||||
{
|
||||
return new PythonQtShell_TaskManager(parent); }
|
||||
|
||||
QList<TaskManager::Task > PythonQtWrapper_TaskManager::GetTasks(TaskManager* theWrappedObject)
|
||||
QList<TaskManager_Task > PythonQtWrapper_TaskManager::GetTasks(TaskManager* theWrappedObject)
|
||||
{
|
||||
return ( theWrappedObject->GetTasks());
|
||||
}
|
||||
@ -3678,7 +3678,7 @@ int PythonQtWrapper_TaskManager::StartTask(TaskManager* theWrappedObject, const
|
||||
|
||||
|
||||
|
||||
TaskManager::Task* PythonQtWrapper_TaskManager_Task::new_TaskManager_Task()
|
||||
TaskManager_Task* PythonQtWrapper_TaskManager_Task::new_TaskManager_Task()
|
||||
{
|
||||
return new PythonQtShell_TaskManager_Task(); }
|
||||
|
||||
@ -4028,15 +4028,15 @@ void PythonQtWrapper_ThreadSafeNetworkDiskCache::updateMetaData(ThreadSafeNetwor
|
||||
|
||||
|
||||
|
||||
UrlHandler::LoadResult PythonQtShell_UrlHandler::LoadNext(const QUrl& url)
|
||||
UrlHandler_LoadResult PythonQtShell_UrlHandler::LoadNext(const QUrl& url)
|
||||
{
|
||||
if (_wrapper) {
|
||||
PyObject* obj = PyObject_GetAttrString((PyObject*)_wrapper, "LoadNext");
|
||||
PyErr_Clear();
|
||||
if (obj && !PythonQtSlotFunction_Check(obj)) {
|
||||
static const char* argumentList[] ={"UrlHandler::LoadResult" , "const QUrl&"};
|
||||
static const char* argumentList[] ={"UrlHandler_LoadResult" , "const QUrl&"};
|
||||
static const PythonQtMethodInfo* methodInfo = PythonQtMethodInfo::getCachedMethodInfoFromArgumentList(2, argumentList);
|
||||
UrlHandler::LoadResult returnValue;
|
||||
UrlHandler_LoadResult returnValue;
|
||||
void* args[2] = {NULL, (void*)&url};
|
||||
PyObject* result = PythonQtSignalTarget::call(obj, methodInfo, args, true);
|
||||
if (result) {
|
||||
@ -4045,7 +4045,7 @@ if (_wrapper) {
|
||||
if (args[0]==NULL) {
|
||||
PythonQt::priv()->handleVirtualOverloadReturnError("LoadNext", methodInfo, result);
|
||||
} else {
|
||||
returnValue = *((UrlHandler::LoadResult*)args[0]);
|
||||
returnValue = *((UrlHandler_LoadResult*)args[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4056,15 +4056,15 @@ if (_wrapper) {
|
||||
}
|
||||
return UrlHandler::LoadNext(url);
|
||||
}
|
||||
UrlHandler::LoadResult PythonQtShell_UrlHandler::StartLoading(const QUrl& url)
|
||||
UrlHandler_LoadResult PythonQtShell_UrlHandler::StartLoading(const QUrl& url)
|
||||
{
|
||||
if (_wrapper) {
|
||||
PyObject* obj = PyObject_GetAttrString((PyObject*)_wrapper, "StartLoading");
|
||||
PyErr_Clear();
|
||||
if (obj && !PythonQtSlotFunction_Check(obj)) {
|
||||
static const char* argumentList[] ={"UrlHandler::LoadResult" , "const QUrl&"};
|
||||
static const char* argumentList[] ={"UrlHandler_LoadResult" , "const QUrl&"};
|
||||
static const PythonQtMethodInfo* methodInfo = PythonQtMethodInfo::getCachedMethodInfoFromArgumentList(2, argumentList);
|
||||
UrlHandler::LoadResult returnValue;
|
||||
UrlHandler_LoadResult returnValue;
|
||||
void* args[2] = {NULL, (void*)&url};
|
||||
PyObject* result = PythonQtSignalTarget::call(obj, methodInfo, args, true);
|
||||
if (result) {
|
||||
@ -4073,7 +4073,7 @@ if (_wrapper) {
|
||||
if (args[0]==NULL) {
|
||||
PythonQt::priv()->handleVirtualOverloadReturnError("StartLoading", methodInfo, result);
|
||||
} else {
|
||||
returnValue = *((UrlHandler::LoadResult*)args[0]);
|
||||
returnValue = *((UrlHandler_LoadResult*)args[0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -4223,19 +4223,19 @@ UrlHandler* PythonQtWrapper_UrlHandler::new_UrlHandler(QObject* parent)
|
||||
{
|
||||
return new PythonQtShell_UrlHandler(parent); }
|
||||
|
||||
UrlHandler::LoadResult PythonQtWrapper_UrlHandler::LoadNext(UrlHandler* theWrappedObject, const QUrl& url)
|
||||
UrlHandler_LoadResult PythonQtWrapper_UrlHandler::LoadNext(UrlHandler* theWrappedObject, const QUrl& url)
|
||||
{
|
||||
return ( ((PythonQtPublicPromoter_UrlHandler*)theWrappedObject)->promoted_LoadNext(url));
|
||||
}
|
||||
|
||||
UrlHandler::LoadResult PythonQtWrapper_UrlHandler::StartLoading(UrlHandler* theWrappedObject, const QUrl& url)
|
||||
UrlHandler_LoadResult PythonQtWrapper_UrlHandler::StartLoading(UrlHandler* theWrappedObject, const QUrl& url)
|
||||
{
|
||||
return ( ((PythonQtPublicPromoter_UrlHandler*)theWrappedObject)->promoted_StartLoading(url));
|
||||
}
|
||||
|
||||
|
||||
|
||||
UrlHandler::LoadResult* PythonQtWrapper_UrlHandler_LoadResult::new_UrlHandler_LoadResult(const QUrl& original_url, UrlHandler::LoadResult::Type type, const QUrl& media_url)
|
||||
UrlHandler_LoadResult* PythonQtWrapper_UrlHandler_LoadResult::new_UrlHandler_LoadResult(const QUrl& original_url, UrlHandler_LoadResult::Type type, const QUrl& media_url)
|
||||
{
|
||||
return new PythonQtShell_UrlHandler_LoadResult(original_url, type, media_url); }
|
||||
|
||||
|
@ -813,7 +813,7 @@ public:
|
||||
public slots:
|
||||
TaskManager* new_TaskManager(QObject* parent = 0);
|
||||
void delete_TaskManager(TaskManager* obj) { delete obj; }
|
||||
QList<TaskManager::Task > GetTasks(TaskManager* theWrappedObject);
|
||||
QList<TaskManager_Task > GetTasks(TaskManager* theWrappedObject);
|
||||
void SetTaskBlocksLibraryScans(TaskManager* theWrappedObject, int id);
|
||||
void SetTaskFinished(TaskManager* theWrappedObject, int id);
|
||||
void SetTaskProgress(TaskManager* theWrappedObject, int id, int progress, int max = 0);
|
||||
@ -824,10 +824,10 @@ void delete_TaskManager(TaskManager* obj) { delete obj; }
|
||||
|
||||
|
||||
|
||||
class PythonQtShell_TaskManager_Task : public TaskManager::Task
|
||||
class PythonQtShell_TaskManager_Task : public TaskManager_Task
|
||||
{
|
||||
public:
|
||||
PythonQtShell_TaskManager_Task():TaskManager::Task(),_wrapper(NULL) {};
|
||||
PythonQtShell_TaskManager_Task():TaskManager_Task(),_wrapper(NULL) {};
|
||||
|
||||
|
||||
PythonQtInstanceWrapper* _wrapper;
|
||||
@ -837,22 +837,22 @@ class PythonQtWrapper_TaskManager_Task : public QObject
|
||||
{ Q_OBJECT
|
||||
public:
|
||||
public slots:
|
||||
TaskManager::Task* new_TaskManager_Task();
|
||||
TaskManager::Task* new_TaskManager_Task(const TaskManager::Task& other) {
|
||||
TaskManager_Task* new_TaskManager_Task();
|
||||
TaskManager_Task* new_TaskManager_Task(const TaskManager_Task& other) {
|
||||
PythonQtShell_TaskManager_Task* a = new PythonQtShell_TaskManager_Task();
|
||||
*((TaskManager::Task*)a) = other;
|
||||
*((TaskManager_Task*)a) = other;
|
||||
return a; }
|
||||
void delete_TaskManager_Task(TaskManager::Task* obj) { delete obj; }
|
||||
void py_set_progress_max(TaskManager::Task* theWrappedObject, int progress_max){ theWrappedObject->progress_max = progress_max; }
|
||||
int py_get_progress_max(TaskManager::Task* theWrappedObject){ return theWrappedObject->progress_max; }
|
||||
void py_set_progress(TaskManager::Task* theWrappedObject, int progress){ theWrappedObject->progress = progress; }
|
||||
int py_get_progress(TaskManager::Task* theWrappedObject){ return theWrappedObject->progress; }
|
||||
void py_set_id(TaskManager::Task* theWrappedObject, int id){ theWrappedObject->id = id; }
|
||||
int py_get_id(TaskManager::Task* theWrappedObject){ return theWrappedObject->id; }
|
||||
void py_set_name(TaskManager::Task* theWrappedObject, QString name){ theWrappedObject->name = name; }
|
||||
QString py_get_name(TaskManager::Task* theWrappedObject){ return theWrappedObject->name; }
|
||||
void py_set_blocks_library_scans(TaskManager::Task* theWrappedObject, bool blocks_library_scans){ theWrappedObject->blocks_library_scans = blocks_library_scans; }
|
||||
bool py_get_blocks_library_scans(TaskManager::Task* theWrappedObject){ return theWrappedObject->blocks_library_scans; }
|
||||
void delete_TaskManager_Task(TaskManager_Task* obj) { delete obj; }
|
||||
void py_set_progress_max(TaskManager_Task* theWrappedObject, int progress_max){ theWrappedObject->progress_max = progress_max; }
|
||||
int py_get_progress_max(TaskManager_Task* theWrappedObject){ return theWrappedObject->progress_max; }
|
||||
void py_set_progress(TaskManager_Task* theWrappedObject, int progress){ theWrappedObject->progress = progress; }
|
||||
int py_get_progress(TaskManager_Task* theWrappedObject){ return theWrappedObject->progress; }
|
||||
void py_set_id(TaskManager_Task* theWrappedObject, int id){ theWrappedObject->id = id; }
|
||||
int py_get_id(TaskManager_Task* theWrappedObject){ return theWrappedObject->id; }
|
||||
void py_set_name(TaskManager_Task* theWrappedObject, QString name){ theWrappedObject->name = name; }
|
||||
QString py_get_name(TaskManager_Task* theWrappedObject){ return theWrappedObject->name; }
|
||||
void py_set_blocks_library_scans(TaskManager_Task* theWrappedObject, bool blocks_library_scans){ theWrappedObject->blocks_library_scans = blocks_library_scans; }
|
||||
bool py_get_blocks_library_scans(TaskManager_Task* theWrappedObject){ return theWrappedObject->blocks_library_scans; }
|
||||
};
|
||||
|
||||
|
||||
@ -918,8 +918,8 @@ class PythonQtShell_UrlHandler : public UrlHandler
|
||||
public:
|
||||
PythonQtShell_UrlHandler(QObject* parent = 0):UrlHandler(parent),_wrapper(NULL) {};
|
||||
|
||||
virtual UrlHandler::LoadResult LoadNext(const QUrl& url);
|
||||
virtual UrlHandler::LoadResult StartLoading(const QUrl& url);
|
||||
virtual UrlHandler_LoadResult LoadNext(const QUrl& url);
|
||||
virtual UrlHandler_LoadResult StartLoading(const QUrl& url);
|
||||
virtual void childEvent(QChildEvent* arg__1);
|
||||
virtual void customEvent(QEvent* arg__1);
|
||||
virtual bool event(QEvent* arg__1);
|
||||
@ -932,8 +932,8 @@ virtual void timerEvent(QTimerEvent* arg__1);
|
||||
|
||||
class PythonQtPublicPromoter_UrlHandler : public UrlHandler
|
||||
{ public:
|
||||
inline UrlHandler::LoadResult promoted_LoadNext(const QUrl& url) { return UrlHandler::LoadNext(url); }
|
||||
inline UrlHandler::LoadResult promoted_StartLoading(const QUrl& url) { return UrlHandler::StartLoading(url); }
|
||||
inline UrlHandler_LoadResult promoted_LoadNext(const QUrl& url) { return UrlHandler::LoadNext(url); }
|
||||
inline UrlHandler_LoadResult promoted_StartLoading(const QUrl& url) { return UrlHandler::StartLoading(url); }
|
||||
};
|
||||
|
||||
class PythonQtWrapper_UrlHandler : public QObject
|
||||
@ -942,18 +942,18 @@ public:
|
||||
public slots:
|
||||
UrlHandler* new_UrlHandler(QObject* parent = 0);
|
||||
void delete_UrlHandler(UrlHandler* obj) { delete obj; }
|
||||
UrlHandler::LoadResult LoadNext(UrlHandler* theWrappedObject, const QUrl& url);
|
||||
UrlHandler::LoadResult StartLoading(UrlHandler* theWrappedObject, const QUrl& url);
|
||||
UrlHandler_LoadResult LoadNext(UrlHandler* theWrappedObject, const QUrl& url);
|
||||
UrlHandler_LoadResult StartLoading(UrlHandler* theWrappedObject, const QUrl& url);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
class PythonQtShell_UrlHandler_LoadResult : public UrlHandler::LoadResult
|
||||
class PythonQtShell_UrlHandler_LoadResult : public UrlHandler_LoadResult
|
||||
{
|
||||
public:
|
||||
PythonQtShell_UrlHandler_LoadResult(const QUrl& original_url = QUrl(), UrlHandler::LoadResult::Type type = UrlHandler::LoadResult::NoMoreTracks, const QUrl& media_url = QUrl()):UrlHandler::LoadResult(original_url, type, media_url),_wrapper(NULL) {};
|
||||
PythonQtShell_UrlHandler_LoadResult(const QUrl& original_url = QUrl(), UrlHandler_LoadResult::Type type = UrlHandler_LoadResult::NoMoreTracks, const QUrl& media_url = QUrl()):UrlHandler_LoadResult(original_url, type, media_url),_wrapper(NULL) {};
|
||||
|
||||
|
||||
PythonQtInstanceWrapper* _wrapper;
|
||||
@ -964,16 +964,16 @@ class PythonQtWrapper_UrlHandler_LoadResult : public QObject
|
||||
public:
|
||||
Q_ENUMS(Type )
|
||||
enum Type{
|
||||
NoMoreTracks = UrlHandler::LoadResult::NoMoreTracks, WillLoadAsynchronously = UrlHandler::LoadResult::WillLoadAsynchronously, TrackAvailable = UrlHandler::LoadResult::TrackAvailable};
|
||||
NoMoreTracks = UrlHandler_LoadResult::NoMoreTracks, WillLoadAsynchronously = UrlHandler_LoadResult::WillLoadAsynchronously, TrackAvailable = UrlHandler_LoadResult::TrackAvailable};
|
||||
public slots:
|
||||
UrlHandler::LoadResult* new_UrlHandler_LoadResult(const QUrl& original_url = QUrl(), UrlHandler::LoadResult::Type type = UrlHandler::LoadResult::NoMoreTracks, const QUrl& media_url = QUrl());
|
||||
void delete_UrlHandler_LoadResult(UrlHandler::LoadResult* obj) { delete obj; }
|
||||
void py_set_original_url_(UrlHandler::LoadResult* theWrappedObject, QUrl original_url_){ theWrappedObject->original_url_ = original_url_; }
|
||||
QUrl py_get_original_url_(UrlHandler::LoadResult* theWrappedObject){ return theWrappedObject->original_url_; }
|
||||
void py_set_media_url_(UrlHandler::LoadResult* theWrappedObject, QUrl media_url_){ theWrappedObject->media_url_ = media_url_; }
|
||||
QUrl py_get_media_url_(UrlHandler::LoadResult* theWrappedObject){ return theWrappedObject->media_url_; }
|
||||
void py_set_type_(UrlHandler::LoadResult* theWrappedObject, UrlHandler::LoadResult::Type type_){ theWrappedObject->type_ = type_; }
|
||||
UrlHandler::LoadResult::Type py_get_type_(UrlHandler::LoadResult* theWrappedObject){ return theWrappedObject->type_; }
|
||||
UrlHandler_LoadResult* new_UrlHandler_LoadResult(const QUrl& original_url = QUrl(), UrlHandler_LoadResult::Type type = UrlHandler_LoadResult::NoMoreTracks, const QUrl& media_url = QUrl());
|
||||
void delete_UrlHandler_LoadResult(UrlHandler_LoadResult* obj) { delete obj; }
|
||||
void py_set_original_url_(UrlHandler_LoadResult* theWrappedObject, QUrl original_url_){ theWrappedObject->original_url_ = original_url_; }
|
||||
QUrl py_get_original_url_(UrlHandler_LoadResult* theWrappedObject){ return theWrappedObject->original_url_; }
|
||||
void py_set_media_url_(UrlHandler_LoadResult* theWrappedObject, QUrl media_url_){ theWrappedObject->media_url_ = media_url_; }
|
||||
QUrl py_get_media_url_(UrlHandler_LoadResult* theWrappedObject){ return theWrappedObject->media_url_; }
|
||||
void py_set_type_(UrlHandler_LoadResult* theWrappedObject, UrlHandler_LoadResult::Type type_){ theWrappedObject->type_ = type_; }
|
||||
UrlHandler_LoadResult::Type py_get_type_(UrlHandler_LoadResult* theWrappedObject){ return theWrappedObject->type_; }
|
||||
};
|
||||
|
||||
|
||||
|
@ -23,9 +23,9 @@ PythonQt::priv()->registerClass(&RadioService::staticMetaObject, "Clementine", P
|
||||
PythonQt::priv()->registerCPPClass("Song", "", "Clementine", PythonQtCreateObject<PythonQtWrapper_Song>, PythonQtSetInstanceWrapperOnShell<PythonQtShell_Song>, module, PythonQt::Type_RichCompare);
|
||||
PythonQt::priv()->registerCPPClass("Subdirectory", "", "Clementine", PythonQtCreateObject<PythonQtWrapper_Subdirectory>, PythonQtSetInstanceWrapperOnShell<PythonQtShell_Subdirectory>, module, 0);
|
||||
PythonQt::priv()->registerClass(&TaskManager::staticMetaObject, "Clementine", PythonQtCreateObject<PythonQtWrapper_TaskManager>, PythonQtSetInstanceWrapperOnShell<PythonQtShell_TaskManager>, module, 0);
|
||||
PythonQt::priv()->registerCPPClass("TaskManager::Task", "", "Clementine", PythonQtCreateObject<PythonQtWrapper_TaskManager_Task>, PythonQtSetInstanceWrapperOnShell<PythonQtShell_TaskManager_Task>, module, 0);
|
||||
PythonQt::priv()->registerCPPClass("TaskManager_Task", "", "Clementine", PythonQtCreateObject<PythonQtWrapper_TaskManager_Task>, PythonQtSetInstanceWrapperOnShell<PythonQtShell_TaskManager_Task>, module, 0);
|
||||
PythonQt::priv()->registerClass(&ThreadSafeNetworkDiskCache::staticMetaObject, "Clementine", PythonQtCreateObject<PythonQtWrapper_ThreadSafeNetworkDiskCache>, PythonQtSetInstanceWrapperOnShell<PythonQtShell_ThreadSafeNetworkDiskCache>, module, 0);
|
||||
PythonQt::priv()->registerClass(&UrlHandler::staticMetaObject, "Clementine", PythonQtCreateObject<PythonQtWrapper_UrlHandler>, PythonQtSetInstanceWrapperOnShell<PythonQtShell_UrlHandler>, module, 0);
|
||||
PythonQt::priv()->registerCPPClass("UrlHandler::LoadResult", "", "Clementine", PythonQtCreateObject<PythonQtWrapper_UrlHandler_LoadResult>, PythonQtSetInstanceWrapperOnShell<PythonQtShell_UrlHandler_LoadResult>, module, 0);
|
||||
PythonQt::priv()->registerCPPClass("UrlHandler_LoadResult", "", "Clementine", PythonQtCreateObject<PythonQtWrapper_UrlHandler_LoadResult>, PythonQtSetInstanceWrapperOnShell<PythonQtShell_UrlHandler_LoadResult>, module, 0);
|
||||
|
||||
}
|
||||
|
@ -23,12 +23,12 @@ LastFMUrlHandler::LastFMUrlHandler(LastFMService* service, QObject* parent)
|
||||
service_(service) {
|
||||
}
|
||||
|
||||
UrlHandler::LoadResult LastFMUrlHandler::StartLoading(const QUrl& url) {
|
||||
UrlHandler_LoadResult LastFMUrlHandler::StartLoading(const QUrl& url) {
|
||||
if (!service_->IsAuthenticated())
|
||||
return LoadResult();
|
||||
return UrlHandler_LoadResult();
|
||||
|
||||
service_->Tune(url);
|
||||
return LoadResult(url, LoadResult::WillLoadAsynchronously);
|
||||
return UrlHandler_LoadResult(url, UrlHandler_LoadResult::WillLoadAsynchronously);
|
||||
}
|
||||
|
||||
void LastFMUrlHandler::TunerTrackAvailable() {
|
||||
@ -36,13 +36,14 @@ void LastFMUrlHandler::TunerTrackAvailable() {
|
||||
}
|
||||
|
||||
void LastFMUrlHandler::TunerError() {
|
||||
emit AsyncLoadComplete(LoadResult(service_->last_url_, LoadResult::NoMoreTracks));
|
||||
emit AsyncLoadComplete(UrlHandler_LoadResult(
|
||||
service_->last_url_, UrlHandler_LoadResult::NoMoreTracks));
|
||||
}
|
||||
|
||||
UrlHandler::LoadResult LastFMUrlHandler::LoadNext(const QUrl& url) {
|
||||
UrlHandler_LoadResult LastFMUrlHandler::LoadNext(const QUrl& url) {
|
||||
const QUrl media_url = service_->DeququeNextMediaUrl();
|
||||
if (media_url.isEmpty()) {
|
||||
return LoadResult();
|
||||
return UrlHandler_LoadResult();
|
||||
}
|
||||
return LoadResult(url, LoadResult::TrackAvailable, media_url);
|
||||
return UrlHandler_LoadResult(url, UrlHandler_LoadResult::TrackAvailable, media_url);
|
||||
}
|
||||
|
@ -30,8 +30,8 @@ public:
|
||||
LastFMUrlHandler(LastFMService* service, QObject* parent);
|
||||
|
||||
QString scheme() const { return "lastfm"; }
|
||||
LoadResult StartLoading(const QUrl& url);
|
||||
LoadResult LoadNext(const QUrl& url);
|
||||
UrlHandler_LoadResult StartLoading(const QUrl& url);
|
||||
UrlHandler_LoadResult LoadNext(const QUrl& url);
|
||||
|
||||
void TunerTrackAvailable();
|
||||
void TunerError();
|
||||
|
@ -23,6 +23,7 @@ MagnatuneUrlHandler::MagnatuneUrlHandler(MagnatuneService* service, QObject* par
|
||||
service_(service) {
|
||||
}
|
||||
|
||||
UrlHandler::LoadResult MagnatuneUrlHandler::StartLoading(const QUrl& url) {
|
||||
return LoadResult(url, LoadResult::TrackAvailable, service_->ModifyUrl(url));
|
||||
UrlHandler_LoadResult MagnatuneUrlHandler::StartLoading(const QUrl& url) {
|
||||
return UrlHandler_LoadResult(url, UrlHandler_LoadResult::TrackAvailable,
|
||||
service_->ModifyUrl(url));
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
MagnatuneUrlHandler(MagnatuneService* service, QObject* parent);
|
||||
|
||||
QString scheme() const { return "magnatune"; }
|
||||
LoadResult StartLoading(const QUrl& url);
|
||||
UrlHandler_LoadResult StartLoading(const QUrl& url);
|
||||
|
||||
private:
|
||||
MagnatuneService* service_;
|
||||
|
@ -33,7 +33,7 @@ SomaFMUrlHandler::SomaFMUrlHandler(SomaFMService* service, QObject* parent)
|
||||
{
|
||||
}
|
||||
|
||||
UrlHandler::LoadResult SomaFMUrlHandler::StartLoading(const QUrl& url) {
|
||||
UrlHandler_LoadResult SomaFMUrlHandler::StartLoading(const QUrl& url) {
|
||||
QUrl playlist_url = url;
|
||||
playlist_url.setScheme("http");
|
||||
|
||||
@ -44,7 +44,7 @@ UrlHandler::LoadResult SomaFMUrlHandler::StartLoading(const QUrl& url) {
|
||||
if (!task_id_)
|
||||
task_id_ = service_->model()->task_manager()->StartTask(tr("Loading stream"));
|
||||
|
||||
return LoadResult(url, LoadResult::WillLoadAsynchronously);
|
||||
return UrlHandler_LoadResult(url, UrlHandler_LoadResult::WillLoadAsynchronously);
|
||||
}
|
||||
|
||||
void SomaFMUrlHandler::LoadPlaylistFinished() {
|
||||
@ -58,7 +58,8 @@ void SomaFMUrlHandler::LoadPlaylistFinished() {
|
||||
if (reply->error() != QNetworkReply::NoError) {
|
||||
// TODO: Error handling
|
||||
qLog(Error) << reply->errorString();
|
||||
emit AsyncLoadComplete(LoadResult(original_url, LoadResult::NoMoreTracks));
|
||||
emit AsyncLoadComplete(UrlHandler_LoadResult(
|
||||
original_url, UrlHandler_LoadResult::NoMoreTracks));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -71,6 +72,7 @@ void SomaFMUrlHandler::LoadPlaylistFinished() {
|
||||
QSettings s(temp_file.fileName(), QSettings::IniFormat);
|
||||
s.beginGroup("playlist");
|
||||
|
||||
emit AsyncLoadComplete(LoadResult(original_url, LoadResult::TrackAvailable,
|
||||
s.value("File1").toString()));
|
||||
emit AsyncLoadComplete(UrlHandler_LoadResult(
|
||||
original_url, UrlHandler_LoadResult::TrackAvailable,
|
||||
s.value("File1").toString()));
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public:
|
||||
SomaFMUrlHandler(SomaFMService* service, QObject* parent);
|
||||
|
||||
QString scheme() const { return "somafm"; }
|
||||
LoadResult StartLoading(const QUrl& url);
|
||||
UrlHandler_LoadResult StartLoading(const QUrl& url);
|
||||
|
||||
private slots:
|
||||
void LoadPlaylistFinished();
|
||||
|
@ -27,7 +27,7 @@ SpotifyUrlHandler::SpotifyUrlHandler(SpotifyService* service, QObject* parent)
|
||||
service_(service) {
|
||||
}
|
||||
|
||||
UrlHandler::LoadResult SpotifyUrlHandler::StartLoading(const QUrl& url) {
|
||||
UrlHandler_LoadResult SpotifyUrlHandler::StartLoading(const QUrl& url) {
|
||||
// Pick an unused local port. There's a possible race condition here -
|
||||
// something else might grab the port before gstreamer does.
|
||||
quint16 port = 0;
|
||||
@ -40,13 +40,13 @@ UrlHandler::LoadResult SpotifyUrlHandler::StartLoading(const QUrl& url) {
|
||||
|
||||
if (port == 0) {
|
||||
qLog(Warning) << "Couldn't pick an unused port";
|
||||
return LoadResult();
|
||||
return UrlHandler_LoadResult();
|
||||
}
|
||||
|
||||
// Tell Spotify to start sending to this port
|
||||
service_->server()->StartPlayback(url.toString(), port);
|
||||
|
||||
// Tell gstreamer to listen on this port
|
||||
return LoadResult(url, LoadResult::TrackAvailable,
|
||||
QUrl("tcp://localhost:" + QString::number(port)));
|
||||
return UrlHandler_LoadResult(url, UrlHandler_LoadResult::TrackAvailable,
|
||||
QUrl("tcp://localhost:" + QString::number(port)));
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ public:
|
||||
SpotifyUrlHandler(SpotifyService* service, QObject* parent);
|
||||
|
||||
QString scheme() const { return "spotify"; }
|
||||
LoadResult StartLoading(const QUrl& url);
|
||||
UrlHandler_LoadResult StartLoading(const QUrl& url);
|
||||
|
||||
private:
|
||||
SpotifyService* service_;
|
||||
|
@ -10,7 +10,7 @@
|
||||
<enum-type name="RadioModel::Type" />
|
||||
<enum-type name="RadioService::AddMode" />
|
||||
<enum-type name="Song::FileType" />
|
||||
<enum-type name="UrlHandler::LoadResult::Type" />
|
||||
<enum-type name="UrlHandler_LoadResult::Type" />
|
||||
|
||||
|
||||
<value-type name="CoverSearchResults" />
|
||||
@ -21,8 +21,8 @@
|
||||
<modify-function signature="BackgroundSave()const" remove="all" />
|
||||
</value-type>
|
||||
<value-type name="Subdirectory" />
|
||||
<value-type name="TaskManager::Task" />
|
||||
<value-type name="UrlHandler::LoadResult" />
|
||||
<value-type name="TaskManager_Task" />
|
||||
<value-type name="UrlHandler_LoadResult" />
|
||||
|
||||
<object-type name="AlbumCoverFetcherSearch">
|
||||
<modify-function signature="timerEvent(QTimerEvent*)">
|
||||
|
@ -47,10 +47,10 @@ void MultiLoadingIndicator::SetTaskManager(TaskManager* task_manager) {
|
||||
}
|
||||
|
||||
void MultiLoadingIndicator::UpdateText() {
|
||||
QList<TaskManager::Task> tasks = task_manager_->GetTasks();
|
||||
QList<TaskManager_Task> tasks = task_manager_->GetTasks();
|
||||
|
||||
QStringList strings;
|
||||
foreach (const TaskManager::Task& task, tasks) {
|
||||
foreach (const TaskManager_Task& task, tasks) {
|
||||
QString task_text(task.name);
|
||||
task_text[0] = task_text[0].toLower();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user