[rkward-cvs] rkward/rkward/plugin rkcheckbox.cpp,1.9,1.10 rkcomponent.cpp,1.10,1.11 rkcomponent.h,1.11,1.12 rkcomponentproperties.cpp,1.16,1.17 rkcomponentproperties.h,1.16,1.17 rkinput.cpp,1.6,1.7 rkinput.h,1.4,1.5 rkstandardcomponent.cpp,1.18,1.19 rkstandardcomponent.h,1.9,1.10 rkvarslot.cpp,1.21,1.22 rkvarslot.h,1.11,1.12

Thomas Friedrichsmeier tfry at users.sourceforge.net
Mon Mar 20 12:41:46 UTC 2006


Update of /cvsroot/rkward/rkward/rkward/plugin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23049/rkward/plugin

Modified Files:
	rkcheckbox.cpp rkcomponent.cpp rkcomponent.h 
	rkcomponentproperties.cpp rkcomponentproperties.h rkinput.cpp 
	rkinput.h rkstandardcomponent.cpp rkstandardcomponent.h 
	rkvarslot.cpp rkvarslot.h 
Log Message:
Enabling/disabling components, property conversions/connnections seem to be working

Index: rkcomponent.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkcomponent.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** rkcomponent.h	20 Mar 2006 00:57:31 -0000	1.11
--- rkcomponent.h	20 Mar 2006 12:41:43 -0000	1.12
***************
*** 37,40 ****
--- 37,41 ----
  		PropertyRObjects = 5,
  		PropertyCode = 6,
+ 		PropertyLogic = 7,
  		PropertyUser = 1000,		/**< for user expansion */
  		PropertyEnd = 1999,
***************
*** 50,53 ****
--- 51,55 ----
  		ComponentBrowser = 2010,
  		ComponentText = 2011,
+ 		ComponentStandard = 2100,
  		ComponentUser = 3000	/**< for user expansion */
  	};
***************
*** 120,124 ****
  	void setVisible (bool visible);
  /** convenience call to set visibilty property (and hence visibility of this component) */
! 	void setEnabled (bool enabled);
  /** convenience call to set visibilty property (and hence visibility of this component) */
  	void setRequired (bool required);
--- 122,126 ----
  	void setVisible (bool visible);
  /** convenience call to set visibilty property (and hence visibility of this component) */
! 	void setEnabledness (bool enabled);
  /** convenience call to set visibilty property (and hence visibility of this component) */
  	void setRequired (bool required);
***************
*** 127,131 ****
  	RKComponent *parentComponent () { return _parent; };
  
! /** Is the component "ready"? I.e. it is up to date according to current settings. Does not imply it is also satisfied. Default implementation always returns true. TODO: maybe ready-state should be made a property as well! */
  	virtual bool isReady () { return true; };
  protected:
--- 129,133 ----
  	RKComponent *parentComponent () { return _parent; };
  
! /** Is the component "ready"? I.e. it is up to date according to current settings. Does not imply it is also satisfied. Default implementation always returns true. */
  	virtual bool isReady () { return true; };
  protected:

Index: rkvarslot.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkvarslot.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** rkvarslot.cpp	20 Mar 2006 00:57:31 -0000	1.21
--- rkvarslot.cpp	20 Mar 2006 12:41:43 -0000	1.22
***************
*** 148,158 ****
  	listSelectionChanged ();		// takes care of updating the select button
  
! 	if (!isSatisfied ()) {
! 		list->setPaletteBackgroundColor (QColor (255, 0, 0));
  	} else {
! 		list->setPaletteBackgroundColor (QColor (255, 255, 255));
  	}
- 
- 	changed ();
  }
  
--- 148,170 ----
  	listSelectionChanged ();		// takes care of updating the select button
  
