[rkward-cvs] SF.net SVN: rkward:[4129] trunk/rkward/rkward/plugin

tfry at users.sourceforge.net tfry at users.sourceforge.net
Thu Dec 15 08:33:22 UTC 2011


Revision: 4129
          http://rkward.svn.sourceforge.net/rkward/?rev=4129&view=rev
Author:   tfry
Date:     2011-12-15 08:33:22 +0000 (Thu, 15 Dec 2011)
Log Message:
-----------
Move RKComponentBuilder::standardComponent() to RKComponent, instead.

Modified Paths:
--------------
    trunk/rkward/rkward/plugin/rkcomponent.cpp
    trunk/rkward/rkward/plugin/rkcomponent.h
    trunk/rkward/rkward/plugin/rkoptionset.cpp
    trunk/rkward/rkward/plugin/rkoptionset.h
    trunk/rkward/rkward/plugin/rkstandardcomponent.cpp
    trunk/rkward/rkward/plugin/rkstandardcomponent.h

Modified: trunk/rkward/rkward/plugin/rkcomponent.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponent.cpp	2011-12-14 22:18:51 UTC (rev 4128)
+++ trunk/rkward/rkward/plugin/rkcomponent.cpp	2011-12-15 08:33:22 UTC (rev 4129)
@@ -17,6 +17,7 @@
 
 #include "rkcomponent.h"
 
+#include "rkstandardcomponent.h"
 #include "../misc/rkcommonfunctions.h"
 
 #include "../debug.h"
@@ -292,6 +293,19 @@
 	emit (componentChanged (this));
 }
 
