[vlc-commits] [Git][videolan/vlc][master] 19 commits: qt: purge some junk code
Jean-Baptiste Kempf
gitlab at videolan.org
Fri Jun 11 10:15:10 UTC 2021
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
ac2d6177 by Lyndon Brown at 2021-06-11T09:11:50+00:00
qt: purge some junk code
- - - - -
817bf9e6 by Lyndon Brown at 2021-06-11T09:11:50+00:00
qt: remove useless code
- - - - -
dfc18c28 by Lyndon Brown at 2021-06-11T09:11:50+00:00
qt: remove pointless else's
- - - - -
e09db820 by Lyndon Brown at 2021-06-11T09:11:50+00:00
qt: remove unused custom QElidingLabel widget
unused since dda157b5ea68d1893241e91ce99d0367919db95b
- - - - -
d38c9219 by Lyndon Brown at 2021-06-11T09:11:50+00:00
qt: remove unused custom QVLCStackedWidget widget
unused since e1c82853965d44b4390af78d9184bd0b60ccc3fb
- - - - -
3983cdea by Lyndon Brown at 2021-06-11T09:11:50+00:00
qt: purge redundant type cases
the `getType()` call actually returns the type class, and all of these
removed types inherit from the generic string control class, which returns
`CONFIG_ITEM_STRING` when this method is called.
- - - - -
3340d3cc by Lyndon Brown at 2021-06-11T09:11:50+00:00
config: move config test macros
i have a use for `CONFIG_CLASS` now in the qt prefs code, and elsewhere in
later work.
the other test macros may be useful to have publicly for preference
interface code so were moved also, and besides, having them all in one
place makes finding them and maintaining them easier. there's no harm in
exposing them to plugins.
- - - - -
98b04191 by Lyndon Brown at 2021-06-11T09:11:50+00:00
qt: clean up control `getType()`
1. the name suggests that it returns an item's type, yet in fact it
returns the item's type class, so essentially it gives up false
information, as named. (one exception is the hotkey group control which
actually does give up its specific type, yet that is somewhat a lie also
because the control does not represent a single config item).
2. any efficiency gain from returning a hard-coded value is dwarfed by the
mess and fragility of having a collection of implementations cluttering
the files, returning hard coded values. it is much more straight
forward to just return the item's actual type value, and either let the
caller use `CONFIG_CLASS()` on it where appropriate, (or do it for them
with a more suitably named method).
3. this method is only used in one single place, the open-capture-advanced
code, so is certainly not worth the mess.
this reworks the method to a single implementation on the base class, which
just returns an item's raw and actual type.
to account for the special hotkey group control which has a null item
pointer since it is not linked to a single config item unlike all other
controls, it guardedly returns `-1` if the item pointer is null.
the one user of this function, (which happens to have no interest in the
hotkey control), now gets the raw type, asserts that it did not unexpectedly
get `-1` to protect against any future mistake, reduces the type down to
type class itself to get the info it actually wants, and proceeds from there
as normal.
- - - - -
455e10bc by Lyndon Brown at 2021-06-11T09:11:50+00:00
qt: add explanation
- - - - -
eb75ffe8 by Lyndon Brown at 2021-06-11T09:11:50+00:00
qt: fix indentation
- - - - -
b9a0c682 by Lyndon Brown at 2021-06-11T09:11:50+00:00
qt: fix simple prefs section comment block consistency
- - - - -
a4a17f0c by Lyndon Brown at 2021-06-11T09:11:50+00:00
qt: some formatting fixes
- - - - -
7dc04eaf by Lyndon Brown at 2021-06-11T09:11:50+00:00
qt: remove unused param
no control uses the `vlc_object_t` object captured by the base class, so
let's remove it, making things much tidier and more understandable.
- - - - -
601ff86a by Lyndon Brown at 2021-06-11T09:11:50+00:00
qt: reorganise prefs widget code
move methods such that types with multiple constructors have them adjacent
to each other, rather than having other methods in between.
the point of this was that it made the code much easier for me to work with.
- - - - -
57c347db by Lyndon Brown at 2021-06-11T09:11:50+00:00
qt: merge lazy creation of related widgets
the search filter for the advanced preferences tree should always be
lazily created at the same time we lazily create the tree widget itself.
there would never be a situation where this function would find one already
created and not the other. we can thus merge the condition blocks here.
- - - - -
b7beda95 by Lyndon Brown at 2021-06-11T09:11:50+00:00
qt: reorganise the lazy advanced prefs panel creation code
with the adv tree and tree filter lazy creation condition blocks now
merged, let's reorganise the construction code more logically.
- - - - -
fea4bf5e by Lyndon Brown at 2021-06-11T09:11:50+00:00
qt: reorganise prefs construction code
it makes it much easier to understand the makeup and contruction of
each individual view and of the entire window this way, with the
components and construction code for each view grouped more
logically together. even more so when a new view is added in later
work of mine. grouping by type of component and interweaving the
creation of the views just make things unnecessarily harder to
follow and work with.
- - - - -
08ef6e13 by Lyndon Brown at 2021-06-11T09:11:50+00:00
qt: remove unneeded code
we have absolutely no need for such a dummy panel.
- - - - -
259f2753 by Lyndon Brown at 2021-06-11T09:11:50+00:00
qt: split out password control creation into dedicated type
the string type was unusual in having a special extra boolean parameter to
select between an ordinary string type control and a password type one,
rather than having a password specific type which derived from it, as
everything else does.
splitting out password controls into their own derived type simplifies
things a little.
it also achieves two other things:
- it puts us into a position from which we can further customise password
controls, as i have done in some later work to be submitted after this.
- it makes it easier/cleaner to add further string derivative controls,
as i also have done in at least one instance in other work.
note that we are also removing a boolean param from the constructors of
`IntegerListConfigControl`. this type only had this param because the
string type did, in connection to the use of generic macros in the simple
preferences code.
- - - - -
12 changed files:
- include/vlc_plugin.h
- modules/gui/qt/dialogs/open/open_panels.cpp
- modules/gui/qt/dialogs/preferences/complete_preferences.cpp
- modules/gui/qt/dialogs/preferences/complete_preferences.hpp
- modules/gui/qt/dialogs/preferences/preferences.cpp
- modules/gui/qt/dialogs/preferences/preferences.hpp
- modules/gui/qt/dialogs/preferences/preferences_widgets.cpp
- modules/gui/qt/dialogs/preferences/preferences_widgets.hpp
- modules/gui/qt/dialogs/preferences/simple_preferences.cpp
- modules/gui/qt/widgets/native/customwidgets.cpp
- modules/gui/qt/widgets/native/customwidgets.hpp
- src/config/configuration.h
Changes:
=====================================
include/vlc_plugin.h
=====================================
@@ -131,8 +131,19 @@ enum vlc_module_properties
#define CONFIG_ITEM_DIRECTORY 0x8E /* Directory option */
#define CONFIG_ITEM_FONT 0x8F /* Font option */
+/* reduce specific type to type class */
+#define CONFIG_CLASS(x) ((x) & ~0x1F)
+
+/* is proper option, not a special hint type? */
#define CONFIG_ITEM(x) (((x) & ~0xF) != 0)
+#define IsConfigStringType(type) \
+ (((type) & CONFIG_ITEM_STRING) != 0)
+#define IsConfigIntegerType(type) \
+ (((type) & CONFIG_ITEM_INTEGER) != 0)
+#define IsConfigFloatType(type) \
+ ((type) == CONFIG_ITEM_FLOAT)
+
/* Hidden categories and subcategories */
/* Any options under this will be hidden in the GUI preferences, but will be
listed in cmdline help output. */
=====================================
modules/gui/qt/dialogs/open/open_panels.cpp
=====================================
@@ -29,6 +29,8 @@
# include "config.h"
#endif
+#include <assert.h>
+
#include "qt.hpp"
#include "maininterface/main_interface.hpp"
#include "open_panels.hpp"
@@ -801,14 +803,12 @@ void CaptureOpenPanel::initialize()
/* dshow Main */
int line = 0;
module_config_t *p_config = config_FindConfig( "dshow-vdev" );
- vdevDshowW = new StringListConfigControl(
- VLC_OBJECT(p_intf), p_config, this );
+ vdevDshowW = new StringListConfigControl( p_config, this );
vdevDshowW->insertIntoExistingGrid( dshowDevLayout, line );
line++;
p_config = config_FindConfig( "dshow-adev" );
- adevDshowW = new StringListConfigControl(
- VLC_OBJECT(p_intf), p_config, this );
+ adevDshowW = new StringListConfigControl( p_config, this );
adevDshowW->insertIntoExistingGrid( dshowDevLayout, line );
line++;
@@ -1373,7 +1373,7 @@ void CaptureOpenPanel::advancedDialog()
msg_Dbg( p_intf, "item %s", p_item->psz_name);
ConfigControl *config = ConfigControl::createControl(
- VLC_OBJECT( p_intf ), p_item, advFrame, gLayout, n );
+ p_item, advFrame, gLayout, n );
if( config )
controls.append( config );
}
@@ -1401,19 +1401,20 @@ void CaptureOpenPanel::advancedDialog()
tempMRL += (i ? " :" : ":");
- if( control->getType() == CONFIG_ITEM_BOOL )
+ int ctrl_type = control->getType();
+ assert(ctrl_type != -1);
+
+ ctrl_type = CONFIG_CLASS(ctrl_type);
+
+ if( ctrl_type == CONFIG_ITEM_BOOL )
if( !(qobject_cast<VIntConfigControl *>(control)->getValue() ) )
tempMRL += "no-";
tempMRL += control->getName();
- switch( control->getType() )
+ switch( ctrl_type )
{
case CONFIG_ITEM_STRING:
- case CONFIG_ITEM_LOADFILE:
- case CONFIG_ITEM_SAVEFILE:
- case CONFIG_ITEM_DIRECTORY:
- case CONFIG_ITEM_MODULE:
tempMRL += colon_escape( QString("=%1").arg( qobject_cast<VStringConfigControl *>(control)->getValue() ) );
break;
case CONFIG_ITEM_INTEGER:
=====================================
modules/gui/qt/dialogs/preferences/complete_preferences.cpp
=====================================
@@ -58,7 +58,7 @@ PrefsTree::PrefsTree( qt_intf_t *_p_intf, QWidget *_parent,
setAlternatingRowColors( true );
setHeaderHidden( true );
- setIconSize( QSize( ITEM_HEIGHT,ITEM_HEIGHT ) );
+ setIconSize( QSize( ITEM_HEIGHT, ITEM_HEIGHT ) );
setTextElideMode( Qt::ElideNone );
setUniformRowHeights( true );
@@ -592,10 +592,6 @@ end:
/*********************************************************************
* The Panel
*********************************************************************/
-AdvPrefsPanel::AdvPrefsPanel( QWidget *_parent ) : QWidget( _parent )
-{
- p_config = NULL;
-}
AdvPrefsPanel::AdvPrefsPanel( qt_intf_t *_p_intf, QWidget *_parent,
PrefsItemData * data ) :
@@ -716,11 +712,11 @@ AdvPrefsPanel::AdvPrefsPanel( qt_intf_t *_p_intf, QWidget *_parent,
ConfigControl *control;
if( ! box )
- control = ConfigControl::createControl( VLC_OBJECT( p_intf ),
- p_item, this, layout, i_line );
+ control = ConfigControl::createControl( p_item, this,
+ layout, i_line );
else
- control = ConfigControl::createControl( VLC_OBJECT( p_intf ),
- p_item, this, boxlayout, i_boxline );
+ control = ConfigControl::createControl( p_item, this,
+ boxlayout, i_boxline );
if( !control )
continue;
@@ -741,7 +737,7 @@ AdvPrefsPanel::AdvPrefsPanel( qt_intf_t *_p_intf, QWidget *_parent,
layout->addWidget( box, i_line, 0, 1, -1 );
}
- scrolled_area->setSizePolicy( QSizePolicy::Preferred,QSizePolicy::Fixed );
+ scrolled_area->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Fixed );
scrolled_area->setLayout( layout );
scroller->setWidget( scrolled_area );
scroller->setWidgetResizable( true );
@@ -760,6 +756,7 @@ void AdvPrefsPanel::clean()
AdvPrefsPanel::~AdvPrefsPanel()
{
- qDeleteAll( controls ); controls.clear();
+ qDeleteAll( controls );
+ controls.clear();
module_config_free( p_config );
}
=====================================
modules/gui/qt/dialogs/preferences/complete_preferences.hpp
=====================================
@@ -61,7 +61,7 @@ class PrefsItemData : public QObject
Q_OBJECT
public:
PrefsItemData( QObject * );
- virtual ~PrefsItemData() { free( psz_shortcut ); };
+ virtual ~PrefsItemData() { free( psz_shortcut ); }
bool contains( const QString &text, Qt::CaseSensitivity cs );
AdvPrefsPanel *panel;
int i_object_id;
@@ -114,7 +114,6 @@ class AdvPrefsPanel : public QWidget
Q_OBJECT
public:
AdvPrefsPanel( qt_intf_t *, QWidget *, PrefsItemData * );
- AdvPrefsPanel( QWidget *);
virtual ~AdvPrefsPanel();
void apply();
void clean();
=====================================
modules/gui/qt/dialogs/preferences/preferences.cpp
=====================================
@@ -51,7 +51,6 @@
PrefsDialog::PrefsDialog( QWidget *parent, qt_intf_t *_p_intf )
: QVLCDialog( parent, _p_intf )
{
- QGridLayout *main_layout = new QGridLayout( this );
setWindowTitle( qtr( "Preferences" ) );
setWindowRole( "vlc-preferences" );
setWindowModality( Qt::WindowModal );
@@ -60,35 +59,26 @@ PrefsDialog::PrefsDialog( QWidget *parent, qt_intf_t *_p_intf )
consistency when reset */
setAttribute( Qt::WA_DeleteOnClose );
- /* Create Panels */
- simple_tree_panel = new QWidget;
- simple_tree_panel->setLayout( new QVBoxLayout );
+ p_list = NULL;
- advanced_tree_panel = new QWidget;
- advanced_tree_panel->setLayout( new QVBoxLayout );
+ QGridLayout *main_layout = new QGridLayout( this );
+ setLayout( main_layout );
- /* Choice for types */
+ /* View (panel) selection */
types = new QGroupBox( qtr("Show settings") );
types->setAlignment( Qt::AlignHCenter );
QHBoxLayout *types_l = new QHBoxLayout;
- types_l->setSpacing( 3 ); types_l->setMargin( 3 );
+ types_l->setSpacing( 3 );
+ types_l->setMargin( 3 );
simple = new QRadioButton( qtr( "Simple" ), types );
simple->setToolTip( qtr( "Switch to simple preferences view" ) );
- types_l->addWidget( simple );
- all = new QRadioButton( qtr("All"), types ); types_l->addWidget( all );
+ all = new QRadioButton( qtr("All"), types );
all->setToolTip( qtr( "Switch to full preferences view" ) );
+ types_l->addWidget( simple );
+ types_l->addWidget( all );
types->setLayout( types_l );
simple->setChecked( true );
- /* Tree and panel initialisations */
- advanced_tree = NULL;
- p_list = NULL;
- tree_filter = NULL;
- current_filter = NULL;
- simple_tree = NULL;
- simple_panels_stack = new QStackedWidget;
- advanced_panels_stack = new QStackedWidget;
-
/* Buttons */
QDialogButtonBox *buttonsBox = new QDialogButtonBox();
QPushButton *save = new QPushButton( qtr( "&Save" ) );
@@ -100,35 +90,50 @@ PrefsDialog::PrefsDialog( QWidget *parent, qt_intf_t *_p_intf )
buttonsBox->addButton( cancel, QDialogButtonBox::RejectRole );
buttonsBox->addButton( reset, QDialogButtonBox::ResetRole );
+ /* View (panel) stack */
+ stack = new QStackedWidget();
+
+ /* Simple view (panel) */
simple_split_widget = new QWidget();
simple_split_widget->setLayout( new QVBoxLayout );
- advanced_split_widget = new QSplitter();
-
- stack = new QStackedWidget();
- stack->insertWidget( SIMPLE, simple_split_widget );
- stack->insertWidget( ADVANCED, advanced_split_widget );
+ simple_tree_panel = new QWidget;
+ simple_tree_panel->setLayout( new QVBoxLayout );
+ simple_tree = NULL;
+ simple_panels_stack = new QStackedWidget;
+ for( int i = 0; i < SPrefsMax ; i++ )
+ simple_panels[i] = NULL;
simple_split_widget->layout()->addWidget( simple_tree_panel );
simple_split_widget->layout()->addWidget( simple_panels_stack );
+
+ simple_tree_panel->layout()->setMargin( 1 );
+ simple_panels_stack->layout()->setContentsMargins( 6, 0, 0, 3 );
simple_split_widget->layout()->setMargin( 0 );
+ stack->insertWidget( SIMPLE, simple_split_widget );
+
+ /* Advanced view (panel) */
+ advanced_split_widget = new QSplitter();
+
+ advanced_tree_panel = new QWidget;
+ advanced_tree_panel->setLayout( new QVBoxLayout );
+ tree_filter = NULL;
+ current_filter = NULL;
+ advanced_tree = NULL;
+ advanced_panels_stack = new QStackedWidget;
+
advanced_split_widget->addWidget( advanced_tree_panel );
advanced_split_widget->addWidget( advanced_panels_stack );
+ stack->insertWidget( ADVANCED, advanced_split_widget );
+
/* Layout */
main_layout->addWidget( stack, 0, 0, 3, 3 );
main_layout->addWidget( types, 3, 0, 2, 1 );
main_layout->addWidget( buttonsBox, 4, 2, 1 ,1 );
main_layout->setRowStretch( 2, 4 );
main_layout->setMargin( 9 );
- setLayout( main_layout );
-
- /* Margins */
- simple_tree_panel->layout()->setMargin( 1 );
- simple_panels_stack->layout()->setContentsMargins( 6, 0, 0, 3 );
-
- for( int i = 0; i < SPrefsMax ; i++ ) simple_panels[i] = NULL;
if( var_InheritBool( p_intf, "qt-advanced-pref" ) )
setAdvanced();
@@ -152,46 +157,35 @@ PrefsDialog::~PrefsDialog()
void PrefsDialog::setAdvanced()
{
- if ( !tree_filter )
+ /* Lazy creation */
+ if( !advanced_tree )
{
- tree_filter = new SearchLineEdit( advanced_tree_panel );
- tree_filter->setMinimumHeight( 26 );
+ p_list = module_list_get( &count );
- CONNECT( tree_filter, textChanged( const QString & ),
- this, advancedTreeFilterChanged( const QString & ) );
+ advanced_tree = new PrefsTree( p_intf, advanced_tree_panel, p_list, count );
- advanced_tree_panel->layout()->addWidget( tree_filter );
+ tree_filter = new SearchLineEdit( advanced_tree_panel );
+ tree_filter->setMinimumHeight( 26 );
current_filter = new QCheckBox( qtr("Only show current") );
current_filter->setToolTip(
qtr("Only show modules related to current playback") );
- CONNECT( current_filter, stateChanged(int),
- this, onlyLoadedToggled() );
- advanced_tree_panel->layout()->addWidget( current_filter );
QShortcut *search = new QShortcut( QKeySequence( QKeySequence::Find ), tree_filter );
- CONNECT( search, activated(), tree_filter, setFocus() );
- }
- /* If don't have already and advanced TREE, then create it */
- if( !advanced_tree )
- {
- /* Creation */
- p_list = module_list_get( &count );
- advanced_tree = new PrefsTree( p_intf, advanced_tree_panel, p_list, count );
- /* and connections */
- CONNECT( advanced_tree,
- currentItemChanged( QTreeWidgetItem *, QTreeWidgetItem * ),
- this, changeAdvPanel( QTreeWidgetItem * ) );
+ advanced_tree_panel->layout()->addWidget( tree_filter );
+ advanced_tree_panel->layout()->addWidget( current_filter );
advanced_tree_panel->layout()->addWidget( advanced_tree );
advanced_tree_panel->setSizePolicy( QSizePolicy::Maximum, QSizePolicy::Preferred );
- }
- /* If no advanced Panel exist, create one, attach it and show it*/
- if( advanced_panels_stack->count() < 1 )
- {
- AdvPrefsPanel *insert = new AdvPrefsPanel( advanced_panels_stack );
- advanced_panels_stack->insertWidget( 0, insert );
+ CONNECT( advanced_tree,
+ currentItemChanged( QTreeWidgetItem *, QTreeWidgetItem * ),
+ this, changeAdvPanel( QTreeWidgetItem * ) );
+ CONNECT( tree_filter, textChanged( const QString & ),
+ this, advancedTreeFilterChanged( const QString & ) );
+ CONNECT( current_filter, stateChanged(int),
+ this, onlyLoadedToggled() );
+ CONNECT( search, activated(), tree_filter, setFocus() );
}
/* Select the first Item of the preferences. Maybe you want to select a specified
@@ -212,7 +206,7 @@ void PrefsDialog::setSimple()
simple_tree = new SPrefsCatList( p_intf, simple_tree_panel );
CONNECT( simple_tree,
currentItemChanged( int ),
- this, changeSimplePanel( int ) );
+ this, changeSimplePanel( int ) );
simple_tree_panel->layout()->addWidget( simple_tree );
simple_tree_panel->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Preferred );
}
@@ -252,40 +246,6 @@ void PrefsDialog::changeAdvPanel( QTreeWidgetItem *item )
advanced_panels_stack->setCurrentWidget( data->panel );
}
-#if 0
-/*Called from extended settings, is not used anymore, but could be useful one day*/
-void PrefsDialog::showModulePrefs( char *psz_module )
-{
- setAdvanced();
- all->setChecked( true );
- for( int i_cat_index = 0 ; i_cat_index < advanced_tree->topLevelItemCount();
- i_cat_index++ )
- {
- QTreeWidgetItem *cat_item = advanced_tree->topLevelItem( i_cat_index );
- PrefsItemData *data = cat_item->data( 0, Qt::UserRole ).
- value<PrefsItemData *>();
- for( int i_sc_index = 0; i_sc_index < cat_item->childCount();
- i_sc_index++ )
- {
- QTreeWidgetItem *subcat_item = cat_item->child( i_sc_index );
- PrefsItemData *sc_data = subcat_item->data(0, Qt::UserRole).
- value<PrefsItemData *>();
- for( int i_module = 0; i_module < subcat_item->childCount();
- i_module++ )
- {
- QTreeWidgetItem *module_item = subcat_item->child( i_module );
- PrefsItemData *mod_data = module_item->data( 0, Qt::UserRole ).
- value<PrefsItemData *>();
- if( !strcmp( mod_data->psz_name, psz_module ) ) {
- advanced_tree->setCurrentItem( module_item );
- }
- }
- }
- }
- show();
-}
-#endif
-
/* Actual apply and save for the preferences */
void PrefsDialog::save()
{
=====================================
modules/gui/qt/dialogs/preferences/preferences.hpp
=====================================
@@ -44,34 +44,33 @@ class PrefsDialog : public QVLCDialog
public:
PrefsDialog( QWidget *, qt_intf_t * );
virtual ~PrefsDialog();
-#if 0
- /*Called from extended settings, is not used anymore, but could be useful one day*/
- void showModulePrefs( char* );
-#endif
private:
- enum { SIMPLE, ADVANCED };
+ size_t count;
+ module_t **p_list;
+
+ /* View stack */
QStackedWidget *stack;
- QWidget *simple_split_widget;
- QSplitter *advanced_split_widget;
+ /* View selection */
+ enum { SIMPLE, ADVANCED };
+ QGroupBox *types;
+ QRadioButton *simple, *all;
- QStackedWidget *advanced_panels_stack;
+ /* Simple view components */
+ QWidget *simple_split_widget;
+ QWidget *simple_tree_panel;
+ SPrefsCatList *simple_tree;
QStackedWidget *simple_panels_stack;
SPrefsPanel *simple_panels[SPrefsMax];
- QWidget *simple_tree_panel;
+ /* Advanced view components */
+ QSplitter *advanced_split_widget;
QWidget *advanced_tree_panel;
-
- SPrefsCatList *simple_tree;
- PrefsTree *advanced_tree;
- size_t count;
- module_t **p_list;
SearchLineEdit *tree_filter;
QCheckBox *current_filter;
-
- QGroupBox *types;
- QRadioButton *simple,*all;
+ PrefsTree *advanced_tree;
+ QStackedWidget *advanced_panels_stack;
private slots:
void setAdvanced();
@@ -85,7 +84,7 @@ private slots:
void save();
void cancel();
void reset();
- void close() { save(); };
+ void close() { save(); }
};
#endif
=====================================
modules/gui/qt/dialogs/preferences/preferences_widgets.cpp
=====================================
@@ -76,8 +76,7 @@ QString formatTooltip(const QString & tooltip)
return formatted;
}
-ConfigControl *ConfigControl::createControl( vlc_object_t *p_this,
- module_config_t *p_item,
+ConfigControl *ConfigControl::createControl( module_config_t *p_item,
QWidget *parent,
QGridLayout *l, int line )
{
@@ -86,53 +85,53 @@ ConfigControl *ConfigControl::createControl( vlc_object_t *p_this,
switch( p_item->i_type )
{
case CONFIG_ITEM_MODULE:
- p_control = new StringListConfigControl( p_this, p_item, parent );
+ p_control = new StringListConfigControl( p_item, parent );
break;
case CONFIG_ITEM_MODULE_CAT:
- p_control = new ModuleConfigControl( p_this, p_item, parent );
+ p_control = new ModuleConfigControl( p_item, parent );
break;
case CONFIG_ITEM_MODULE_LIST:
- p_control = new ModuleListConfigControl( p_this, p_item, parent, false );
+ p_control = new ModuleListConfigControl( p_item, parent, false );
break;
case CONFIG_ITEM_MODULE_LIST_CAT:
- p_control = new ModuleListConfigControl( p_this, p_item, parent, true );
+ p_control = new ModuleListConfigControl( p_item, parent, true );
break;
case CONFIG_ITEM_STRING:
if( p_item->list_count )
- p_control = new StringListConfigControl( p_this, p_item, parent );
+ p_control = new StringListConfigControl( p_item, parent );
else
- p_control = new StringConfigControl( p_this, p_item, parent, false );
+ p_control = new StringConfigControl( p_item, parent );
break;
case CONFIG_ITEM_PASSWORD:
- p_control = new StringConfigControl( p_this, p_item, parent, true );
+ p_control = new PasswordConfigControl( p_item, parent );
break;
case CONFIG_ITEM_RGB:
- p_control = new ColorConfigControl( p_this, p_item, parent );
+ p_control = new ColorConfigControl( p_item, parent );
break;
case CONFIG_ITEM_INTEGER:
if( p_item->list_count )
- p_control = new IntegerListConfigControl( p_this, p_item, parent, false );
+ p_control = new IntegerListConfigControl( p_item, parent );
else
- p_control = new IntegerRangeConfigControl( p_this, p_item, parent );
+ p_control = new IntegerRangeConfigControl( p_item, parent );
break;
case CONFIG_ITEM_LOADFILE:
case CONFIG_ITEM_SAVEFILE:
- p_control = new FileConfigControl( p_this, p_item, parent );
+ p_control = new FileConfigControl( p_item, parent );
break;
case CONFIG_ITEM_DIRECTORY:
- p_control = new DirectoryConfigControl( p_this, p_item, parent );
+ p_control = new DirectoryConfigControl( p_item, parent );
break;
case CONFIG_ITEM_FONT:
- p_control = new FontConfigControl( p_this, p_item, parent );
+ p_control = new FontConfigControl( p_item, parent );
break;
case CONFIG_ITEM_KEY:
- p_control = new KeySelectorControl( p_this, parent );
+ p_control = new KeySelectorControl( parent );
break;
case CONFIG_ITEM_BOOL:
- p_control = new BoolConfigControl( p_this, p_item, parent );
+ p_control = new BoolConfigControl( p_item, parent );
break;
case CONFIG_ITEM_FLOAT:
- p_control = new FloatRangeConfigControl( p_this, p_item, parent );
+ p_control = new FloatRangeConfigControl( p_item, parent );
break;
default:
break;
@@ -206,37 +205,30 @@ VStringConfigControl::doApply()
}
/*********** String **************/
-StringConfigControl::StringConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item,
- QWidget *_parent,
- bool pwd ) :
- VStringConfigControl( _p_this, _p_item )
+StringConfigControl::StringConfigControl( module_config_t *_p_item,
+ QWidget *_parent ) :
+ VStringConfigControl( _p_item )
{
label = new QLabel( p_item->psz_text ? qfut(p_item->psz_text) : "", _parent );
text = new QLineEdit( p_item->value.psz ? qfu(p_item->value.psz) : "", _parent );
- if( pwd ) text->setEchoMode( QLineEdit::Password );
finish();
}
-void StringConfigControl::fillGrid( QGridLayout *l, int line )
-{
- l->addWidget( label, line, 0 );
- l->setColumnMinimumWidth( 1, 10 );
- l->addWidget( text, line, LAST_COLUMN, Qt::AlignRight );
-}
-
-StringConfigControl::StringConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item,
- QLabel *_label, QLineEdit *_text, bool pwd ):
- VStringConfigControl( _p_this, _p_item )
+StringConfigControl::StringConfigControl( module_config_t *_p_item,
+ QLabel *_label, QLineEdit *_text ) :
+ VStringConfigControl( _p_item )
{
text = _text;
- if( pwd ) text->setEchoMode( QLineEdit::Password );
label = _label;
finish( );
}
-int VStringConfigControl::getType() const { return CONFIG_ITEM_STRING; }
+void StringConfigControl::fillGrid( QGridLayout *l, int line )
+{
+ l->addWidget( label, line, 0 );
+ l->setColumnMinimumWidth( 1, 10 );
+ l->addWidget( text, line, LAST_COLUMN, Qt::AlignRight );
+}
void StringConfigControl::finish()
{
@@ -252,10 +244,29 @@ void StringConfigControl::finish()
label->setBuddy( text );
}
+/********* String / Password **********/
+PasswordConfigControl::PasswordConfigControl( module_config_t *_p_item,
+ QWidget *_parent ) :
+ StringConfigControl( _p_item, _parent )
+{
+ finish();
+}
+
+PasswordConfigControl::PasswordConfigControl( module_config_t *_p_item,
+ QLabel *_label, QLineEdit *_text ) :
+ StringConfigControl( _p_item, _label, _text )
+{
+ finish();
+}
+
+void PasswordConfigControl::finish()
+{
+ text->setEchoMode( QLineEdit::Password );
+}
+
/*********** File **************/
-FileConfigControl::FileConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item, QWidget *p ) :
- VStringConfigControl( _p_this, _p_item )
+FileConfigControl::FileConfigControl( module_config_t *_p_item, QWidget *p ) :
+ VStringConfigControl( _p_item )
{
label = new QLabel( qfut(p_item->psz_text), p );
text = new QLineEdit( qfu(p_item->value.psz), p );
@@ -266,6 +277,20 @@ FileConfigControl::FileConfigControl( vlc_object_t *_p_this,
finish();
}
+FileConfigControl::FileConfigControl( module_config_t *_p_item,
+ QLabel *_label, QLineEdit *_text,
+ QPushButton *_button ) :
+ VStringConfigControl( _p_item )
+{
+ browse = _button;
+ text = _text;
+ label = _label;
+
+ BUTTONACT( browse, updateField() );
+
+ finish( );
+}
+
void FileConfigControl::fillGrid( QGridLayout *l, int line )
{
l->addWidget( label, line, 0 );
@@ -277,21 +302,6 @@ void FileConfigControl::fillGrid( QGridLayout *l, int line )
l->addLayout( textAndButton, line, LAST_COLUMN );
}
-FileConfigControl::FileConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item,
- QLabel *_label, QLineEdit *_text,
- QPushButton *_button ):
- VStringConfigControl( _p_this, _p_item )
-{
- browse = _button;
- text = _text;
- label = _label;
-
- BUTTONACT( browse, updateField() );
-
- finish( );
-}
-
void FileConfigControl::updateField()
{
QString file;
@@ -322,15 +332,16 @@ void FileConfigControl::finish()
}
/********* String / Directory **********/
-DirectoryConfigControl::DirectoryConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item, QWidget *p ) :
- FileConfigControl( _p_this, _p_item, p )
+DirectoryConfigControl::DirectoryConfigControl( module_config_t *_p_item,
+ QWidget *p ) :
+ FileConfigControl( _p_item, p )
{}
-DirectoryConfigControl::DirectoryConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item, QLabel *_p_label,
- QLineEdit *_p_line, QPushButton *_p_button ):
- FileConfigControl( _p_this, _p_item, _p_label, _p_line, _p_button)
+DirectoryConfigControl::DirectoryConfigControl( module_config_t *_p_item,
+ QLabel *_p_label,
+ QLineEdit *_p_line,
+ QPushButton *_p_button ) :
+ FileConfigControl( _p_item, _p_label, _p_line, _p_button)
{}
void DirectoryConfigControl::updateField()
@@ -346,9 +357,8 @@ void DirectoryConfigControl::updateField()
}
/********* String / Font **********/
-FontConfigControl::FontConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item, QWidget *p ) :
- VStringConfigControl( _p_this, _p_item )
+FontConfigControl::FontConfigControl( module_config_t *_p_item, QWidget *p ) :
+ VStringConfigControl( _p_item )
{
label = new QLabel( qfut(p_item->psz_text), p );
font = new QFontComboBox( p );
@@ -360,16 +370,10 @@ FontConfigControl::FontConfigControl( vlc_object_t *_p_this,
}
}
-void FontConfigControl::fillGrid( QGridLayout *l, int line )
-{
- l->addWidget( label, line, 0 );
- l->addWidget( font, line, 1, 1, -1 );
-}
-
-FontConfigControl::FontConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item, QLabel *_p_label,
- QFontComboBox *_p_font):
- VStringConfigControl( _p_this, _p_item)
+FontConfigControl::FontConfigControl( module_config_t *_p_item,
+ QLabel *_p_label,
+ QFontComboBox *_p_font) :
+ VStringConfigControl( _p_item)
{
label = _p_label;
font = _p_font;
@@ -381,29 +385,46 @@ FontConfigControl::FontConfigControl( vlc_object_t *_p_this,
}
}
+void FontConfigControl::fillGrid( QGridLayout *l, int line )
+{
+ l->addWidget( label, line, 0 );
+ l->addWidget( font, line, 1, 1, -1 );
+}
+
/********* String / choice list **********/
-StringListConfigControl::StringListConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item, QWidget *p ) :
- VStringConfigControl( _p_this, _p_item )
+StringListConfigControl::StringListConfigControl( module_config_t *_p_item,
+ QWidget *p ) :
+ VStringConfigControl( _p_item )
{
label = new QLabel( qfut(p_item->psz_text), p );
combo = new QComboBox( p );
combo->setMinimumWidth( MINWIDTH_BOX );
combo->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::Preferred );
+ /* needed to see update from getting choice list where callback used */
module_config_t *p_module_config = config_FindConfig( p_item->psz_name );
finish( p_module_config );
}
+StringListConfigControl::StringListConfigControl( module_config_t *_p_item,
+ QLabel *_label,
+ QComboBox *_combo ) :
+ VStringConfigControl( _p_item )
+{
+ combo = _combo;
+ label = _label;
+
+ /* needed to see update from getting choice list where callback used */
+ module_config_t *p_module_config = config_FindConfig( getName() );
+
+ finish( p_module_config );
+}
+
void StringListConfigControl::fillGrid( QGridLayout *l, int line )
{
l->addWidget( label, line, 0 );
l->addWidget( combo, line, LAST_COLUMN, Qt::AlignRight );
- int i = 0;
- foreach( QPushButton *button, buttons )
- l->addWidget( button, line, LAST_COLUMN + i++,
- Qt::AlignRight );
}
void StringListConfigControl::comboIndexChanged( int i_index )
@@ -412,22 +433,10 @@ void StringListConfigControl::comboIndexChanged( int i_index )
emit changed();
}
-StringListConfigControl::StringListConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item, QLabel *_label, QComboBox *_combo,
- bool ) : VStringConfigControl( _p_this, _p_item )
-{
- combo = _combo;
- label = _label;
-
- module_config_t *p_module_config = config_FindConfig( getName() );
-
- finish( p_module_config );
-}
-
void StringListConfigControl::finish(module_config_t *p_module_config )
{
combo->setEditable( false );
- CONNECT( combo, currentIndexChanged ( int ), this, comboIndexChanged( int ) );
+ CONNECT( combo, currentIndexChanged( int ), this, comboIndexChanged( int ) );
if(!p_module_config) return;
@@ -447,7 +456,7 @@ void StringListConfigControl::finish(module_config_t *p_module_config )
free( texts );
free( values );
- if( p_module_config->psz_longtext )
+ if( p_module_config->psz_longtext )
{
QString tipText = qfut(p_module_config->psz_longtext);
combo->setToolTip( formatTooltip(tipText) );
@@ -505,9 +514,9 @@ void setfillVLCConfigCombo( const char *configname, QComboBox *combo )
}
/********* Module **********/
-ModuleConfigControl::ModuleConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item, QWidget *p ) :
- VStringConfigControl( _p_this, _p_item )
+ModuleConfigControl::ModuleConfigControl( module_config_t *_p_item,
+ QWidget *p ) :
+ VStringConfigControl( _p_item )
{
label = new QLabel( qfut(p_item->psz_text), p );
combo = new QComboBox( p );
@@ -515,21 +524,21 @@ ModuleConfigControl::ModuleConfigControl( vlc_object_t *_p_this,
finish( );
}
-void ModuleConfigControl::fillGrid( QGridLayout *l, int line )
-{
- l->addWidget( label, line, 0 );
- l->addWidget( combo, line, LAST_COLUMN );
-}
-
-ModuleConfigControl::ModuleConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item, QLabel *_label, QComboBox *_combo )
- : VStringConfigControl( _p_this, _p_item )
+ModuleConfigControl::ModuleConfigControl( module_config_t *_p_item,
+ QLabel *_label, QComboBox *_combo ) :
+ VStringConfigControl( _p_item )
{
combo = _combo;
label = _label;
finish( );
}
+void ModuleConfigControl::fillGrid( QGridLayout *l, int line )
+{
+ l->addWidget( label, line, 0 );
+ l->addWidget( combo, line, LAST_COLUMN );
+}
+
void ModuleConfigControl::finish( )
{
combo->setEditable( false );
@@ -584,16 +593,16 @@ QString ModuleConfigControl::getValue() const
}
/********* Module list **********/
-ModuleListConfigControl::ModuleListConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item, QWidget *p, bool bycat ) :
- VStringConfigControl( _p_this, _p_item )
+ModuleListConfigControl::ModuleListConfigControl( module_config_t *_p_item,
+ QWidget *p, bool bycat ) :
+ VStringConfigControl( _p_item )
{
groupBox = NULL;
/* Special Hack */
if( !p_item->psz_text ) return;
- groupBox = new QGroupBox ( qfut(p_item->psz_text), p );
+ groupBox = new QGroupBox( qfut(p_item->psz_text), p );
text = new QLineEdit( p );
QGridLayout *layoutGroupBox = new QGridLayout( groupBox );
@@ -748,21 +757,21 @@ VIntConfigControl::doApply()
}
/*********** Integer **************/
-IntegerConfigControl::IntegerConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item, QWidget *p ) :
- VIntConfigControl( _p_this, _p_item )
+IntegerConfigControl::IntegerConfigControl( module_config_t *_p_item,
+ QWidget *p ) :
+ VIntConfigControl( _p_item )
{
label = new QLabel( qfut(p_item->psz_text), p );
- spin = new QSpinBox( p ); spin->setMinimumWidth( MINWIDTH_BOX );
+ spin = new QSpinBox( p );
+ spin->setMinimumWidth( MINWIDTH_BOX );
spin->setAlignment( Qt::AlignRight );
spin->setMaximumWidth( MINWIDTH_BOX );
finish();
}
-IntegerConfigControl::IntegerConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item,
+IntegerConfigControl::IntegerConfigControl( module_config_t *_p_item,
QLabel *_label, QSpinBox *_spin ) :
- VIntConfigControl( _p_this, _p_item )
+ VIntConfigControl( _p_item )
{
spin = _spin;
label = _label;
@@ -797,20 +806,18 @@ int IntegerConfigControl::getValue() const
return spin->value();
}
-int VIntConfigControl::getType() const { return CONFIG_ITEM_INTEGER; }
-
/********* Integer range **********/
-IntegerRangeConfigControl::IntegerRangeConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item, QWidget *p ) :
- IntegerConfigControl( _p_this, _p_item, p )
+IntegerRangeConfigControl::IntegerRangeConfigControl( module_config_t *_p_item,
+ QWidget *p ) :
+ IntegerConfigControl( _p_item, p )
{
finish();
}
-IntegerRangeConfigControl::IntegerRangeConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item,
- QLabel *_label, QSpinBox *_spin ) :
- IntegerConfigControl( _p_this, _p_item, _label, _spin )
+IntegerRangeConfigControl::IntegerRangeConfigControl( module_config_t *_p_item,
+ QLabel *_label,
+ QSpinBox *_spin ) :
+ IntegerConfigControl( _p_item, _label, _spin )
{
finish();
}
@@ -822,10 +829,9 @@ void IntegerRangeConfigControl::finish()
}
IntegerRangeSliderConfigControl::IntegerRangeSliderConfigControl(
- vlc_object_t *_p_this,
module_config_t *_p_item,
- QLabel *_label, QSlider *_slider ):
- VIntConfigControl( _p_this, _p_item )
+ QLabel *_label, QSlider *_slider ) :
+ VIntConfigControl( _p_item )
{
slider = _slider;
label = _label;
@@ -845,46 +851,45 @@ IntegerRangeSliderConfigControl::IntegerRangeSliderConfigControl(
int IntegerRangeSliderConfigControl::getValue() const
{
- return slider->value();
+ return slider->value();
}
/********* Integer / choice list **********/
-IntegerListConfigControl::IntegerListConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item, QWidget *p, bool ) :
- VIntConfigControl( _p_this, _p_item )
+IntegerListConfigControl::IntegerListConfigControl( module_config_t *_p_item,
+ QWidget *p ) :
+ VIntConfigControl( _p_item )
{
label = new QLabel( qfut(p_item->psz_text), p );
combo = new QComboBox( p );
combo->setMinimumWidth( MINWIDTH_BOX );
+ /* needed to see update from getting choice list where callback used */
module_config_t *p_module_config = config_FindConfig( p_item->psz_name );
finish( p_module_config );
}
-void IntegerListConfigControl::fillGrid( QGridLayout *l, int line )
-{
- l->addWidget( label, line, 0 );
- l->addWidget( combo, line, LAST_COLUMN, Qt::AlignRight );
- int i = 0;
- foreach( QPushButton *button, buttons )
- l->addWidget( button, line, LAST_COLUMN + i++,
- Qt::AlignRight );
-}
-
-IntegerListConfigControl::IntegerListConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item, QLabel *_label, QComboBox *_combo,
- bool ) : VIntConfigControl( _p_this, _p_item )
+IntegerListConfigControl::IntegerListConfigControl( module_config_t *_p_item,
+ QLabel *_label,
+ QComboBox *_combo ) :
+ VIntConfigControl( _p_item )
{
combo = _combo;
label = _label;
+ /* needed to see update from getting choice list where callback used */
module_config_t *p_module_config = config_FindConfig( getName() );
finish( p_module_config );
}
+void IntegerListConfigControl::fillGrid( QGridLayout *l, int line )
+{
+ l->addWidget( label, line, 0 );
+ l->addWidget( combo, line, LAST_COLUMN, Qt::AlignRight );
+}
+
void IntegerListConfigControl::finish(module_config_t *p_module_config )
{
combo->setEditable( false );
@@ -921,31 +926,27 @@ int IntegerListConfigControl::getValue() const
}
/*********** Boolean **************/
-BoolConfigControl::BoolConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item, QWidget *p ) :
- VIntConfigControl( _p_this, _p_item )
+BoolConfigControl::BoolConfigControl( module_config_t *_p_item, QWidget *p ) :
+ VIntConfigControl( _p_item )
{
checkbox = new QCheckBox( qfut(p_item->psz_text), p );
finish();
}
-void BoolConfigControl::fillGrid( QGridLayout *l, int line )
-{
- l->addWidget( checkbox, line, 0, 1, -1 );
-}
-
-BoolConfigControl::BoolConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item,
+BoolConfigControl::BoolConfigControl( module_config_t *_p_item,
QLabel *_label,
QAbstractButton *_checkbox ) :
- VIntConfigControl( _p_this, _p_item )
+ VIntConfigControl( _p_item )
{
checkbox = _checkbox;
VLC_UNUSED( _label );
finish();
}
-int BoolConfigControl::getType() const { return CONFIG_ITEM_BOOL; }
+void BoolConfigControl::fillGrid( QGridLayout *l, int line )
+{
+ l->addWidget( checkbox, line, 0, 1, -1 );
+}
void BoolConfigControl::finish()
{
@@ -960,31 +961,31 @@ int BoolConfigControl::getValue() const
}
/************* Color *************/
-ColorConfigControl::ColorConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item, QWidget *p ) :
- VIntConfigControl( _p_this, _p_item )
+ColorConfigControl::ColorConfigControl( module_config_t *_p_item,
+ QWidget *p ) :
+ VIntConfigControl( _p_item )
{
label = new QLabel( p );
color_but = new QToolButton( p );
finish();
}
-void ColorConfigControl::fillGrid( QGridLayout *l, int line )
-{
- l->addWidget( label, line, 0 );
- l->addWidget( color_but, line, LAST_COLUMN, Qt::AlignRight );
-}
-
-ColorConfigControl::ColorConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item,
- QLabel *_label, QAbstractButton *_color ):
- VIntConfigControl( _p_this, _p_item )
+ColorConfigControl::ColorConfigControl( module_config_t *_p_item,
+ QLabel *_label,
+ QAbstractButton *_color ) :
+ VIntConfigControl( _p_item )
{
label = _label;
color_but = _color;
finish();
}
+void ColorConfigControl::fillGrid( QGridLayout *l, int line )
+{
+ l->addWidget( label, line, 0 );
+ l->addWidget( color_but, line, LAST_COLUMN, Qt::AlignRight );
+}
+
void ColorConfigControl::finish()
{
i_color = p_item->value.i;
@@ -1033,9 +1034,9 @@ VFloatConfigControl::doApply()
}
/*********** Float **************/
-FloatConfigControl::FloatConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item, QWidget *p ) :
- VFloatConfigControl( _p_this, _p_item )
+FloatConfigControl::FloatConfigControl( module_config_t *_p_item,
+ QWidget *p ) :
+ VFloatConfigControl( _p_item )
{
label = new QLabel( qfut(p_item->psz_text), p );
spin = new QDoubleSpinBox( p );
@@ -1045,25 +1046,22 @@ FloatConfigControl::FloatConfigControl( vlc_object_t *_p_this,
finish();
}
-void FloatConfigControl::fillGrid( QGridLayout *l, int line )
-{
- l->addWidget( label, line, 0 );
- l->addWidget( spin, line, LAST_COLUMN, Qt::AlignRight );
-}
-
-int VFloatConfigControl::getType() const { return CONFIG_ITEM_FLOAT; }
-
-FloatConfigControl::FloatConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item,
+FloatConfigControl::FloatConfigControl( module_config_t *_p_item,
QLabel *_label,
QDoubleSpinBox *_spin ) :
- VFloatConfigControl( _p_this, _p_item )
+ VFloatConfigControl( _p_item )
{
spin = _spin;
label = _label;
finish();
}
+void FloatConfigControl::fillGrid( QGridLayout *l, int line )
+{
+ l->addWidget( label, line, 0 );
+ l->addWidget( spin, line, LAST_COLUMN, Qt::AlignRight );
+}
+
void FloatConfigControl::finish()
{
spin->setMaximum( 2000000000. );
@@ -1087,18 +1085,17 @@ float FloatConfigControl::getValue() const
}
/*********** Float with range **************/
-FloatRangeConfigControl::FloatRangeConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item, QWidget *p ) :
- FloatConfigControl( _p_this, _p_item, p )
+FloatRangeConfigControl::FloatRangeConfigControl( module_config_t *_p_item,
+ QWidget *p ) :
+ FloatConfigControl( _p_item, p )
{
finish();
}
-FloatRangeConfigControl::FloatRangeConfigControl( vlc_object_t *_p_this,
- module_config_t *_p_item,
- QLabel *_label,
- QDoubleSpinBox *_spin ) :
- FloatConfigControl( _p_this, _p_item, _label, _spin )
+FloatRangeConfigControl::FloatRangeConfigControl( module_config_t *_p_item,
+ QLabel *_label,
+ QDoubleSpinBox *_spin ) :
+ FloatConfigControl( _p_item, _label, _spin )
{
finish();
}
@@ -1113,8 +1110,7 @@ void FloatRangeConfigControl::finish()
/**********************************************************************
* Key selector widget
**********************************************************************/
-KeySelectorControl::KeySelectorControl( vlc_object_t *_p_this, QWidget *p ) :
- ConfigControl( _p_this, nullptr )
+KeySelectorControl::KeySelectorControl( QWidget *p ) : ConfigControl( nullptr )
{
label = new QLabel(
qtr( "Action hotkey mappings. Double-click (or select and press Enter) "
@@ -1169,8 +1165,6 @@ void KeySelectorControl::fillGrid( QGridLayout *l, int line )
l->addLayout( gLayout, line, 0, 1, -1 );
}
-int KeySelectorControl::getType() const { return CONFIG_ITEM_KEY; }
-
void KeySelectorControl::buildAppHotkeysList( QWidget *rootWidget )
{
QList<QAction *> actionsList = rootWidget->findChildren<QAction *>();
@@ -1519,4 +1513,4 @@ void KeyInputDialog::wheelEvent( QWheelEvent *e )
checkForConflicts( QString() );
}
-void KeyInputDialog::unsetAction() { done( 2 ); };
+void KeyInputDialog::unsetAction() { done( 2 ); }
=====================================
modules/gui/qt/dialogs/preferences/preferences_widgets.hpp
=====================================
@@ -78,13 +78,12 @@ class ConfigControl : public QObject
{
Q_OBJECT
public:
- virtual int getType() const = 0;
+ int getType() const { return (p_item) ? p_item->i_type : -1; }
const char * getName() const { return p_item->psz_name; }
void hide() { changeVisibility( false ); }
void show() { changeVisibility( true ); }
/* ConfigControl factory */
- static ConfigControl * createControl( vlc_object_t*,
- module_config_t*,QWidget*,
+ static ConfigControl * createControl( module_config_t*, QWidget*,
QGridLayout *, int line = 0 );
/* Inserts control into another layout block, using a sublayout */
void insertInto( QBoxLayout * );
@@ -92,18 +91,12 @@ public:
void insertIntoExistingGrid( QGridLayout*, int );
virtual void doApply() = 0;
protected:
- ConfigControl( vlc_object_t *_p_this, module_config_t *_p_conf ) :
- p_this (_p_this ), p_item( _p_conf ) {}
+ ConfigControl( module_config_t *_p_conf ) : p_item( _p_conf ) {}
virtual void changeVisibility( bool ) { }
- vlc_object_t *p_this;
module_config_t *p_item;
virtual void fillGrid( QGridLayout*, int ) {}
signals:
void changed();
-#if 0
-/* You shouldn't use that now..*/
- void Updated();
-#endif
};
/*******************************************************
@@ -111,27 +104,24 @@ signals:
*******************************************************/
class VIntConfigControl : public ConfigControl
{
-Q_OBJECT
+ Q_OBJECT
public:
virtual int getValue() const = 0;
- virtual int getType() const Q_DECL_OVERRIDE;
virtual void doApply() Q_DECL_OVERRIDE;
protected:
- VIntConfigControl( vlc_object_t *a, module_config_t *b ) :
- ConfigControl(a,b) {}
+ VIntConfigControl( module_config_t *i ) : ConfigControl(i) {}
};
class IntegerConfigControl : public VIntConfigControl
{
-Q_OBJECT
+ Q_OBJECT
public:
- IntegerConfigControl( vlc_object_t *, module_config_t *, QWidget * );
- IntegerConfigControl( vlc_object_t *, module_config_t *,
- QLabel*, QSpinBox* );
+ IntegerConfigControl( module_config_t *, QWidget * );
+ IntegerConfigControl( module_config_t *, QLabel*, QSpinBox* );
int getValue() const Q_DECL_OVERRIDE;
protected:
QSpinBox *spin;
- void changeVisibility( bool b ) Q_DECL_OVERRIDE
+ void changeVisibility( bool b ) Q_DECL_OVERRIDE
{
spin->setVisible( b );
if ( label ) label->setVisible( b );
@@ -146,11 +136,9 @@ class IntegerRangeConfigControl : public IntegerConfigControl
{
Q_OBJECT
public:
- IntegerRangeConfigControl( vlc_object_t *, module_config_t *, QWidget * );
- IntegerRangeConfigControl( vlc_object_t *, module_config_t *,
- QLabel*, QSpinBox* );
- IntegerRangeConfigControl( vlc_object_t *, module_config_t *,
- QLabel*, QSlider* );
+ IntegerRangeConfigControl( module_config_t *, QWidget * );
+ IntegerRangeConfigControl( module_config_t *, QLabel*, QSpinBox* );
+ IntegerRangeConfigControl( module_config_t *, QLabel*, QSlider* );
private:
void finish();
};
@@ -159,8 +147,7 @@ class IntegerRangeSliderConfigControl : public VIntConfigControl
{
Q_OBJECT
public:
- IntegerRangeSliderConfigControl( vlc_object_t *, module_config_t *,
- QLabel *, QSlider * );
+ IntegerRangeSliderConfigControl( module_config_t *, QLabel *, QSlider * );
int getValue() const Q_DECL_OVERRIDE;
protected:
QSlider *slider;
@@ -178,9 +165,8 @@ class IntegerListConfigControl : public VIntConfigControl
{
Q_OBJECT
public:
- IntegerListConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool );
- IntegerListConfigControl( vlc_object_t *, module_config_t *, QLabel *,
- QComboBox*, bool );
+ IntegerListConfigControl( module_config_t *, QWidget * );
+ IntegerListConfigControl( module_config_t *, QLabel *, QComboBox* );
int getValue() const Q_DECL_OVERRIDE;
protected:
void changeVisibility( bool b ) Q_DECL_OVERRIDE
@@ -193,18 +179,15 @@ private:
void finish(module_config_t * );
QLabel *label;
QComboBox *combo;
- QList<QPushButton *> buttons;
};
class BoolConfigControl : public VIntConfigControl
{
Q_OBJECT
public:
- BoolConfigControl( vlc_object_t *, module_config_t *, QWidget * );
- BoolConfigControl( vlc_object_t *, module_config_t *,
- QLabel *, QAbstractButton* );
+ BoolConfigControl( module_config_t *, QWidget * );
+ BoolConfigControl( module_config_t *, QLabel *, QAbstractButton* );
int getValue() const Q_DECL_OVERRIDE;
- int getType() const Q_DECL_OVERRIDE;
protected:
void changeVisibility( bool b ) Q_DECL_OVERRIDE
{
@@ -218,11 +201,10 @@ private:
class ColorConfigControl : public VIntConfigControl
{
-Q_OBJECT
+ Q_OBJECT
public:
- ColorConfigControl( vlc_object_t *, module_config_t *, QWidget * );
- ColorConfigControl( vlc_object_t *, module_config_t *,
- QLabel *, QAbstractButton* );
+ ColorConfigControl( module_config_t *, QWidget * );
+ ColorConfigControl( module_config_t *, QLabel *, QAbstractButton* );
virtual ~ColorConfigControl() { delete color_px; }
int getValue() const Q_DECL_OVERRIDE;
protected:
@@ -250,20 +232,17 @@ class VFloatConfigControl : public ConfigControl
Q_OBJECT
public:
virtual float getValue() const = 0;
- int getType() const Q_DECL_OVERRIDE;
void doApply() Q_DECL_OVERRIDE;
protected:
- VFloatConfigControl( vlc_object_t *a, module_config_t *b ) :
- ConfigControl(a,b) {};
+ VFloatConfigControl( module_config_t *i ) : ConfigControl(i) {}
};
class FloatConfigControl : public VFloatConfigControl
{
Q_OBJECT
public:
- FloatConfigControl( vlc_object_t *, module_config_t *, QWidget * );
- FloatConfigControl( vlc_object_t *, module_config_t *,
- QLabel*, QDoubleSpinBox* );
+ FloatConfigControl( module_config_t *, QWidget * );
+ FloatConfigControl( module_config_t *, QLabel*, QDoubleSpinBox* );
float getValue() const Q_DECL_OVERRIDE;
protected:
@@ -284,9 +263,8 @@ class FloatRangeConfigControl : public FloatConfigControl
{
Q_OBJECT
public:
- FloatRangeConfigControl( vlc_object_t *, module_config_t *, QWidget * );
- FloatRangeConfigControl( vlc_object_t *, module_config_t *,
- QLabel*, QDoubleSpinBox* );
+ FloatRangeConfigControl( module_config_t *, QWidget * );
+ FloatRangeConfigControl( module_config_t *, QLabel*, QDoubleSpinBox* );
private:
void finish();
};
@@ -299,22 +277,18 @@ class VStringConfigControl : public ConfigControl
Q_OBJECT
public:
virtual QString getValue() const = 0;
- int getType() const Q_DECL_OVERRIDE;
void doApply() Q_DECL_OVERRIDE;
protected:
- VStringConfigControl( vlc_object_t *a, module_config_t *b ) :
- ConfigControl(a,b) {}
+ VStringConfigControl( module_config_t *i ) : ConfigControl(i) {}
};
class StringConfigControl : public VStringConfigControl
{
Q_OBJECT
public:
- StringConfigControl( vlc_object_t *, module_config_t *,
- QWidget *, bool pwd );
- StringConfigControl( vlc_object_t *, module_config_t *, QLabel *,
- QLineEdit*, bool pwd );
- QString getValue() const Q_DECL_OVERRIDE { return text->text(); };
+ StringConfigControl( module_config_t *, QWidget * );
+ StringConfigControl( module_config_t *, QLabel *, QLineEdit* );
+ QString getValue() const Q_DECL_OVERRIDE { return text->text(); }
protected:
void changeVisibility( bool b ) Q_DECL_OVERRIDE
{
@@ -322,20 +296,29 @@ protected:
if ( label ) label->setVisible( b );
}
void fillGrid( QGridLayout*, int ) Q_DECL_OVERRIDE;
+ QLineEdit *text;
private:
void finish();
- QLineEdit *text;
QLabel *label;
};
+class PasswordConfigControl : public StringConfigControl
+{
+ Q_OBJECT
+public:
+ PasswordConfigControl( module_config_t *, QWidget * );
+ PasswordConfigControl( module_config_t *, QLabel *, QLineEdit* );
+private:
+ void finish();
+};
+
class FileConfigControl : public VStringConfigControl
{
Q_OBJECT
public:
- FileConfigControl( vlc_object_t *, module_config_t *, QWidget * );
- FileConfigControl( vlc_object_t *, module_config_t *, QLabel *,
- QLineEdit *, QPushButton * );
- QString getValue() const Q_DECL_OVERRIDE { return text->text(); };
+ FileConfigControl( module_config_t *, QWidget * );
+ FileConfigControl( module_config_t *, QLabel *, QLineEdit *, QPushButton * );
+ QString getValue() const Q_DECL_OVERRIDE { return text->text(); }
public slots:
virtual void updateField();
protected:
@@ -356,9 +339,8 @@ class DirectoryConfigControl : public FileConfigControl
{
Q_OBJECT
public:
- DirectoryConfigControl( vlc_object_t *, module_config_t *, QWidget * );
- DirectoryConfigControl( vlc_object_t *, module_config_t *, QLabel *,
- QLineEdit *, QPushButton * );
+ DirectoryConfigControl( module_config_t *, QWidget * );
+ DirectoryConfigControl( module_config_t *, QLabel *, QLineEdit *, QPushButton * );
public slots:
void updateField() Q_DECL_OVERRIDE;
};
@@ -367,10 +349,9 @@ class FontConfigControl : public VStringConfigControl
{
Q_OBJECT
public:
- FontConfigControl( vlc_object_t *, module_config_t *, QWidget * );
- FontConfigControl( vlc_object_t *, module_config_t *, QLabel *,
- QFontComboBox *);
- QString getValue() const Q_DECL_OVERRIDE { return font->currentFont().family(); }
+ FontConfigControl( module_config_t *, QWidget * );
+ FontConfigControl( module_config_t *, QLabel *, QFontComboBox *);
+ QString getValue() const Q_DECL_OVERRIDE { return font->currentFont().family(); }
protected:
void changeVisibility( bool b ) Q_DECL_OVERRIDE
{
@@ -386,9 +367,8 @@ class ModuleConfigControl : public VStringConfigControl
{
Q_OBJECT
public:
- ModuleConfigControl( vlc_object_t *, module_config_t *, QWidget * );
- ModuleConfigControl( vlc_object_t *, module_config_t *, QLabel *,
- QComboBox* );
+ ModuleConfigControl( module_config_t *, QWidget * );
+ ModuleConfigControl( module_config_t *, QLabel *, QComboBox* );
QString getValue() const Q_DECL_OVERRIDE;
protected:
void changeVisibility( bool b ) Q_DECL_OVERRIDE
@@ -413,9 +393,8 @@ class ModuleListConfigControl : public VStringConfigControl
Q_OBJECT
friend class ConfigControl;
public:
- ModuleListConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool );
-// ModuleListConfigControl( vlc_object_t *, module_config_t *, QLabel *,
-// QComboBox*, bool );
+ ModuleListConfigControl( module_config_t *, QWidget *, bool );
+// ModuleListConfigControl( module_config_t *, QLabel *, QComboBox*, bool );
virtual ~ModuleListConfigControl();
QString getValue() const Q_DECL_OVERRIDE;
public slots:
@@ -436,9 +415,8 @@ class StringListConfigControl : public VStringConfigControl
{
Q_OBJECT
public:
- StringListConfigControl( vlc_object_t *, module_config_t *, QWidget * );
- StringListConfigControl( vlc_object_t *, module_config_t *, QLabel *,
- QComboBox*, bool );
+ StringListConfigControl( module_config_t *, QWidget * );
+ StringListConfigControl( module_config_t *, QLabel *, QComboBox* );
QString getValue() const Q_DECL_OVERRIDE;
protected:
void changeVisibility( bool b ) Q_DECL_OVERRIDE
@@ -451,35 +429,12 @@ protected:
private:
void finish(module_config_t * );
QLabel *label;
- QList<QPushButton *> buttons;
private slots:
void comboIndexChanged( int );
};
void setfillVLCConfigCombo(const char *configname, QComboBox *combo );
-#if 0
-struct ModuleCheckBox {
- QCheckBox *checkbox;
- QString module;
-};
-
-class ModuleListConfigControl : public ConfigControl
-{
- Q_OBJECT
-public:
- StringConfigControl( vlc_object_t *, module_config_t *, QWidget *, bool
- bycat );
- virtual ~StringConfigControl();
- QString getValue() Q_DECL_OVERRIDE;
-private:
- QVector<ModuleCheckBox> checkboxes;
- QLineEdit *text;
-private slot:
- void OnUpdate();
-};
-#endif
-
/**********************************************************************
* Key selector widget
**********************************************************************/
@@ -488,8 +443,7 @@ class KeySelectorControl : public ConfigControl
Q_OBJECT
public:
- KeySelectorControl( vlc_object_t *, QWidget * );
- int getType() const Q_DECL_OVERRIDE;
+ KeySelectorControl( QWidget * );
void doApply() Q_DECL_OVERRIDE;
enum ColumnIndex
{
=====================================
modules/gui/qt/dialogs/preferences/simple_preferences.cpp
=====================================
@@ -154,47 +154,43 @@ static int getDefaultAudioVolume(const char *aout)
#else
return -1;
#endif
- else
+
/* Note: For hysterical raisins, this is sorted by decreasing priority
* order (then alphabetical order). */
if (!strcmp(aout, "pulse"))
return -1;
- else
+
#ifdef __linux__
if (!strcmp(aout, "alsa") && module_exists("alsa"))
return cbrtf(config_GetFloat("alsa-gain")) * 100.f + .5f;
- else
#endif
#ifdef _WIN32
if (!strcmp(aout, "mmdevice"))
return config_GetFloat("mmdevice-volume") * 100.f + .5f;
- else
#endif
#ifdef __APPLE__
if (!strcmp(aout, "auhal") && module_exists("auhal"))
return (config_GetFloat("auhal-volume") * 100.f + .5f)
/ AOUT_VOLUME_DEFAULT;
- else
#endif
#ifdef _WIN32
if (!strcmp(aout, "directsound") && module_exists("directsound"))
return config_GetFloat("directx-volume") * 100.f + .5f;
- else
#endif
+
if (!strcmp(aout, "jack"))
return cbrtf(config_GetFloat("jack-gain")) * 100.f + 0.5f;
- else
+
#ifdef __OS2__
if (!strcmp(aout, "kai"))
return cbrtf(config_GetFloat("kai-gain")) * 100.f + .5f;
- else
#endif
#ifdef _WIN32
if (!strcmp(aout, "waveout"))
return config_GetFloat("waveout-volume") * 100.f + .5f;
- else
#endif
- return -1;
+
+ return -1;
}
namespace
@@ -326,8 +322,8 @@ SPrefsPanel::SPrefsPanel( qt_intf_t *_p_intf, QWidget *_parent,
p_config = config_FindConfig( option ); \
if( p_config ) \
{ \
- control = new type ## ConfigControl( VLC_OBJECT(p_intf), \
- p_config, label, ui.qcontrol, false ); \
+ control = new type ## ConfigControl( \
+ p_config, label, ui.qcontrol ); \
controls.append( control ); \
} \
else { \
@@ -339,8 +335,8 @@ SPrefsPanel::SPrefsPanel( qt_intf_t *_p_intf, QWidget *_parent,
p_config = config_FindConfig( option ); \
if( p_config ) \
{ \
- control = new BoolConfigControl( VLC_OBJECT(p_intf), \
- p_config, NULL, ui.qcontrol ); \
+ control = new BoolConfigControl( \
+ p_config, NULL, ui.qcontrol ); \
controls.append( control ); \
} \
else { ui.qcontrol->setEnabled( false ); }
@@ -350,8 +346,8 @@ SPrefsPanel::SPrefsPanel( qt_intf_t *_p_intf, QWidget *_parent,
p_config = config_FindConfig( option ); \
if( p_config ) \
{ \
- control = new type ## ConfigControl( VLC_OBJECT(p_intf), \
- p_config, label, qcontrol, false ); \
+ control = new type ## ConfigControl( \
+ p_config, label, qcontrol ); \
controls.append( control ); \
} \
else { \
@@ -365,7 +361,7 @@ SPrefsPanel::SPrefsPanel( qt_intf_t *_p_intf, QWidget *_parent,
p_config = config_FindConfig( option ); \
if( p_config ) \
{ \
- control = new type ## ConfigControl( VLC_OBJECT(p_intf), \
+ control = new type ## ConfigControl( \
p_config, label, ui.qcontrol ); \
controls.append( control ); \
}
@@ -374,7 +370,7 @@ SPrefsPanel::SPrefsPanel( qt_intf_t *_p_intf, QWidget *_parent,
p_config = config_FindConfig( option ); \
if( p_config ) \
{ \
- control = new type ## ConfigControl( VLC_OBJECT(p_intf), \
+ control = new type ## ConfigControl( \
p_config, label, qcontrol, qbutton ); \
controls.append( control ); \
}
@@ -413,7 +409,7 @@ SPrefsPanel::SPrefsPanel( qt_intf_t *_p_intf, QWidget *_parent,
/******************************
* VIDEO Panel Implementation *
******************************/
- START_SPREFS_CAT( Video , qtr("Video Settings") );
+ START_SPREFS_CAT( Video, qtr("Video Settings") );
CONFIG_BOOL( "video", enableVideo );
ui.videoZone->setEnabled( ui.enableVideo->isChecked() );
CONNECT( ui.enableVideo, toggled( bool ),
@@ -433,7 +429,7 @@ SPrefsPanel::SPrefsPanel( qt_intf_t *_p_intf, QWidget *_parent,
ui.fullscreenScreenBox->addItem( screen->name(), i_screenCount );
i_screenCount++;
}
- p_config = config_FindConfig( "qt-fullscreen-screennumber" );
+ p_config = config_FindConfig( "qt-fullscreen-screennumber" );
if( p_config )
{
int i_defaultScreen = p_config->value.i + 1;
@@ -468,7 +464,7 @@ SPrefsPanel::SPrefsPanel( qt_intf_t *_p_intf, QWidget *_parent,
snapshotsSequentialNumbering );
CONFIG_GENERIC( "snapshot-format", StringList, ui.arLabel,
snapshotsFormat );
- END_SPREFS_CAT;
+ END_SPREFS_CAT;
/******************************
* AUDIO Panel Implementation *
@@ -661,7 +657,9 @@ SPrefsPanel::SPrefsPanel( qt_intf_t *_p_intf, QWidget *_parent,
END_SPREFS_CAT;
- /* Input and Codecs Panel Implementation */
+ /*****************************************
+ * INPUT AND CODECS Panel Implementation *
+ *****************************************/
START_SPREFS_CAT( InputAndCodecs, qtr("Input & Codecs Settings") );
/* Disk Devices */
@@ -704,8 +702,7 @@ SPrefsPanel::SPrefsPanel( qt_intf_t *_p_intf, QWidget *_parent,
CONFIG_GENERIC( "avi-index", IntegerList, ui.aviLabel, AviRepair );
/* live555 module prefs */
- CONFIG_BOOL( "rtsp-tcp",
- live555TransportRTSP_TCPRadio );
+ CONFIG_BOOL( "rtsp-tcp", live555TransportRTSP_TCPRadio );
if ( !module_exists( "live555" ) )
{
ui.live555TransportRTSP_TCPRadio->hide();
@@ -747,13 +744,14 @@ SPrefsPanel::SPrefsPanel( qt_intf_t *_p_intf, QWidget *_parent,
TestCaC( "live-caching", 1 );
if( b_cache_equal == 1 )
ui.cachingCombo->setCurrentIndex(
- ui.cachingCombo->findData( QVariant( i_cache ) ) );
+ ui.cachingCombo->findData( QVariant( i_cache ) ) );
#undef TestCaC
END_SPREFS_CAT;
- /*******************
- * Interface Panel *
- *******************/
+
+ /**********************************
+ * INTERFACE Panel Implementation *
+ **********************************/
START_SPREFS_CAT( Interface, qtr("Interface Settings") );
#ifndef _WIN32
@@ -916,8 +914,7 @@ SPrefsPanel::SPrefsPanel( qt_intf_t *_p_intf, QWidget *_parent,
{
CONFIG_BOOL( "one-instance", OneInterfaceMode );
CONFIG_BOOL( "playlist-enqueue", EnqueueOneInterfaceMode );
- ui.EnqueueOneInterfaceMode->setEnabled(
- ui.OneInterfaceMode->isChecked() );
+ ui.EnqueueOneInterfaceMode->setEnabled( ui.OneInterfaceMode->isChecked() );
CONNECT( ui.OneInterfaceMode, toggled( bool ),
ui.EnqueueOneInterfaceMode, setEnabled( bool ) );
CONFIG_BOOL( "one-instance-when-started-from-file", oneInstanceFromFile );
@@ -935,6 +932,9 @@ SPrefsPanel::SPrefsPanel( qt_intf_t *_p_intf, QWidget *_parent,
END_SPREFS_CAT;
+ /**********************************
+ * SUBTITLES Panel Implementation *
+ **********************************/
START_SPREFS_CAT( Subtitles,
qtr("Subtitle & On Screen Display Settings") );
CONFIG_BOOL( "osd", OSDBox);
@@ -975,6 +975,9 @@ SPrefsPanel::SPrefsPanel( qt_intf_t *_p_intf, QWidget *_parent,
CONFIG_GENERIC_NO_BOOL( "secondary-sub-margin", Integer, ui.secondarySubsPosLabel, secondarySubsPosition );
END_SPREFS_CAT;
+ /********************************
+ * HOTKEYS Panel Implementation *
+ ********************************/
case SPrefsHotkeys:
{
QGridLayout *gLayout = new QGridLayout;
@@ -982,23 +985,21 @@ SPrefsPanel::SPrefsPanel( qt_intf_t *_p_intf, QWidget *_parent,
int line = 0;
panel_label->setText( qtr( "Configure Hotkeys" ) );
- control = new KeySelectorControl( VLC_OBJECT(p_intf), this );
+ control = new KeySelectorControl( this );
control->insertIntoExistingGrid( gLayout, line );
controls.append( control );
line++;
p_config = config_FindConfig( "hotkeys-y-wheel-mode" );
- control = new IntegerListConfigControl( VLC_OBJECT(p_intf),
- p_config, this, false );
+ control = new IntegerListConfigControl( p_config, this );
control->insertIntoExistingGrid( gLayout, line );
controls.append( control );
line++;
p_config = config_FindConfig( "hotkeys-x-wheel-mode" );
- control = new IntegerListConfigControl( VLC_OBJECT(p_intf),
- p_config, this, false );
+ control = new IntegerListConfigControl( p_config, this );
control->insertIntoExistingGrid( gLayout, line );
controls.append( control );
@@ -1006,36 +1007,39 @@ SPrefsPanel::SPrefsPanel( qt_intf_t *_p_intf, QWidget *_parent,
line++;
p_config = config_FindConfig( "qt-disable-volume-keys" );
- control = new BoolConfigControl( VLC_OBJECT(p_intf), p_config, this );
+ control = new BoolConfigControl( p_config, this );
control->insertIntoExistingGrid( gLayout, line );
controls.append( control );
#endif
break;
}
- START_SPREFS_CAT( MediaLibrary , qtr("Media Library Settings") );
+ /**************************************
+ * MEDIA LIBRARY Panel Implementation *
+ **************************************/
+ START_SPREFS_CAT( MediaLibrary , qtr("Media Library Settings") );
- if ( vlc_ml_instance_get( p_intf ) != NULL )
- {
- auto foldersModel = new MLFoldersModel( this );
- foldersModel->setMl( vlc_ml_instance_get( p_intf ) );
- ui.entryPoints->setMLFoldersModel( foldersModel );
- mlFoldersEditor = ui.entryPoints;
-
- auto bannedFoldersModel = new MLBannedFoldersModel( this );
- bannedFoldersModel->setMl( vlc_ml_instance_get( p_intf ));
- ui.bannedEntryPoints->setMLFoldersModel( bannedFoldersModel );
- mlBannedFoldersEditor = ui.bannedEntryPoints;
-
- BUTTONACT( ui.addButton , MLaddNewFolder() );
- BUTTONACT( ui.banButton , MLBanFolder() );
- }
- else
- {
- ui.mlGroupBox->hide( );
- }
+ if ( vlc_ml_instance_get( p_intf ) != NULL )
+ {
+ auto foldersModel = new MLFoldersModel( this );
+ foldersModel->setMl( vlc_ml_instance_get( p_intf ) );
+ ui.entryPoints->setMLFoldersModel( foldersModel );
+ mlFoldersEditor = ui.entryPoints;
+
+ auto bannedFoldersModel = new MLBannedFoldersModel( this );
+ bannedFoldersModel->setMl( vlc_ml_instance_get( p_intf ));
+ ui.bannedEntryPoints->setMLFoldersModel( bannedFoldersModel );
+ mlBannedFoldersEditor = ui.bannedEntryPoints;
+
+ BUTTONACT( ui.addButton , MLaddNewFolder() );
+ BUTTONACT( ui.banButton , MLBanFolder() );
+ }
+ else
+ {
+ ui.mlGroupBox->hide( );
+ }
- END_SPREFS_CAT;
+ END_SPREFS_CAT;
}
panel_layout->addWidget( panel_label );
@@ -1059,7 +1063,7 @@ SPrefsPanel::SPrefsPanel( qt_intf_t *_p_intf, QWidget *_parent,
}
-void SPrefsPanel::updateAudioOptions( int number)
+void SPrefsPanel::updateAudioOptions( int number )
{
QString value = qobject_cast<QComboBox *>(optionWidgets["audioOutCoB"])
->itemData( number ).toString();
=====================================
modules/gui/qt/widgets/native/customwidgets.cpp
=====================================
@@ -54,24 +54,6 @@ void QFramelessButton::paintEvent( QPaintEvent * )
}
-QElidingLabel::QElidingLabel( const QString &s, Qt::TextElideMode mode, QWidget * parent )
- : QLabel( s, parent ), elideMode( mode )
-{ }
-
-void QElidingLabel::setElideMode( Qt::TextElideMode mode )
-{
- elideMode = mode;
- repaint();
-}
-
-void QElidingLabel::paintEvent( QPaintEvent * )
-{
- QPainter p( this );
- int space = frameWidth() + margin();
- QRect r = rect().adjusted( space, space, -space, -space );
- p.drawText( r, fontMetrics().elidedText( text(), elideMode, r.width() ), alignment() );
-}
-
QString QVLCDebugLevelSpinBox::textFromValue( int v ) const
{
QString const texts[] = {
=====================================
modules/gui/qt/widgets/native/customwidgets.hpp
=====================================
@@ -76,30 +76,6 @@ signals:
void longClicked();
};
-class QElidingLabel : public QLabel
-{
-public:
- QElidingLabel( const QString &s = QString(),
- Qt::TextElideMode mode = Qt::ElideRight,
- QWidget * parent = NULL );
- void setElideMode( Qt::TextElideMode );
-protected:
- void paintEvent( QPaintEvent * event ) Q_DECL_OVERRIDE;
-private:
- Qt::TextElideMode elideMode;
-};
-
-
-class QVLCStackedWidget : public QStackedWidget
-{
-public:
- QVLCStackedWidget( QWidget *parent ) : QStackedWidget( parent ) { }
- QSize minimumSizeHint () const
- {
- return currentWidget() ? currentWidget()->minimumSizeHint() : QSize();
- }
-};
-
class QVLCDebugLevelSpinBox : public QSpinBox
{
Q_OBJECT
=====================================
src/config/configuration.h
=====================================
@@ -40,15 +40,6 @@ bool config_PrintHelp (vlc_object_t *);
int config_SortConfig (void);
void config_UnsortConfig (void);
-#define CONFIG_CLASS(x) ((x) & ~0x1F)
-
-#define IsConfigStringType(type) \
- (((type) & CONFIG_ITEM_STRING) != 0)
-#define IsConfigIntegerType(type) \
- (((type) & CONFIG_ITEM_INTEGER) != 0)
-#define IsConfigFloatType(type) \
- ((type) == CONFIG_ITEM_FLOAT)
-
extern vlc_rwlock_t config_lock;
extern bool config_dirty;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/06314d8c471a5ed216b9e2b012b6489c59fbe627...259f2753afdb957f7a1063f9781a5ac2a13d60f8
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/06314d8c471a5ed216b9e2b012b6489c59fbe627...259f2753afdb957f7a1063f9781a5ac2a13d60f8
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list