! 	changed ();
! }
! 
! void RKVarSlot::updateLook () {
! 	RK_TRACE (PLUGIN);
! 
! 	if (isEnabled ()) {
! 		if (!isSatisfied ()) {
! 			list->setPaletteBackgroundColor (QColor (255, 0, 0));
! 		} else {
! 			list->setPaletteBackgroundColor (QColor (255, 255, 255));
! 		}
  	} else {
! 		if (!isSatisfied ()) {
! 			list->setPaletteBackgroundColor (QColor (200, 0, 0));
! 		} else {
! 			list->setPaletteBackgroundColor (QColor (200, 200, 200));
! 		}
  	}
  }
  

Index: rkcomponentproperties.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkcomponentproperties.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** rkcomponentproperties.cpp	20 Mar 2006 00:57:31 -0000	1.16
--- rkcomponentproperties.cpp	20 Mar 2006 12:41:43 -0000	1.17
***************
*** 114,118 ****
  ///////////////////////////////////////////// Bool //////////////////////////////////////////
  
! RKComponentPropertyBool::RKComponentPropertyBool (QObject *parent, bool required, const QString &value_true, const QString &value_false, bool default_state) : RKComponentPropertyBase (parent, required) {
  	RK_TRACE (PLUGIN);
  	RKComponentPropertyBool::value_true = value_true;
--- 114,118 ----
  ///////////////////////////////////////////// Bool //////////////////////////////////////////
  
! RKComponentPropertyBool::RKComponentPropertyBool (QObject *parent, bool required, bool default_state, const QString &value_true, const QString &value_false) : RKComponentPropertyBase (parent, required) {
  	RK_TRACE (PLUGIN);
  	RKComponentPropertyBool::value_true = value_true;
***************
*** 173,176 ****
--- 173,184 ----
  	if (modifier == "true") return value_true;
  	if (modifier == "false") return value_false;
+ 	if (modifier == "not") {
+ 		if (current_value) return value_false;
+ 		else return value_true;
+ 	}
+ 	if (modifier == "numeric") {
+ 		if (current_value) return "1";
+ 		else return "0";
+ 	}
  
  	warnModifierNotRecognized (modifier);
***************
*** 964,966 ****
--- 972,1118 ----
  }
  
+ 
+ 
+ /////////////////////////////////////////// Convert ////////////////////////////////////////////////
+ 
+ RKComponentPropertyConvert::RKComponentPropertyConvert (RKComponent *parent) : RKComponentPropertyBool (parent, false) {
+ 	RK_TRACE (PLUGIN);
+ 
+ 	_mode = Equals;
+ 	require_true = false;
+ 	c_parent = parent;
+ 	// get notified of own changes
+ 	connect (this, SIGNAL (valueChanged (RKComponentPropertyBase *)), this, SLOT (selfChanged (RKComponentPropertyBase *)));
+ }
+ 
+ RKComponentPropertyConvert::~RKComponentPropertyConvert () {
+ 	RK_TRACE (PLUGIN);
+ }
+ 
+ void RKComponentPropertyConvert::setMode (ConvertMode mode) {
+ 	RK_TRACE (PLUGIN);
+ 
+ 	_mode = mode;
+ 	sourcePropertyChanged (0);
+ }
+ 
+ void RKComponentPropertyConvert::setSources (const QString &source_string) {
+ 	RK_TRACE (PLUGIN);
+ 
+ 	sources.clear ();
+ 	QStringList source_ids = QStringList::split (";", source_string);
+ 	for (QStringList::const_iterator it = source_ids.constBegin (); it != source_ids.constEnd (); ++it) {
+ 		Source s;
+ 		RKComponentBase *prop = c_parent->lookupComponent (*it, &(s.modifier));
+ 		if (prop && prop->isProperty ()) {
+ 			s.property = static_cast<RKComponentPropertyBase *>(prop);
+ 			sources.append (s);
+ 			connect (s.property, SIGNAL (valueChanged (RKComponentPropertyBase *)), this, SLOT (sourcePropertyChanged (RKComponentPropertyBase *)));
+ 		} else {
+ 			RK_DO (qDebug ("Not found or not a property: %s", (*it).latin1 ()), PLUGIN, DL_WARNING);
+ 		}
+ 	}
+ 
+ 	sourcePropertyChanged (0);
+ }
+ 
+ void RKComponentPropertyConvert::setStandard (const QString &standard) {
+ 	RK_TRACE (PLUGIN);
+ 
+ 	RKComponentPropertyConvert::standard = standard;
+ 	sourcePropertyChanged (0);
+ }
+ 
+ void RKComponentPropertyConvert::setRange (double min, double max) {
+ 	RK_TRACE (PLUGIN);
+ 
+ 	RKComponentPropertyConvert::min = min;
+ 	RKComponentPropertyConvert::max = max;
+ 	sourcePropertyChanged (0);
+ }
+ 
+ void RKComponentPropertyConvert::selfChanged (RKComponentPropertyBase *) {
+ 	RK_TRACE (PLUGIN);
+ 
+ 	c_parent->changed ();
+ }
+ 
+ void RKComponentPropertyConvert::sourcePropertyChanged (RKComponentPropertyBase *) {
+ 	RK_TRACE (PLUGIN);
+ 
+ 	for (QValueList<Source>::const_iterator it = sources.constBegin (); it != sources.constEnd (); ++it) {
+ 		Source source = *it;		// easier typing
+ 		switch (_mode) {
+ 			case Equals: {
+ 				if (source.property->value (source.modifier) != standard) {
+ 					setBoolValue (false);
+ 					return;
+ 				}
+ 				break;
+ 			} case Range: {
+ 				double val;
+ 				if (source.property->type () == PropertyInt) {
+ 					val = (double) static_cast<RKComponentPropertyInt *>(source.property)->intValue ();
+ 				} else if (source.property->type () == PropertyDouble) {
+ 					val = (double) static_cast<RKComponentPropertyDouble *>(source.property)->doubleValue ();
+ 				} else {
+ 					val = min;
+ 					RK_DO (qDebug ("Non-numeric property in convert sources, cannot check range"), PLUGIN, DL_WARNING);
+ 				}
+ 
+ 				if ((min > val) || (max < val)) {
+ 					setBoolValue (false);
+ 					return;
+ 				}
+ 				break;
+ 			} case And: {
+ 				if ((source.property->type () == PropertyBool) || (source.property->type () == PropertyLogic)) {
+ 					if (!(static_cast<RKComponentPropertyBool *>(source.property)->boolValue ())) {
+ 						setBoolValue (false);
+ 						return;
+ 					}
+ 				} else {
+ 					RK_DO (qDebug ("Non-boolean property in convert sources, cannot check AND"), PLUGIN, DL_WARNING);
+ 				}
+ 				break;
+ 			} case Or: {
+ 				if ((source.property->type () == PropertyBool) || (source.property->type () == PropertyLogic)) {
+ 					if (!(static_cast<RKComponentPropertyBool *>(source.property)->boolValue ())) {
+ 						setBoolValue (true);
+ 						return;
+ 					}
+ 				} else {
+ 					RK_DO (qDebug ("Non-boolean property in convert sources, cannot check OR"), PLUGIN, DL_WARNING);
+ 				}
+ 				break;
+ 			}
+ 		}
+ 	}
+ 
+ 	// if we did not return above, this is the default value:
+ 	switch (_mode) {
+ 		case Equals:
+ 		case Range:
+ 		case And: { setBoolValue (true); break; }
+ 		case Or: { setBoolValue (false); break; }
+ 	}
+ }
+ 
+ void RKComponentPropertyConvert::setRequireTrue (bool require_true) {
+ 	RK_TRACE (PLUGIN);
+ 
+ 	RKComponentPropertyConvert::require_true = require_true;
+ 	required = require_true;
+ }
+ 
+ bool RKComponentPropertyConvert::isValid () {
+ 	RK_TRACE (PLUGIN);
+ 
+ 	if (require_true) {
+ 		return (boolValue ());
+ 	}
+ 
+ 	return is_valid;
+ }
+ 
  #include "rkcomponentproperties.moc"

Index: rkstandardcomponent.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkstandardcomponent.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** rkstandardcomponent.h	20 Mar 2006 00:57:31 -0000	1.9
--- rkstandardcomponent.h	20 Mar 2006 12:41:43 -0000	1.10
***************
*** 43,47 ****
  /** reimplemented to update code on changes*/
  	void changed ();
! /** reimplemented to return true only when the backend is idle*/
  	bool isReady ();
  /** reimplemented to return true, if the RKStandardComponent is in Wizard mode */
--- 43,47 ----
  /** reimplemented to update code on changes*/
  	void changed ();
! /** reimplemented to return true only when the backend is idle */
  	bool isReady ();
  /** reimplemented to return true, if the RKStandardComponent is in Wizard mode */
***************
*** 57,60 ****
--- 57,62 ----
  /** switch from dialog to wizard or vice versa */
  	void switchInterface ();
+ /** RTTI */
+ 	int type () { return ComponentStandard; };
  public slots:
  /** this gets called by the script-backend, when it's done. Might enable the

Index: rkinput.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkinput.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** rkinput.h	20 Mar 2006 00:57:31 -0000	1.4
--- rkinput.h	20 Mar 2006 12:41:43 -0000	1.5
***************
*** 44,47 ****
--- 44,50 ----
  	void textChanged ();
  	void textChanged (RKComponentPropertyBase *);
+ protected:
+ /** Grey out input when disabled */
+ 	void enabledChange (bool old);
  private:
  	bool updating;

Index: rkstandardcomponent.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkstandardcomponent.cpp,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** rkstandardcomponent.cpp	20 Mar 2006 01:29:01 -0000	1.18
--- rkstandardcomponent.cpp	20 Mar 2006 12:41:43 -0000	1.19
***************
*** 268,271 ****
--- 268,273 ----
  		gui->enableSubmit (isSatisfied ());
  	}
