]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/complete_preferences.cpp
- qt4: retrict FileDialog changes to win32
[vlc] / modules / gui / qt4 / components / complete_preferences.cpp
index cb50ae869d242f5565326e8adc5c7ec5e8d8f614..b77ce3c2725c256c18d8dc5a796815de8ce17cdd 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * preferences.cpp : "Normal preferences"
  ****************************************************************************
- * Copyright (C) 2006 the VideoLAN team
+ * Copyright (C) 2006-2007 the VideoLAN team
  * $Id$
  *
  * Authors: ClĂ©ment Stenac <zorglub@videolan.org>
@@ -97,7 +97,7 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) :
     for (size_t i = 0; i < p_module->confsize; i++)
     {
         const module_config_t *p_item = p_module->p_config + i;
-        char *psz_help;
+        const char *psz_help;
         QIcon icon;
         switch( p_item->i_type )
         {
@@ -188,31 +188,33 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) :
     /* Build the tree of plugins */
     for( int i_index = 0; i_index < p_list->i_count; i_index++ )
     {
-        int i_subcategory = -1, i_category = -1, i_options = 0;
         p_module = (module_t *)p_list->p_values[i_index].p_object;
 
         // Main module excluded
         if( !strcmp( p_module->psz_object_name, "main" ) ) continue;
 
-        /* Exclude empty plugins (submodules don't have config options, they
-         * are stored in the parent module) */
+        /* Exclude submodules; they have no config options of their own */
         if( p_module->b_submodule ) continue;
 
+        unsigned i_subcategory = 0, i_category = 0;
+        bool b_options = false;
+
         for (size_t i = 0; i < p_module->confsize; i++)
         {
-            module_config_t *p_item = p_module->p_config + i;
+            const module_config_t *p_item = p_module->p_config + i;
 
             if( p_item->i_type == CONFIG_CATEGORY )
                 i_category = p_item->value.i;
             else if( p_item->i_type == CONFIG_SUBCATEGORY )
                 i_subcategory = p_item->value.i;
+
             if( p_item->i_type & CONFIG_ITEM )
-                i_options++;
+                b_options = true;
 
-            if( i_options > 0 && i_category >= 0 && i_subcategory >= 0 )
+            if( b_options && i_category && i_subcategory )
                 break;
         }
-        if( !i_options ) continue; // Nothing to display
+        if( !b_options || i_category == 0 || i_subcategory == 0 ) continue;
 
         // Locate the category item;
         QTreeWidgetItem *subcat_item = NULL;
@@ -373,9 +375,14 @@ PrefsPanel::PrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
         }
     }
 
+    /* Widgets now */
     global_layout = new QVBoxLayout();
     global_layout->setMargin( 2 );
     QString head;
+    QString help;
+
+    help = QString( data->help );
+
     if( data->i_type == TYPE_SUBCATEGORY || data->i_type ==  TYPE_CATSUBCAT )
     {
         head = QString( data->name );
@@ -386,21 +393,28 @@ PrefsPanel::PrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
         head = QString( qfu(p_module->psz_longname) );
         if( p_module->psz_help )
         {
-            head.append( "\n" );
-            head.append( qfu( p_module->psz_help ) );
+            help.append( "\n" );
+            help.append( qfu( p_module->psz_help ) );
         }
     }
 
-    QLabel *label = new QLabel( head );
-    global_layout->addWidget( label );
-    QFont myFont = QApplication::font( static_cast<QWidget*>(0) );
-    myFont.setPointSize( myFont.pointSize() + 3 ); myFont.setBold( true );
+    QLabel *titleLabel = new QLabel( head );
+    QFont titleFont = QApplication::font( static_cast<QWidget*>(0) );
+    titleFont.setPointSize( titleFont.pointSize() + 6 );
+    titleFont.setFamily( "Verdana" );
+    titleLabel->setFont( titleFont );
+
+    // Title <hr>
+    QFrame *title_line = new QFrame;
+    title_line->setFrameShape(QFrame::HLine);
+    title_line->setFrameShadow(QFrame::Sunken);
 
-    label->setFont( myFont );
-    QLabel *help = new QLabel( data->help, this );
-    help->setWordWrap( true );
+    QLabel *helpLabel = new QLabel( help, this );
+    helpLabel->setWordWrap( true );
 
-    global_layout->addWidget( help );
+    global_layout->addWidget( titleLabel );
+    global_layout->addWidget( title_line );
+    global_layout->addWidget( helpLabel );
 
     QGroupBox *box = NULL;
     QGridLayout *boxlayout = NULL;