[vlmc-devel] commit: Don't rely on a label to retreive settings. ( Hugo Beauzée-Luyssen )

git at videolan.org git at videolan.org
Sat Oct 30 17:26:34 CEST 2010


vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Tue Oct 26 17:47:16 2010 +0200| [01f299636c23b364fb2b76566981051419b2fa04] | committer: Hugo Beauzée-Luyssen 

Don't rely on a label to retreive settings.

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=01f299636c23b364fb2b76566981051419b2fa04
---

 src/Gui/MainWindow.cpp                |   14 +++++++-------
 src/Gui/settings/PreferenceWidget.cpp |    6 +++---
 src/Gui/settings/PreferenceWidget.h   |    2 +-
 src/Gui/settings/Settings.cpp         |    6 +++---
 src/Gui/settings/Settings.h           |    3 ++-
 5 files changed, 16 insertions(+), 15 deletions(-)

diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index a2d178c..de911de 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -518,13 +518,13 @@ void
 MainWindow::createGlobalPreferences()
 {
     m_globalPreferences = new Settings( SettingsManager::Vlmc, this );
-    m_globalPreferences->addCategory( QT_TRANSLATE_NOOP( "Settings", "General" ), SettingsManager::Vlmc,
+    m_globalPreferences->addCategory( "general", QT_TRANSLATE_NOOP( "Settings", "General" ), SettingsManager::Vlmc,
                                      QIcon( ":/images/vlmc" ) );
-    m_globalPreferences->addCategory( QT_TRANSLATE_NOOP( "Settings", "Keyboard" ), SettingsManager::Vlmc,
+    m_globalPreferences->addCategory( "keyboard", QT_TRANSLATE_NOOP( "Settings", "Keyboard" ), SettingsManager::Vlmc,
                                      QIcon( ":/images/keyboard" ) );
-    m_globalPreferences->addCategory( QT_TRANSLATE_NOOP( "Settings", "YouTube" ), SettingsManager::Vlmc,
+    m_globalPreferences->addCategory( "youtube", QT_TRANSLATE_NOOP( "Settings", "YouTube" ), SettingsManager::Vlmc,
                                      QIcon( ":/images/youtube" ) );
-    m_globalPreferences->addCategory( QT_TRANSLATE_NOOP( "Settings", "Network" ), SettingsManager::Vlmc,
+    m_globalPreferences->addCategory( "network", QT_TRANSLATE_NOOP( "Settings", "Network" ), SettingsManager::Vlmc,
                                      QIcon( ":/images/network" ) );
 }
 
@@ -551,11 +551,11 @@ void
 MainWindow::createProjectPreferences()
 {
     m_projectPreferences = new Settings( SettingsManager::Project, this );
-    m_projectPreferences->addCategory( QT_TRANSLATE_NOOP( "Settings", "General" ), SettingsManager::Project,
+    m_projectPreferences->addCategory( "general", QT_TRANSLATE_NOOP( "Settings", "General" ), SettingsManager::Project,
                                    QIcon( ":/images/vlmc" ) );
-    m_projectPreferences->addCategory( QT_TRANSLATE_NOOP( "Settings", "Video" ), SettingsManager::Project,
+    m_projectPreferences->addCategory( "video", QT_TRANSLATE_NOOP( "Settings", "Video" ), SettingsManager::Project,
                                    QIcon( ":/images/video" ) );
-    m_projectPreferences->addCategory( QT_TRANSLATE_NOOP( "Settings", "Audio" ), SettingsManager::Project,
+    m_projectPreferences->addCategory( "audio", QT_TRANSLATE_NOOP( "Settings", "Audio" ), SettingsManager::Project,
                                    QIcon( ":/images/audio" ) );
 }
 
diff --git a/src/Gui/settings/PreferenceWidget.cpp b/src/Gui/settings/PreferenceWidget.cpp
index d51a2e0..931946f 100644
--- a/src/Gui/settings/PreferenceWidget.cpp
+++ b/src/Gui/settings/PreferenceWidget.cpp
@@ -42,14 +42,14 @@
 #include <QHashIterator>
 #include <QEvent>
 
-PreferenceWidget::PreferenceWidget( const char *category, SettingsManager::Type type,
+PreferenceWidget::PreferenceWidget( const QString &name, const char *label, SettingsManager::Type type,
                                     QWidget *parent ) :
     QScrollArea( parent ),
-    m_category( category )
+    m_category( label )
 {
     QWidget     *container = new QWidget( this );
     SettingsManager::SettingList    settings =
-            SettingsManager::getInstance()->group( QString( category ), type );
+            SettingsManager::getInstance()->group( name, type );
     QFormLayout *layout = new QFormLayout( container );
     layout->setFieldGrowthPolicy( QFormLayout::AllNonFixedFieldsGrow );
 
diff --git a/src/Gui/settings/PreferenceWidget.h b/src/Gui/settings/PreferenceWidget.h
index 78ba8f9..96d85b5 100644
--- a/src/Gui/settings/PreferenceWidget.h
+++ b/src/Gui/settings/PreferenceWidget.h
@@ -40,7 +40,7 @@ class   PreferenceWidget : public QScrollArea
     Q_OBJECT
     public:
         typedef QList<ISettingsCategoryWidget*>    SettingsList;
-        PreferenceWidget( const char* category, SettingsManager::Type type,
+        PreferenceWidget( const QString &name, const char* category, SettingsManager::Type type,
                           QWidget* parent = 0 );
         virtual ~PreferenceWidget() {}
 
diff --git a/src/Gui/settings/Settings.cpp b/src/Gui/settings/Settings.cpp
index 9a817d4..b6dcb94 100644
--- a/src/Gui/settings/Settings.cpp
+++ b/src/Gui/settings/Settings.cpp
@@ -62,16 +62,16 @@ Settings::Settings( SettingsManager::Type type, QWidget *parent ) :
 }
 
 void
-Settings::addCategory( const char *name,
+Settings::addCategory( const QString &name, const char *label,
                        SettingsManager::Type type,
                        const QIcon &icon )
 {
-    PreferenceWidget    *pWidget = new PreferenceWidget( name, type, this );
+    PreferenceWidget    *pWidget = new PreferenceWidget( name, label, type, this );
 
     m_stackedLayout->addWidget( pWidget );
 
     // Create a button linked to the widget using its index
-    m_panel->addButton( name, icon, m_stackedLayout->count() - 1 );
+    m_panel->addButton( label, icon, m_stackedLayout->count() - 1 );
 
     switchWidget( 0 );
 }
diff --git a/src/Gui/settings/Settings.h b/src/Gui/settings/Settings.h
index 3379280..cbd592f 100644
--- a/src/Gui/settings/Settings.h
+++ b/src/Gui/settings/Settings.h
@@ -47,7 +47,8 @@ class   Settings : public QDialog
     public:
         Settings( SettingsManager::Type type, QWidget *parent = 0 );
 
-        void                        addCategory( const char *name,
+        void                        addCategory( const QString& categorieName,
+                                                 const char *label,
                                                  SettingsManager::Type type,
                                                  const QIcon &icon );
 



More information about the Vlmc-devel mailing list