/*********************************************************************
* The Panel
*********************************************************************/
-PrefsPanel::PrefsPanel( QWidget *_parent ) : QWidget( _parent )
+AdvPrefsPanel::AdvPrefsPanel( QWidget *_parent ) : QWidget( _parent )
{}
-PrefsPanel::PrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
+AdvPrefsPanel::AdvPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
PrefsItemData * data ) :
QWidget( _parent ), p_intf( _p_intf )
{
setLayout( global_layout );
}
-void PrefsPanel::apply()
+void AdvPrefsPanel::apply()
{
QList<ConfigControl *>::Iterator i;
for( i = controls.begin() ; i != controls.end() ; i++ )
c->doApply( p_intf );
}
}
-void PrefsPanel::clean()
+void AdvPrefsPanel::clean()
{}
for( int i = 0; i < SPrefsMax ; i++ ) simple_panels[i] = NULL;
if( config_GetInt( p_intf, "qt-advanced-pref") == 1 )
- {
- setAll();
- }
+ SetAdvanced();
else
- {
setSmall();
- }
BUTTONACT( save, save() );
BUTTONACT( cancel, cancel() );
BUTTONACT( reset, reset() );
- BUTTONACT( small, setSmall() );
- BUTTONACT( all, setAll() );
+ BUTTONACT( small, setSmall() );
+ BUTTONACT( all, SetAdvanced() );
}
-void PrefsDialog::setAll()
+void PrefsDialog::SetAdvanced()
{
/* We already have a simple TREE, and we just want to hide it */
if( simple_tree )
/* and connections */
CONNECT( advanced_tree,
currentItemChanged( QTreeWidgetItem *, QTreeWidgetItem *),
- this, changePanel( QTreeWidgetItem * ) );
+ this, changeAdvPanel( QTreeWidgetItem * ) );
}
/* Add the Advanced tree to the tree_panel, even if it is already inside,
since it can't hurt. And show it. */
}
/* If no advanced Panel exist, create one, attach it and show it*/
if( !advanced_panel )
- advanced_panel = new PrefsPanel( main_panel );
+ advanced_panel = new AdvPrefsPanel( main_panel );
main_panel_l->addWidget( advanced_panel );
all->setChecked( true );
advanced_panel->show();
current_simple_panel->show();
}
+/* Switching from on simple panel to another */
void PrefsDialog::changeSimplePanel( int number )
{
if( current_simple_panel )
current_simple_panel->show();
}
-void PrefsDialog::changePanel( QTreeWidgetItem *item )
+/* Changing from one Advanced Panel to another */
+void PrefsDialog::changeAdvPanel( QTreeWidgetItem *item )
{
PrefsItemData *data = item->data( 0, Qt::UserRole ).value<PrefsItemData*>();
advanced_panel->hide();
}
if( !data->panel )
- data->panel = new PrefsPanel( p_intf, main_panel , data );
+ data->panel = new AdvPrefsPanel( p_intf, main_panel , data );
advanced_panel = data->panel;
main_panel_l->addWidget( advanced_panel );
advanced_panel->show();
}
+#if 0
+/*Called from extended settings, is not used anymore, but could be useful one day*/
void PrefsDialog::showModulePrefs( char *psz_module )
{
- setAll();
+ SetAdvanced();
all->setChecked( true );
for( int i_cat_index = 0 ; i_cat_index < advanced_tree->topLevelItemCount();
i_cat_index++ )
}
show();
}
+#endif
+/* Actual apply and save for the preferences */
void PrefsDialog::save()
-{
- apply();
- hide();
-}
-
-void PrefsDialog::apply()
{
if( small->isChecked() && simple_tree )
{
delete current_simple_panel;
current_simple_panel = NULL;
}
+
+ hide();
}
+/* Clean the preferences, dunno if it does something really */
void PrefsDialog::cancel()
{
if( small->isChecked() && simple_tree )
hide();
}
+/* Reset all the preferences, when you click the button */
void PrefsDialog::reset()
{
int ret = QMessageBox::question(this, qtr("Reset Preferences"),
class PrefsTree;
class SPrefsCatList;
-class PrefsPanel;
+class AdvPrefsPanel;
class SPrefsPanel;
class QTreeWidgetItem;
class QTreeWidget;
return instance;
}
virtual ~PrefsDialog() {};
-
+#if 0
+ /*Called from extended settings, is not used anymore, but could be useful one day*/
void showModulePrefs( char* );
+#endif
private:
PrefsDialog( intf_thread_t * );
QWidget *main_panel;
QHBoxLayout *main_panel_l;
- PrefsPanel *advanced_panel;
+
+ AdvPrefsPanel *advanced_panel;
SPrefsPanel *current_simple_panel;
SPrefsPanel *simple_panels[SPrefsMax];
QGridLayout *main_layout;
static PrefsDialog *instance;
+
private slots:
- void changePanel( QTreeWidgetItem * );
- void changeSimplePanel( int );
- void setAll();
- void setSmall();
- void save();
- void apply();
- void cancel();
- void reset();
- void close(){ save(); };
+ void SetAdvanced();
+ void setSmall();
+
+ void changeAdvPanel( QTreeWidgetItem * );
+ void changeSimplePanel( int );
+
+ void save();
+ void cancel();
+ void reset();
+ void close(){ save(); }; /* Needed for any generic CloseEvent*/
};
#endif