[vlc-commits] Qt4: rationalize QVLCVariable and add missing classes

Rémi Denis-Courmont git at videolan.org
Tue Apr 17 18:42:57 CEST 2012


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Apr 17 19:26:52 2012 +0300| [02746c1c1330bb31903a6b7759d4ba3b631fae41] | committer: Rémi Denis-Courmont

Qt4: rationalize QVLCVariable and add missing classes

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=02746c1c1330bb31903a6b7759d4ba3b631fae41
---

 modules/gui/qt4/dialogs/external.cpp |   24 ++++++++--------
 modules/gui/qt4/dialogs/external.hpp |    8 ++--
 modules/gui/qt4/variables.cpp        |   43 +++++++++++++++++++++++----
 modules/gui/qt4/variables.hpp        |   52 ++++++++++++++++++++++++++++-----
 4 files changed, 96 insertions(+), 31 deletions(-)

diff --git a/modules/gui/qt4/dialogs/external.cpp b/modules/gui/qt4/dialogs/external.cpp
index 5765b11..5aef585 100644
--- a/modules/gui/qt4/dialogs/external.cpp
+++ b/modules/gui/qt4/dialogs/external.cpp
@@ -50,17 +50,17 @@ DialogHandler::DialogHandler (intf_thread_t *p_intf, QObject *_parent)
     connect (this, SIGNAL(error(const QString &, const QString &)),
              SLOT(displayError(const QString &, const QString &)));
 
