AUTOMAKE_OPTIONS = subdir-objects
TOUI = ui/input_stats ui/main_interface ui/file_open \
- ui/logindialog ui/inputdialog ui/progressdialog
+ ui/logindialog ui/inputdialog ui/progressdialog ui/sprefs_trivial
UIH = $(TOUI:%=%.h)
TOMOC = main_interface \
components/infopanels \
components/preferences_widgets \
components/preferences \
+ components/simple_preferences \
components/open \
components/video_widget \
components/playlist/panels \
components/infopanels.moc.cpp \
components/preferences_widgets.moc.cpp \
components/preferences.moc.cpp \
+ components/simple_preferences.moc.cpp \
components/open.moc.cpp \
components/video_widget.moc.cpp \
components/playlist/panels.moc.cpp \
components/infopanels.cpp \
components/preferences_widgets.cpp \
components/preferences.cpp \
+ components/simple_preferences.cpp \
components/open.cpp \
components/video_widget.cpp \
components/playlist/standardpanel.cpp \
components/infopanels.hpp \
components/preferences_widgets.hpp \
components/preferences.hpp \
+ components/simple_preferences.hpp \
components/open.hpp \
components/video_widget.hpp \
components/playlist/panels.hpp \
ui/logindialog.ui \
ui/inputdialog.ui \
ui/progressdialog.ui \
+ ui/sprefs_trivial.ui \
pixmaps/advanced.xpm \
pixmaps/audio.xpm \
pixmaps/codec.xpm \
/*****************************************************************************
- * preferences_tree.cpp : Tree of modules for preferences
+ * preferences.cpp : "Normal preferences"
****************************************************************************
* Copyright (C) 2006 the VideoLAN team
* $Id$
#include "components/preferences_widgets.hpp"
#include "qt4.hpp"
#include <vlc_config_cat.h>
+#include <vlc_intf_strings.h>
#include <assert.h>
#include "pixmaps/audio.xpm"
else
{
head = QString( qfu(p_module->psz_longname) );
- if( p_module->psz_help )
+ if( p_module->psz_help )
{
head.append( "\n" );
head.append( qfu( p_module->psz_help ) );
continue;
}
if( !box )
- layout->addWidget( control );
+ layout->addWidget( control->getWidget() );
else
- boxlayout->addWidget( control );
+ boxlayout->addWidget( control->getWidget() );
controls.append( control );
}
scroller->setWidgetResizable( true );
global_layout->addWidget( scroller );
- some_hidden_text = new QLabel( "Some options are available but hidden. "\
- "Check \"Advanced options\" to see them." );
+ some_hidden_text = new QLabel( qfu( I_HIDDEN_ADV ) );
some_hidden_text->setWordWrap( true );
setLayout( global_layout );
if( (*i)->isAdvanced() )
{
if( !advanced ) some_hidden = true;
- (*i)->setVisible( advanced );
+ (*i)->getWidget()->setVisible( advanced );
}
}
if( some_hidden_text )
#include <QVariant>
#include <QComboBox>
-ConfigControl::ConfigControl( vlc_object_t *_p_this, module_config_t *p_item,
- QWidget *_parent ) : QWidget( _parent ),
- p_this( _p_this ), _name( p_item->psz_name )
-{
-}
-
-ConfigControl::~ConfigControl() {}
-
ConfigControl *ConfigControl::createControl( vlc_object_t *p_this,
- module_config_t *p_item, QWidget *parent )
+ module_config_t *p_item,
+ QWidget *parent )
{
ConfigControl *p_control = NULL;
if( p_item->psz_current ) return NULL;
/*********** String **************/
StringConfigControl::StringConfigControl( vlc_object_t *_p_this,
- module_config_t *p_item, QWidget *_parent, bool pwd )
- : VStringConfigControl( _p_this, p_item, _parent )
+ module_config_t *_p_item,
+ QWidget *_parent, bool pwd ) :
+ VStringConfigControl( _p_this, _p_item, _parent )
{
QLabel *label = new QLabel( qfu(p_item->psz_text) );
text = new QLineEdit( qfu(p_item->psz_value) );
- text->setToolTip( qfu(p_item->psz_longtext) );
- label->setToolTip( qfu(p_item->psz_longtext) );
+ finish(label);
QHBoxLayout *layout = new QHBoxLayout();
layout->addWidget( label, 0 ); layout->addWidget( text, 1 );
- setLayout( layout );
+ widget->setLayout( layout );
}
-StringConfigControl::~StringConfigControl() {}
-
-QString StringConfigControl::getValue() { return text->text(); };
+StringConfigControl::StringConfigControl( vlc_object_t *_p_this,
+ module_config_t *_p_item,
+ QLabel *label, QLineEdit *_text, bool pwd ):
+ VStringConfigControl( _p_this, _p_item )
+{
+ text = _text;
+ finish( label );
+}
+void StringConfigControl::finish( QLabel *label )
+{
+ text->setToolTip( qfu(p_item->psz_longtext) );
+ label->setToolTip( qfu(p_item->psz_longtext) );
+}
/********* Module **********/
ModuleConfigControl::ModuleConfigControl( vlc_object_t *_p_this,
- module_config_t *p_item, QWidget *_parent,
- bool bycat ) : VStringConfigControl( _p_this, p_item, _parent )
+ module_config_t *_p_item, QWidget *_parent,
+ bool bycat ) : VStringConfigControl( _p_this, _p_item, _parent )
+{
+ QLabel *label = new QLabel( qfu(p_item->psz_text) );
+ combo = new QComboBox();
+ finish( label, bycat );
+ QHBoxLayout *layout = new QHBoxLayout();
+ layout->addWidget( label ); layout->addWidget( combo );
+ widget->setLayout( layout );
+}
+ModuleConfigControl::ModuleConfigControl( vlc_object_t *_p_this,
+ module_config_t *_p_item, QLabel *label, QComboBox *_combo,
+ bool bycat ) : VStringConfigControl( _p_this, _p_item )
+{
+ fprintf( stderr, "%p %p\n", _p_item, p_item );
+ combo = _combo;
+ finish( label, bycat );
+}
+
+void ModuleConfigControl::finish( QLabel *label, bool bycat )
{
vlc_list_t *p_list;
module_t *p_parser;
- QLabel *label = new QLabel( qfu(p_item->psz_text) );
- combo = new QComboBox();
combo->setEditable( false );
/* build a list of available modules */
vlc_list_release( p_list );
combo->setToolTip( qfu(p_item->psz_longtext) );
label->setToolTip( qfu(p_item->psz_longtext) );
-
- QHBoxLayout *layout = new QHBoxLayout();
- layout->addWidget( label ); layout->addWidget( combo );
- setLayout( layout );
}
ModuleConfigControl::~ModuleConfigControl() {};
#define _INFOPANELS_H_
#include <vlc/vlc.h>
#include <QWidget>
+#include <QLineEdit>
#include "ui/input_stats.h"
+#include "qt4.hpp"
+#include <assert.h>
class QSpinBox;
-class QLineEdit;
class QString;
class QComboBox;
class QCheckBox;
-class ConfigControl : public QWidget
+class ConfigControl : public QObject
{
Q_OBJECT;
public:
- ConfigControl( vlc_object_t *, module_config_t *, QWidget * );
- virtual ~ConfigControl();
- QString getName() { return _name; }
- bool isAdvanced() { return _advanced; }
+ ConfigControl( vlc_object_t *_p_this, module_config_t *_p_conf,
+ QWidget *p ) : p_this( _p_this ), p_item( _p_conf )
+ {
+ widget = new QWidget( p );
+ }
+ ConfigControl( vlc_object_t *_p_this, module_config_t *_p_conf ) :
+ p_this (_p_this ), p_item( _p_conf )
+ {
+ widget = NULL;
+ }
+ virtual ~ConfigControl() {};
+ QString getName() { return qfu( p_item->psz_name ); }
+ QWidget *getWidget() { assert( widget ); return widget; }
+ bool isAdvanced() { return p_item->b_advanced; }
static ConfigControl * createControl( vlc_object_t*,
- module_config_t*,QWidget* );
+ module_config_t*,QWidget* );
protected:
vlc_object_t *p_this;
+ module_config_t *p_item;
QString _name;
+ QWidget *widget;
bool _advanced;
signals:
void Updated();
class VStringConfigControl : public ConfigControl
{
public:
- VStringConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
+ VStringConfigControl( vlc_object_t *a, module_config_t *b, QWidget *c ) :
ConfigControl(a,b,c) {};
+ VStringConfigControl( vlc_object_t *a, module_config_t *b ) :
+ ConfigControl(a,b) {};
virtual ~VStringConfigControl() {};
virtual QString getValue() = 0;
};
public:
StringConfigControl( vlc_object_t *, module_config_t *, QWidget *,
bool pwd );
- virtual ~StringConfigControl();
- virtual QString getValue();
+ StringConfigControl( vlc_object_t *, module_config_t *, QLabel *,
+ QLineEdit*, bool pwd );
+ virtual ~StringConfigControl() {};
+ virtual QString getValue() { return text->text(); };
private:
+ void finish( QLabel * );
QLineEdit *text;
};
public:
ModuleConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool
bycat );
+ ModuleConfigControl( vlc_object_t *, module_config_t *, QLabel *,
+ QComboBox*, bool );
virtual ~ModuleConfigControl();
virtual QString getValue();
private:
+ void finish( QLabel *, bool );
QComboBox *combo;
};
#if 0
--- /dev/null
+/*****************************************************************************
+ * simple_preferences.cpp : "Simple preferences"
+ ****************************************************************************
+ * Copyright (C) 2006 the VideoLAN team
+ * $Id: preferences.cpp 16348 2006-08-25 21:10:10Z zorglub $
+ *
+ * Authors: Clément Stenac <zorglub@videolan.org>
+ * Antoine Cellerier <dionoea@videolan.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#include "components/simple_preferences.hpp"
+#include "components/preferences_widgets.hpp"
+#include "qt4.hpp"
+#include <vlc_config_cat.h>
+#include <assert.h>
+#include <QListWidget>
+#include <QListWidgetItem>
+#include <QString>
+#include <QFont>
+
+#include "pixmaps/audio.xpm"
+#include "ui/sprefs_trivial.h"
+
+#define ITEM_HEIGHT 25
+
+/*********************************************************************
+ * The List of categories
+ *********************************************************************/
+SPrefsCatList::SPrefsCatList( intf_thread_t *_p_intf, QWidget *_parent ) :
+ QListWidget( _parent ), p_intf( _p_intf )
+{
+ setIconSize( QSize( ITEM_HEIGHT,ITEM_HEIGHT ) );
+ setAlternatingRowColors( true );
+
+#ifndef WIN32
+ // Fixme - A bit UGLY
+ QFont f = font();
+ int pSize = f.pointSize();
+ if( pSize > 0 )
+ f.setPointSize( pSize + 1 );
+ else
+ f.setPixelSize( f.pixelSize() + 1 );
+ setFont( f );
+#endif
+
+ addItem( "Very trivial" );
+ item(0)->setIcon( QIcon( QPixmap( audio_xpm ) ) );
+}
+
+void SPrefsCatList::ApplyAll()
+{
+ DoAll( false );
+}
+
+void SPrefsCatList::CleanAll()
+{
+ DoAll( true );
+}
+
+/// \todo When cleaning, we should remove the panel ?
+void SPrefsCatList::DoAll( bool doclean )
+{
+ /* Todo */
+}
+
+/*********************************************************************
+ * The Panels
+ *********************************************************************/
+SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
+ int number ) : QWidget( _parent ), p_intf( _p_intf )
+{
+ if( number == 0 )
+ {
+ Ui::SPrefsTrivial ui;
+ ui.setupUi( this );
+ msg_Err( p_intf, "Intf there" );
+ module_config_t *p_config = config_FindConfig( VLC_OBJECT(p_intf),
+ "memcpy" );
+ msg_Err( p_intf, "%p", p_config );
+ ConfigControl *control = new ModuleConfigControl( VLC_OBJECT(p_intf),
+ p_config, ui.memcpyLabel, ui.memcpyCombo, false );
+ controls.append( control );
+ }
+ else
+ {
+ int *p = NULL;
+ fprintf( stderr, "Ha ha ca te fait bien la bite\n" );
+ *p=42;
+ }
+}
+
+void SPrefsPanel::Apply()
+{
+ /* todo: factorize with PrefsPanel */
+ QList<ConfigControl *>::Iterator i;
+ for( i = controls.begin() ; i != controls.end() ; i++ )
+ {
+ VIntConfigControl *vicc = qobject_cast<VIntConfigControl *>(*i);
+ if( !vicc )
+ {
+ VFloatConfigControl *vfcc = qobject_cast<VFloatConfigControl *>(*i);
+ if( !vfcc)
+ {
+ VStringConfigControl *vscc =
+ qobject_cast<VStringConfigControl *>(*i);
+ assert( vscc );
+ config_PutPsz( p_intf, vscc->getName().toAscii().data(),
+ vscc->getValue().toAscii().data() );
+ continue;
+ }
+ config_PutFloat( p_intf, vfcc->getName().toAscii().data(),
+ vfcc->getValue() );
+ continue;
+ }
+ config_PutInt( p_intf, vicc->getName().toAscii().data(),
+ vicc->getValue() );
+ }
+}
+
+void SPrefsPanel::Clean()
+{}
--- /dev/null
+/*****************************************************************************
+ * simple_preferences.hpp : Simple prefs
+ ****************************************************************************
+ * Copyright (C) 2006 the VideoLAN team
+ * $Id: preferences.hpp 16348 2006-08-25 21:10:10Z zorglub $
+ *
+ * Authors: Clément Stenac <zorglub@videolan.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ *****************************************************************************/
+
+#ifndef _SIMPLEPREFS_H_
+#define _SIMPLEPREFS_H_
+
+#include <QListWidget>
+#include <vlc/vlc.h>
+#include <vlc/intf.h>
+
+class ConfigControl;
+
+class SPrefsCatList : public QListWidget
+{
+ Q_OBJECT;
+public:
+ SPrefsCatList( intf_thread_t *, QWidget *);
+ virtual ~SPrefsCatList() {};
+
+ void ApplyAll();
+ void CleanAll();
+
+private:
+ void DoAll( bool );
+ intf_thread_t *p_intf;
+};
+
+class SPrefsPanel : public QWidget
+{
+ Q_OBJECT
+public:
+ SPrefsPanel( intf_thread_t *, QWidget *, int );
+ virtual ~SPrefsPanel() {};
+ void Apply();
+ void Clean();
+private:
+ intf_thread_t *p_intf;
+ QList<ConfigControl *> controls;
+};
+
+#endif
QVLCMenu::createPlMenuBar( menuBar(), p_intf );
selector = new PLSelector( centralWidget(), p_intf, THEPL );
- selector->setMaximumWidth( 140 );
+ selector->setMaximumWidth( 130 );
playlist_item_t *p_root = playlist_GetPreferredNode( THEPL,
THEPL->p_local_category );
#include "util/qvlcframe.hpp"
#include "components/preferences.hpp"
+#include "components/simple_preferences.hpp"
#include "qt4.hpp"
#include <QHBoxLayout>
advanced_tree->hide();
}
if( !simple_tree )
- simple_tree = new QTreeWidget();
+ {
+ simple_tree = new SPrefsCatList( p_intf, tree_panel );
+ connect( simple_tree,
+ SIGNAL( currentItemChanged( QListWidgetItem *, QListWidgetItem *) ),
+ this, SLOT( changeSimplePanel( QListWidgetItem * ) ) );
+
+ }
tree_panel_l->addWidget( simple_tree );
simple_tree->show();
advanced_panel->hide();
}
if( !simple_panel )
- simple_panel = new QWidget();
+ simple_panel = new SPrefsPanel( p_intf, main_panel, 0 );
main_panel_l->addWidget( simple_panel );
simple_panel->show();
}
{
}
+void PrefsDialog::changeSimplePanel( QListWidgetItem *item )
+{
+ if( simple_panel )
+ {
+ main_panel_l->removeWidget( simple_panel );
+ simple_panel->hide();
+ /* Don't do this once it works, you would loose all changes */
+ delete simple_panel;
+ }
+ simple_panel = new SPrefsPanel( p_intf, main_panel, 0 );
+ main_panel_l->addWidget( simple_panel );
+ simple_panel->show();
+}
+
void PrefsDialog::changePanel( QTreeWidgetItem *item )
{
PrefsItemData *data = item->data( 0, Qt::UserRole ).value<PrefsItemData*>();
#include "util/qvlcframe.hpp"
class PrefsTree;
+class SPrefsCatList;
class PrefsPanel;
+class SPrefsPanel;
class QTreeWidgetItem;
class QTreeWidget;
class QHBoxLayout;
class QRadioButton;
class QWidget;
class QCheckBox;
+class QListWidget;
+class QListWidgetItem;
class PrefsDialog : public QVLCFrame
{
QWidget *main_panel;
QHBoxLayout *main_panel_l;
PrefsPanel *advanced_panel;
- QWidget *simple_panel;
+ SPrefsPanel *simple_panel;
QWidget *tree_panel;
QHBoxLayout *tree_panel_l;
- QTreeWidget *simple_tree;
+ SPrefsCatList *simple_tree;
PrefsTree *advanced_tree;
QGroupBox *types;
QRadioButton *small,*all;
QCheckBox *adv_chk;
-
+
QGridLayout *main_layout;
static PrefsDialog *instance;
private slots:
void changePanel( QTreeWidgetItem *);
+ void changeSimplePanel( QListWidgetItem *);
void setAll();
void setSmall();
void setAdvanced( bool );
--- /dev/null
+<ui version="4.0" >
+ <author></author>
+ <comment></comment>
+ <exportmacro></exportmacro>
+ <class>SPrefsTrivial</class>
+ <widget class="QWidget" name="SPrefsTrivial" >
+ <property name="geometry" >
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>681</width>
+ <height>300</height>
+ </rect>
+ </property>
+ <property name="windowTitle" >
+ <string>Form</string>
+ </property>
+ <layout class="QGridLayout" >
+ <property name="margin" >
+ <number>9</number>
+ </property>
+ <property name="spacing" >
+ <number>6</number>
+ </property>
+ <item row="4" column="1" >
+ <widget class="QSpinBox" name="crSpin" />
+ </item>
+ <item row="0" column="0" >
+ <widget class="QComboBox" name="memcpyCombo" />
+ </item>
+ <item row="5" column="0" colspan="2" >
+ <widget class="QDateTimeEdit" name="dateTimeEdit" />
+ </item>
+ <item row="4" column="0" >
+ <widget class="QLabel" name="crLabel" >
+ <property name="text" >
+ <string>That's the question</string>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="QLabel" name="memcpyLabel" >
+ <property name="text" >
+ <string>Should labels be set in Designer or by program ?.</string>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QLCDNumber" name="lcdNumber" >
+ <property name="numDigits" >
+ <number>3</number>
+ </property>
+ <property name="value" stdset="0" >
+ <double>42</double>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </widget>
+ <pixmapfunction></pixmapfunction>
+ <resources/>
+ <connections/>
+</ui>