1 /*****************************************************************************
2 * simple_preferences.cpp : "Simple preferences"
3 ****************************************************************************
4 * Copyright (C) 2006 the VideoLAN team
5 * $Id: preferences.cpp 16348 2006-08-25 21:10:10Z zorglub $
7 * Authors: Clément Stenac <zorglub@videolan.org>
8 * Antoine Cellerier <dionoea@videolan.org>
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 *****************************************************************************/
25 #include "components/simple_preferences.hpp"
26 #include "components/preferences_widgets.hpp"
28 #include <vlc_config_cat.h>
30 #include <QListWidget>
31 #include <QListWidgetItem>
35 #include "pixmaps/audio.xpm"
36 #include "pixmaps/video.xpm"
37 #include "ui/sprefs_trivial.h"
39 #define ITEM_HEIGHT 25
41 /*********************************************************************
42 * The List of categories
43 *********************************************************************/
44 SPrefsCatList::SPrefsCatList( intf_thread_t *_p_intf, QWidget *_parent ) :
45 QListWidget( _parent ), p_intf( _p_intf )
47 setIconSize( QSize( ITEM_HEIGHT,ITEM_HEIGHT ) );
48 setAlternatingRowColors( true );
53 int pSize = f.pointSize();
55 f.setPointSize( pSize + 1 );
57 f.setPixelSize( f.pixelSize() + 1 );
61 addItem( "Very trivial" );
62 item(0)->setIcon( QIcon( QPixmap( audio_xpm ) ) );
63 item(0)->setData( Qt::UserRole, qVariantFromValue( 0 ) );
65 item(1)->setIcon( QIcon( QPixmap( video_xpm ) ) );
66 item(1)->setData( Qt::UserRole, qVariantFromValue( 1 ) );
69 void SPrefsCatList::ApplyAll()
74 void SPrefsCatList::CleanAll()
79 /// \todo When cleaning, we should remove the panel ?
80 void SPrefsCatList::DoAll( bool doclean )
85 /*********************************************************************
87 *********************************************************************/
88 SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
89 int number ) : QWidget( _parent ), p_intf( _p_intf )
95 module_config_t *p_config = config_FindConfig( VLC_OBJECT(p_intf),
97 ConfigControl *control = new ModuleConfigControl( VLC_OBJECT(p_intf),
98 p_config, ui.memcpyLabel, ui.memcpyCombo, false );
99 controls.append( control );
104 fprintf( stderr, "Ha ha ca te fait bien la bite\n" );
109 void SPrefsPanel::Apply()
111 /* todo: factorize with PrefsPanel */
112 QList<ConfigControl *>::Iterator i;
113 for( i = controls.begin() ; i != controls.end() ; i++ )
115 VIntConfigControl *vicc = qobject_cast<VIntConfigControl *>(*i);
118 VFloatConfigControl *vfcc = qobject_cast<VFloatConfigControl *>(*i);
121 VStringConfigControl *vscc =
122 qobject_cast<VStringConfigControl *>(*i);
124 config_PutPsz( p_intf, vscc->getName().toAscii().data(),
125 vscc->getValue().toAscii().data() );
128 config_PutFloat( p_intf, vfcc->getName().toAscii().data(),
132 config_PutInt( p_intf, vicc->getName().toAscii().data(),
137 void SPrefsPanel::Clean()