-    connect (&critical, SIGNAL(pointerChanged(vlc_object_t *, void *)),
-             SLOT(displayCritical(vlc_object_t *, void *)),
+    connect (&critical, SIGNAL(pointerChanged(void *)),
+             SLOT(displayCritical(void *)),
              Qt::BlockingQueuedConnection);
-    connect (&login, SIGNAL(pointerChanged(vlc_object_t *, void *)),
-             SLOT(requestLogin(vlc_object_t *, void *)),
+    connect (&login, SIGNAL(pointerChanged(void *)),
+             SLOT(requestLogin(void *)),
              Qt::BlockingQueuedConnection);
-    connect (&question, SIGNAL(pointerChanged(vlc_object_t *, void *)),
-             SLOT(requestAnswer(vlc_object_t *, void *)),
+    connect (&question, SIGNAL(pointerChanged(void *)),
+             SLOT(requestAnswer(void *)),
              Qt::BlockingQueuedConnection);
-    connect (&progressBar, SIGNAL(pointerChanged(vlc_object_t *, void *)),
-             SLOT(startProgressBar(vlc_object_t *, void *)),
+    connect (&progressBar, SIGNAL(pointerChanged(void *)),
+             SLOT(startProgressBar(void *)),
              Qt::BlockingQueuedConnection);
     connect (this,
              SIGNAL(progressBarDestroyed(QWidget *)),
@@ -93,7 +93,7 @@ void DialogHandler::displayError (const QString& title, const QString& message)
     ErrorsDialog::getInstance (intf)->addError(title, message);
 }
 
-void DialogHandler::displayCritical (vlc_object_t *, void *value)
+void DialogHandler::displayCritical (void *value)
 {
     const dialog_fatal_t *dialog = (const dialog_fatal_t *)value;
 
@@ -101,7 +101,7 @@ void DialogHandler::displayCritical (vlc_object_t *, void *value)
                            QMessageBox::Ok);
 }
 
-void DialogHandler::requestLogin (vlc_object_t *, void *value)
+void DialogHandler::requestLogin (void *value)
 {
     dialog_login_t *data = (dialog_login_t *)value;
     QDialog *dialog = new QDialog;
@@ -153,7 +153,7 @@ void DialogHandler::requestLogin (vlc_object_t *, void *value)
     delete dialog;
 }
 
-void DialogHandler::requestAnswer (vlc_object_t *, void *value)
+void DialogHandler::requestAnswer (void *value)
 {
     dialog_question_t *data = (dialog_question_t *)value;
 
@@ -245,7 +245,7 @@ void QVLCProgressDialog::saveCancel (void)
     cancelled = true;
 }
 
-void DialogHandler::startProgressBar (vlc_object_t *, void *value)
+void DialogHandler::startProgressBar (void *value)
 {
     dialog_progress_bar_t *data = (dialog_progress_bar_t *)value;
     QWidget *dlg = new QVLCProgressDialog (this, data);
diff --git a/modules/gui/qt4/dialogs/external.hpp b/modules/gui/qt4/dialogs/external.hpp
index f0470d9..e2dfd1e 100644
--- a/modules/gui/qt4/dialogs/external.hpp
+++ b/modules/gui/qt4/dialogs/external.hpp
@@ -56,10 +56,10 @@ signals:
 
 private slots:
     void displayError (const QString&, const QString&);
-    void displayCritical (vlc_object_t *, void *);
-    void requestLogin (vlc_object_t *, void *);
-    void requestAnswer (vlc_object_t *, void *);
-    void startProgressBar (vlc_object_t *, void *);
+    void displayCritical (void *);
+    void requestLogin (void *);
+    void requestAnswer (void *);
+    void startProgressBar (void *);
     void stopProgressBar (QWidget *);
 };
 
diff --git a/modules/gui/qt4/variables.cpp b/modules/gui/qt4/variables.cpp
index 1200f19..23aef37 100644
--- a/modules/gui/qt4/variables.cpp
+++ b/modules/gui/qt4/variables.cpp
@@ -52,7 +52,7 @@ int QVLCVariable::callback (vlc_object_t *object, const char *,
 
     QVLCVariable *self = static_cast<QVLCVariable *>(data);
 
-    self->trigger (self->object, old, cur);
+    self->trigger (old, cur);
     return VLC_SUCCESS;
 }
 
@@ -62,10 +62,9 @@ QVLCPointer::QVLCPointer (vlc_object_t *obj, const char *varname, bool inherit)
 {
 }
 
-void QVLCPointer::trigger (vlc_object_t *obj, vlc_value_t old, vlc_value_t cur)
+void QVLCPointer::trigger (vlc_value_t, vlc_value_t cur)
 {
-    emit pointerChanged (obj, old.p_address, cur.p_address);
-    emit pointerChanged (obj, cur.p_address);
+    emit pointerChanged (cur.p_address);
 }
 
 
@@ -74,8 +73,38 @@ QVLCInteger::QVLCInteger (vlc_object_t *obj, const char *varname, bool inherit)
 {
 }
 
-void QVLCInteger::trigger (vlc_object_t *obj, vlc_value_t old, vlc_value_t cur)
+void QVLCInteger::trigger (vlc_value_t, vlc_value_t cur)
 {
-    emit integerChanged (obj, old.i_int, cur.i_int);
-    emit integerChanged (obj, cur.i_int);
+    emit integerChanged (cur.i_int);
+}
+
+QVLCBool::QVLCBool (vlc_object_t *obj, const char *varname, bool inherit)
+    : QVLCVariable (obj, varname, VLC_VAR_BOOL, inherit)
+{
+}
+
+void QVLCBool::trigger (vlc_value_t, vlc_value_t cur)
+{
+    emit boolChanged (cur.b_bool);
+}
+
+QVLCFloat::QVLCFloat (vlc_object_t *obj, const char *varname, bool inherit)
+    : QVLCVariable (obj, varname, VLC_VAR_FLOAT, inherit)
+{
+}
+
+void QVLCFloat::trigger (vlc_value_t, vlc_value_t cur)
+{
+    emit floatChanged (cur.f_float);
+}
+
+QVLCString::QVLCString (vlc_object_t *obj, const char *varname, bool inherit)
+    : QVLCVariable (obj, varname, VLC_VAR_STRING, inherit)
+{
+}
+
+void QVLCString::trigger (vlc_value_t, vlc_value_t cur)
+{
+    QString str = qfu(cur.psz_string);
+    emit stringChanged (str);
 }
diff --git a/modules/gui/qt4/variables.hpp b/modules/gui/qt4/variables.hpp
index 99c9859..84f05b1 100644
--- a/modules/gui/qt4/variables.hpp
+++ b/modules/gui/qt4/variables.hpp
@@ -36,39 +36,75 @@ private:
                          vlc_value_t, vlc_value_t, void *);
     vlc_object_t *object;
     QString name;
-    virtual void trigger (vlc_object_t *, vlc_value_t, vlc_value_t) = 0;
+    virtual void trigger (vlc_value_t, vlc_value_t) = 0;
 
 public:
     QVLCVariable (vlc_object_t *, const char *, int, bool);
-    virtual ~QVLCVariable (void);
+    ~QVLCVariable (void);
 };
 
 class QVLCPointer : public QVLCVariable
 {
     Q_OBJECT
 private:
-    virtual void trigger (vlc_object_t *, vlc_value_t, vlc_value_t);
+    virtual void trigger (vlc_value_t, vlc_value_t);
 
 public:
     QVLCPointer (vlc_object_t *, const char *, bool inherit = false);
 
 signals:
-    void pointerChanged (vlc_object_t *, void *, void *);
-    void pointerChanged (vlc_object_t *, void *);
+    void pointerChanged (void *);
 };
 
 class QVLCInteger : public QVLCVariable
 {
     Q_OBJECT
 private:
-    virtual void trigger (vlc_object_t *, vlc_value_t, vlc_value_t);
+    virtual void trigger (vlc_value_t, vlc_value_t);
 
 public:
     QVLCInteger (vlc_object_t *, const char *, bool inherit = false);
 
 signals:
-    void integerChanged (vlc_object_t *, int, int);
-    void integerChanged (vlc_object_t *, int);
+    void integerChanged (int64_t);
 };
 
+class QVLCBool : public QVLCVariable
+{
+    Q_OBJECT
+private:
+    virtual void trigger (vlc_value_t, vlc_value_t);
+
+public:
+    QVLCBool (vlc_object_t *, const char *, bool inherit = false);
+
+signals:
+    void boolChanged (bool);
+};
+
+class QVLCFloat : public QVLCVariable
+{
+    Q_OBJECT
+private:
+    virtual void trigger (vlc_value_t, vlc_value_t);
+
+public:
+    QVLCFloat (vlc_object_t *, const char *, bool inherit = false);
+
+signals:
+    void floatChanged (float);
+};
+
+class QVLCString : public QVLCVariable
+{
+    Q_OBJECT
+private:
+    virtual void trigger (vlc_value_t, vlc_value_t);
+
+public:
+    QVLCString (vlc_object_t *, const char *, bool inherit = false);
+
+signals:
+    void stringChanged (QString);
+};
 #endif



More information about the vlc-commits mailing list