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

* qt: add a FontConfigControl

parent e14328ac
......@@ -61,6 +61,7 @@ extern "C" {
#define CONFIG_ITEM_MODULE_CAT 0x0090 /* Module option */
#define CONFIG_ITEM_MODULE_LIST 0x00A0 /* Module option */
#define CONFIG_ITEM_MODULE_LIST_CAT 0x00B0 /* Module option */
#define CONFIG_ITEM_FONT 0x00C0 /* Font option */
#define CONFIG_ITEM 0x00F0
......
......@@ -46,6 +46,7 @@
#include <QPushButton>
#include <QSlider>
#include <QFileDialog>
#include <QFontDialog>
#include <vlc_keys.h>
......@@ -110,6 +111,10 @@ ConfigControl *ConfigControl::createControl( vlc_object_t *p_this,
p_control = new DirectoryConfigControl( p_this, p_item, parent, l,
line, false );
break;
case CONFIG_ITEM_FONT:
p_control = new FontConfigControl( p_this, p_item, parent, l,
line, false );
break;
case CONFIG_ITEM_KEY:
p_control = new KeySelectorControl( p_this, p_item, parent, l, line );
break;
......@@ -273,7 +278,6 @@ void FileConfigControl::finish()
}
/********* String / Directory **********/
DirectoryConfigControl::DirectoryConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, QWidget *_p_widget,
QGridLayout *_p_layout, int& _int, bool _pwd ) :
......@@ -286,7 +290,6 @@ DirectoryConfigControl::DirectoryConfigControl( vlc_object_t *_p_this,
FileConfigControl( _p_this, _p_item, _p_label, _p_line, _p_button, _pwd)
{}
void DirectoryConfigControl::updateField()
{
QString dir = QFileDialog::getExistingDirectory( NULL,
......@@ -297,6 +300,27 @@ void DirectoryConfigControl::updateField()
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 **********/
StringListConfigControl::StringListConfigControl( vlc_object_t *_p_this,
module_config_t *_p_item, QWidget *_parent, bool bycat,
......
......@@ -295,6 +295,19 @@ public slots:
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
{
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