+ 
+ 	RKComponent::changed ();		// notify parent, if any
  }
  
***************
*** 346,350 ****
  	
  	XMLChildList::const_iterator it;
! 	for (it = children.begin (); it != children.end (); ++it) {
  		RKComponent *widget = 0;
  		QDomElement e = *it;		// shorthand
--- 348,352 ----
  	
  	XMLChildList::const_iterator it;
! 	for (it = children.constBegin (); it != children.constEnd (); ++it) {
  		RKComponent *widget = 0;
  		QDomElement e = *it;		// shorthand
***************
*** 422,429 ****
  }
  
  void RKComponentBuilder::parseLogic (const QDomElement &element) {
  	RK_TRACE (PLUGIN);
  
! 	// TODO
  }
  
--- 424,462 ----
  }
  
+ /**
+  * 
+  * @param element 
+  */
  void RKComponentBuilder::parseLogic (const QDomElement &element) {
  	RK_TRACE (PLUGIN);
  
! 	if (element.isNull ()) return;
! 
! 	// find connect elements
! 	XMLHelper* xml = XMLHelper::getStaticHelper ();
! 	XMLChildList children = xml->getChildElements (element, "connect", DL_INFO);
! 
! 	XMLChildList::const_iterator it;
! 	for (it = children.constBegin (); it != children.constEnd (); ++it) {
! 		addConnection (xml->getStringAttribute (*it, "client", "#noid#", DL_WARNING), QString::null, xml->getStringAttribute (*it, "governor", "#noid#", DL_WARNING), QString::null, xml->getBoolAttribute (*it, "reconcile", false, DL_INFO), element);
! 	}
! 
! 	// find convert elements
! 	children = xml->getChildElements (element, "convert", DL_INFO);
! 	for (it = children.constBegin (); it != children.constEnd (); ++it) {
! 		RKComponentPropertyConvert *convert = new RKComponentPropertyConvert (component ());
! 		QString id = xml->getStringAttribute (*it, "id", "#noid#", DL_WARNING);
! 		int mode = xml->getMultiChoiceAttribute (*it, "mode", convert->convertModeOptionString (), 0, DL_WARNING);
! 		QString sources = xml->getStringAttribute (*it, "sources", QString::null, DL_WARNING);
! 		convert->setMode ((RKComponentPropertyConvert::ConvertMode) mode);
! 		convert->setSources (sources);
! 		if (mode == RKComponentPropertyConvert::Equals) {
! 			convert->setStandard (xml->getStringAttribute (*it, "standard", QString::null, DL_WARNING));
! 		} else if (mode == RKComponentPropertyConvert::Range) {
! 			convert->setRange (xml->getDoubleAttribute (*it, "min", FLT_MIN, DL_INFO), xml->getDoubleAttribute (*it, "max", FLT_MAX, DL_INFO));
! 		}
! 		convert->setRequireTrue (xml->getStringAttribute (*it, "require_true", false, DL_INFO));
! 		component ()->addChild (id, convert);
! 	}
  }
  
***************
*** 432,437 ****
  
  	RKComponentPropertyConnection conn;
! 	conn.client_property = client_id + "::" + client_property;
! 	conn.governor_property = governor_id + "::" + governor_property;
  	conn.reconcile = reconcile;
  	conn.origin = origin;
--- 465,472 ----
  
  	RKComponentPropertyConnection conn;
! 	conn.client_property = client_id;
! 	if (!client_property.isEmpty ()) conn.client_property += "." + client_property;
! 	conn.governor_property = governor_id;
! 	if (!governor_property.isEmpty ()) conn.governor_property += "." + governor_property;
  	conn.reconcile = reconcile;
  	conn.origin = origin;

Index: rkinput.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkinput.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** rkinput.cpp	17 Mar 2006 16:46:25 -0000	1.6
--- rkinput.cpp	20 Mar 2006 12:41:43 -0000	1.7
***************
*** 47,58 ****
  	int size = xml->getMultiChoiceAttribute (element, "size", "small;medium;large", 1, DL_INFO);
  	if (size == 0) {
! 		textedit->setFixedSize (100,25);
  	} else if (size == 1) {
! 		textedit->setFixedSize (250,25);
  	} else if (size == 2) {
  		textedit->setMinimumSize (250, 100);
  	}
  	vbox->addWidget (textedit);
! 	connect (textedit, SIGNAL (textChanged ()),SLOT (textChanged ()));
  
  	vbox->addStretch (1);		// to keep the label attached
--- 47,58 ----
  	int size = xml->getMultiChoiceAttribute (element, "size", "small;medium;large", 1, DL_INFO);
  	if (size == 0) {
! 		textedit->setFixedSize (100, 25);
  	} else if (size == 1) {
! 		textedit->setFixedSize (250, 25);
  	} else if (size == 2) {
  		textedit->setMinimumSize (250, 100);
  	}
  	vbox->addWidget (textedit);
! 	connect (textedit, SIGNAL (textChanged ()), SLOT (textChanged ()));
  
  	vbox->addStretch (1);		// to keep the label attached
***************
*** 67,70 ****
--- 67,82 ----
  }
  
+ void RKInput::enabledChange (bool old) {
+ 	RK_TRACE (PLUGIN);
+ 
+ 	if (isEnabled ()) {
+ 		textedit->setPaletteBackgroundColor (QColor (255, 255, 255));
+ 	} else {
+ 		textedit->setPaletteBackgroundColor (QColor (200, 200, 200));
+ 	}
+ 
+ 	RKComponent::enabledChange (old);
+ }
+ 
  void RKInput::textChanged (RKComponentPropertyBase *) {
  	RK_TRACE (PLUGIN);

Index: rkvarslot.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkvarslot.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** rkvarslot.h	19 Mar 2006 16:41:26 -0000	1.11
--- rkvarslot.h	20 Mar 2006 12:41:43 -0000	1.12
***************
*** 43,46 ****
--- 43,49 ----
  	int type () {return ComponentVarSlot; };
  	QString value (const QString &modifier) { return (available->value (modifier)); };
+ /** reimplemented to call updateLook (), in case enabledness changed */
+ 	void changed () { updateLook (); RKComponent::changed (); };
+ 	void updateLook ();
  public slots:
  /** Called when the select-button is pressed */
***************
*** 48,51 ****
--- 51,57 ----
  	void listSelectionChanged ();
  	void availablePropertyChanged (RKComponentPropertyBase *);
+ protected:
+ /** Calls updateLook (), when enabledness changes */
+ 	void enabledChange (bool old) { updateLook (); QWidget::enabledChange (old); };
  private:
  /** change the select button to left/right / add/remove

Index: rkcomponentproperties.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkcomponentproperties.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** rkcomponentproperties.h	19 Mar 2006 16:41:26 -0000	1.16
--- rkcomponentproperties.h	20 Mar 2006 12:41:43 -0000	1.17
***************
*** 77,81 ****
  @param value_false string value if false/off
  @param default_state value to use, if invalid string value was set */
! 	RKComponentPropertyBool (QObject *parent, bool required, const QString &value_true="TRUE", const QString &value_false="FALSE", bool default_state=true);
  /** destructor */
  	~RKComponentPropertyBool ();
--- 77,81 ----
  @param value_false string value if false/off
  @param default_state value to use, if invalid string value was set */
! 	RKComponentPropertyBool (QObject *parent, bool required, bool default_state=true, const QString &value_true="true", const QString &value_false="false");
  /** destructor */
  	~RKComponentPropertyBool ();
***************
*** 335,338 ****
--- 335,390 ----
  };
  
+ class RKComponent;	// what the ... why do I need this?
+ /** A bool component that can do some logical transformations. This property works slightly different than the others, and is not intended to be connected the usual way. Also by default it is not required, since it does not really hold a validity state (unless in require mode).
+ 
+ @author Thomas Friedrichsmeier */
+ class RKComponentPropertyConvert : public RKComponentPropertyBool {
+ 	Q_OBJECT
+ public:
+ /** constructor. Note that this property *requires* an RKComponent as parent (the one at the top of all the source properties) */
+ 	RKComponentPropertyConvert (RKComponent *parent);
+ 	~RKComponentPropertyConvert ();
+ 
+ /** Mode of operation. see setMode () */
+ 	enum ConvertMode {
+ 		Equals = 0,		/** < Check, whether some property has exactly the given string value (see setSources (), setStandard ()) */
+ 		Range = 1,		/** < Check, whether some *numeric* property is in the given range (see setSources (), setRange ()) */
+ 		And = 2,			/** < Check, whether several *boolean* properties are all true at once (see setSources ()) */
+ 		Or = 3				/** < Check, whether one of several *boolean* properties is true (see setSources ()) */
+ 	};
+ 
+ /** set the mode. Usually you will only call this once, after construction, and usually followed by setSources () - if applicable - setStandard () or setRange (). */
+ 	void setMode (ConvertMode mode);
+ /** set the sources, i.e. the properties to check against. To specify multiple sources, separate their IDs with ";" */
+ 	void setSources (const QString &source_string);
+ /** set the standard for comparison. Only meaningful in Equals mode */
+ 	void setStandard (const QString &standard);
+ /** set the range for comparison. Only meaningful in Range mode */
+ 	void setRange (double min, double max);
+ /** set this property to required. Also it will only be valid if it is currently true. So it will block it's parent component in false state. */
+ 	void setRequireTrue (bool require_true);
+ 
+ /** reimplemented for setRequireTrue ()*/
+ 	bool isValid ();
+ 
+ /** string represenation of the options in ConvertMode. For use in XMLHelper::getMultiChoiceAttribute */
+ 	static QString convertModeOptionString () { return ("equals;range;and;or;require"); };
+ public slots:
+ /** unfortuntely, as the parent component likely does not know about us, we have to notify it manually of any changes. That's done from this slot */
+ 	void selfChanged (RKComponentPropertyBase *);
+ /** a source property changed. Check the state */
+ 	void sourcePropertyChanged (RKComponentPropertyBase *);
+ private:
+ 	ConvertMode _mode;
+ 	double min, max;
+ 	QString standard;
+ 	bool require_true;
+ 	RKComponent *c_parent;		// actually the same as parent (), but without the hassle of conversion
+ 	struct Source {
+ 		RKComponentPropertyBase *property;
+ 		QString modifier;
+ 	};
+ 	QValueList<Source> sources;
+ };
  
  #endif

Index: rkcheckbox.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkcheckbox.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** rkcheckbox.cpp	17 Mar 2006 16:46:25 -0000	1.9
--- rkcheckbox.cpp	20 Mar 2006 12:41:43 -0000	1.10
***************
*** 31,35 ****
  
  	// create and add property
! 	addChild ("state", state = new RKComponentPropertyBool (this, true, xml->getStringAttribute (element, "value", "1", DL_WARNING), xml->getStringAttribute (element, "value_unchecked", QString::null, DL_INFO), xml->getBoolAttribute (element, "checked", false, DL_INFO)));
  	connect (state, SIGNAL (valueChanged (RKComponentPropertyBase *)), this, SLOT (changedState (RKComponentPropertyBase *)));
  
--- 31,35 ----
  
  	// create and add property
! 	addChild ("state", state = new RKComponentPropertyBool (this, true, xml->getBoolAttribute (element, "checked", false, DL_INFO), xml->getStringAttribute (element, "value", "1", DL_WARNING), xml->getStringAttribute (element, "value_unchecked", QString::null, DL_INFO)));
  	connect (state, SIGNAL (valueChanged (RKComponentPropertyBase *)), this, SLOT (changedState (RKComponentPropertyBase *)));
  

Index: rkcomponent.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkcomponent.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** rkcomponent.cpp	20 Mar 2006 00:57:31 -0000	1.10
--- rkcomponent.cpp	20 Mar 2006 12:41:43 -0000	1.11
***************
*** 28,37 ****
  	RK_DO (qDebug ("looking up '%s'", identifier.latin1 ()), PLUGIN, DL_DEBUG);
  
! 	RKComponentBase *child = child_map.find (identifier.section ("::", 0, 0));
  	if (!child) {	// if we do not have such a child, return 0 unless this is a property
! 		if (remainder) *remainder = identifier.section ("::", 1);
  		return this;
  	} else {	// else do recursive lookup
! 		return child->lookupComponent (identifier.section ("::", 1), remainder);
  	}
  }
--- 28,37 ----
  	RK_DO (qDebug ("looking up '%s'", identifier.latin1 ()), PLUGIN, DL_DEBUG);
  
! 	RKComponentBase *child = child_map.find (identifier.section (".", 0, 0));
  	if (!child) {	// if we do not have such a child, return 0 unless this is a property
! 		if (remainder) *remainder = identifier.section (".", 1);
  		return this;
  	} else {	// else do recursive lookup
! 		return child->lookupComponent (identifier.section (".", 1), remainder);
  	}
  }
***************
*** 99,107 ****
  	RK_TRACE (PLUGIN);
  
  	if (property == visibility_property) {
! 		setShown (visibility_property->boolValue ());
  	} else if (property == enabledness_property) {
! 		setEnabled (enabledness_property->boolValue ());
  	} else if (property == requiredness_property) {
  		changed ();
  	}
--- 99,117 ----
  	RK_TRACE (PLUGIN);
  
+ 	// slightly more elaborat than necessary on first thought, to prevent loops
  	if (property == visibility_property) {
! 		if (visibility_property->boolValue ()) {
! 			if (!isShown ()) show ();
! 		} else {
! 			if (isShown ()) hide ();
! 		}
  	} else if (property == enabledness_property) {
! 		if (enabledness_property->boolValue ()) {
! 			if (!isEnabled ()) setEnabled (true);
! 		} else {
! 			if (isEnabled ()) setEnabled (false);
! 		}
  	} else if (property == requiredness_property) {
+ 		required = requiredness_property->boolValue ();
  		changed ();
  	}
***************
*** 141,145 ****
  }
  
! void RKComponent::setEnabled (bool enabled) {
  	RK_TRACE (PLUGIN);
  
--- 151,155 ----
  }
  
! void RKComponent::setEnabledness (bool enabled) {
  	RK_TRACE (PLUGIN);
  





More information about the rkward-tracker mailing list