[vlc-devel] [PATCH 4/5] gui/qt: extended_panels: refactor OptionFromWidgetName
Filip Roséen
filip at atch.se
Sat Feb 25 07:31:44 CET 2017
---
modules/gui/qt/components/extended_panels.cpp | 17 +++++------------
1 file changed, 5 insertions(+), 12 deletions(-)
diff --git a/modules/gui/qt/components/extended_panels.cpp b/modules/gui/qt/components/extended_panels.cpp
index 837932eb79..6a9c947520 100644
--- a/modules/gui/qt/components/extended_panels.cpp
+++ b/modules/gui/qt/components/extended_panels.cpp
@@ -39,6 +39,7 @@
#include <QFileDialog>
#include <QGraphicsScene>
#include <QPainter>
+#include <QRegExp>
#include "components/extended_panels.hpp"
#include "dialogs/preferences.hpp"
@@ -64,18 +65,10 @@ static const QString ModuleFromWidgetName( QObject *obj )
static QString OptionFromWidgetName( QObject *obj )
{
/* Gruik ? ... nah */
- QString option = obj->objectName().replace( "Slider", "" )
- .replace( "Combo" , "" )
- .replace( "Dial" , "" )
- .replace( "Check" , "" )
- .replace( "Spin" , "" )
- .replace( "Text" , "" );
- for( char a = 'A'; a <= 'Z'; a++ )
- {
- option = option.replace( QString( a ),
- QString( '-' ) + QString( a + 'a' - 'A' ) );
- }
- return option;
+ return obj->objectName()
+ .remove( QRegExp( "Slider|Combo|Dial|Check|Spin|Text" ) )
+ .replace( QRegExp( "([A-Z])" ), "-\\1" )
+ .toLower();
}
static inline void setup_vfilter( intf_thread_t *p_intf, const char* psz_name, QWidget *widget )
--
2.11.1
More information about the vlc-devel
mailing list