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 "ui/sprefs_trivial.h"
38 #define ITEM_HEIGHT 25
40 /*********************************************************************
41 * The List of categories
42 *********************************************************************/
43 SPrefsCatList::SPrefsCatList( intf_thread_t *_p_intf, QWidget *_parent ) :
44 QListWidget( _parent ), p_intf( _p_intf )
46 setIconSize( QSize( ITEM_HEIGHT,ITEM_HEIGHT ) );
47 setAlternatingRowColors( true );
52 int pSize = f.pointSize();
54 f.setPointSize( pSize + 1 );
56 f.setPixelSize( f.pixelSize() + 1 );
60 addItem( "Very trivial" );
61 item(0)->setIcon( QIcon( QPixmap( audio_xpm ) ) );
64 void SPrefsCatList::ApplyAll()
69 void SPrefsCatList::CleanAll()
74 /// \todo When cleaning, we should remove the panel ?
75 void SPrefsCatList::DoAll( bool doclean )
80 /*********************************************************************
82 *********************************************************************/
83 SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
84 int number ) : QWidget( _parent ), p_intf( _p_intf )
90 msg_Err( p_intf, "Intf there" );
91 module_config_t *p_config = config_FindConfig( VLC_OBJECT(p_intf),
93 msg_Err( p_intf, "%p", p_config );
94 ConfigControl *control = new ModuleConfigControl( VLC_OBJECT(p_intf),
95 p_config, ui.memcpyLabel, ui.memcpyCombo, false );
96 controls.append( control );
101 fprintf( stderr, "Ha ha ca te fait bien la bite\n" );
106 void SPrefsPanel::Apply()
108 /* todo: factorize with PrefsPanel */
109 QList<ConfigControl *>::Iterator i;
110 for( i = controls.begin() ; i != controls.end() ; i++ )
112 VIntConfigControl *vicc = qobject_cast<VIntConfigControl *>(*i);
115 VFloatConfigControl *vfcc = qobject_cast<VFloatConfigControl *>(*i);
118 VStringConfigControl *vscc =
119 qobject_cast<VStringConfigControl *>(*i);
121 config_PutPsz( p_intf, vscc->getName().toAscii().data(),
122 vscc->getValue().toAscii().data() );
125 config_PutFloat( p_intf, vfcc->getName().toAscii().data(),
129 config_PutInt( p_intf, vicc->getName().toAscii().data(),
134 void SPrefsPanel::Clean()