Commit 42980ccc authored by Yoann Peronneau's avatar Yoann Peronneau

* qt: add a FontConfigControl

parent e14328ac
...@@ -61,6 +61,7 @@ extern "C" { ...@@ -61,6 +61,7 @@ extern "C" {
#define CONFIG_ITEM_MODULE_CAT 0x0090 /* Module option */ #define CONFIG_ITEM_MODULE_CAT 0x0090 /* Module option */
#define CONFIG_ITEM_MODULE_LIST 0x00A0 /* Module option */ #define CONFIG_ITEM_MODULE_LIST 0x00A0 /* Module option */
#define CONFIG_ITEM_MODULE_LIST_CAT 0x00B0 /* Module option */ #define CONFIG_ITEM_MODULE_LIST_CAT 0x00B0 /* Module option */
#define CONFIG_ITEM_FONT 0x00C0 /* Font option */
#define CONFIG_ITEM 0x00F0 #define CONFIG_ITEM 0x00F0
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#include <QPushButton> #include <QPushButton>
#include <QSlider> #include <QSlider>
#include <QFileDialog> #include <QFileDialog>
#include <QFontDialog>
#include <vlc_keys.h> #include <vlc_keys.h>
...@@ -110,6 +111,10 @@ ConfigControl *ConfigControl::createControl( vlc_object_t *p_this, ...@@ -110,6 +111,10 @@ ConfigControl *ConfigControl::createControl( vlc_object_t *p_this,
p_control = new DirectoryConfigControl( p_this, p_item, parent, l, p_control = new DirectoryConfigControl( p_this, p_item, parent, l,
line, false ); line, false );
break; break;
case CONFIG_ITEM_FONT:
p_control = new FontConfigControl( p_this, p_item, parent, l,
line, false );
break;
case CONFIG_ITEM_KEY: case CONFIG_ITEM_KEY:
p_control = new KeySelectorControl( p_this, p_item, parent, l, line ); p_control = new KeySelectorControl( p_this, p_item, parent, l, line );
break; break;
...@@ -273,7 +278,6 @@ void FileConfigControl::finish() ...@@ -273,7 +278,6 @@ void FileConfigControl::finish()
} }
/********* String / Directory **********/ /********* String / Directory **********/
DirectoryConfigControl::DirectoryConfigControl( vlc_object_t *_p_this, DirectoryConfigControl::DirectoryConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, QWidget *_p_widget, module_config_t *_p_item, QWidget *_p_widget,
QGridLayout *_p_layout, int& _int, bool _pwd ) : QGridLayout *_p_layout, int& _int, bool _pwd ) :
...@@ -286,7 +290,6 @@ DirectoryConfigControl::DirectoryConfigControl( vlc_object_t *_p_this, ...@@ -286,7 +290,6 @@ DirectoryConfigControl::DirectoryConfigControl( vlc_object_t *_p_this,
FileConfigControl( _p_this, _p_item, _p_label, _p_line, _p_button, _pwd) FileConfigControl( _p_this, _p_item, _p_label, _p_line, _p_button, _pwd)
{} {}
void DirectoryConfigControl::updateField() void DirectoryConfigControl::updateField()
{ {
QString dir = QFileDialog::getExistingDirectory( NULL, QString dir = QFileDialog::getExistingDirectory( NULL,
...@@ -297,6 +300,27 @@ void DirectoryConfigControl::updateField() ...@@ -297,6 +300,27 @@ void DirectoryConfigControl::updateField()
text->setText( dir ); text->setText( dir );
} }
/********* String / Font **********/
FontConfigControl::FontConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, QWidget *_p_widget,
QGridLayout *_p_layout, int& _int, bool _pwd ) :
FileConfigControl( _p_this, _p_item, _p_widget, _p_layout, _int, _pwd)
{}
FontConfigControl::FontConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, QLabel *_p_label,
QLineEdit *_p_line, QPushButton *_p_button, bool _pwd ):
FileConfigControl( _p_this, _p_item, _p_label, _p_line, _p_button, _pwd)
{}
void FontConfigControl::updateField()
{
bool ok;
QFont font = QFontDialog::getFont( &ok, QFont( text->text() ), NULL );
if( !ok ) return;
text->setText( font.family() );
}
/********* String / choice list **********/ /********* String / choice list **********/
StringListConfigControl::StringListConfigControl( vlc_object_t *_p_this, StringListConfigControl::StringListConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, QWidget *_parent, bool bycat, module_config_t *_p_item, QWidget *_parent, bool bycat,
......
...@@ -266,9 +266,9 @@ class FileConfigControl : public VStringConfigControl ...@@ -266,9 +266,9 @@ class FileConfigControl : public VStringConfigControl
Q_OBJECT; Q_OBJECT;
public: public:
FileConfigControl( vlc_object_t *, module_config_t *, QWidget *, FileConfigControl( vlc_object_t *, module_config_t *, QWidget *,
QGridLayout *, int&, bool pwd ); QGridLayout *, int&, bool pwd );
FileConfigControl( vlc_object_t *, module_config_t *, QLabel *, FileConfigControl( vlc_object_t *, module_config_t *, QLabel *,
QLineEdit *, QPushButton *, bool pwd ); QLineEdit *, QPushButton *, bool pwd );
virtual ~FileConfigControl() {}; virtual ~FileConfigControl() {};
virtual QString getValue() { return text->text(); }; virtual QString getValue() { return text->text(); };
virtual void show() { text->show(); label->show(); browse->show(); } virtual void show() { text->show(); label->show(); browse->show(); }
...@@ -287,14 +287,27 @@ class DirectoryConfigControl : public FileConfigControl ...@@ -287,14 +287,27 @@ class DirectoryConfigControl : public FileConfigControl
Q_OBJECT; Q_OBJECT;
public: public:
DirectoryConfigControl( vlc_object_t *, module_config_t *, QWidget *, DirectoryConfigControl( vlc_object_t *, module_config_t *, QWidget *,
QGridLayout *, int&, bool pwd ); QGridLayout *, int&, bool pwd );
DirectoryConfigControl( vlc_object_t *, module_config_t *, QLabel *, DirectoryConfigControl( vlc_object_t *, module_config_t *, QLabel *,
QLineEdit *, QPushButton *, bool pwd ); QLineEdit *, QPushButton *, bool pwd );
virtual ~DirectoryConfigControl() {}; virtual ~DirectoryConfigControl() {};
public slots: public slots:
virtual void updateField(); virtual void updateField();
}; };
class FontConfigControl : public FileConfigControl
{
Q_OBJECT;
public:
FontConfigControl( vlc_object_t *, module_config_t *, QWidget *,
QGridLayout *, int&, bool pwd );
FontConfigControl( vlc_object_t *, module_config_t *, QLabel *,
QLineEdit *, QPushButton *, bool pwd );
virtual ~FontConfigControl() {};
public slots:
virtual void updateField();
};
class ModuleConfigControl : public VStringConfigControl class ModuleConfigControl : public VStringConfigControl
{ {
public: public:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment