Mercurial > hg > forks > UniversalIndentGUI
changeset 492:9b091f4bab8d
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
author | thomas_-_s <thomas_-_s@59b1889a-e5ac-428c-b0c7-476e01d41282> |
---|---|
date | Mon, 16 Jun 2008 08:54:59 +0000 |
parents | e3215923077a |
children | 1a61b405be21 |
files | src/indenthandler.cpp src/indenthandler.h |
diffstat | 2 files changed, 20 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- 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(); + } +}
--- 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);