[vlc-devel] commit: Qt4: adapt to error changes ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sat Jul 4 23:59:43 CEST 2009
vlc | branch: 1.0-bugfix | Rémi Denis-Courmont <remi at remlab.net> | Sun Jul 5 00:52:22 2009 +0300| [851009127b881ca078e4aa2d9bd001dd8978161e] | committer: Rémi Denis-Courmont
Qt4: adapt to error changes
This gets rid of the blocking queued connection for non-modal errors,
which was causing deadlocks in the audio output
Pointed-out-by: Laurent Aimar
(cherry picked from commit c545ce84a4843cc0ae6418e3a517d24865d71c1a)
Conflicts:
modules/gui/qt4/dialogs/external.cpp
modules/gui/qt4/dialogs/external.hpp
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=851009127b881ca078e4aa2d9bd001dd8978161e
---
modules/gui/qt4/dialogs/external.cpp | 45 ++++++++++++++++++++++++----------
modules/gui/qt4/dialogs/external.hpp | 8 ++++-
2 files changed, 38 insertions(+), 15 deletions(-)
diff --git a/modules/gui/qt4/dialogs/external.cpp b/modules/gui/qt4/dialogs/external.cpp
index ee090b0..692a2a3 100644
--- a/modules/gui/qt4/dialogs/external.cpp
+++ b/modules/gui/qt4/dialogs/external.cpp
@@ -61,13 +61,18 @@ int QVLCVariable::callback (vlc_object_t *object, const char *,
DialogHandler::DialogHandler (intf_thread_t *intf, QObject *_parent)
: intf (intf), QObject( _parent ),
- message (VLC_OBJECT(intf), "dialog-fatal", VLC_VAR_ADDRESS),
+ critical (VLC_OBJECT(intf), "dialog-critical", VLC_VAR_ADDRESS),
login (VLC_OBJECT(intf), "dialog-login", VLC_VAR_ADDRESS),
question (VLC_OBJECT(intf), "dialog-question", VLC_VAR_ADDRESS),
progressBar (VLC_OBJECT(intf), "dialog-progress-bar", VLC_VAR_ADDRESS)
{
- connect (&message, SIGNAL(pointerChanged(vlc_object_t *, void *)),
- SLOT(displayMessage(vlc_object_t *, void *)),
+ var_Create (intf, "dialog-error", VLC_VAR_ADDRESS);
+ var_AddCallback (intf, "dialog-error", error, this);
+ 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 *)),
Qt::BlockingQueuedConnection);
connect (&login, SIGNAL(pointerChanged(vlc_object_t *, void *)),
SLOT(requestLogin(vlc_object_t *, void *)),
@@ -88,19 +93,33 @@ DialogHandler::DialogHandler (intf_thread_t *intf, QObject *_parent)
DialogHandler::~DialogHandler (void)
{
dialog_Unregister (intf);
+
+ var_DelCallback (intf, "dialog-error", error, this);
+ var_Destroy (intf, "dialog-error");
}
-void DialogHandler::displayMessage (vlc_object_t *, void *value)
+int DialogHandler::error (vlc_object_t *obj, const char *,
+ vlc_value_t, vlc_value_t value, void *data)
{
- const dialog_fatal_t *dialog = (const dialog_fatal_t *)value;
+ const dialog_fatal_t *dialog = (const dialog_fatal_t *)value.p_address;
+ DialogHandler *self = static_cast<DialogHandler *>(data);
- if (dialog->modal)
- QMessageBox::critical (NULL, qfu(dialog->title), qfu(dialog->message),
- QMessageBox::Ok);
- else
- if (config_GetInt (intf, "qt-error-dialogs"))
- ErrorsDialog::getInstance (intf)->addError(qfu(dialog->title),
- qfu(dialog->message));
+ if (config_GetInt (obj, "qt-error-dialogs"))
+ emit self->error (qfu(dialog->title), qfu(dialog->message));
+ return VLC_SUCCESS;
+}
+
+void DialogHandler::displayError (const QString& title, const QString& message)
+{
+ ErrorsDialog::getInstance (intf)->addError(title, message);
+}
+
+void DialogHandler::displayCritical (vlc_object_t *, void *value)
+{
+ const dialog_fatal_t *dialog = (const dialog_fatal_t *)value;
+
+ QMessageBox::critical (NULL, qfu(dialog->title), qfu(dialog->message),
+ QMessageBox::Ok);
}
void DialogHandler::requestLogin (vlc_object_t *, void *value)
diff --git a/modules/gui/qt4/dialogs/external.hpp b/modules/gui/qt4/dialogs/external.hpp
index 526a280..74521b3 100644
--- a/modules/gui/qt4/dialogs/external.hpp
+++ b/modules/gui/qt4/dialogs/external.hpp
@@ -56,15 +56,19 @@ public:
private:
intf_thread_t *intf;
- QVLCVariable message;
+ static int error (vlc_object_t *, const char *, vlc_value_t, vlc_value_t,
+ void *);
+ QVLCVariable critical;
QVLCVariable login;
QVLCVariable question;
QVLCVariable progressBar;
signals:
void progressBarDestroyed (QWidget *);
+ void error (const QString&, const QString&);
private slots:
- void displayMessage (vlc_object_t *, void *);
+ 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 *);
More information about the vlc-devel
mailing list