[vlmc-devel] commit: Preferences: Adding a Password flag. ( Hugo Beauzée-Luyssen )
git at videolan.org
git at videolan.org
Thu Jul 8 12:24:54 CEST 2010
vlmc | branch: master | Hugo Beauzée-Luyssen <beauze.h at gmail.com> | Thu Jul 8 12:24:53 2010 +0200| [b4f8942a358cb885b883f2bb4a3d885fd29f899f] | committer: Hugo Beauzée-Luyssen
Preferences: Adding a Password flag.
The proxy password is now a password, and is displayed as such.
> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=b4f8942a358cb885b883f2bb4a3d885fd29f899f
---
src/Gui/MainWindow.cpp | 2 +-
src/Gui/settings/StringWidget.cpp | 2 ++
src/Settings/SettingValue.h | 3 ++-
src/Settings/SettingsManager.h | 3 +++
4 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index 5059945..48f68bf 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -287,7 +287,7 @@ MainWindow::initVlmcPreferences()
QT_TRANSLATE_NOOP( "PreferenceWidget", "Proxy Username" ),
QT_TRANSLATE_NOOP( "PreferenceWidget", "The HTTP Proxy Username" ) );
- VLMC_CREATE_PREFERENCE_STRING( "network/ProxyPassword", "",
+ VLMC_CREATE_PREFERENCE_PASSWORD( "network/ProxyPassword", "",
QT_TRANSLATE_NOOP( "PreferenceWidget", "Proxy Password" ),
QT_TRANSLATE_NOOP( "PreferenceWidget", "The HTTP Proxy Password" ) );
diff --git a/src/Gui/settings/StringWidget.cpp b/src/Gui/settings/StringWidget.cpp
index 9d4305d..bd131a4 100644
--- a/src/Gui/settings/StringWidget.cpp
+++ b/src/Gui/settings/StringWidget.cpp
@@ -29,6 +29,8 @@ StringWidget::StringWidget( SettingValue *s, QWidget *parent /*= NULL*/ ) :
m_setting( s )
{
m_lineEdit = new QLineEdit( parent );
+ if ( ( s->flags() & SettingValue::Password ) != 0 )
+ m_lineEdit->setEchoMode( QLineEdit::Password );
connect( s, SIGNAL( changed( const QVariant& ) ),
this, SLOT( changed( const QVariant& ) ) );
changed( s->get() );
diff --git a/src/Settings/SettingValue.h b/src/Settings/SettingValue.h
index 2d72956..b00c9f7 100644
--- a/src/Settings/SettingValue.h
+++ b/src/Settings/SettingValue.h
@@ -51,7 +51,8 @@ class SettingValue : public QObject
{
Nothing = 0,
/// If this flag is used, then the variable should not be shown in the config widgets.
- Private = 1,
+ Private = 1 << 0,
+ Password = 1 << 1,
};
/**
diff --git a/src/Settings/SettingsManager.h b/src/Settings/SettingsManager.h
index dcebbc9..f786d04 100644
--- a/src/Settings/SettingsManager.h
+++ b/src/Settings/SettingsManager.h
@@ -92,6 +92,9 @@ SettingsManager::getInstance()->createVar( type, key, defaultValue, name, \
VLMC_CREATE_PREFERENCE( SettingValue::String, key, defaultValue, "", "", SettingValue::Private )
#define VLMC_CREATE_PRIVATE_PROJECT_STRING( key, defaultValue ) \
VLMC_CREATE_PROJECT_VAR( SettingValue::String, key, defaultValue, "", "", SettingValue::Private )
+#define VLMC_CREATE_PREFERENCE_PASSWORD( key, defaultValue, name, desc ) \
+ VLMC_CREATE_PREFERENCE( SettingValue::String, key, defaultValue, name, desc, SettingValue::Password )
+
class SettingsManager : public QObject, public Singleton<SettingsManager>
{
More information about the Vlmc-devel
mailing list