]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs/external.hpp
qt4: attempt to work around a design flaw in the toolbar editor
[vlc] / modules / gui / qt4 / dialogs / external.hpp
1 /*****************************************************************************
2  * external.hpp : Dialogs from other LibVLC core and other plugins
3  ****************************************************************************
4  * Copyright (C) 2009 RĂ©mi Denis-Courmont
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
19  *****************************************************************************/
20
21 #ifndef QVLC_DIALOGS_EXTERNAL_H_
22 #define QVLC_DIALOGS_EXTERNAL_H_ 1
23
24 #include <QObject>
25 #include <vlc_common.h>
26 #include "variables.hpp"
27
28 struct intf_thread_t;
29 class QProgressDialog;
30
31 class DialogHandler : public QObject
32 {
33     Q_OBJECT
34
35     friend class QVLCProgressDialog;
36
37 public:
38     DialogHandler (intf_thread_t *, QObject *parent);
39     ~DialogHandler (void);
40
41 private:
42     intf_thread_t *intf;
43     static int error (vlc_object_t *, const char *, vlc_value_t, vlc_value_t,
44                       void *);
45     QVLCPointer critical;
46     QVLCPointer login;
47     QVLCPointer question;
48     QVLCPointer progressBar;
49 signals:
50     void progressBarDestroyed (QWidget *);
51     void error (const QString&, const QString&);
52
53 private slots:
54     void displayError (const QString&, const QString&);
55     void displayCritical (vlc_object_t *, void *);
56     void requestLogin (vlc_object_t *, void *);
57     void requestAnswer (vlc_object_t *, void *);
58     void startProgressBar (vlc_object_t *, void *);
59     void stopProgressBar (QWidget *);
60 };
61
62 /* Put here instead of .cpp because of MOC */
63 #include <QProgressDialog>
64
65 class QVLCProgressDialog : public QProgressDialog
66 {
67     Q_OBJECT
68 public:
69     QVLCProgressDialog (DialogHandler *parent,
70                         struct dialog_progress_bar_t *);
71 private:
72     DialogHandler *handler;
73     bool cancelled;
74
75     static void update (void *, const char *, float);
76     static bool check (void *);
77     static void destroy (void *);
78 private slots:
79     void saveCancel (void);
80
81 signals:
82     void progressed (int);
83     void described (const QString&);
84     void destroyed (void);
85 };
86
87 #endif