1 /*****************************************************************************
2 * qvlcframe.hpp : A few helpers
3 ****************************************************************************
4 * Copyright (C) 2006 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. *****************************************************************************/
28 #include <QSpacerItem>
29 #include <QHBoxLayout>
30 #include <QApplication>
32 #include <QMainWindow>
33 #include <QPlastiqueStyle>
34 #include <QPushButton>
37 #include <vlc_charset.h>
39 class QVLCFrame : public QWidget
42 static QHBoxLayout* doButtons( QWidget *w, QBoxLayout *l,
43 QPushButton **defaul, char *psz_default,
44 QPushButton **alt, char *psz_alt,
45 QPushButton **other, char *psz_other )
49 QHBoxLayout *buttons_layout = new QHBoxLayout;
50 QSpacerItem *spacerItem = new QSpacerItem( 40, 20,
51 QSizePolicy::Expanding, QSizePolicy::Minimum);
52 buttons_layout->addItem( spacerItem );
56 *defaul = new QPushButton(0);
57 (*defaul)->setFocus();
58 buttons_layout->addWidget( *defaul );
59 (*defaul)->setText( qfu( psz_default ) );
63 *alt = new QPushButton(0);
64 buttons_layout->addWidget( *alt );
65 (*alt)->setText( qfu( psz_alt ) );
69 *other = new QPushButton( 0 );
70 buttons_layout->addWidget( *other );
71 (*other)->setText( qfu( psz_other ) );
74 l->addLayout( buttons_layout );
76 return buttons_layout;
79 QVLCFrame( intf_thread_t *_p_intf ) : QWidget( NULL ), p_intf( _p_intf )
81 virtual ~QVLCFrame() {};
85 if( isVisible() ) hide();
89 intf_thread_t *p_intf;
91 void readSettings( QString name, QSize defSize )
93 QSettings settings( "VideoLAN", "VLC" );
94 settings.beginGroup( name );
95 resize( settings.value( "size", defSize ).toSize() );
96 move( settings.value( "pos", QPoint( 0,0 ) ).toPoint() );
99 void writeSettings( QString name )
101 QSettings settings( "VideoLAN", "VLC" );
102 settings.beginGroup( name );
103 settings.setValue ("size", size() );
104 settings.setValue( "pos", pos() );
109 class QVLCDialog : public QDialog
112 QVLCDialog( QWidget* parent, intf_thread_t *_p_intf ) :
113 QDialog( parent ), p_intf( _p_intf )
115 virtual ~QVLCDialog() {};
118 if( isVisible() ) hide();
123 intf_thread_t *p_intf;
126 class QVLCMW : public QMainWindow
129 QVLCMW( intf_thread_t *_p_intf ) : QMainWindow( NULL ), p_intf( _p_intf )
131 virtual ~QVLCMW() {};
134 if( isVisible() ) hide();
138 intf_thread_t *p_intf;
141 void readSettings( QString name, QSize defSize )
143 QSettings settings( "VideoLAN", "VLC" );
144 settings.beginGroup( name );
145 QSize s = settings.value( "size", defSize ).toSize() ;
146 fprintf( stderr, "%i %i ", s.width(), s.height() );
147 move( settings.value( "pos", QPoint( 0,0 ) ).toPoint() );
150 void readSettings( QString name )
152 QSettings settings( "VideoLAN", "VLC" );
153 settings.beginGroup( name );
154 mainSize = settings.value( "size", QSize( 0,0 ) ).toSize();
157 void writeSettings( QString name )
159 QSettings settings( "VideoLAN", "VLC" );
160 settings.beginGroup( name );
161 settings.setValue ("size", size() );
162 settings.setValue( "pos", pos() );