summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorllunak <llunak@fairy.suse.cz>2008-10-22 13:18:03 +0200
committerllunak <llunak@fairy.suse.cz>2008-10-22 13:18:03 +0200
commitb92aa7928b821d7bd178d48c83846462ddcd2e05 (patch)
treec271ab5a569ae851cf5c0c288906352f85eebbfa
parentc55e8fec90ef11230cd01875891a78450b03b98b (diff)
downloadsimple-ccsm-kde-b92aa7928b821d7bd178d48c83846462ddcd2e05.tar.gz
simple-ccsm-kde-b92aa7928b821d7bd178d48c83846462ddcd2e05.tar.bz2
Try to handle better optional plugins.
-rw-r--r--dialog.cpp40
1 files changed, 34 insertions, 6 deletions
diff --git a/dialog.cpp b/dialog.cpp
index 4d08ad5..ce40919 100644
--- a/dialog.cpp
+++ b/dialog.cpp
@@ -274,7 +274,7 @@ void Dialog::setupCube()
{
CCSPlugin* cube = plugin( "cube" );
ui.cube_groupbox->setTitle( QString::fromUtf8( cube->shortDesc ));
- CCSPlugin* cubeaddon = plugin( "cubeaddon" );
+ CCSPlugin* cubeaddon = plugin( "cubeaddon", false );
setupCombo( cubeaddon, "deformation", ui.deformation_label, ui.deformation_combo );
setupSpinbox( cube, "active_opacity", ui.opacity_label, ui.opacity_spinbox );
setupCheckbox( cubeaddon, "reflection", true, ui.reflection_checkbox );
@@ -284,7 +284,7 @@ void Dialog::setupCube()
void Dialog::saveCube()
{
CCSPlugin* cube = plugin( "cube" );
- CCSPlugin* cubeaddon = plugin( "cubeaddon" );
+ CCSPlugin* cubeaddon = plugin( "cubeaddon", false );
saveCombo( cubeaddon, "deformation", ui.deformation_combo );
saveSpinbox( cube, "active_opacity", ui.opacity_spinbox );
saveCheckbox( cubeaddon, "reflection", ui.reflection_checkbox );
@@ -312,7 +312,7 @@ void Dialog::saveDesktop()
{
if( ui.desktop_appearance_combo->currentIndex() == 0 )
{
- ccsPluginSetActive( plugin( "cubeaddon" ), FALSE );
+ ccsPluginSetActive( plugin( "cubeaddon", false ), FALSE );
ccsPluginSetActive( plugin( "rotate" ), FALSE );
ccsPluginSetActive( plugin( "cube" ), FALSE );
ccsPluginSetActive( plugin( "wall" ), TRUE );
@@ -322,7 +322,7 @@ void Dialog::saveDesktop()
ccsPluginSetActive( plugin( "wall" ), FALSE );
ccsPluginSetActive( plugin( "cube" ), TRUE );
ccsPluginSetActive( plugin( "rotate" ), TRUE );
- ccsPluginSetActive( plugin( "cubeaddon" ), TRUE );
+ ccsPluginSetActive( plugin( "cubeaddon", false ), TRUE );
ui.desktop_rows_spinbox->setValue( 1 );
}
saveSpinbox( plugin( "core" ), "hsize", ui.desktop_columns_spinbox );
@@ -442,6 +442,12 @@ void Dialog::saveEdge( CCSPlugin* plugin, const char* option, unsigned int edges
void Dialog::setupCombo( CCSPlugin* p, const char* option, QLabel* label, QComboBox* combo )
{
+ if( p == NULL )
+ {
+ label->hide();
+ combo->hide();
+ return;
+ }
CCSSetting* s = setting( p, option );
label->setText( s->shortDesc );
label->setToolTip( s->longDesc );
@@ -479,6 +485,8 @@ void Dialog::setupCombo( CCSPlugin* p, const char* option, QLabel* label, QCombo
void Dialog::saveCombo( CCSPlugin* p, const char* option, QComboBox* combo )
{
+ if( p == NULL )
+ return;
CCSSetting* s = setting( p, option );
if( s->type == TypeList )
{
@@ -560,6 +568,12 @@ void Dialog::saveAnimationCombo( const char* option, QComboBox* combo )
void Dialog::setupSpinbox( CCSPlugin* p, const char* option, QLabel* label, QDoubleSpinBox* spinbox )
{
+ if( p == NULL )
+ {
+ label->hide();
+ spinbox->hide();
+ return;
+ }
CCSSetting* s = setting( p, option );
label->setText( s->shortDesc );
label->setToolTip( s->longDesc );
@@ -587,6 +601,8 @@ void Dialog::setupSpinbox( CCSPlugin* p, const char* option, QLabel* label, QDou
void Dialog::saveSpinbox( CCSPlugin* p, const char* option, QDoubleSpinBox* spinbox )
{
+ if( p == NULL )
+ return;
CCSSetting* s = setting( p, option );
if( s->type == TypeFloat )
ccsSetFloat( s, spinbox->value());
@@ -598,6 +614,11 @@ void Dialog::saveSpinbox( CCSPlugin* p, const char* option, QDoubleSpinBox* spin
void Dialog::setupCheckbox( CCSPlugin* plugin, const char* option, bool group, QCheckBox* checkbox )
{
+ if( plugin == NULL )
+ {
+ checkbox->hide();
+ return;
+ }
CCSSetting* s = setting( plugin, option );
checkbox->setText( group ? s->group : s->shortDesc );
checkbox->setToolTip( s->longDesc );
@@ -608,13 +629,20 @@ void Dialog::setupCheckbox( CCSPlugin* plugin, const char* option, bool group, Q
void Dialog::saveCheckbox( CCSPlugin* plugin, const char* option, QCheckBox* checkbox )
{
+ if( plugin == NULL )
+ return;
CCSSetting* s = setting( plugin, option );
ccsSetBool( s, checkbox->isChecked());
}
void Dialog::setupCheckbox( const char* pl, QCheckBox* checkbox )
{
- CCSPlugin* p = plugin( pl );
+ CCSPlugin* p = plugin( pl, false );
+ if( p == NULL )
+ {
+ checkbox->hide();
+ return;
+ }
checkbox->setText( p->shortDesc );
checkbox->setToolTip( p->longDesc );
checkbox->setChecked( ccsPluginIsActive( context, const_cast< char* >( pl )));
@@ -622,7 +650,7 @@ void Dialog::setupCheckbox( const char* pl, QCheckBox* checkbox )
void Dialog::saveCheckbox( const char* pl, QCheckBox* checkbox )
{
- ccsPluginSetActive( plugin( pl ), checkbox->isChecked());
+ ccsPluginSetActive( plugin( pl, false ), checkbox->isChecked());
}
void Dialog::setupKeyButton( CCSPlugin* plugin, const char* option, QLabel* label, QPushButton* button )