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. *****************************************************************************/
27 #include <QApplication>
29 #include <QMainWindow>
30 #include <QPlastiqueStyle>
33 class QVLCFrame : public QWidget
36 static void fixStyle( QWidget *w)
38 QStyle *style = qApp->style();
40 // Plastique is too dark.
41 /// theming ? getting KDE data ? ?
42 if( qobject_cast<QPlastiqueStyle *>(style) )
44 QPalette plt( w->palette() );
45 plt.setColor( QPalette::Active, QPalette::Highlight, Qt::gray );
46 QColor vlg = (Qt::lightGray);
48 vlg.setHsv( vlg.hue(), vlg.saturation(), 235 );
49 plt.setColor( QPalette::Active, QPalette::Window, vlg );
50 plt.setColor( QPalette::Inactive, QPalette::Window, vlg );
56 QVLCFrame( intf_thread_t *_p_intf ) : QWidget( NULL ), p_intf( _p_intf )
60 virtual ~QVLCFrame() {};
64 if( isVisible() ) hide();
68 intf_thread_t *p_intf;
70 void readSettings( QString name, QSize defSize )
72 QSettings settings( "VideoLAN", "VLC" );
73 settings.beginGroup( name );
74 resize( settings.value( "size", defSize ).toSize() );
75 move( settings.value( "pos", QPoint( 0,0 ) ).toPoint() );
78 void writeSettings( QString name )
80 QSettings settings( "VideoLAN", "VLC" );
81 settings.beginGroup( name );
82 settings.setValue ("size", size() );
83 settings.setValue( "pos", pos() );
88 class QVLCMW : public QMainWindow
91 QVLCMW( intf_thread_t *_p_intf ) : QMainWindow( NULL ), p_intf( _p_intf )
93 QVLCFrame::fixStyle( this );
97 intf_thread_t *p_intf;
100 void readSettings( QString name, QSize defSize )
102 QSettings settings( "VideoLAN", "VLC" );
103 settings.beginGroup( name );
104 mainSize = settings.value( "size", defSize ).toSize();
105 QPoint npos = settings.value( "pos", QPoint( 0,0 ) ).toPoint();
110 void readSettings( QString name )
112 QSettings settings( "VideoLAN", "VLC" );
113 settings.beginGroup( name );
114 mainSize = settings.value( "size", QSize( 0,0 ) ).toSize();
117 void writeSettings( QString name )
119 QSettings settings( "VideoLAN", "VLC" );
120 settings.beginGroup( name );
121 settings.setValue ("size", size() );
122 settings.setValue( "pos", pos() );