[rkward-cvs] rkward/rkward/plugin rkcomponent.cpp,1.14,1.15 rkcomponent.h,1.15,1.16 rkcomponentproperties.cpp,1.22,1.23 rkstandardcomponent.cpp,1.25,1.26 rkvarslot.cpp,1.24,1.25
Thomas Friedrichsmeier
tfry at users.sourceforge.net
Wed Mar 29 16:21:53 UTC 2006
Update of /cvsroot/rkward/rkward/rkward/plugin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9465/rkward/plugin
Modified Files:
rkcomponent.cpp rkcomponent.h rkcomponentproperties.cpp
rkstandardcomponent.cpp rkvarslot.cpp
Log Message:
Copy property values when switching from wizard to dialog and back; fix some bugs in varslot
Index: rkcomponent.h
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkcomponent.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** rkcomponent.h 21 Mar 2006 16:35:46 -0000 1.15
--- rkcomponent.h 29 Mar 2006 16:21:51 -0000 1.16
***************
*** 20,25 ****
--- 20,28 ----
#include <qdict.h>
+ #include <qmap.h>
#include <qwidget.h>
+ class RKComponentPropertyBase;
+
/** a very low level base for RKComponent and RKComponentProperty. */
class RKComponentBase {
***************
*** 78,81 ****
--- 81,92 ----
QDict<RKComponentBase> child_map;
bool required;
+ /** recursively fetch the current values of all properties present as direct or indirect children of this component. Used to transfer values e.g. when switching interfaces (or to store settings per plugin in the future). Values are placed in the dictionary provided (be sure to create one first!).
+ @param list the list to store the object values in
+ @param include_top_level include direct properties of the component in the list (or only properties of children)
+ @param prefix used during recursion to provide full ids for the added objects */
+ void fetchPropertyValuesRecursive (QMap<QString, QString> *list, bool include_top_level=false, const QString &prefix=QString::null);
+ /** counterpart to fetchPropertyValuesRecursive (). Tries to apply all values from the list to properties of the given names. If some keys can not be found, or do not resolve to properties, the are ignored.
+ @param list a list of id->value such as generated by fetchPropertyValuesRecursive () */
+ void setPropertyValues (QMap<QString, QString> *list);
};
Index: rkvarslot.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkvarslot.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** rkvarslot.cpp 23 Mar 2006 15:09:51 -0000 1.24
--- rkvarslot.cpp 29 Mar 2006 16:21:51 -0000 1.25
***************
*** 122,126 ****
selected->setObjectList (sellist);
! setSelectButton ((!selection) && (!available->atMaxLength ()));
}
--- 122,126 ----
selected->setObjectList (sellist);
! setSelectButton (((!multi) || (!selection)) && (!available->atMaxLength ()));
}
***************
*** 180,184 ****
}
} else {
! available->setObjectValue (source->objectValue ());
}
} else { // remove-mode
--- 180,184 ----
}
} else {
! if (source->objectValue ()) available->setObjectValue (source->objectValue ());
}
} else { // remove-mode
Index: rkcomponent.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkcomponent.cpp,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** rkcomponent.cpp 21 Mar 2006 16:03:41 -0000 1.14
--- rkcomponent.cpp 29 Mar 2006 16:21:51 -0000 1.15
***************
*** 43,46 ****
--- 43,74 ----
}
+ void RKComponentBase::fetchPropertyValuesRecursive (QMap<QString, QString> *list, bool include_top_level, const QString &prefix) {
+ RK_TRACE (PLUGIN);
+
+ for (QDictIterator<RKComponentBase> it (child_map); it.current (); ++it) {
+ if (it.currentKey () != "#noid#") {
+ if (it.current ()->isProperty ()) {
+ if (include_top_level) {
+ list->insert (prefix + it.currentKey (), it.current ()->value ());
+ }
+ } else {
+ it.current ()->fetchPropertyValuesRecursive (list, true, prefix + it.currentKey () + ".");
+ }
+ }
+ }
+ }
+
+ void RKComponentBase::setPropertyValues (QMap<QString, QString> *list) {
+ RK_TRACE (PLUGIN);
+
+ for (QMap<QString, QString>::const_iterator it = list->constBegin (); it != list->constEnd (); ++it) {
+ QString mod;
+ RKComponentBase *prop = lookupComponent (it.key (), &mod);
+ if (mod.isEmpty () && prop->isProperty ()) { // found a property
+ static_cast<RKComponentPropertyBase*>(prop)->setValue (it.data ());
+ }
+ }
+ }
+
QString RKComponentBase::fetchStringValue (const QString &identifier) {
RK_TRACE (PLUGIN);
***************
*** 152,156 ****
}
! void RKComponent::addComponentToCurrentPage (RKComponent *component) {
RK_TRACE (PLUGIN);
RK_ASSERT (false); // should not be called as isWizardish returns false
--- 180,184 ----
}
! void RKComponent::addComponentToCurrentPage (RKComponent *) {
RK_TRACE (PLUGIN);
RK_ASSERT (false); // should not be called as isWizardish returns false
Index: rkstandardcomponent.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkstandardcomponent.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** rkstandardcomponent.cpp 23 Mar 2006 15:09:51 -0000 1.25
--- rkstandardcomponent.cpp 29 Mar 2006 16:21:51 -0000 1.26
***************
*** 229,235 ****
--- 229,240 ----
if (isWizardish ()) force_mode = 1;
+ QMap<QString, QString> value_save; // fetch current GUI settings
+ fetchPropertyValuesRecursive (&value_save);
+
discard ();
createTopLevel (doc_element, force_mode);
+
+ setPropertyValues (&value_save); // set old GUI settings
}
Index: rkcomponentproperties.cpp
===================================================================
RCS file: /cvsroot/rkward/rkward/rkward/plugin/rkcomponentproperties.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** rkcomponentproperties.cpp 23 Mar 2006 15:09:51 -0000 1.22
--- rkcomponentproperties.cpp 29 Mar 2006 16:21:51 -0000 1.23
***************
*** 802,805 ****
--- 802,806 ----
checkListLengthValid ();
+ emit (valueChanged (this));
return (isValid () && ok);
}
More information about the rkward-tracker
mailing list