# HG changeset patch # User thomas_-_s # Date 1213606499 0 # Node ID 9b091f4bab8dc4ff0f783a947d261c49e9b9a48c # Parent e3215923077a761338441bdda0282d050ec9ab80 Now handling all parameter change dependent stuff in one central function. git-svn-id: svn://svn.code.sf.net/p/universalindent/code/trunk@732 59b1889a-e5ac-428c-b0c7-476e01d41282 diff -r e3215923077a -r 9b091f4bab8d src/indenthandler.cpp --- a/src/indenthandler.cpp Mon Jun 16 07:47:31 2008 +0000 +++ b/src/indenthandler.cpp Mon Jun 16 08:54:59 2008 +0000 @@ -680,10 +680,10 @@ paramValue = cfgFileData.mid( index, crPos - index ).toInt(NULL); // disable the signal-slot connection. Otherwise signal is emmitted each time when value is set - QObject::disconnect(pNumeric.spinBox, SIGNAL(valueChanged(int)), this, SIGNAL(indenterSettingsChanged())); + QObject::disconnect(pNumeric.spinBox, SIGNAL(valueChanged(int)), this, SLOT(handleChangedIndenterSettings())); pNumeric.spinBox->setValue( paramValue ); pNumeric.valueEnabledChkBox->setChecked( true ); - QObject::connect(pNumeric.spinBox, SIGNAL(valueChanged(int)), this, SIGNAL(indenterSettingsChanged())); + QObject::connect(pNumeric.spinBox, SIGNAL(valueChanged(int)), this, SLOT(handleChangedIndenterSettings())); } // parameter was not found in config file else { @@ -903,8 +903,8 @@ paramNumeric.valueEnabledChkBox = chkBox; paramNumerics.append(paramNumeric); - QObject::connect(spinBox, SIGNAL(valueChanged(int)), this, SIGNAL(indenterSettingsChanged())); - QObject::connect(chkBox, SIGNAL(clicked()), this, SIGNAL(indenterSettingsChanged())); + QObject::connect(spinBox, SIGNAL(valueChanged(int)), this, SLOT(handleChangedIndenterSettings())); + QObject::connect(chkBox, SIGNAL(clicked()), this, SLOT(handleChangedIndenterSettings())); } // edit type is boolean so create a checkbox else if ( editType == "boolean" ) { @@ -925,7 +925,7 @@ paramBoolean.falseString = trueFalseStrings.at(1); paramBooleans.append(paramBoolean); - QObject::connect(chkBox, SIGNAL(clicked()), this, SIGNAL(indenterSettingsChanged())); + QObject::connect(chkBox, SIGNAL(clicked()), this, SLOT(handleChangedIndenterSettings())); } // edit type is numeric so create a line edit with label else if ( editType == "string" ) { @@ -973,8 +973,8 @@ paramString.valueEnabledChkBox = chkBox; paramStrings.append(paramString); - QObject::connect(lineEdit, SIGNAL(editingFinished()), this, SIGNAL(indenterSettingsChanged())); - QObject::connect(chkBox, SIGNAL(clicked()), this, SIGNAL(indenterSettingsChanged())); + QObject::connect(lineEdit, SIGNAL(editingFinished()), this, SLOT(handleChangedIndenterSettings())); + QObject::connect(chkBox, SIGNAL(clicked()), this, SLOT(handleChangedIndenterSettings())); } // edit type is multiple so create a combobox with label else if ( editType == "multiple" ) { @@ -1020,8 +1020,8 @@ paramMultiple.valueEnabledChkBox = chkBox; paramMultiples.append(paramMultiple); - QObject::connect(comboBox, SIGNAL(activated(int)), this, SIGNAL(indenterSettingsChanged())); - QObject::connect(chkBox, SIGNAL(clicked()), this, SIGNAL(indenterSettingsChanged())); + QObject::connect(comboBox, SIGNAL(activated(int)), this, SLOT(handleChangedIndenterSettings())); + QObject::connect(chkBox, SIGNAL(clicked()), this, SLOT(handleChangedIndenterSettings())); #ifdef UNIVERSALINDENTGUI_NPP_EXPORTS connect( comboBox, SIGNAL(activated(int)), comboBox, SLOT(repaint()) ); #endif // UNIVERSALINDENTGUI_NPP_EXPORTS @@ -1125,7 +1125,7 @@ // Load the users last settings made for this indenter. loadConfigFile( settingsDirctoryStr + "/" + indenterFileName + ".cfg" ); - emit( indenterSettingsChanged() ); + handleChangedIndenterSettings(); QApplication::restoreOverrideCursor(); @@ -1468,3 +1468,12 @@ void IndentHandler::setParameterChangedCallback( void(*paramChangedCallback)(void) ) { parameterChangedCallback = paramChangedCallback; } + + +void IndentHandler::handleChangedIndenterSettings() { + emit( indenterSettingsChanged() ); + + if ( parameterChangedCallback != NULL ) { + parameterChangedCallback(); + } +} diff -r e3215923077a -r 9b091f4bab8d src/indenthandler.h --- a/src/indenthandler.h Mon Jun 16 07:47:31 2008 +0000 +++ b/src/indenthandler.h Mon Jun 16 08:54:59 2008 +0000 @@ -88,6 +88,7 @@ void saveasIndentCfgFileDialog(); void createIndenterCallShellScript(); void resetIndenterParameter(); + void handleChangedIndenterSettings(); private: QString callExecutableIndenter(QString sourceCode, QString inputFileExtension);