1
0
mirror of https://github.com/clementine-player/Clementine synced 2024-12-16 11:19:18 +01:00

Handle conversions of SongLists properly between python and Qt

This commit is contained in:
David Sansome 2011-05-21 10:43:08 +00:00
parent ef1358e5aa
commit a18146bf8a

View File

@ -16,6 +16,7 @@
*/
#include <Python.h>
#include <PythonQtConversion.h>
#include <com_trolltech_qt_core/com_trolltech_qt_core_init.h>
#include <com_trolltech_qt_gui/com_trolltech_qt_gui_init.h>
#include <com_trolltech_qt_network/com_trolltech_qt_network_init.h>
@ -25,6 +26,7 @@
#include "pythonengine.h"
#include "pythonscript.h"
#include "core/logging.h"
#include "core/song.h"
#include "core/player.h"
#include "core/taskmanager.h"
#include "covers/coverproviders.h"
@ -86,6 +88,20 @@ bool PythonEngine::EnsureInitialised() {
python_qt->installDefaultImporter();
python_qt->addDecorators(new ObjectDecorators);
PythonQtConv::registerMetaTypeToPythonConverter(qMetaTypeId<SongList>(),
PythonQtConvertListOfValueTypeToPythonList<SongList, Song>);
PythonQtConv::registerMetaTypeToPythonConverter(QMetaType::type("QList<Song>"),
PythonQtConvertListOfValueTypeToPythonList<SongList, Song>);
PythonQtConv::registerMetaTypeToPythonConverter(qMetaTypeId<DirectoryList>(),
PythonQtConvertListOfValueTypeToPythonList<DirectoryList, Directory>);
PythonQtConv::registerPythonToMetaTypeConverter(qMetaTypeId<SongList>(),
PythonQtConvertPythonListToListOfValueType<SongList, Song>);
PythonQtConv::registerPythonToMetaTypeConverter(QMetaType::type("QList<Song>"),
PythonQtConvertPythonListToListOfValueType<SongList, Song>);
PythonQtConv::registerPythonToMetaTypeConverter(qMetaTypeId<DirectoryList>(),
PythonQtConvertPythonListToListOfValueType<DirectoryList, Directory>);
connect(python_qt, SIGNAL(pythonStdOut(QString)), SLOT(PythonStdOut(QString)));
connect(python_qt, SIGNAL(pythonStdErr(QString)), SLOT(PythonStdErr(QString)));