]> git.sesse.net Git - vlc/commitdiff
* qt: add a FontConfigControl
authorYoann Peronneau <yoann@videolan.org>
Tue, 27 Mar 2007 21:54:16 +0000 (21:54 +0000)
committerYoann Peronneau <yoann@videolan.org>
Tue, 27 Mar 2007 21:54:16 +0000 (21:54 +0000)
include/vlc_configuration.h
modules/gui/qt4/components/preferences_widgets.cpp
modules/gui/qt4/components/preferences_widgets.hpp

index 1212aacaf639a6ed2336716e0992aa453812dc40..33b052f26100905f30596a3d5b03ecf9a54cc1e8 100644 (file)
@@ -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
 
index aea238411db1f92e06f2448ae40fe6e0e65fc1fa..0760c74a80ad1813cb621fc2d826cebc82130b32 100644 (file)
@@ -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,
index d27d7f16fc1e5883d0c13b3fc22d7805995cb0c2..76e5b5b5f3760b333de478b13edc24b29c604447 100644 (file)
@@ -266,9 +266,9 @@ class FileConfigControl : public VStringConfigControl
     Q_OBJECT;
 public:
     FileConfigControl( vlc_object_t *, module_config_t *, QWidget *,
-                         QGridLayout *, int&, bool pwd );
+                       QGridLayout *, int&, bool pwd );
     FileConfigControl( vlc_object_t *, module_config_t *, QLabel *,
-                        QLineEdit *, QPushButton *, bool pwd );
+                       QLineEdit *, QPushButton *, bool pwd );
     virtual ~FileConfigControl() {};
     virtual QString getValue() { return text->text(); };
     virtual void show() { text->show(); label->show(); browse->show(); }
@@ -287,14 +287,27 @@ class DirectoryConfigControl : public FileConfigControl
     Q_OBJECT;
 public:
     DirectoryConfigControl( vlc_object_t *, module_config_t *, QWidget *,
-                         QGridLayout *, int&, bool pwd );
+                            QGridLayout *, int&, bool pwd );
     DirectoryConfigControl( vlc_object_t *, module_config_t *, QLabel *,
-                        QLineEdit *, QPushButton *, bool pwd );
+                            QLineEdit *, QPushButton *, bool pwd );
     virtual ~DirectoryConfigControl() {};
 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: