#include "directoryscantask.h"
#include "mylist.h"
+#include "settings.h"
#include "addfiletask.h"
#include <QDebug>
#include "localmylist_global.h"
#include "database.h"
-#include "settings.h"
#include <QObject>
#include <QSet>
namespace LocalMyList {
+class Settings;
class AbstractTask;
class WorkThread;
class RequestHandler;
class LOCALMYLISTSHARED_EXPORT MyList : public QObject {
Q_OBJECT
- Q_PROPERTY(Database *database READ database)
+ Q_PROPERTY(LocalMyList::Database *database READ database)
+ Q_PROPERTY(LocalMyList::Settings *settings READ settings)
Q_PROPERTY(QString hostName READ hostName WRITE setHostName)
Q_PROPERTY(int hostId READ hostId)
Q_PROPERTY(bool isUdpHost READ isUdpHost)
MyList();
~MyList();
- Database *database() const;
- Settings *settings() const;
+ LocalMyList::Database *database() const;
+ LocalMyList::Settings *settings() const;
QString hostName() const;
void setHostName(QString name);
} // namespace LocalMyList
+Q_DECLARE_METATYPE(LocalMyList::MyList*)
+
#endif // LOCALMYLIST_H
#include "mylist.h"
#include "database.h"
+#include "settings.h"
#include <AniDBUdpClient/Client>
#include <AniDBUdpClient/AnimeCommand>
#include "scriptable.h"
+#include "mylist.h"
#include "database.h"
+#include "settings.h"
namespace LocalMyList {
void registerTypes(QScriptEngine *engine)
{
+ qScriptRegisterMetaType<MyList*>(engine, Scriptable::toScriptValue<MyList*>, Scriptable::fromScriptValue<MyList*>);
+ qScriptRegisterMetaType<Database*>(engine, Scriptable::toScriptValue<Database*>, Scriptable::fromScriptValue<Database*>);
+ qScriptRegisterMetaType<Settings*>(engine, Scriptable::toScriptValue<Settings*>, Scriptable::fromScriptValue<Settings*>);
+
Scriptable::Anime *AnimePrototype = new Scriptable::Anime();
engine->setDefaultPrototype(qMetaTypeId<Anime>(), engine->newQObject(AnimePrototype));
engine->setDefaultPrototype(qMetaTypeId<Anime*>(), engine->newQObject(AnimePrototype));
void LOCALMYLISTSHARED_EXPORT registerTypes(QScriptEngine *engine);
namespace Scriptable {
+
+template<typename T> QScriptValue toScriptValue(QScriptEngine *engine, const T &t)
+{
+ return engine->newQObject(t);
+}
+
+template<typename T> void fromScriptValue(const QScriptValue &value, T &t)
+{
+ t = qobject_cast<T>(value.toQObject());
+}
+
/*
struct LOCALMYLISTSHARED_EXPORT AnimeTitle
{
} // namespace LocalMyList
+Q_DECLARE_METATYPE(LocalMyList::Settings*)
+
#endif // SETTINGS_H
#include "mylist.h"
#include "database.h"
+#include "settings.h"
#include "mylistmodel.h"
#include "unknownfilelookuptask.h"
#include "addrelatedepisodestask.h"