]> git.sesse.net Git - vlc/blob - modules/gui/qt4/dialogs_provider.cpp
* Fix QT detection and make dist
[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/streaminfo.hpp"
28 #include <QApplication>
29
30 DialogsProvider* DialogsProvider::instance = NULL;
31
32 DialogsProvider::DialogsProvider( intf_thread_t *_p_intf ) :
33                                       QObject( NULL ), p_intf( _p_intf )
34 {
35     idle_timer = new QTimer( this );
36     idle_timer->start( 0 );
37
38     fixed_timer = new QTimer( this );
39     fixed_timer->start( 100 /* milliseconds */ );
40 }
41
42 DialogsProvider::~DialogsProvider()
43 {
44 }
45
46 void DialogsProvider::customEvent( QEvent *event )
47 {
48     if( event->type() == DialogEvent_Type )
49     {
50         DialogEvent *de = dynamic_cast<DialogEvent*>(event);
51         switch( de->i_dialog )
52         {
53             case INTF_DIALOG_FILE:
54             case INTF_DIALOG_DISC:
55             case INTF_DIALOG_NET:
56             case INTF_DIALOG_CAPTURE:
57                 openDialog( de->i_dialog ); break;
58             case INTF_DIALOG_PLAYLIST:
59                 playlistDialog(); break;
60             case INTF_DIALOG_MESSAGES:
61                 messagesDialog(); break;
62             case INTF_DIALOG_PREFS:
63                prefsDialog(); break;
64             case INTF_DIALOG_POPUPMENU:
65             case INTF_DIALOG_AUDIOPOPUPMENU:
66             case INTF_DIALOG_VIDEOPOPUPMENU:
67             case INTF_DIALOG_MISCPOPUPMENU:
68                popupMenu( de->i_dialog ); break;
69             case INTF_DIALOG_FILEINFO:
70                streaminfoDialog(); break;
71             case INTF_DIALOG_VLM:
72             case INTF_DIALOG_INTERACTION:
73             case INTF_DIALOG_BOOKMARKS:
74             case INTF_DIALOG_WIZARD:
75             default:
76                fprintf( stderr, "Unimplemented dialog\n");
77         }
78     }
79 }
80
81 void DialogsProvider::playlistDialog()
82 {
83     PlaylistDialog::getInstance( p_intf )->toggleVisible();
84 }
85
86 void DialogsProvider::openDialog( int i_dialog )
87 {
88 }
89
90 void DialogsProvider::streaminfoDialog()
91 {
92     StreamInfoDialog::getInstance( p_intf )->toggleVisible();
93     QObject::connect( DialogsProvider::getInstance(NULL)->fixed_timer, SIGNAL( timeout() ), this, SLOT( prefsDialog() )) ;
94 }
95
96 void DialogsProvider::prefsDialog()
97 {
98 fprintf( stderr, "P\n");
99 }
100
101 void DialogsProvider::messagesDialog()
102 {
103 fprintf( stderr, "M\n");
104 }
105
106 void DialogsProvider::popupMenu( int i_dialog )
107 {
108
109 }