From: APTX Date: Tue, 4 Aug 2009 22:51:46 +0000 (+0200) Subject: - Make library scriptable. X-Git-Url: https://gitweb.tyo.aptx.org/?a=commitdiff_plain;h=79bd0785ca9edcd124d08f65693fb029673b13ff;p=anidbudpclient.git - Make library scriptable. - Fix UPTIME reply parsing. --- diff --git a/abstractcommand.h b/abstractcommand.h index 630f2bc..91587a3 100644 --- a/abstractcommand.h +++ b/abstractcommand.h @@ -196,4 +196,7 @@ protected: ReplyCode m_replyCode; }; +#include +Q_SCRIPT_DECLARE_QMETAOBJECT(AbstractCommand, QObject*); + #endif // ABSTRACTCOMMAND_H diff --git a/anidbudpclient.h b/anidbudpclient.h index 98ed3e1..f688439 100644 --- a/anidbudpclient.h +++ b/anidbudpclient.h @@ -226,8 +226,6 @@ private: QtState *connectingState; QtState *connectedState; QtState *authenticatingState; - QtState *logoutState; - QtState *loggedOutState; QtState *idleState; QtState *idleTimeoutState; @@ -258,4 +256,7 @@ private slots: void timerTimeout(); }; +#include +Q_SCRIPT_DECLARE_QMETAOBJECT(AniDBUdpClient, QObject*); + #endif // ANIDBUDPCLIENT_H diff --git a/anidbudpclient.pri b/anidbudpclient.pri index 8af8ec6..10bcec5 100644 --- a/anidbudpclient.pri +++ b/anidbudpclient.pri @@ -1,4 +1,4 @@ -QT *= network +QT *= network script INCLUDEPATH += $$PWD DEPENDPATH += $$PWD LIBS += -lanidbudpclient diff --git a/anidbudpclient.pro b/anidbudpclient.pro index e0c60af..8e1b8c1 100644 --- a/anidbudpclient.pro +++ b/anidbudpclient.pro @@ -1,7 +1,7 @@ # ------------------------------------------------- # Project created by QtCreator 2009-03-22T14:53:52 # ------------------------------------------------- -QT += network +QT += network script QT -= gui TEMPLATE = lib TARGET = anidbudpclient diff --git a/mylistcommand.h b/mylistcommand.h index b842d47..67d4ec1 100644 --- a/mylistcommand.h +++ b/mylistcommand.h @@ -111,4 +111,8 @@ private: }; + +#include +Q_SCRIPT_DECLARE_QMETAOBJECT(MyListCommand, QObject*); + #endif // MYLISTCOMMAND_H diff --git a/uptimecommand.cpp b/uptimecommand.cpp index 096aa34..7e2aa73 100644 --- a/uptimecommand.cpp +++ b/uptimecommand.cpp @@ -25,7 +25,7 @@ void UptimeCommand::setRawReply(ReplyCode replyCode, const QString &reply, AniDB { case UPTIME: { - QString uptimeText = reply.mid(reply.indexOf(' ')); + QString uptimeText = reply.mid(reply.indexOf('\n')); bool ok = false; m_uptime = uptimeText.toInt(&ok, 10); if (!ok) diff --git a/uptimecommand.h b/uptimecommand.h index 98fbd2b..6b1f07b 100644 --- a/uptimecommand.h +++ b/uptimecommand.h @@ -20,4 +20,7 @@ private: int m_uptime; }; +#include +Q_SCRIPT_DECLARE_QMETAOBJECT(UptimeCommand, QObject*); + #endif // UPTIMECOMMAND_H