Convert CoverSearchResult lists correctly
This commit is contained in:
parent
2dbf6a4871
commit
fc97e4bb8c
|
@ -191,6 +191,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
qRegisterMetaType<CoverSearchResult>("CoverSearchResult");
|
qRegisterMetaType<CoverSearchResult>("CoverSearchResult");
|
||||||
qRegisterMetaType<CoverSearchResults>("CoverSearchResults");
|
qRegisterMetaType<CoverSearchResults>("CoverSearchResults");
|
||||||
|
qRegisterMetaType<QList<CoverSearchResult> >("QList<CoverSearchResult>");
|
||||||
qRegisterMetaType<Directory>("Directory");
|
qRegisterMetaType<Directory>("Directory");
|
||||||
qRegisterMetaType<DirectoryList>("DirectoryList");
|
qRegisterMetaType<DirectoryList>("DirectoryList");
|
||||||
qRegisterMetaType<Subdirectory>("Subdirectory");
|
qRegisterMetaType<Subdirectory>("Subdirectory");
|
||||||
|
|
|
@ -72,6 +72,20 @@ PythonEngine::~PythonEngine() {
|
||||||
PythonQt::cleanup();
|
PythonQt::cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
static void RegisterListConverter(const char* other_class_name) {
|
||||||
|
typedef QList<T> L;
|
||||||
|
PythonQtConv::registerMetaTypeToPythonConverter(qMetaTypeId<L>(),
|
||||||
|
PythonQtConvertListOfValueTypeToPythonList<L, T>);
|
||||||
|
PythonQtConv::registerMetaTypeToPythonConverter(QMetaType::type(other_class_name),
|
||||||
|
PythonQtConvertListOfValueTypeToPythonList<L, T>);
|
||||||
|
|
||||||
|
PythonQtConv::registerPythonToMetaTypeConverter(qMetaTypeId<L>(),
|
||||||
|
PythonQtConvertPythonListToListOfValueType<L, T>);
|
||||||
|
PythonQtConv::registerPythonToMetaTypeConverter(QMetaType::type(other_class_name),
|
||||||
|
PythonQtConvertPythonListToListOfValueType<L, T>);
|
||||||
|
}
|
||||||
|
|
||||||
bool PythonEngine::EnsureInitialised() {
|
bool PythonEngine::EnsureInitialised() {
|
||||||
if (initialised_)
|
if (initialised_)
|
||||||
return true;
|
return true;
|
||||||
|
@ -92,23 +106,9 @@ bool PythonEngine::EnsureInitialised() {
|
||||||
python_qt->addDecorators(new ObjectDecorators);
|
python_qt->addDecorators(new ObjectDecorators);
|
||||||
|
|
||||||
// Register converters for list types
|
// Register converters for list types
|
||||||
PythonQtConv::registerMetaTypeToPythonConverter(qMetaTypeId<SongList>(),
|
RegisterListConverter<Song>("QList<Song>");
|
||||||
PythonQtConvertListOfValueTypeToPythonList<SongList, Song>);
|
RegisterListConverter<Directory>("QList<Directory>");
|
||||||
PythonQtConv::registerMetaTypeToPythonConverter(QMetaType::type("QList<Song>"),
|
RegisterListConverter<CoverSearchResult>("QList<CoverSearchResult>");
|
||||||
PythonQtConvertListOfValueTypeToPythonList<SongList, Song>);
|
|
||||||
PythonQtConv::registerMetaTypeToPythonConverter(qMetaTypeId<DirectoryList>(),
|
|
||||||
PythonQtConvertListOfValueTypeToPythonList<DirectoryList, Directory>);
|
|
||||||
PythonQtConv::registerMetaTypeToPythonConverter(qMetaTypeId<CoverSearchResults>(),
|
|
||||||
PythonQtConvertListOfValueTypeToPythonList<CoverSearchResults, CoverSearchResult>);
|
|
||||||
|
|
||||||
PythonQtConv::registerPythonToMetaTypeConverter(qMetaTypeId<SongList>(),
|
|
||||||
PythonQtConvertPythonListToListOfValueType<SongList, Song>);
|
|
||||||
PythonQtConv::registerPythonToMetaTypeConverter(QMetaType::type("QList<Song>"),
|
|
||||||
PythonQtConvertPythonListToListOfValueType<SongList, Song>);
|
|
||||||
PythonQtConv::registerPythonToMetaTypeConverter(qMetaTypeId<DirectoryList>(),
|
|
||||||
PythonQtConvertPythonListToListOfValueType<DirectoryList, Directory>);
|
|
||||||
PythonQtConv::registerPythonToMetaTypeConverter(qMetaTypeId<CoverSearchResults>(),
|
|
||||||
PythonQtConvertPythonListToListOfValueType<CoverSearchResults, CoverSearchResult>);
|
|
||||||
|
|
||||||
// Connect stdout, stderr
|
// Connect stdout, stderr
|
||||||
connect(python_qt, SIGNAL(pythonStdOut(QString)), SLOT(PythonStdOut(QString)));
|
connect(python_qt, SIGNAL(pythonStdOut(QString)), SLOT(PythonStdOut(QString)));
|
||||||
|
|
Loading…
Reference in New Issue