[rkward-cvs] SF.net SVN: rkward: [1090] trunk/rkward/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Mon Jan 8 12:09:41 UTC 2007
Revision: 1090
http://svn.sourceforge.net/rkward/?rev=1090&view=rev
Author: tfry
Date: 2007-01-08 04:09:40 -0800 (Mon, 08 Jan 2007)
Log Message:
-----------
Most basic help is working
Modified Paths:
--------------
trunk/rkward/rkward/misc/xmlhelper.cpp
trunk/rkward/rkward/misc/xmlhelper.h
trunk/rkward/rkward/plugins/descriptive/descriptive_statistics.rkh
trunk/rkward/rkward/plugins/descriptive/descriptive_statistics.xml
trunk/rkward/rkward/windows/rkhtmlwindow.cpp
Modified: trunk/rkward/rkward/misc/xmlhelper.cpp
===================================================================
--- trunk/rkward/rkward/misc/xmlhelper.cpp 2007-01-08 10:50:18 UTC (rev 1089)
+++ trunk/rkward/rkward/misc/xmlhelper.cpp 2007-01-08 12:09:40 UTC (rev 1090)
@@ -2,7 +2,7 @@
xmlhelper.cpp - description
-------------------
begin : Fri May 6 2005
- copyright : (C) 2005 by Thomas Friedrichsmeier
+ copyright : (C) 2005, 2007 by Thomas Friedrichsmeier
email : tfry at users.sourceforge.net
***************************************************************************/
@@ -103,6 +103,27 @@
return list.first ();
}
+QDomElement XMLHelper::findElementWithAttribute (const QDomElement &parent, const QString &attribute_name, const QString &attribute_value, bool recursive, int debug_level) {
+ RK_TRACE (XML);
+
+ XMLChildList list = getChildElements (parent, QString (), debug_level);
+ for (XMLChildList::const_iterator it = list.constBegin (); it != list.constEnd (); ++it) {
+ if ((*it).hasAttribute (attribute_name)) {
+ if (((*it).attribute (attribute_name)) == attribute_value) {
+ return (*it);
+ }
+ }
+ if (recursive) {
+ QDomElement found = findElementWithAttribute (*it, attribute_name, attribute_value, true, debug_level);
+ if (!found.isNull ()) return found;
+ }
+ }
+
+ QDomElement dummy;
+ return dummy;
+}
+
+
QString XMLHelper::getStringAttribute (const QDomElement &element, const QString &name, const QString &def, int debug_level) {
RK_TRACE (XML);
Modified: trunk/rkward/rkward/misc/xmlhelper.h
===================================================================
--- trunk/rkward/rkward/misc/xmlhelper.h 2007-01-08 10:50:18 UTC (rev 1089)
+++ trunk/rkward/rkward/misc/xmlhelper.h 2007-01-08 12:09:40 UTC (rev 1090)
@@ -2,7 +2,7 @@
xmlhelper.h - description
-------------------
begin : Fri May 6 2005
- copyright : (C) 2005 by Thomas Friedrichsmeier
+ copyright : (C) 2005, 2007 by Thomas Friedrichsmeier
email : tfry at users.sourceforge.net
***************************************************************************/
@@ -64,6 +64,15 @@
@returns the element found */
QDomElement getChildElement (const QDomElement &parent, const QString &name, int debug_level);
+/** find the first child element of parent, that has a certain attribute
+ at param parent the element whose children to search
+ at param attribute_name the attribute name of the attribute to search for
+ at param attribute_value the attribute value of the attribute to search for
+ at param recursive do a recursive search? If false, only direct children will be looked at
+ at param debug_level level of debug message to generate in case of failure
+ at returns the element found */
+ QDomElement findElementWithAttribute (const QDomElement &parent, const QString &attribute_name, const QString &attribute_value, bool recursive, int debug_level);
+
/** returns the value of a string attribute (Note: most get...Attribute functions use this function internally)
@param element the element whose attributes to search
@param name the name of the attribute to read
Modified: trunk/rkward/rkward/plugins/descriptive/descriptive_statistics.rkh
===================================================================
--- trunk/rkward/rkward/plugins/descriptive/descriptive_statistics.rkh 2007-01-08 10:50:18 UTC (rev 1089)
+++ trunk/rkward/rkward/plugins/descriptive/descriptive_statistics.rkh 2007-01-08 12:09:40 UTC (rev 1090)
@@ -13,9 +13,13 @@
Same paragraph
</usage>
<settings>
+ <caption id="tab_variables"/>
<setting id="x">Select one or more numeric vectors to analyse</setting>
+ <caption id="tab_mean_sd"/>
<setting id="mean">Should the mean value be computed?</setting>
<setting id="trim">Trim of the mean. See <link href="rkward://rhelp/mean"/></setting>
+ <caption id="tab_median_mad"/>
+ <caption id="tab_range_etc"/>
</settings>
<related>
<ul>
Modified: trunk/rkward/rkward/plugins/descriptive/descriptive_statistics.xml
===================================================================
--- trunk/rkward/rkward/plugins/descriptive/descriptive_statistics.xml 2007-01-08 10:50:18 UTC (rev 1089)
+++ trunk/rkward/rkward/plugins/descriptive/descriptive_statistics.xml 2007-01-08 12:09:40 UTC (rev 1090)
@@ -6,7 +6,7 @@
<dialog label="Descriptive Statistics" >
<tabbook>
- <tab label="Variables">
+ <tab label="Variables" id="tab_variables">
<row>
<column>
<varselector id="vars" />
@@ -16,7 +16,7 @@
</column>
</row>
</tab>
- <tab label="Mean Standard Deviation">
+ <tab label="Mean Standard Deviation" id="tab_mean_sd">
<column>
<checkbox value_unchecked="0" checked="true" value="1" id="mean" label="mean" />
<spinbox type="real" initial="0" min="0" id="trim" max="0.5" label="trim" />
@@ -26,7 +26,7 @@
</column>
<stretch/>
</tab>
- <tab label="Median, MAD">
+ <tab label="Median, MAD" id="tab_median_mad">
<column>
<frame label="Median, Range" >
<checkbox value_unchecked="0" value="1" id="median" label="median" />
@@ -43,7 +43,7 @@
<stretch/>
</column>
</tab>
- <tab label="Range, Sum, Product and Length">
+ <tab label="Range, Sum, Product and Length" id="tab_range_etc">
<row>
<column>
<frame>
Modified: trunk/rkward/rkward/windows/rkhtmlwindow.cpp
===================================================================
--- trunk/rkward/rkward/windows/rkhtmlwindow.cpp 2007-01-08 10:50:18 UTC (rev 1089)
+++ trunk/rkward/rkward/windows/rkhtmlwindow.cpp 2007-01-08 12:09:40 UTC (rev 1090)
@@ -435,14 +435,37 @@
// TODO: handle some generic sections
- // TODO: handle settings section
+ element = help_xml->getChildElement (help_doc_element, "settings", DL_WARNING);
+ if (!element.isNull ()) {
+ khtmlpart->write ("<h2>" + i18n ("GUI settings") + "</h2>\n");
+ XMLChildList setting_elements = help_xml->getChildElements (element, QString (), DL_WARNING);
+ for (XMLChildList::iterator it = setting_elements.begin (); it != setting_elements.end (); ++it) {
+ if ((*it).tagName () == "setting") {
+ QString id = help_xml->getStringAttribute (*it, "id", QString (), DL_WARNING);
+ QString title = help_xml->getStringAttribute (*it, "title", QString (), DL_WARNING);
+ if (title.isEmpty ()) {
+ QDomElement source_element = component_xml->findElementWithAttribute (component_doc_element, "id", id, true, DL_WARNING);
+ title = component_xml->getStringAttribute (source_element, "label", i18n ("Unnamed GUI element"), DL_WARNING);
+ }
+ khtmlpart->write ("<h4>" + title + "</h4>");
+ khtmlpart->write (renderHelpFragment (*it));
+ } else if ((*it).tagName () == "caption") {
+ QString id = help_xml->getStringAttribute (*it, "id", QString (), DL_WARNING);
+ QString title = help_xml->getStringAttribute (*it, "title", QString (), DL_INFO);
+ QDomElement source_element = component_xml->findElementWithAttribute (component_doc_element, "id", id, true, DL_WARNING);
+ title = component_xml->getStringAttribute (source_element, "label", title, DL_WARNING);
+ khtmlpart->write ("<h3>" + title + "</h3>");
+ } else {
+ help_xml->displayError (&(*it), "Tag not allowed, here", DL_WARNING);
+ }
+ }
+ }
element = help_xml->getChildElement (help_doc_element, "related", DL_WARNING);
if (!element.isNull ()) {
khtmlpart->write ("<h2>" + i18n ("Related functions and pages") + "</h2>\n");
khtmlpart->write (renderHelpFragment (element));
}
- // TODO: handle related section
khtmlpart->end ();
success = true;
@@ -466,17 +489,17 @@
if (element.isNull ()) continue;
prepareHelpLink (&element);
- qDebug ("fragment");
}
QString ret;
QTextOStream stream (&ret);
- fragment.save (stream, 0);
+ for (QDomNode node = fragment.firstChild (); !node.isNull (); node = node.nextSibling ()) {
+ node.save (stream, 0);
+ }
ret.prepend ("<p>");
ret.append ("</p>");
ret.replace ("\n\n", "</p>\n<p>");
- // TOOD: prettification: the fragment's old tag (e.g. <summary> is still present inthe output)
qDebug ("%s", ret.latin1 ());
return ret;
@@ -484,7 +507,6 @@
void RKHelpWindow::prepareHelpLink (QDomElement *link_element) {
RK_TRACE (APP);
- qDebug ("link");
link_element->setTagName ("a");
if (link_element->text ().isEmpty ()) {
@@ -493,7 +515,11 @@
if (url.protocol () == "rkward") {
if (url.host () == "component") {
RKComponentHandle *chandle = componentPathToHandle (url.path ());
- chandle ? text = chandle->getLabel () : text = i18n ("BROKEN REFERENCE");
+ if (chandle) text = chandle->getLabel ();
+ else {
+ text = i18n ("BROKEN REFERENCE");
+ RK_DO (qDebug ("Broken component reference to %s", url.path ().latin1 ()), APP, DL_WARNING);
+ }
} else if (url.host () == "rhelp") {
text = i18n ("R Reference on '%1'").arg (url.path ().mid (1));
} else if (url.host () == "page") {
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