Commit 94379150 authored by Thomas Guillem's avatar Thomas Guillem

Qt: implement new dialog callbacks

parent c50d31d8
This diff is collapsed.
...@@ -26,65 +26,132 @@ ...@@ -26,65 +26,132 @@
#endif #endif
#include <QObject> #include <QObject>
#include <QDialog>
#include <QMap>
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_dialog.h>
#include "adapters/variables.hpp" #include "adapters/variables.hpp"
struct intf_thread_t; struct intf_thread_t;
class QProgressDialog; class QProgressDialog;
class DialogWrapper;
class DialogHandler : public QObject class DialogHandler : public QObject
{ {
Q_OBJECT Q_OBJECT
friend class QVLCProgressDialog;
public: public:
DialogHandler (intf_thread_t *, QObject *parent); DialogHandler (intf_thread_t *, QObject *parent);
virtual ~DialogHandler (void); virtual ~DialogHandler();
void removeDialogId(vlc_dialog_id *p_id);
private:
intf_thread_t *p_intf;
static int error (vlc_object_t *, const char *, vlc_value_t, vlc_value_t,
void *);
QVLCPointer critical;
QVLCPointer login;
QVLCPointer question;
QVLCPointer progressBar;
signals: signals:
void error (const QString&, const QString&); void errorDisplayed(const QString &title, const QString &text);
void loginDisplayed(vlc_dialog_id *p_id, const QString &title,
const QString &text, const QString &defaultUsername,
bool b_ask_store);
void questionDisplayed(vlc_dialog_id *p_id, const QString &title,
const QString &text, int i_type,
const QString &cancel, const QString &action1,
const QString &action2);
void progressDisplayed(vlc_dialog_id *p_id, const QString &title,
const QString &text, bool b_indeterminate,
float f_position, const QString &cancel);
void cancelled(vlc_dialog_id *p_id);
void progressUpdated(vlc_dialog_id *p_id, float f_value, const QString &text);
private slots: private slots:
void displayError (const QString&, const QString&); void displayError(const QString &title, const QString &text);
void displayCritical (void *); void displayLogin(vlc_dialog_id *p_id, const QString &title,
void requestLogin (void *); const QString &text, const QString &defaultUsername,
void requestAnswer (void *); bool b_ask_store);
void startProgressBar (void *); void displayQuestion(vlc_dialog_id *p_id, const QString &title,
void stopProgressBar (QWidget *); const QString &text, int i_type,
const QString &cancel, const QString &action1,
const QString &action2);
void displayProgress(vlc_dialog_id *p_id, const QString &title,
const QString &text, bool b_indeterminate,
float f_position, const QString &cancel);
void cancel(vlc_dialog_id *p_id);
void updateProgress(vlc_dialog_id *p_id, float f_value, const QString &text);
private:
intf_thread_t *p_intf;
static void displayErrorCb(const char *, const char *, void *);
static void displayLoginCb(vlc_dialog_id *, const char *, const char *,
const char *, bool, void *);
static void displayQuestionCb(vlc_dialog_id *, const char *, const char *,
vlc_dialog_question_type, const char *,
const char *, const char *, void *);
static void displayProgressCb(vlc_dialog_id *, const char *, const char *,
bool, float, const char *, void *);
static void cancelCb(vlc_dialog_id *, void *);
static void updateProgressCb(vlc_dialog_id *, float, const char *, void *);
}; };
/* Put here instead of .cpp because of MOC */ class DialogWrapper : public QObject
#include <QProgressDialog> {
Q_OBJECT
friend class DialogHandler;
public:
DialogWrapper(DialogHandler *p_handler, intf_thread_t *p_intf,
vlc_dialog_id *p_id, QDialog *p_dialog);
virtual ~DialogWrapper();
protected slots:
virtual void finish(int result = QDialog::Rejected);
protected:
DialogHandler *p_handler;
intf_thread_t *p_intf;
vlc_dialog_id *p_id;
QDialog *p_dialog;
};
class QVLCProgressDialog : public QProgressDialog class QLineEdit;
class QCheckBox;
class LoginDialogWrapper : public DialogWrapper
{ {
Q_OBJECT Q_OBJECT
public: public:
QVLCProgressDialog (DialogHandler *parent, LoginDialogWrapper(DialogHandler *p_handler, intf_thread_t *p_intf,
struct dialog_progress_bar_t *); vlc_dialog_id *p_id, QDialog *p_dialog,
QLineEdit *userLine, QLineEdit *passLine,
QCheckBox *checkbox);
private slots:
virtual void accept();
private: private:
DialogHandler *handler; QLineEdit *userLine;
bool cancelled; QLineEdit *passLine;
QCheckBox *checkbox;
};
static void update (void *, const char *, float); class QAbstractButton;
static bool check (void *); class QMessageBox;
static void destroy (void *); class QuestionDialogWrapper : public DialogWrapper
{
Q_OBJECT
public:
QuestionDialogWrapper(DialogHandler *p_handler, intf_thread_t *p_intf,
vlc_dialog_id *p_id, QMessageBox *p_box,
QAbstractButton *action1, QAbstractButton *action2);
private slots: private slots:
void saveCancel (void); virtual void buttonClicked(QAbstractButton *);
private:
QAbstractButton *action1;
QAbstractButton *action2;
};
signals: class ProgressDialogWrapper : public DialogWrapper
void progressed (int); {
void described (const QString&); Q_OBJECT
void released (void); public:
ProgressDialogWrapper(DialogHandler *p_handler, intf_thread_t *p_intf,
vlc_dialog_id *p_id, QProgressDialog *p_progress,
bool b_indeterminate);
void updateProgress(float f_position, const QString &text);
private:
bool b_indeterminate;
}; };
#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