Commit 0166bb73 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Qt: add QVLCVariable::addCallback helper

parent 02746c1c
...@@ -67,6 +67,11 @@ void QVLCPointer::trigger (vlc_value_t, vlc_value_t cur) ...@@ -67,6 +67,11 @@ void QVLCPointer::trigger (vlc_value_t, vlc_value_t cur)
emit pointerChanged (cur.p_address); emit pointerChanged (cur.p_address);
} }
bool QVLCPointer::addCallback (QObject *tgt, const char *method,
Qt::ConnectionType type)
{
return tgt->connect (this, SIGNAL(pointerChanged(void *)), method, type);
}
QVLCInteger::QVLCInteger (vlc_object_t *obj, const char *varname, bool inherit) QVLCInteger::QVLCInteger (vlc_object_t *obj, const char *varname, bool inherit)
: QVLCVariable (obj, varname, VLC_VAR_INTEGER, inherit) : QVLCVariable (obj, varname, VLC_VAR_INTEGER, inherit)
...@@ -78,6 +83,12 @@ void QVLCInteger::trigger (vlc_value_t, vlc_value_t cur) ...@@ -78,6 +83,12 @@ void QVLCInteger::trigger (vlc_value_t, vlc_value_t cur)
emit integerChanged (cur.i_int); emit integerChanged (cur.i_int);
} }
bool QVLCInteger::addCallback (QObject *tgt, const char *method,
Qt::ConnectionType type)
{
return tgt->connect (this, SIGNAL(integerChanged(int64_t)), method, type);
}
QVLCBool::QVLCBool (vlc_object_t *obj, const char *varname, bool inherit) QVLCBool::QVLCBool (vlc_object_t *obj, const char *varname, bool inherit)
: QVLCVariable (obj, varname, VLC_VAR_BOOL, inherit) : QVLCVariable (obj, varname, VLC_VAR_BOOL, inherit)
{ {
...@@ -88,6 +99,12 @@ void QVLCBool::trigger (vlc_value_t, vlc_value_t cur) ...@@ -88,6 +99,12 @@ void QVLCBool::trigger (vlc_value_t, vlc_value_t cur)
emit boolChanged (cur.b_bool); emit boolChanged (cur.b_bool);
} }
bool QVLCBool::addCallback (QObject *tgt, const char *method,
Qt::ConnectionType type)
{
return tgt->connect (this, SIGNAL(boolChanged(bool)), method, type);
}
QVLCFloat::QVLCFloat (vlc_object_t *obj, const char *varname, bool inherit) QVLCFloat::QVLCFloat (vlc_object_t *obj, const char *varname, bool inherit)
: QVLCVariable (obj, varname, VLC_VAR_FLOAT, inherit) : QVLCVariable (obj, varname, VLC_VAR_FLOAT, inherit)
{ {
...@@ -98,6 +115,12 @@ void QVLCFloat::trigger (vlc_value_t, vlc_value_t cur) ...@@ -98,6 +115,12 @@ void QVLCFloat::trigger (vlc_value_t, vlc_value_t cur)
emit floatChanged (cur.f_float); emit floatChanged (cur.f_float);
} }
bool QVLCFloat::addCallback (QObject *tgt, const char *method,
Qt::ConnectionType type)
{
return tgt->connect (this, SIGNAL(floatChanged(float)), method, type);
}
QVLCString::QVLCString (vlc_object_t *obj, const char *varname, bool inherit) QVLCString::QVLCString (vlc_object_t *obj, const char *varname, bool inherit)
: QVLCVariable (obj, varname, VLC_VAR_STRING, inherit) : QVLCVariable (obj, varname, VLC_VAR_STRING, inherit)
{ {
...@@ -108,3 +131,9 @@ void QVLCString::trigger (vlc_value_t, vlc_value_t cur) ...@@ -108,3 +131,9 @@ void QVLCString::trigger (vlc_value_t, vlc_value_t cur)
QString str = qfu(cur.psz_string); QString str = qfu(cur.psz_string);
emit stringChanged (str); emit stringChanged (str);
} }
bool QVLCString::addCallback (QObject *tgt, const char *method,
Qt::ConnectionType type)
{
return tgt->connect (this, SIGNAL(stringChanged(QString)), method, type);
}
...@@ -51,6 +51,8 @@ private: ...@@ -51,6 +51,8 @@ private:
public: public:
QVLCPointer (vlc_object_t *, const char *, bool inherit = false); QVLCPointer (vlc_object_t *, const char *, bool inherit = false);
bool addCallback (QObject *, const char *,
Qt::ConnectionType type = Qt::AutoConnection);
signals: signals:
void pointerChanged (void *); void pointerChanged (void *);
...@@ -64,6 +66,8 @@ private: ...@@ -64,6 +66,8 @@ private:
public: public:
QVLCInteger (vlc_object_t *, const char *, bool inherit = false); QVLCInteger (vlc_object_t *, const char *, bool inherit = false);
bool addCallback (QObject *, const char *,
Qt::ConnectionType type = Qt::AutoConnection);
signals: signals:
void integerChanged (int64_t); void integerChanged (int64_t);
...@@ -77,6 +81,8 @@ private: ...@@ -77,6 +81,8 @@ private:
public: public:
QVLCBool (vlc_object_t *, const char *, bool inherit = false); QVLCBool (vlc_object_t *, const char *, bool inherit = false);
bool addCallback (QObject *, const char *,
Qt::ConnectionType type = Qt::AutoConnection);
signals: signals:
void boolChanged (bool); void boolChanged (bool);
...@@ -90,6 +96,8 @@ private: ...@@ -90,6 +96,8 @@ private:
public: public:
QVLCFloat (vlc_object_t *, const char *, bool inherit = false); QVLCFloat (vlc_object_t *, const char *, bool inherit = false);
bool addCallback (QObject *, const char *,
Qt::ConnectionType type = Qt::AutoConnection);
signals: signals:
void floatChanged (float); void floatChanged (float);
...@@ -103,6 +111,8 @@ private: ...@@ -103,6 +111,8 @@ private:
public: public:
QVLCString (vlc_object_t *, const char *, bool inherit = false); QVLCString (vlc_object_t *, const char *, bool inherit = false);
bool addCallback (QObject *, const char *,
Qt::ConnectionType type = Qt::AutoConnection);
signals: signals:
void stringChanged (QString); void stringChanged (QString);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment