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>
40 #include <vlc_charset.h>
42 class QVLCFrame : public QWidget
45 QVLCFrame( intf_thread_t *_p_intf ) : QWidget( NULL ), p_intf( _p_intf )
47 virtual ~QVLCFrame() {};
51 if( isVisible() ) hide();
55 intf_thread_t *p_intf;
57 void readSettings( QString name, QSize defSize )
59 QSettings settings( "vlc", "vlc-qt-interface" );
60 settings.beginGroup( name );
61 resize( settings.value( "size", defSize ).toSize() );
62 move( settings.value( "pos", QPoint( 0,0 ) ).toPoint() );
65 void writeSettings( QString name )
67 QSettings settings( "vlc", "vlc-qt-interface" );
68 settings.beginGroup( name );
69 settings.setValue ("size", size() );
70 settings.setValue( "pos", pos() );
81 virtual void keyPressEvent( QKeyEvent *keyEvent )
83 if( keyEvent->key() == Qt::Key_Escape )
85 msg_Dbg( p_intf, "Escp Key pressed" );
88 else if( keyEvent->key() == Qt::Key_Return )
90 msg_Dbg( p_intf, "Enter Key pressed" );
97 class QVLCDialog : public QDialog
100 QVLCDialog( QWidget* parent, intf_thread_t *_p_intf ) :
101 QDialog( parent ), p_intf( _p_intf )
103 virtual ~QVLCDialog() {};
106 if( isVisible() ) hide();
111 intf_thread_t *p_intf;
113 virtual void cancel()
121 virtual void keyPressEvent( QKeyEvent *keyEvent )
123 if( keyEvent->key() == Qt::Key_Escape )
125 msg_Dbg( p_intf, "Escp Key pressed" );
128 else if( keyEvent->key() == Qt::Key_Return )
130 msg_Dbg( p_intf, "Enter Key pressed" );
136 class QVLCMW : public QMainWindow
139 QVLCMW( intf_thread_t *_p_intf ) : QMainWindow( NULL ), p_intf( _p_intf )
141 virtual ~QVLCMW() {};
144 if( isVisible() ) hide();
148 intf_thread_t *p_intf;
151 void readSettings( QString name, QSize defSize )
153 QSettings settings( "vlc", "vlc-qt-interface" );
154 settings.beginGroup( name );
155 QSize s = settings.value( "size", defSize ).toSize() ;
156 fprintf( stderr, "%i %i ", s.width(), s.height() );
157 move( settings.value( "pos", QPoint( 0,0 ) ).toPoint() );
160 void readSettings( QString name )
162 QSettings settings( "vlc", "vlc-qt-interface" );
163 settings.beginGroup( name );
164 mainSize = settings.value( "size", QSize( 0,0 ) ).toSize();
167 void writeSettings( QString name )
169 QSettings settings( "vlc", "vlc-qt-interface" );
170 settings.beginGroup( name );
171 settings.setValue ("size", size() );
172 settings.setValue( "pos", pos() );