Commit c545ce84 authored by Rémi Denis-Courmont's avatar 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
parent afacc88a
...@@ -38,13 +38,18 @@ ...@@ -38,13 +38,18 @@
DialogHandler::DialogHandler (intf_thread_t *intf, QObject *_parent) DialogHandler::DialogHandler (intf_thread_t *intf, QObject *_parent)
: intf (intf), QObject( _parent ), : intf (intf), QObject( _parent ),
message (VLC_OBJECT(intf), "dialog-fatal"), critical (VLC_OBJECT(intf), "dialog-critical"),
login (VLC_OBJECT(intf), "dialog-login"), login (VLC_OBJECT(intf), "dialog-login"),
question (VLC_OBJECT(intf), "dialog-question"), question (VLC_OBJECT(intf), "dialog-question"),
progressBar (VLC_OBJECT(intf), "dialog-progress-bar") progressBar (VLC_OBJECT(intf), "dialog-progress-bar")
{ {
connect (&message, SIGNAL(pointerChanged(vlc_object_t *, void *)), var_Create (intf, "dialog-error", VLC_VAR_ADDRESS);
SLOT(displayMessage(vlc_object_t *, void *)), 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); Qt::BlockingQueuedConnection);
connect (&login, SIGNAL(pointerChanged(vlc_object_t *, void *)), connect (&login, SIGNAL(pointerChanged(vlc_object_t *, void *)),
SLOT(requestLogin(vlc_object_t *, void *)), SLOT(requestLogin(vlc_object_t *, void *)),
...@@ -65,19 +70,33 @@ DialogHandler::DialogHandler (intf_thread_t *intf, QObject *_parent) ...@@ -65,19 +70,33 @@ DialogHandler::DialogHandler (intf_thread_t *intf, QObject *_parent)
DialogHandler::~DialogHandler (void) DialogHandler::~DialogHandler (void)
{ {
dialog_Unregister (intf); 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) if (config_GetInt (obj, "qt-error-dialogs"))
QMessageBox::critical (NULL, qfu(dialog->title), qfu(dialog->message), emit self->error (qfu(dialog->title), qfu(dialog->message));
QMessageBox::Ok); return VLC_SUCCESS;
else }
if (config_GetInt (intf, "qt-error-dialogs"))
ErrorsDialog::getInstance (intf)->addError(qfu(dialog->title), void DialogHandler::displayError (const QString& title, const QString& message)
qfu(dialog->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) void DialogHandler::requestLogin (vlc_object_t *, void *value)
......
...@@ -40,15 +40,19 @@ public: ...@@ -40,15 +40,19 @@ public:
private: private:
intf_thread_t *intf; intf_thread_t *intf;
QVLCPointer message; static int error (vlc_object_t *, const char *, vlc_value_t, vlc_value_t,
void *);
QVLCPointer critical;
QVLCPointer login; QVLCPointer login;
QVLCPointer question; QVLCPointer question;
QVLCPointer progressBar; QVLCPointer progressBar;
signals: signals:
void progressBarDestroyed (QWidget *); void progressBarDestroyed (QWidget *);
void error (const QString&, const QString&);
private slots: 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 requestLogin (vlc_object_t *, void *);
void requestAnswer (vlc_object_t *, void *); void requestAnswer (vlc_object_t *, void *);
void startProgressBar (vlc_object_t *, void *); void startProgressBar (vlc_object_t *, void *);
......
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