+RKStandardComponent *RKComponent::standardComponent (QString *id_adjust) {
+	RK_TRACE (PLUGIN);
+
+	RKComponent *p = this;
+	while (p) {
+		if (p->type () == RKComponent::ComponentStandard) return static_cast<RKStandardComponent*> (p);
+		if (id_adjust) id_adjust->prepend (p->getIdInParent () + '.');
+		p = p->parentComponent ();
+	}
+	RK_ASSERT (false);
+	return 0;
+}
+
 void RKComponent::removeFromParent () {
 	RK_TRACE (PLUGIN);
 

Modified: trunk/rkward/rkward/plugin/rkcomponent.h
===================================================================
--- trunk/rkward/rkward/plugin/rkcomponent.h	2011-12-14 22:18:51 UTC (rev 4128)
+++ trunk/rkward/rkward/plugin/rkcomponent.h	2011-12-15 08:33:22 UTC (rev 4129)
@@ -23,6 +23,7 @@
 #include <qwidget.h>
 
 class RKComponentPropertyBase;
+class RKStandardComponent;
 
 /** a very low level base for RKComponent and RKComponentProperty. */
 class RKComponentBase {
@@ -180,6 +181,8 @@
 
 /** The parent of this component. Should be notified, whenever isSatisfied () or isReady ()-state changed. */
 	RKComponent *parentComponent () const { return _parent; };
+/** The standard component containing this component (if any). If @param id_adjust is given, it will be set to a relative path to the standard component. */
+	RKStandardComponent *standardComponent (QString *id_adjust=0);
 
 /** 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; };

Modified: trunk/rkward/rkward/plugin/rkoptionset.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkoptionset.cpp	2011-12-14 22:18:51 UTC (rev 4128)
+++ trunk/rkward/rkward/plugin/rkoptionset.cpp	2011-12-15 08:33:22 UTC (rev 4129)
@@ -28,12 +28,14 @@
 
 #include "../debug.h"
 
-RKOptionSet::RKOptionSet (const QDomElement &element, RKComponent *parent_component, QWidget *parent_widget, RKStandardComponentBuilder *builder) {
+RKOptionSet::RKOptionSet (const QDomElement &element, RKComponent *parent_component, QWidget *parent_widget, RKStandardComponentBuilder *builder) : RKComponent (parent_component, parent_widget) {
 	RK_TRACE (PLUGIN);
 
 	XMLHelper *xml = XMLHelper::getStaticHelper ();
 	updating_from_contents = changing_row = false;
 
+	connect (standardComponent (), SIGNAL (componentChanged(RKComponent*)), this, SLOT (componentChangeComplete(RKComponent*)));
+
 	// create some meta properties
 	current_row = new RKComponentPropertyInt (this, false, -1);
 	row_count->setInternal (true);

Modified: trunk/rkward/rkward/plugin/rkoptionset.h
===================================================================
--- trunk/rkward/rkward/plugin/rkoptionset.h	2011-12-14 22:18:51 UTC (rev 4128)
+++ trunk/rkward/rkward/plugin/rkoptionset.h	2011-12-15 08:33:22 UTC (rev 4129)
@@ -40,13 +40,14 @@
 	void currentRowPropertyChanged (RKComponentPropertyBase *property);
 	void addRow ();
 	void removeRow (int index);
+	void componentChangeComplete (RKComponent *component);
 private:
 	void initDisplay ();
 
 	QMap<QString, QString> defaults;
 /** for option sets which are "driven" (i.e. the user cannot simply add / remove rows, directly), this holds the key column, controlling addition / removal of rows in the set.
   * if this length (or order) is changed in this row, it will also be changed in the other rows. */
-	QString keycolumn;
+	RKComponentPropertyStringList *keycolumn;
 	QMultiMap<RKComponentPropertyBase *, RKComponentPropertyStringList *> columns_to_update;
 	struct ColumnInfo {
 		QString column_name;

Modified: trunk/rkward/rkward/plugin/rkstandardcomponent.cpp
===================================================================
--- trunk/rkward/rkward/plugin/rkstandardcomponent.cpp	2011-12-14 22:18:51 UTC (rev 4128)
+++ trunk/rkward/rkward/plugin/rkstandardcomponent.cpp	2011-12-15 08:33:22 UTC (rev 4129)
@@ -512,19 +512,6 @@
 	RK_TRACE (PLUGIN);
 }
 
-RKStandardComponent *RKComponentBuilder::standardComponent (QString *id_adjust) {
-	RK_TRACE (PLUGIN);
-
-	RKComponent *p = parent;
-	while (p) {
-		if (p->type () == RKComponent::ComponentStandard) return static_cast<RKStandardComponent*> (p);
-		if (id_adjust) id_adjust->prepend (p->getIdInParent () + '.');
-		p = p->parentComponent ();
-	}
-	RK_ASSERT (false);
-	return 0;
-}
-
 QDomElement RKComponentBuilder::doElementCopy (const QString id, const QDomElement &copy) {
 	RK_TRACE (PLUGIN);
 
@@ -673,7 +660,7 @@
 			KVBox *box = new KVBox (widget);
 			layout->addWidget (box);
 			QString id_adjust;
-			standardComponent (&id_adjust)->scriptingProxy ()->addScriptableWidget (id_adjust + id, widget);
+			parent->standardComponent (&id_adjust)->scriptingProxy ()->addScriptableWidget (id_adjust + id, widget);
 		} else {
 			xml->displayError (&e, QString ("Invalid tagname '%1'").arg (e.tagName ()), DL_ERROR);
 		}
@@ -743,7 +730,7 @@
 	if (!e.isNull ()) {
 		QString file = xml->getStringAttribute (e, "file", QString (), DL_INFO);
 		QString inline_command = e.text ();
-		standardComponent ()->scriptingProxy ()->initialize (file, inline_command);
+		parent->standardComponent ()->scriptingProxy ()->initialize (file, inline_command);
 	}
 }
 

Modified: trunk/rkward/rkward/plugin/rkstandardcomponent.h
===================================================================
--- trunk/rkward/rkward/plugin/rkstandardcomponent.h	2011-12-14 22:18:51 UTC (rev 4128)
+++ trunk/rkward/rkward/plugin/rkstandardcomponent.h	2011-12-15 08:33:22 UTC (rev 4129)
@@ -161,7 +161,6 @@
 	typedef QList <RKComponentPropertyConnection> ConnectionList;
 	ConnectionList connection_list;
 	QMap<QString, QString> initial_values;
-	RKStandardComponent *standardComponent (QString *id_adjust=0);
 };
 
 #endif

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.





More information about the rkward-tracker mailing list