1 /*****************************************************************************
2 * qvlcframe.hpp : A few helpers
3 *****************************************************************************
4 * Copyright (C) 2006-2007 the VideoLAN team
7 * Authors: Clément Stenac <zorglub@videolan.org>
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.
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.
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 *****************************************************************************/
29 #include <QSpacerItem>
30 #include <QHBoxLayout>
31 #include <QApplication>
33 #include <QMainWindow>
34 #include <QPlastiqueStyle>
35 #include <QPushButton>
39 #include <vlc_charset.h>
41 class QVLCFrame : public QWidget
44 QVLCFrame( intf_thread_t *_p_intf ) : QWidget( NULL ), p_intf( _p_intf )
46 virtual ~QVLCFrame() {};
50 if( isVisible() ) hide();
54 intf_thread_t *p_intf;
56 void readSettings( QString name, QSize defSize )
58 QSettings settings( "vlc", "vlc-qt-interface" );
59 settings.beginGroup( name );
60 resize( settings.value( "size", defSize ).toSize() );
61 move( settings.value( "pos", QPoint( 0,0 ) ).toPoint() );
64 void writeSettings( QString name )
66 QSettings settings( "vlc", "vlc-qt-interface" );
67 settings.beginGroup( name );
68 settings.setValue ("size", size() );
69 settings.setValue( "pos", pos() );
80 virtual void keyPressEvent( QKeyEvent *keyEvent )
82 if( keyEvent->key() == Qt::Key_Escape )
84 msg_Dbg( p_intf, "Escp Key pressed" );
87 else if( keyEvent->key() == Qt::Key_Return )
89 msg_Dbg( p_intf, "Enter Key pressed" );
96 class QVLCDialog : public QDialog
99 QVLCDialog( QWidget* parent, intf_thread_t *_p_intf ) :
100 QDialog( parent ), p_intf( _p_intf )
102 virtual ~QVLCDialog() {};
105 if( isVisible() ) hide();
110 intf_thread_t *p_intf;
112 virtual void cancel()
120 virtual void keyPressEvent( QKeyEvent *keyEvent )
122 if( keyEvent->key() == Qt::Key_Escape )
124 msg_Dbg( p_intf, "Escp Key pressed" );
127 else if( keyEvent->key() == Qt::Key_Return )
129 msg_Dbg( p_intf, "Enter Key pressed" );
135 class QVLCMW : public QMainWindow
138 QVLCMW( intf_thread_t *_p_intf ) : QMainWindow( NULL ), p_intf( _p_intf )
140 virtual ~QVLCMW() {};
143 if( isVisible() ) hide();
147 intf_thread_t *p_intf;
150 void readSettings( QString name, QSize defSize )
152 QSettings settings( "vlc", "vlc-qt-interface" );
153 settings.beginGroup( name );
154 QSize s = settings.value( "size", defSize ).toSize() ;
155 fprintf( stderr, "%i %i ", s.width(), s.height() );
156 move( settings.value( "pos", QPoint( 0,0 ) ).toPoint() );
159 void readSettings( QString name )
161 QSettings settings( "vlc", "vlc-qt-interface" );
162 settings.beginGroup( name );
163 mainSize = settings.value( "size", QSize( 0,0 ) ).toSize();
166 void writeSettings( QString name )
168 QSettings settings( "vlc", "vlc-qt-interface" );
169 settings.beginGroup( name );
170 settings.setValue ("size", size() );
171 settings.setValue( "pos", pos() );