/*****************************************************************************
* preferences_widgets.hpp : Widgets for preferences panels
****************************************************************************
- * Copyright (C) 2006 the VideoLAN team
+ * Copyright (C) 2006-2007 the VideoLAN team
* $Id$
*
* Authors: Clément Stenac <zorglub@videolan.org>
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
-#ifndef _INFOPANELS_H_
-#define _INFOPANELS_H_
-#include <vlc/vlc.h>
+#ifndef _PREFERENCESWIDGETS_H_
+#define _PREFERENCESWIDGETS_H_
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include "qt4.hpp"
+#include <assert.h>
+
#include <QWidget>
-#include <QTreeWidget>
+
+#include <QCheckBox>
+#include <QComboBox>
#include <QLineEdit>
+#include <QTreeWidget>
#include <QSpinBox>
-#include <QDoubleSpinBox>
-#include <QComboBox>
-#include <QCheckBox>
-#include <QVector>
-#include <QDialog>
#include <QLabel>
-#include <QFile>
+#include <QDoubleSpinBox>
#include <QPushButton>
+#include <QDialog>
+#include <QFontComboBox>
-#include "qt4.hpp"
-#include <assert.h>
-
+class QTreeWidget;
+class QTreeWidgetItem;
+class QGroupBox;
class QGridLayout;
+class QDialogButtonBox;
+class QVBoxLayout;
-class ConfigControl : public QObject
+/*******************************************************
+ * Simple widgets
+ *******************************************************/
+
+class InterfacePreviewWidget : public QLabel
+{
+ Q_OBJECT
+public:
+ InterfacePreviewWidget( QWidget * );
+ enum enum_style {
+ COMPLETE, // aka MPC
+ MINIMAL, // aka WMP12 minimal
+ SKINS };
+public slots:
+ void setPreview( enum_style );
+ void setNormalPreview( bool b_minimal );
+};
+
+/*******************************************************
+ * Variable controls
+ *******************************************************/
+
+class ConfigControl : public QObject
{
Q_OBJECT
public:
{
widget = NULL;
}
- virtual ~ConfigControl() {};
- virtual int getType() = 0;
- const char * getName() { return p_item->psz_name; }
- QWidget *getWidget() { assert( widget ); return widget; }
- bool isAdvanced() { return p_item->b_advanced; }
+ virtual int getType() const = 0;
+ const char * getName() const { return p_item->psz_name; }
+ QWidget *getWidget() const { assert( widget ); return widget; }
+ bool isAdvanced() const { return p_item->b_advanced; }
virtual void hide() { getWidget()->hide(); };
virtual void show() { getWidget()->show(); };
- static ConfigControl * createControl( vlc_object_t*,
- module_config_t*,QWidget* );
static ConfigControl * createControl( vlc_object_t*,
module_config_t*,QWidget*,
- QGridLayout *, int& );
- void doApply( intf_thread_t *);
+ QGridLayout *, int line = 0 );
+ virtual void doApply() = 0;
protected:
vlc_object_t *p_this;
module_config_t *p_item;
QString _name;
QWidget *widget;
- bool _advanced;
+#if 0
+/* You shouldn't use that now..*/
signals:
void Updated();
+#endif
};
/*******************************************************
ConfigControl(a,b,c) {};
VIntConfigControl( vlc_object_t *a, module_config_t *b ) :
ConfigControl(a,b) {};
- virtual ~VIntConfigControl() {};
- virtual int getValue() = 0;
- virtual int getType() { return 1; }
+ virtual int getValue() const = 0;
+ virtual int getType() const { return CONFIG_ITEM_INTEGER; }
+ virtual void doApply();
};
class IntegerConfigControl : public VIntConfigControl
Q_OBJECT
public:
IntegerConfigControl( vlc_object_t *, module_config_t *, QWidget *,
- QGridLayout *, int& );
+ QGridLayout *, int );
IntegerConfigControl( vlc_object_t *, module_config_t *,
QLabel*, QSpinBox* );
IntegerConfigControl( vlc_object_t *, module_config_t *,
QLabel*, QSlider* );
- virtual ~IntegerConfigControl() {};
- virtual int getValue();
- virtual void show() { spin->show(); label->show(); }
- virtual void hide() { spin->hide(); label->hide(); }
+ virtual int getValue() const;
+ virtual void show() const { spin->show(); if( label ) label->show(); }
+ virtual void hide() const { spin->hide(); if( label ) label->hide(); }
protected:
QSpinBox *spin;
{
public:
IntegerRangeConfigControl( vlc_object_t *, module_config_t *, QWidget *,
- QGridLayout *, int& );
+ QGridLayout *, int );
IntegerRangeConfigControl( vlc_object_t *, module_config_t *,
QLabel*, QSpinBox* );
private:
public:
IntegerRangeSliderConfigControl( vlc_object_t *, module_config_t *,
QLabel *, QSlider * );
- virtual ~IntegerRangeSliderConfigControl() {};
- virtual int getValue();
+ virtual int getValue() const;
protected:
QSlider *slider;
private:
class IntegerListConfigControl : public VIntConfigControl
{
+Q_OBJECT
public:
IntegerListConfigControl( vlc_object_t *, module_config_t *, QWidget *,
- bool, QGridLayout*, int& );
+ bool, QGridLayout*, int );
IntegerListConfigControl( vlc_object_t *, module_config_t *, QLabel *,
QComboBox*, bool );
- virtual ~IntegerListConfigControl() {};
- virtual int getValue();
- virtual void hide() { combo->hide(); label->hide(); }
- virtual void show() { combo->show(); label->show(); }
+ virtual int getValue() const;
+ virtual void hide() { combo->hide(); if( label ) label->hide(); }
+ virtual void show() { combo->show(); if( label ) label->show(); }
private:
- void finish( bool );
+ void finish(module_config_t * );
QLabel *label;
QComboBox *combo;
+private slots:
+ void actionRequested( int );
+
};
class BoolConfigControl : public VIntConfigControl
{
public:
BoolConfigControl( vlc_object_t *, module_config_t *, QWidget *,
- QGridLayout *, int& );
+ QGridLayout *, int );
BoolConfigControl( vlc_object_t *, module_config_t *,
- QLabel *, QCheckBox*, bool );
- virtual ~BoolConfigControl() {};
- virtual int getValue();
+ QLabel *, QAbstractButton* );
+ virtual int getValue() const;
virtual void show() { checkbox->show(); }
virtual void hide() { checkbox->hide(); }
+ virtual int getType() const { return CONFIG_ITEM_BOOL; }
private:
- QCheckBox *checkbox;
+ QAbstractButton *checkbox;
void finish();
};
ConfigControl(a,b,c) {};
VFloatConfigControl( vlc_object_t *a, module_config_t *b ) :
ConfigControl(a,b) {};
- virtual ~VFloatConfigControl() {};
- virtual float getValue() = 0;
- virtual int getType() { return 2; }
+ virtual float getValue() const = 0;
+ virtual int getType() const { return CONFIG_ITEM_FLOAT; }
+ virtual void doApply();
};
class FloatConfigControl : public VFloatConfigControl
Q_OBJECT
public:
FloatConfigControl( vlc_object_t *, module_config_t *, QWidget *,
- QGridLayout *, int& );
+ QGridLayout *, int );
FloatConfigControl( vlc_object_t *, module_config_t *,
QLabel*, QDoubleSpinBox* );
- virtual ~FloatConfigControl() {};
- virtual float getValue();
- virtual void show() { spin->show(); label->show(); }
- virtual void hide() { spin->hide(); label->hide(); }
+ virtual float getValue() const;
+ virtual void show() { spin->show(); if( label ) label->show(); }
+ virtual void hide() { spin->hide(); if( label ) label->hide(); }
protected:
QDoubleSpinBox *spin;
Q_OBJECT
public:
FloatRangeConfigControl( vlc_object_t *, module_config_t *, QWidget *,
- QGridLayout *, int& );
+ QGridLayout *, int );
FloatRangeConfigControl( vlc_object_t *, module_config_t *,
QLabel*, QDoubleSpinBox* );
private:
ConfigControl(a,b,c) {};
VStringConfigControl( vlc_object_t *a, module_config_t *b ) :
ConfigControl(a,b) {};
- virtual ~VStringConfigControl() {};
- virtual QString getValue() = 0;
- virtual int getType() { return 3; }
+ virtual QString getValue() const = 0;
+ virtual int getType() const { return CONFIG_ITEM_STRING; }
+ virtual void doApply();
};
class StringConfigControl : public VStringConfigControl
Q_OBJECT
public:
StringConfigControl( vlc_object_t *, module_config_t *, QWidget *,
- QGridLayout *, int&, bool pwd );
+ QGridLayout *, int, bool pwd );
StringConfigControl( vlc_object_t *, module_config_t *, QLabel *,
QLineEdit*, bool pwd );
- virtual ~StringConfigControl() {};
- virtual QString getValue() { return text->text(); };
- virtual void show() { text->show(); label->show(); }
- virtual void hide() { text->hide(); label->hide(); }
+ virtual QString getValue() const { return text->text(); };
+ virtual void show() { text->show(); if( label ) label->show(); }
+ virtual void hide() { text->hide(); if( label ) label->hide(); }
private:
void finish();
QLineEdit *text;
class FileConfigControl : public VStringConfigControl
{
- Q_OBJECT;
+ Q_OBJECT
public:
FileConfigControl( vlc_object_t *, module_config_t *, QWidget *,
- QGridLayout *, int&, bool pwd );
+ QGridLayout *, int );
FileConfigControl( vlc_object_t *, module_config_t *, QLabel *,
- QLineEdit *, QPushButton *, bool pwd );
- virtual ~FileConfigControl() {};
- virtual QString getValue() { return text->text(); };
- virtual void show() { text->show(); label->show(); browse->show(); }
- virtual void hide() { text->hide(); label->hide(); browse->hide(); }
+ QLineEdit *, QPushButton * );
+ virtual QString getValue() const { return text->text(); };
+ virtual void show() { text->show(); if( label ) label->show(); browse->show(); }
+ virtual void hide() { text->hide(); if( label ) label->hide(); browse->hide(); }
public slots:
virtual void updateField();
protected:
void finish();
-private:
QLineEdit *text;
QLabel *label;
QPushButton *browse;
class DirectoryConfigControl : public FileConfigControl
{
- Q_OBJECT;
+ Q_OBJECT
public:
DirectoryConfigControl( vlc_object_t *, module_config_t *, QWidget *,
- QGridLayout *, int&, bool pwd );
+ QGridLayout *, int );
DirectoryConfigControl( vlc_object_t *, module_config_t *, QLabel *,
- QLineEdit *, QPushButton *, bool pwd );
- virtual ~DirectoryConfigControl() {};
- virtual QString getValue() { return text->text(); };
- virtual void show() { text->show(); label->show(); browse->show(); }
- virtual void hide() { text->hide(); label->hide(); browse->hide(); }
+ QLineEdit *, QPushButton * );
public slots:
virtual void updateField();
-private:
- QLineEdit *text;
+};
+
+class FontConfigControl : public VStringConfigControl
+{
+ Q_OBJECT
+public:
+ FontConfigControl( vlc_object_t *, module_config_t *, QWidget *,
+ QGridLayout *, int);
+ FontConfigControl( vlc_object_t *, module_config_t *, QLabel *,
+ QFontComboBox *);
+ virtual QString getValue() const { return font->currentFont().family(); }
+protected:
QLabel *label;
- QPushButton *browse;
+ QFontComboBox *font;
};
class ModuleConfigControl : public VStringConfigControl
{
public:
ModuleConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool,
- QGridLayout*, int& );
+ QGridLayout*, int );
ModuleConfigControl( vlc_object_t *, module_config_t *, QLabel *,
QComboBox*, bool );
- virtual ~ModuleConfigControl() {};
- virtual QString getValue();
- virtual void hide() { combo->hide(); label->hide(); }
- virtual void show() { combo->show(); label->show(); }
+ virtual QString getValue() const;
+ virtual void hide() { combo->hide(); if( label ) label->hide(); }
+ virtual void show() { combo->show(); if( label ) label->show(); }
private:
void finish( bool );
QLabel *label;
QComboBox *combo;
};
+struct checkBoxListItem {
+ QCheckBox *checkBox;
+ char *psz_module;
+};
+
class ModuleListConfigControl : public VStringConfigControl
{
- Q_OBJECT;
+ Q_OBJECT
+ friend class ConfigControl;
public:
ModuleListConfigControl( vlc_object_t *, module_config_t *, QWidget *,
- bool, QGridLayout*, int& );
+ bool, QGridLayout*, int );
// ModuleListConfigControl( vlc_object_t *, module_config_t *, QLabel *,
// QComboBox*, bool );
virtual ~ModuleListConfigControl();
- virtual QString getValue();
+ virtual QString getValue() const;
virtual void hide();
virtual void show();
public slots:
- void wakeUp_TheUserJustClickedOnSomething( int value );
+ void onUpdate();
private:
void finish( bool );
- QVector<QCheckBox*> modules;
- QLabel *label;
+ QList<checkBoxListItem*> modules;
+ QGroupBox *groupBox;
QLineEdit *text;
};
class StringListConfigControl : public VStringConfigControl
{
+ Q_OBJECT
public:
StringListConfigControl( vlc_object_t *, module_config_t *, QWidget *,
- bool, QGridLayout*, int& );
+ QGridLayout*, int );
StringListConfigControl( vlc_object_t *, module_config_t *, QLabel *,
QComboBox*, bool );
- virtual ~StringListConfigControl() {};
- virtual QString getValue();
- virtual void hide() { combo->hide(); label->hide(); }
- virtual void show() { combo->show(); label->show(); }
+ virtual QString getValue() const;
+ virtual void hide() { combo->hide(); if( label ) label->hide(); }
+ virtual void show() { combo->show(); if( label ) label->show(); }
+ QComboBox *combo;
private:
- void finish( bool );
+ void finish(module_config_t * );
QLabel *label;
- QComboBox *combo;
+private slots:
+ void actionRequested( int );
+
};
+
+void setfillVLCConfigCombo(const char *configname, intf_thread_t *p_intf,
+ QComboBox *combo );
+
#if 0
struct ModuleCheckBox {
QCheckBox *checkbox;
/**********************************************************************
* Key selector widget
**********************************************************************/
-class KeyInputDialog : public QDialog
+class KeyShortcutEdit: public QLineEdit
{
+ Q_OBJECT
public:
- KeyInputDialog( QList<module_config_t *> &, const char * );
- int keyValue;
- bool conflicts;
+ void setValue( const QString& value ){ this->value = value; }
+ QString getValue() const { return value; }
+
+ void setGlobal( bool _value ) { b_global = _value; }
+ bool getGlobal() const { return b_global; }
+public slots:
+ virtual void clear(void) { value = qfu(""); QLineEdit::clear(); }
private:
- void keyPressEvent( QKeyEvent *);
- QLabel *selected;
- QLabel *warning;
- const char * keyToChange;
- QList<module_config_t*> values;
+ QString value;
+ bool b_global;
+ virtual void mousePressEvent( QMouseEvent *event );
+signals:
+ void pressed();
};
+class SearchLineEdit;
class KeySelectorControl : public ConfigControl
{
- Q_OBJECT;
+ Q_OBJECT
public:
KeySelectorControl( vlc_object_t *, module_config_t *, QWidget *,
- QGridLayout*, int& );
- virtual int getType() { return 4; }
- virtual ~KeySelectorControl() {};
- virtual void hide() { table->hide(); label->hide(); }
- virtual void show() { table->show(); label->show(); }
- void doApply();
+ QGridLayout*, int );
+ virtual int getType() const { return CONFIG_ITEM_KEY; }
+ virtual void hide() { table->hide(); if( label ) label->hide(); }
+ virtual void show() { table->show(); if( label ) label->show(); }
+ virtual void doApply();
private:
void finish();
QLabel *label;
QTreeWidget *table;
+ KeyShortcutEdit *shortcutValue;
QList<module_config_t *> values;
+ SearchLineEdit *actionSearch;
private slots:
- void selectKey( QTreeWidgetItem *);
+ void setTheKey();
+ void selectKey( QTreeWidgetItem * = NULL, int column = 1 );
+ void select( QTreeWidgetItem * = NULL, int column = 1 );
+ void select1Key();
+ void filter( const QString & );
};
+class KeyInputDialog : public QDialog
+{
+public:
+ KeyInputDialog( QTreeWidget *, const QString&, QWidget *, bool b_global = false);
+ int keyValue;
+ bool conflicts;
+private:
+ QTreeWidget *table;
+ void checkForConflicts( int i_vlckey );
+ void keyPressEvent( QKeyEvent *);
+ void wheelEvent( QWheelEvent *);
+ QLabel *selected, *warning;
+ QVBoxLayout *vLayout;
+ QDialogButtonBox *buttonBox;
+ bool b_global;
+};
#endif