]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs_provider.cpp
Preferences
[vlc] / modules / gui / qt4 / dialogs_provider.cpp
1 /*****************************************************************************
2  * main_inteface.cpp : Main interface
3  ****************************************************************************
4  * Copyright (C) 2000-2005 the VideoLAN team
5  * $Id: wxwidgets.cpp 15731 2006-05-25 14:43:53Z zorglub $
6  *
7  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/
22
23 #include "dialogs_provider.hpp"
24 #include "qt4.hpp"
25 #include <QEvent>
26 #include "dialogs/playlist.hpp"
27 #include "dialogs/prefs_dialog.hpp"
28 #include "dialogs/streaminfo.hpp"
29 #include <QApplication>
30
31 DialogsProvider* DialogsProvider::instance = NULL;
32
33 DialogsProvider::DialogsProvider( intf_thread_t *_p_intf ) :
34                                       QObject( NULL ), p_intf( _p_intf )
35 {
36     idle_timer = new QTimer( this );
37  //   idle_timer->start( 0 );
38
39     fixed_timer = new QTimer( this );
40     fixed_timer->start( 100 /* milliseconds */ );
41 }
42
43 DialogsProvider::~DialogsProvider()
44 {
45 }
46
47 void DialogsProvider::customEvent( QEvent *event )
48 {
49     if( event->type() == DialogEvent_Type )
50     {
51         DialogEvent *de = dynamic_cast<DialogEvent*>(event);
52         switch( de->i_dialog )
53         {
54             case INTF_DIALOG_FILE:
55             case INTF_DIALOG_DISC:
56             case INTF_DIALOG_NET:
57             case INTF_DIALOG_CAPTURE:
58                 openDialog( de->i_dialog ); break;
59             case INTF_DIALOG_PLAYLIST:
60                 playlistDialog(); break;
61             case INTF_DIALOG_MESSAGES:
62                 messagesDialog(); break;
63             case INTF_DIALOG_PREFS:
64                prefsDialog(); break;
65             case INTF_DIALOG_POPUPMENU:
66             case INTF_DIALOG_AUDIOPOPUPMENU:
67             case INTF_DIALOG_VIDEOPOPUPMENU:
68             case INTF_DIALOG_MISCPOPUPMENU:
69                popupMenu( de->i_dialog ); break;
70             case INTF_DIALOG_FILEINFO:
71                streaminfoDialog(); break;
72             case INTF_DIALOG_VLM:
73             case INTF_DIALOG_INTERACTION:
74             case INTF_DIALOG_BOOKMARKS:
75             case INTF_DIALOG_WIZARD:
76             default:
77                fprintf( stderr, "Unimplemented dialog\n");
78         }
79     }
80 }
81
82 void DialogsProvider::playlistDialog()
83 {
84     PlaylistDialog::getInstance( p_intf )->toggleVisible();
85 }
86
87 void DialogsProvider::openDialog( int i_dialog )
88 {
89 }
90
91 void DialogsProvider::streaminfoDialog()
92 {
93     StreamInfoDialog::getInstance( p_intf )->toggleVisible();
94 }
95
96 void DialogsProvider::prefsDialog()
97 {
98     PrefsDialog::getInstance( p_intf )->toggleVisible();
99 }
100
101 void DialogsProvider::messagesDialog()
102 {
103 }
104
105 void DialogsProvider::popupMenu( int i_dialog )
106 {
107
108 }