X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Fgui%2Fqt4%2Fcomponents%2Fpreferences_widgets.hpp;h=412f21e81e6f400855f1aeed615d0c6cac65edf8;hb=2a100fcd186304e600d6d896325855836fa899e6;hp=8f09e57c3f144f02aecccaec27aaf0e95e770aee;hpb=b1d9857cfcec04ad618bd13ca871b5d8a63193fa;p=vlc diff --git a/modules/gui/qt4/components/preferences_widgets.hpp b/modules/gui/qt4/components/preferences_widgets.hpp index 8f09e57c3f..412f21e81e 100644 --- a/modules/gui/qt4/components/preferences_widgets.hpp +++ b/modules/gui/qt4/components/preferences_widgets.hpp @@ -1,7 +1,7 @@ /***************************************************************************** * 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 @@ -23,27 +23,58 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ -#ifndef _INFOPANELS_H_ -#define _INFOPANELS_H_ -#include +#ifndef _PREFERENCESWIDGETS_H_ +#define _PREFERENCESWIDGETS_H_ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#include "qt4.hpp" +#include + #include -#include + +#include +#include #include +#include #include +#include #include -#include -#include +#include #include #include -#include -#include -#include -#include - -#include "qt4.hpp" -#include +#include +class QTreeWidget; +class QTreeWidgetItem; +class QGroupBox; class QGridLayout; +class QDialogButtonBox; +class QVBoxLayout; + +/******************************************************* + * 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 { @@ -79,8 +110,11 @@ protected: QString _name; QWidget *widget; bool _advanced; +#if 0 +/* You shouldn't use that now..*/ signals: void Updated(); +#endif }; /******************************************************* @@ -96,7 +130,7 @@ public: ConfigControl(a,b) {}; virtual ~VIntConfigControl() {}; virtual int getValue() = 0; - virtual int getType() { return 1; } + virtual int getType() { return CONFIG_ITEM_INTEGER; } }; class IntegerConfigControl : public VIntConfigControl @@ -111,8 +145,8 @@ public: QLabel*, QSlider* ); virtual ~IntegerConfigControl() {}; virtual int getValue(); - virtual void show() { spin->show(); label->show(); } - virtual void hide() { spin->hide(); label->hide(); } + virtual void show() { spin->show(); if( label ) label->show(); } + virtual void hide() { spin->hide(); if( label ) label->hide(); } protected: QSpinBox *spin; @@ -148,6 +182,7 @@ private: class IntegerListConfigControl : public VIntConfigControl { +Q_OBJECT public: IntegerListConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool, QGridLayout*, int& ); @@ -155,12 +190,15 @@ public: QComboBox*, bool ); virtual ~IntegerListConfigControl() {}; virtual int getValue(); - virtual void hide() { combo->hide(); label->hide(); } - virtual void show() { combo->show(); label->show(); } + 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 *, bool ); QLabel *label; QComboBox *combo; +private slots: + void actionRequested( int ); + }; class BoolConfigControl : public VIntConfigControl @@ -169,13 +207,14 @@ public: BoolConfigControl( vlc_object_t *, module_config_t *, QWidget *, QGridLayout *, int& ); BoolConfigControl( vlc_object_t *, module_config_t *, - QLabel *, QCheckBox*, bool ); + QLabel *, QAbstractButton*, bool ); virtual ~BoolConfigControl() {}; virtual int getValue(); virtual void show() { checkbox->show(); } virtual void hide() { checkbox->hide(); } + virtual int getType() { return CONFIG_ITEM_BOOL; } private: - QCheckBox *checkbox; + QAbstractButton *checkbox; void finish(); }; @@ -192,7 +231,7 @@ public: ConfigControl(a,b) {}; virtual ~VFloatConfigControl() {}; virtual float getValue() = 0; - virtual int getType() { return 2; } + virtual int getType() { return CONFIG_ITEM_FLOAT; } }; class FloatConfigControl : public VFloatConfigControl @@ -205,8 +244,8 @@ public: QLabel*, QDoubleSpinBox* ); virtual ~FloatConfigControl() {}; virtual float getValue(); - virtual void show() { spin->show(); label->show(); } - virtual void hide() { spin->hide(); label->hide(); } + virtual void show() { spin->show(); if( label ) label->show(); } + virtual void hide() { spin->hide(); if( label ) label->hide(); } protected: QDoubleSpinBox *spin; @@ -241,7 +280,7 @@ public: ConfigControl(a,b) {}; virtual ~VStringConfigControl() {}; virtual QString getValue() = 0; - virtual int getType() { return 3; } + virtual int getType() { return CONFIG_ITEM_STRING; } }; class StringConfigControl : public VStringConfigControl @@ -254,8 +293,8 @@ public: 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 void show() { text->show(); if( label ) label->show(); } + virtual void hide() { text->hide(); if( label ) label->hide(); } private: void finish(); QLineEdit *text; @@ -264,16 +303,16 @@ private: 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 ); + QLineEdit *, QPushButton * ); 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(); } + 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: @@ -285,28 +324,30 @@ protected: 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 ); + QLineEdit *, QPushButton * ); virtual ~DirectoryConfigControl() {}; public slots: virtual void updateField(); }; -class FontConfigControl : public FileConfigControl +class FontConfigControl : public VStringConfigControl { - Q_OBJECT; + Q_OBJECT public: FontConfigControl( vlc_object_t *, module_config_t *, QWidget *, - QGridLayout *, int&, bool pwd ); + QGridLayout *, int&); FontConfigControl( vlc_object_t *, module_config_t *, QLabel *, - QLineEdit *, QPushButton *, bool pwd ); + QFontComboBox *); virtual ~FontConfigControl() {}; -public slots: - virtual void updateField(); + virtual QString getValue(){ return font->currentFont().family(); } +protected: + QLabel *label; + QFontComboBox *font; }; class ModuleConfigControl : public VStringConfigControl @@ -318,17 +359,23 @@ public: QComboBox*, bool ); virtual ~ModuleConfigControl() {}; virtual QString getValue(); - virtual void hide() { combo->hide(); label->hide(); } - virtual void show() { combo->show(); label->show(); } + 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& ); @@ -339,16 +386,17 @@ public: virtual void hide(); virtual void show(); public slots: - void wakeUp_TheUserJustClickedOnSomething( int value ); + void onUpdate(); private: void finish( bool ); - QVector modules; + QVector modules; QGroupBox *groupBox; QLineEdit *text; }; class StringListConfigControl : public VStringConfigControl { + Q_OBJECT public: StringListConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool, QGridLayout*, int& ); @@ -356,13 +404,20 @@ public: QComboBox*, bool ); virtual ~StringListConfigControl() {}; virtual QString getValue(); - virtual void hide() { combo->hide(); label->hide(); } - virtual void show() { combo->show(); label->show(); } + 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 *, bool ); 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; @@ -387,40 +442,66 @@ private slot: /********************************************************************** * Key selector widget **********************************************************************/ -class KeyInputDialog : public QDialog +class KeyShortcutEdit: public QLineEdit { + Q_OBJECT public: - KeyInputDialog( QList &, const char * ); - int keyValue; - bool conflicts; + void setValue( int _value ){ value = _value; } + int getValue() const { return value; } + + void setGlobal( bool _value ) { b_global = _value; } + bool getGlobal() const { return b_global; } +public slots: + virtual void clear(void) { value = 0; QLineEdit::clear(); } private: - void checkForConflicts( int i_vlckey ); - void keyPressEvent( QKeyEvent *); - void wheelEvent( QWheelEvent *); - QLabel *selected; - QLabel *warning; - const char * keyToChange; - QList values; + int 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 int getType() { return CONFIG_ITEM_KEY; } virtual ~KeySelectorControl() {}; - virtual void hide() { table->hide(); label->hide(); } - virtual void show() { table->show(); label->show(); } + virtual void hide() { table->hide(); if( label ) label->hide(); } + virtual void show() { table->show(); if( label ) label->show(); } void doApply(); private: void finish(); QLabel *label; QTreeWidget *table; + KeyShortcutEdit *shortcutValue; QList 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