[Ktutorial-commits] SF.net SVN: ktutorial:[206] trunk/ktutorial/ktutorial-editor/src/view
Status: Alpha
Brought to you by:
danxuliu
From: <dan...@us...> - 2010-03-29 03:15:44
|
Revision: 206 http://ktutorial.svn.sourceforge.net/ktutorial/?rev=206&view=rev Author: danxuliu Date: 2010-03-29 03:15:38 +0000 (Mon, 29 Mar 2010) Log Message: ----------- Refactor the code to save the trigger and response types Modified Paths: -------------- trunk/ktutorial/ktutorial-editor/src/view/ReactionWidget.cpp trunk/ktutorial/ktutorial-editor/src/view/ReactionWidget.h Modified: trunk/ktutorial/ktutorial-editor/src/view/ReactionWidget.cpp =================================================================== --- trunk/ktutorial/ktutorial-editor/src/view/ReactionWidget.cpp 2010-03-29 00:36:12 UTC (rev 205) +++ trunk/ktutorial/ktutorial-editor/src/view/ReactionWidget.cpp 2010-03-29 03:15:38 UTC (rev 206) @@ -51,12 +51,14 @@ connect(ui->responseStepRadioButton, SIGNAL(toggled(bool)), this, SLOT(selectResponseStep(bool))); + mCurrentTriggerType = reaction->triggerType(); if (reaction->triggerType() == Reaction::ConditionMet) { ui->triggerConditionRadioButton->setChecked(true); } else { ui->triggerOptionRadioButton->setChecked(true); } + mCurrentResponseType = reaction->responseType(); if (reaction->responseType() == Reaction::CustomCode) { ui->responseCodeRadioButton->setChecked(true); } else { @@ -106,30 +108,16 @@ commands.append(reactionCommands.setNextStepId(nextStepId, parent)); } - if (mReaction->triggerType() != Reaction::ConditionMet && - ui->triggerConditionRadioButton->isChecked()) { - commands.append(reactionCommands.setTriggerType(Reaction::ConditionMet, + if (mReaction->triggerType() != mCurrentTriggerType) { + commands.append(reactionCommands.setTriggerType(mCurrentTriggerType, parent)); } - if (mReaction->triggerType() != Reaction::OptionSelected && - ui->triggerOptionRadioButton->isChecked()) { - commands.append(reactionCommands.setTriggerType(Reaction::OptionSelected, - parent)); - } - - if (mReaction->responseType() != Reaction::CustomCode && - ui->responseCodeRadioButton->isChecked()) { - commands.append(reactionCommands.setResponseType(Reaction::CustomCode, + if (mReaction->responseType() != mCurrentResponseType) { + commands.append(reactionCommands.setResponseType(mCurrentResponseType, parent)); } - if (mReaction->responseType() != Reaction::NextStep && - ui->responseStepRadioButton->isChecked()) { - commands.append(reactionCommands.setResponseType(Reaction::NextStep, - parent)); - } - return commands; } @@ -142,6 +130,8 @@ ui->triggerOptionLineEdit->setEnabled(false); mWaitForWidget->setEnabled(true); + + mCurrentTriggerType = Reaction::ConditionMet; } void ReactionWidget::selectTriggerOption(bool checked) { @@ -151,6 +141,8 @@ mWaitForWidget->setEnabled(false); ui->triggerOptionLineEdit->setEnabled(true); + + mCurrentTriggerType = Reaction::OptionSelected; } void ReactionWidget::selectResponseStep(bool checked) { @@ -160,6 +152,8 @@ ui->responseCodeTextEdit->setEnabled(false); ui->responseStepLineEdit->setEnabled(true); + + mCurrentResponseType = Reaction::NextStep; } void ReactionWidget::selectResponseCode(bool checked) { @@ -169,4 +163,6 @@ ui->responseStepLineEdit->setEnabled(false); ui->responseCodeTextEdit->setEnabled(true); + + mCurrentResponseType = Reaction::CustomCode; } Modified: trunk/ktutorial/ktutorial-editor/src/view/ReactionWidget.h =================================================================== --- trunk/ktutorial/ktutorial-editor/src/view/ReactionWidget.h 2010-03-29 00:36:12 UTC (rev 205) +++ trunk/ktutorial/ktutorial-editor/src/view/ReactionWidget.h 2010-03-29 03:15:38 UTC (rev 206) @@ -22,8 +22,8 @@ #include <QPointer> #include "CommandWidget.h" +#include "../data/Reaction.h" -class Reaction; class WaitFor; class WaitForWidget; @@ -84,6 +84,16 @@ WaitForWidget* mWaitForWidget; /** + * The currently selected trigger type. + */ + Reaction::TriggerType mCurrentTriggerType; + + /** + * The currently selected response type. + */ + Reaction::ResponseType mCurrentResponseType; + + /** * The Ui Designer generated class. */ Ui::ReactionWidget* ui; @@ -92,7 +102,7 @@ /** * When the condition radio button is selected, it enables and disables the - * appropriate widgets. + * appropriate widgets, and updates the current trigger type. * * @param checked Whether the radio button was checked or unchecked. */ @@ -100,7 +110,7 @@ /** * When the option radio button is selected, it enables and disables the - * appropriate widgets. + * appropriate widgets, and updates the current trigger type. * * @param checked Whether the radio button was checked or unchecked. */ @@ -108,7 +118,7 @@ /** * When the custom code radio button is selected, it enables and disables - * the appropriate widgets. + * the appropriate widgets, and updates the current response type. * * @param checked Whether the radio button was checked or unchecked. */ @@ -116,7 +126,7 @@ /** * When the next step radio button is selected, it enables and disables the - * appropriate widgets. + * appropriate widgets, and updates the current response type. * * @param checked Whether the radio button was checked or unchecked. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |