+
+int DialogHandler::QuestionCallback (vlc_object_t *obj, const char *var,
+ vlc_value_t, vlc_value_t value, void *data)
+{
+ DialogHandler *self = (DialogHandler *)data;
+ dialog_question_t *dialog = (dialog_question_t *)value.p_address;
+
+ emit self->question (dialog);
+ return VLC_SUCCESS;
+}
+
+void DialogHandler::requestAnswer (struct dialog_question_t *data)
+{
+ QMessageBox *box = new QMessageBox (QMessageBox::Question,
+ qfu(data->title), qfu(data->message));
+ QAbstractButton *yes = (data->yes != NULL)
+ ? box->addButton ("&" + qfu(data->yes), QMessageBox::YesRole) : NULL;
+ QAbstractButton *no = (data->no != NULL)
+ ? box->addButton ("&" + qfu(data->no), QMessageBox::NoRole) : NULL;
+ QAbstractButton *cancel = (data->cancel != NULL)
+ ? box->addButton ("&" + qfu(data->cancel), QMessageBox::RejectRole)
+ : NULL;
+
+ box->exec ();
+
+ int answer;
+ if (box->clickedButton () == yes)
+ answer = 1;
+ else
+ if (box->clickedButton () == no)
+ answer = 2;
+ else
+ answer = 3;
+
+ delete box;
+ data->answer = answer;
+}