Commit 02746c1c authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Qt4: rationalize QVLCVariable and add missing classes

parent bc2987f3
...@@ -50,17 +50,17 @@ DialogHandler::DialogHandler (intf_thread_t *p_intf, QObject *_parent) ...@@ -50,17 +50,17 @@ DialogHandler::DialogHandler (intf_thread_t *p_intf, QObject *_parent)
connect (this, SIGNAL(error(const QString &, const QString &)), connect (this, SIGNAL(error(const QString &, const QString &)),
SLOT(displayError(const QString &, const QString &))); SLOT(displayError(const QString &, const QString &)));
connect (&critical, SIGNAL(pointerChanged(vlc_object_t *, void *)), connect (&critical, SIGNAL(pointerChanged(void *)),
SLOT(displayCritical(vlc_object_t *, void *)), SLOT(displayCritical(void *)),
Qt::BlockingQueuedConnection); Qt::BlockingQueuedConnection);
connect (&login, SIGNAL(pointerChanged(vlc_object_t *, void *)), connect (&login, SIGNAL(pointerChanged(void *)),
SLOT(requestLogin(vlc_object_t *, void *)), SLOT(requestLogin(void *)),
Qt::BlockingQueuedConnection); Qt::BlockingQueuedConnection);
connect (&question, SIGNAL(pointerChanged(vlc_object_t *, void *)), connect (&question, SIGNAL(pointerChanged(void *)),
SLOT(requestAnswer(vlc_object_t *, void *)), SLOT(requestAnswer(void *)),
Qt::BlockingQueuedConnection); Qt::BlockingQueuedConnection);
connect (&progressBar, SIGNAL(pointerChanged(vlc_object_t *, void *)), connect (&progressBar, SIGNAL(pointerChanged(void *)),
SLOT(startProgressBar(vlc_object_t *, void *)), SLOT(startProgressBar(void *)),
Qt::BlockingQueuedConnection); Qt::BlockingQueuedConnection);
connect (this, connect (this,
SIGNAL(progressBarDestroyed(QWidget *)), SIGNAL(progressBarDestroyed(QWidget *)),
...@@ -93,7 +93,7 @@ void DialogHandler::displayError (const QString& title, const QString& message) ...@@ -93,7 +93,7 @@ void DialogHandler::displayError (const QString& title, const QString& message)
ErrorsDialog::getInstance (intf)->addError(title, 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; const dialog_fatal_t *dialog = (const dialog_fatal_t *)value;
...@@ -101,7 +101,7 @@ void DialogHandler::displayCritical (vlc_object_t *, void *value) ...@@ -101,7 +101,7 @@ void DialogHandler::displayCritical (vlc_object_t *, void *value)
QMessageBox::Ok); QMessageBox::Ok);
} }
void DialogHandler::requestLogin (vlc_object_t *, void *value) void DialogHandler::requestLogin (void *value)
{ {
dialog_login_t *data = (dialog_login_t *)value; dialog_login_t *data = (dialog_login_t *)value;
QDialog *dialog = new QDialog; QDialog *dialog = new QDialog;
...@@ -153,7 +153,7 @@ void DialogHandler::requestLogin (vlc_object_t *, void *value) ...@@ -153,7 +153,7 @@ void DialogHandler::requestLogin (vlc_object_t *, void *value)
delete dialog; delete dialog;
} }
void DialogHandler::requestAnswer (vlc_object_t *, void *value) void DialogHandler::requestAnswer (void *value)
{ {
dialog_question_t *data = (dialog_question_t *)value; dialog_question_t *data = (dialog_question_t *)value;
...@@ -245,7 +245,7 @@ void QVLCProgressDialog::saveCancel (void) ...@@ -245,7 +245,7 @@ void QVLCProgressDialog::saveCancel (void)
cancelled = true; 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; dialog_progress_bar_t *data = (dialog_progress_bar_t *)value;
QWidget *dlg = new QVLCProgressDialog (this, data); QWidget *dlg = new QVLCProgressDialog (this, data);
......
...@@ -56,10 +56,10 @@ signals: ...@@ -56,10 +56,10 @@ signals:
private slots: private slots:
void displayError (const QString&, const QString&); void displayError (const QString&, const QString&);
void displayCritical (vlc_object_t *, void *); void displayCritical (void *);
void requestLogin (vlc_object_t *, void *); void requestLogin (void *);
void requestAnswer (vlc_object_t *, void *); void requestAnswer (void *);
void startProgressBar (vlc_object_t *, void *); void startProgressBar (void *);
void stopProgressBar (QWidget *); void stopProgressBar (QWidget *);
}; };
......
...@@ -52,7 +52,7 @@ int QVLCVariable::callback (vlc_object_t *object, const char *, ...@@ -52,7 +52,7 @@ int QVLCVariable::callback (vlc_object_t *object, const char *,
QVLCVariable *self = static_cast<QVLCVariable *>(data); QVLCVariable *self = static_cast<QVLCVariable *>(data);
self->trigger (self->object, old, cur); self->trigger (old, cur);
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -62,10 +62,9 @@ QVLCPointer::QVLCPointer (vlc_object_t *obj, const char *varname, bool inherit) ...@@ -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 (cur.p_address);
emit pointerChanged (obj, cur.p_address);
} }
...@@ -74,8 +73,38 @@ QVLCInteger::QVLCInteger (vlc_object_t *obj, const char *varname, bool inherit) ...@@ -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 (cur.i_int);
emit integerChanged (obj, 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);
} }
...@@ -36,39 +36,75 @@ private: ...@@ -36,39 +36,75 @@ private:
vlc_value_t, vlc_value_t, void *); vlc_value_t, vlc_value_t, void *);
vlc_object_t *object; vlc_object_t *object;
QString name; 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: public:
QVLCVariable (vlc_object_t *, const char *, int, bool); QVLCVariable (vlc_object_t *, const char *, int, bool);
virtual ~QVLCVariable (void); ~QVLCVariable (void);
}; };
class QVLCPointer : public QVLCVariable class QVLCPointer : public QVLCVariable
{ {
Q_OBJECT Q_OBJECT
private: private:
virtual void trigger (vlc_object_t *, vlc_value_t, vlc_value_t); virtual void trigger (vlc_value_t, vlc_value_t);
public: public:
QVLCPointer (vlc_object_t *, const char *, bool inherit = false); QVLCPointer (vlc_object_t *, const char *, bool inherit = false);
signals: signals:
void pointerChanged (vlc_object_t *, void *, void *); void pointerChanged (void *);
void pointerChanged (vlc_object_t *, void *);
}; };
class QVLCInteger : public QVLCVariable class QVLCInteger : public QVLCVariable
{ {
Q_OBJECT Q_OBJECT
private: private:
virtual void trigger (vlc_object_t *, vlc_value_t, vlc_value_t); virtual void trigger (vlc_value_t, vlc_value_t);
public: public:
QVLCInteger (vlc_object_t *, const char *, bool inherit = false); QVLCInteger (vlc_object_t *, const char *, bool inherit = false);
signals: signals:
void integerChanged (vlc_object_t *, int, int); void integerChanged (int64_t);
void integerChanged (vlc_object_t *, int);
}; };
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 #endif
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