Commit a05072b5 authored by Francois Cartegnie's avatar Francois Cartegnie

Qt: prefsItem: namespace TYPE_*

parent 6f8e8326
...@@ -108,7 +108,7 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : ...@@ -108,7 +108,7 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) :
data->help = qtr( psz_help ); data->help = qtr( psz_help );
else else
data->help.clear(); data->help.clear();
data->i_type = TYPE_CATEGORY; data->i_type = PrefsItemData::TYPE_CATEGORY;
data->i_object_id = p_item->value.i; data->i_object_id = p_item->value.i;
/* This is a category, put a nice icon */ /* This is a category, put a nice icon */
...@@ -151,7 +151,7 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : ...@@ -151,7 +151,7 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) :
p_item->value.i == SUBCAT_AUDIO_GENERAL ) ) p_item->value.i == SUBCAT_AUDIO_GENERAL ) )
{ {
/* Data still contains the correct thing */ /* Data still contains the correct thing */
data->i_type = TYPE_CATSUBCAT; data->i_type = PrefsItemData::TYPE_CATSUBCAT;
data->i_subcat_id = p_item->value.i; data->i_subcat_id = p_item->value.i;
data->name = qtr( config_CategoryNameGet( p_item->value.i ) ); data->name = qtr( config_CategoryNameGet( p_item->value.i ) );
psz_help = config_CategoryHelpGet( p_item->value.i ); psz_help = config_CategoryHelpGet( p_item->value.i );
...@@ -174,7 +174,7 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : ...@@ -174,7 +174,7 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) :
data_sub->help = qtr( psz_help ); data_sub->help = qtr( psz_help );
else else
data_sub->help.clear(); data_sub->help.clear();
data_sub->i_type = TYPE_SUBCATEGORY; data_sub->i_type = PrefsItemData::TYPE_SUBCATEGORY;
data_sub->i_object_id = p_item->value.i; data_sub->i_object_id = p_item->value.i;
/* Create a new TreeWidget */ /* Create a new TreeWidget */
...@@ -269,7 +269,7 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) : ...@@ -269,7 +269,7 @@ PrefsTree::PrefsTree( intf_thread_t *_p_intf, QWidget *_parent ) :
if( !b_found ) continue; if( !b_found ) continue;
PrefsItemData *module_data = new PrefsItemData(); PrefsItemData *module_data = new PrefsItemData();
module_data->i_type = TYPE_MODULE; module_data->i_type = PrefsItemData::TYPE_MODULE;
module_data->psz_name = strdup( module_get_object( p_module ) ); module_data->psz_name = strdup( module_get_object( p_module ) );
module_data->name = qtr( module_get_name( p_module, false ) ); module_data->name = qtr( module_get_name( p_module, false ) );
module_data->help.clear(); module_data->help.clear();
...@@ -581,9 +581,9 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -581,9 +581,9 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
{ {
/* Find our module */ /* Find our module */
module_t *p_module = NULL; module_t *p_module = NULL;
if( data->i_type == TYPE_CATEGORY ) if( data->i_type == PrefsItemData::TYPE_CATEGORY )
return; return;
else if( data->i_type == TYPE_MODULE ) else if( data->i_type == PrefsItemData::TYPE_MODULE )
p_module = module_find( data->psz_name ); p_module = module_find( data->psz_name );
else else
{ {
...@@ -596,15 +596,16 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -596,15 +596,16 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
*p_item = p_config, *p_item = p_config,
*p_end = p_config + confsize; *p_end = p_config + confsize;
if( data->i_type == TYPE_SUBCATEGORY || data->i_type == TYPE_CATSUBCAT ) if( data->i_type == PrefsItemData::TYPE_SUBCATEGORY ||
data->i_type == PrefsItemData::TYPE_CATSUBCAT )
{ {
while (p_item < p_end) while (p_item < p_end)
{ {
if( p_item->i_type == CONFIG_SUBCATEGORY && if( p_item->i_type == CONFIG_SUBCATEGORY &&
( ( data->i_type == TYPE_SUBCATEGORY && ( ( data->i_type == PrefsItemData::TYPE_SUBCATEGORY &&
p_item->value.i == data->i_object_id ) || p_item->value.i == data->i_object_id ) ||
( data->i_type == TYPE_CATSUBCAT && ( data->i_type == PrefsItemData::TYPE_CATSUBCAT &&
p_item->value.i == data->i_subcat_id ) ) ) p_item->value.i == data->i_subcat_id ) ) )
break; break;
p_item++; p_item++;
} }
...@@ -618,7 +619,8 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -618,7 +619,8 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
help = QString( data->help ); help = QString( data->help );
if( data->i_type == TYPE_SUBCATEGORY || data->i_type == TYPE_CATSUBCAT ) if( data->i_type == PrefsItemData::TYPE_SUBCATEGORY ||
data->i_type == PrefsItemData::TYPE_CATSUBCAT )
{ {
head = QString( data->name ); head = QString( data->name );
p_item++; // Why that ? p_item++; // Why that ?
...@@ -658,9 +660,9 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -658,9 +660,9 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
if( p_item ) do if( p_item ) do
{ {
if( ( ( data->i_type == TYPE_SUBCATEGORY && if( ( ( data->i_type == PrefsItemData::TYPE_SUBCATEGORY &&
p_item->value.i != data->i_object_id ) || p_item->value.i != data->i_object_id ) ||
( data->i_type == TYPE_CATSUBCAT && ( data->i_type == PrefsItemData::TYPE_CATSUBCAT &&
p_item->value.i != data->i_subcat_id ) ) && p_item->value.i != data->i_subcat_id ) ) &&
( p_item->i_type == CONFIG_CATEGORY || ( p_item->i_type == CONFIG_CATEGORY ||
p_item->i_type == CONFIG_SUBCATEGORY ) ) p_item->i_type == CONFIG_SUBCATEGORY ) )
...@@ -702,8 +704,8 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent, ...@@ -702,8 +704,8 @@ AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
else i_line++; else i_line++;
controls.append( control ); controls.append( control );
} }
while( !( ( data->i_type == TYPE_SUBCATEGORY || while( !( ( data->i_type == PrefsItemData::TYPE_SUBCATEGORY ||
data->i_type == TYPE_CATSUBCAT ) && data->i_type == PrefsItemData::TYPE_CATSUBCAT ) &&
( p_item->i_type == CONFIG_CATEGORY || ( p_item->i_type == CONFIG_CATEGORY ||
p_item->i_type == CONFIG_SUBCATEGORY ) ) p_item->i_type == CONFIG_SUBCATEGORY ) )
&& ( ++p_item < p_end ) ); && ( ++p_item < p_end ) );
......
...@@ -34,14 +34,6 @@ ...@@ -34,14 +34,6 @@
#include <QTreeWidget> #include <QTreeWidget>
#include <QSet> #include <QSet>
enum
{
TYPE_CATEGORY,
TYPE_CATSUBCAT,
TYPE_SUBCATEGORY,
TYPE_MODULE
};
class AdvPrefsPanel; class AdvPrefsPanel;
class QLabel; class QLabel;
class QVBoxLayout; class QVBoxLayout;
...@@ -56,7 +48,14 @@ public: ...@@ -56,7 +48,14 @@ public:
AdvPrefsPanel *panel; AdvPrefsPanel *panel;
int i_object_id; int i_object_id;
int i_subcat_id; int i_subcat_id;
int i_type; enum prefsType
{
TYPE_CATEGORY,
TYPE_CATSUBCAT,
TYPE_SUBCATEGORY,
TYPE_MODULE
};
prefsType i_type;
char *psz_name; char *psz_name;
bool b_loaded; bool b_loaded;
QString name; QString name;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment