[vlc-commits] [Git][videolan/vlc][master] 2 commits: config: add unknown cat/subcat defines
Jean-Baptiste Kempf (@jbk)
gitlab at videolan.org
Wed Jun 30 11:31:22 UTC 2021
Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC
Commits:
aef8cbfe by Lyndon Brown at 2021-06-30T10:48:32+00:00
config: add unknown cat/subcat defines
for use in unknown/unset/invalid situations.
- - - - -
3b07d208 by Lyndon Brown at 2021-06-30T10:48:32+00:00
qt: improve a subcat ID init
(non-functional).
a value of `0` in some parts of the tree construction code corresponds
to unknown/unset/invalid, for which the new 'unknown' defines are used.
a value of `-1` corresponds to 'hidden'.
this instance of `-1` was not changed to use the `SUBCAT_HIDDEN` define
when that was introduced because it was not clear that 'hidden' truly
represented what was really intended by this init value and in fact
that the wrong init value was likely being used here.
since this attribute is only ever used for `TYPE_CATSUBCAT` instances,
and is always overwritten by the actual subcat ID upon creation, it
really doesn't matter what it is initialised with. to be more correct,
clear and consistent though, let's init as 'unknown' - the correct
define for initialisation purposes.
- - - - -
3 changed files:
- include/vlc_plugin.h
- modules/gui/macosx/preferences/prefs.m
- modules/gui/qt/dialogs/preferences/complete_preferences.cpp
Changes:
=====================================
include/vlc_plugin.h
=====================================
@@ -150,6 +150,10 @@ enum vlc_module_properties
#define CAT_HIDDEN -1
#define SUBCAT_HIDDEN -1
+/* Unknown/unset/invalid */
+#define CAT_UNKNOWN 0
+#define SUBCAT_UNKNOWN 0
+
/* Categories and subcategories */
#define CAT_INTERFACE 1
#define SUBCAT_INTERFACE_GENERAL 101
=====================================
modules/gui/macosx/preferences/prefs.m
=====================================
@@ -488,7 +488,7 @@
VLCTreeSubCategoryItem * subCategoryItem = nil;
VLCTreePluginItem * pluginItem = nil;
module_config_t *p_configs = NULL;
- int lastsubcat = 0;
+ int lastsubcat = SUBCAT_UNKNOWN;
unsigned int confsize;
module_t * p_module = modules[i];
=====================================
modules/gui/qt/dialogs/preferences/complete_preferences.cpp
=====================================
@@ -189,7 +189,7 @@ PrefsTree::PrefsTree( qt_intf_t *_p_intf, QWidget *_parent,
if( module_is_main( p_module) ) continue;
unsigned confsize;
- int i_subcategory = 0, i_category = 0;
+ int i_subcategory = SUBCAT_UNKNOWN, i_category = CAT_UNKNOWN;
bool b_options = false;
module_config_t *const p_config = module_config_get (p_module, &confsize);
@@ -207,14 +207,14 @@ PrefsTree::PrefsTree( qt_intf_t *_p_intf, QWidget *_parent,
if( CONFIG_ITEM(p_item->i_type) )
b_options = true;
- if( b_options && i_category && i_subcategory )
+ if( b_options && i_category != CAT_UNKNOWN && i_subcategory != SUBCAT_UNKNOWN )
break;
}
module_config_free (p_config);
/* Dummy item, please proceed */
- if( !b_options || i_category == 0 || i_subcategory == 0 ) continue;
-
+ if( !b_options || i_category == CAT_UNKNOWN || i_subcategory == SUBCAT_UNKNOWN )
+ continue;
// Locate the category item;
QTreeWidgetItem *subcat_item = NULL;
@@ -482,7 +482,7 @@ PrefsItemData::PrefsItemData( QObject *_parent ) : QObject( _parent )
{
panel = NULL;
i_object_id = 0;
- i_subcat_id = -1;
+ i_subcat_id = SUBCAT_UNKNOWN;
psz_shortcut = NULL;
b_loaded = false;
}
@@ -495,7 +495,7 @@ bool PrefsItemData::contains( const QString &text, Qt::CaseSensitivity cs )
return false;
bool is_core = this->i_type != TYPE_MODULE;
- int id = 0;
+ int id = SUBCAT_UNKNOWN;
/* find our module */
module_t *p_module;
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fe250af922d3a927643ecf3287a03996700c9363...3b07d208af4a3b0533efef3bc59f08d2a84795f5
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/fe250af922d3a927643ecf3287a03996700c9363...3b07d208af4a3b0533efef3bc59f08d2a84795f5
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list