This list is closed, nobody may subscribe to it.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(13) |
Nov
(40) |
Dec
(2) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
|
Feb
(17) |
Mar
(25) |
Apr
(144) |
May
(18) |
Jun
|
Jul
(1) |
Aug
|
Sep
(130) |
Oct
(134) |
Nov
(72) |
Dec
(14) |
2006 |
Jan
|
Feb
(17) |
Mar
(90) |
Apr
(169) |
May
(21) |
Jun
(16) |
Jul
(1) |
Aug
(16) |
Sep
(125) |
Oct
(131) |
Nov
(64) |
Dec
(47) |
2007 |
Jan
(249) |
Feb
(247) |
Mar
(254) |
Apr
(86) |
May
(64) |
Jun
(10) |
Jul
(4) |
Aug
(17) |
Sep
(58) |
Oct
(144) |
Nov
(124) |
Dec
(13) |
2008 |
Jan
(58) |
Feb
|
Mar
(5) |
Apr
(19) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(24) |
Dec
|
2009 |
Jan
(1) |
Feb
(10) |
Mar
(29) |
Apr
(14) |
May
(62) |
Jun
(48) |
Jul
(27) |
Aug
(43) |
Sep
(44) |
Oct
(34) |
Nov
(10) |
Dec
(10) |
2010 |
Jan
(1) |
Feb
(26) |
Mar
(53) |
Apr
(41) |
May
(19) |
Jun
(52) |
Jul
(36) |
Aug
(24) |
Sep
(114) |
Oct
(73) |
Nov
(48) |
Dec
(139) |
2011 |
Jan
(54) |
Feb
(48) |
Mar
(45) |
Apr
(32) |
May
(121) |
Jun
(46) |
Jul
(3) |
Aug
(19) |
Sep
(146) |
Oct
(142) |
Nov
(48) |
Dec
(77) |
2012 |
Jan
(17) |
Feb
(5) |
Mar
(39) |
Apr
(31) |
May
(37) |
Jun
(7) |
Jul
|
Aug
(23) |
Sep
(40) |
Oct
(68) |
Nov
(68) |
Dec
(13) |
2013 |
Jan
(32) |
Feb
(47) |
Mar
(86) |
Apr
(82) |
May
(23) |
Jun
(1) |
Jul
(3) |
Aug
(1) |
Sep
|
Oct
(4) |
Nov
(3) |
Dec
(3) |
2014 |
Jan
|
Feb
|
Mar
(10) |
Apr
(8) |
May
(4) |
Jun
(1) |
Jul
|
Aug
(2) |
Sep
(65) |
Oct
(119) |
Nov
(82) |
Dec
(84) |
2015 |
Jan
(94) |
Feb
(46) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(3) |
2016 |
Jan
(4) |
Feb
(4) |
Mar
(2) |
Apr
(1) |
May
(2) |
Jun
|
Jul
(3) |
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
From: m.eik m. <mei...@un...> - 2015-01-06 14:57:58
|
Git commit 97710a1010f3fa28ed2b06b6a9f3ea3361327b67 by m.eik michalke. Committed on 06/01/2015 at 14:57. Pushed by meikm into branch 'master'. improved the author and maintainer fileds in generated DESCRIPTION files M +3 -1 packages/rkwarddev/ChangeLog M +42 -0 packages/rkwarddev/R/rk-internal.R M +6 -5 packages/rkwarddev/R/rk.plugin.skeleton.R http://commits.kde.org/rkward/97710a1010f3fa28ed2b06b6a9f3ea3361327b67 diff --git a/packages/rkwarddev/ChangeLog b/packages/rkwarddev/ChangeLog index a761708..0822bf7 100644 --- a/packages/rkwarddev/ChangeLog +++ b/packages/rkwarddev/ChangeLog @@ -1,6 +1,6 @@ ChangeLog for package rkwarddev -changes in version 0.06-6 (2015-01-02) +changes in version 0.06-6 (2015-01-06) fixed: - rk.XML.optionset() does now allow to re-use objects defined in the same function call (i.e., refer to optioncolumns in the logic section) @@ -62,6 +62,8 @@ changed: - rk.JS.doc() now uses a more robust method to set global variables, namely by defining an additional function setGlobalVars() and calling that inside preprocess() + - updated the generation of author and maintainer fileds in DESCRIPTIONs + made by rk.plugin.skeleton(), borrowing get.authors() from roxyPackage removed: - the functions rk.set.language() rk.get.language() were no longer useful and therefore removed diff --git a/packages/rkwarddev/R/rk-internal.R b/packages/rkwarddev/R/rk-internal.R index 637e73f..e8499bd 100644 --- a/packages/rkwarddev/R/rk-internal.R +++ b/packages/rkwarddev/R/rk-internal.R @@ -547,6 +547,48 @@ get.by.role <- function(persons, role="aut"){ } ## end function get.by.role() +## function get.authors() +get.authors <- function(description, maintainer=TRUE, contributor=FALSE, copyright=FALSE){ + if("Authors@R" %in% names(description)){ + gotPersons <- TRUE + authorsFromDescription <- description[["Authors@R"]] + } else if("Author@R" %in% names(description)){ + gotPersons <- TRUE + authorsFromDescription <- description[["Author@R"]] + } else { + gotPersons <- FALSE + } + + if(isTRUE(gotPersons)){ + got.aut <- paste(format(get.by.role(eval(parse(text=authorsFromDescription))), include=c("given", "family")), collapse=", ") + got.cre <- ifelse(isTRUE(maintainer), + paste(format(get.by.role(eval(parse(text=authorsFromDescription)), role="cre"), include=c("given", "family", "email")), collapse=", "), + "") + got.ctb <- ifelse(isTRUE(contributor), + paste(format(get.by.role(eval(parse(text=authorsFromDescription)), role="ctb"), include=c("given", "family")), collapse=", "), + "") + got.cph <- ifelse(isTRUE(copyright), + paste(format(get.by.role(eval(parse(text=authorsFromDescription)), role="cph"), include=c("given", "family")), collapse=", "), + "") + } else { + got.aut <- description[["Author"]] + got.cre <- ifelse(isTRUE(maintainer), + description[["Maintainer"]], + "") + # contributors should already be named in got.aut + got.ctb <- "" + got.cph <- "" + } + got.cre.clean <- gsub("<([^@]*)@([^>]*)>", "\\\\email{\\1@@\\2}", gsub("\n[[:space:]]*", "\n#' ", got.cre)) + # append contributors + if(isTRUE(contributor) && got.ctb != ""){ + got.aut <- paste0(got.aut, ", with contributions from ", got.ctb) + } else {} + gotAuthors <- list(aut=got.aut, cre=got.cre, cre.clean=got.cre.clean, ctb=got.ctb, cph=got.cph) + return(gotAuthors) +} ## end function get.authors() + + ## function check.ID() # - node: a XiMpLe.node to search for an ID # - search.environment: if TRUE, the internal environment is searched for the ID diff --git a/packages/rkwarddev/R/rk.plugin.skeleton.R b/packages/rkwarddev/R/rk.plugin.skeleton.R index 5766e75..83eb764 100644 --- a/packages/rkwarddev/R/rk.plugin.skeleton.R +++ b/packages/rkwarddev/R/rk.plugin.skeleton.R @@ -364,11 +364,12 @@ rk.plugin.skeleton <- function(about, path=tempdir(), ## create DESCRIPTION file if("desc" %in% create){ if(isTRUE(checkCreateFiles(description.file, ow=overwrite, action="desc"))){ - authors <- XML2person(about.node, eval=TRUE) - all.authors <- format(get.by.role(authors, role="aut"), - include=c("given", "family", "email"), braces=list(email=c("<", ">"))) - all.maintainers <- format(get.by.role(authors, role="cre"), - include=c("given", "family", "email"), braces=list(email=c("<", ">"))) + # R replaces the @ with a dot, so we need to rename it as a workaround + authors.person <- data.frame(AuthorsR=paste0("c(", XML2person(about.node), ")"), stringsAsFactors=FALSE) + colnames(authors.person)[1] <- "Authors@R" + authors <- get.authors(authors.person, maintainer=TRUE, contributor=TRUE) + all.authors <- authors[["aut"]] + all.maintainers <- authors[["cre"]] ## TODO: check and add the commented values here: desc <- data.frame( |
From: Thomas F. <tho...@ru...> - 2015-01-05 21:25:16
|
Git commit 90304e9907a53a0f5472a42e9f7997d0d43afda1 by Thomas Friedrichsmeier. Committed on 05/01/2015 at 21:24. Pushed by tfry into branch 'master'. Don't rely on an active plugins component handle to persist (it will be deleted, and may or may not be recreated when reloading pluginmaps). M +0 -1 ChangeLog M +1 -1 rkward/plugin/rkcomponentmap.cpp M +6 -3 rkward/plugin/rkstandardcomponent.cpp M +5 -5 rkward/plugin/rkstandardcomponent.h M +4 -6 rkward/plugin/rkstandardcomponentgui.cpp http://commits.kde.org/rkward/90304e9907a53a0f5472a42e9f7997d0d43afda1 diff --git a/ChangeLog b/ChangeLog index 5960d9d..76743f7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,5 @@ - Fix a hang-on-exit issue - Add R function rk.set.plugin.status() to allow further customization of loaded plugins (hiding of individual menu entries) - - TODO: With the improved interface to plugins from R, make sure plugins can actually be modified at runtime without crashing (close and re-open them) - Pluginmap-management was reworked, partially, and moved to Settings->Manage R packages and plugins - Provide more detailed information on loaded plugins in rk.list.plugins() - Allow to override plugins from a different pluginmap (the plugin with the highest specified version is used) diff --git a/rkward/plugin/rkcomponentmap.cpp b/rkward/plugin/rkcomponentmap.cpp index 5ed7cf7..e9128b9 100644 --- a/rkward/plugin/rkcomponentmap.cpp +++ b/rkward/plugin/rkcomponentmap.cpp @@ -793,7 +793,7 @@ RKComponentHandle::~RKComponentHandle () { RKStandardComponent *RKComponentHandle::invoke (RKComponent *parent_component, QWidget *parent_widget) { RK_TRACE (PLUGIN); - return (new RKStandardComponent (parent_component, parent_widget, getFilename (), this)); + return (new RKStandardComponent (parent_component, parent_widget, getFilename (), RKComponentMap::getComponentId (this))); } QString RKComponentHandle::getAttributeValue (const QString &attribute_id) { diff --git a/rkward/plugin/rkstandardcomponent.cpp b/rkward/plugin/rkstandardcomponent.cpp index c28b389..0902499 100644 --- a/rkward/plugin/rkstandardcomponent.cpp +++ b/rkward/plugin/rkstandardcomponent.cpp @@ -64,11 +64,11 @@ #include "../debug.h" -RKStandardComponent::RKStandardComponent (RKComponent *parent_component, QWidget *parent_widget, const QString &filename, RKComponentHandle *handle) : RKComponent (parent_component, parent_widget) { +RKStandardComponent::RKStandardComponent (RKComponent *parent_component, QWidget *parent_widget, const QString &filename, const QString &id) : RKComponent (parent_component, parent_widget) { RK_TRACE (PLUGIN); RKStandardComponent::filename = filename; - RKStandardComponent::handle = handle; + RKStandardComponent::id = id; command_chain = 0; backend = 0; scripting = 0; @@ -225,7 +225,10 @@ void RKStandardComponent::setCaption (const QString &caption) { XMLHelper* RKStandardComponent::getXmlHelper () { RK_TRACE (PLUGIN); - if (!xml) xml = new XMLHelper (filename, getHandle ()->messageCatalog ()); + if (!xml) { + RKComponentHandle *handle = RKComponentMap::getComponentHandle (id); + xml = new XMLHelper (filename, handle ? handle->messageCatalog () : 0); + } return xml; } diff --git a/rkward/plugin/rkstandardcomponent.h b/rkward/plugin/rkstandardcomponent.h index 325eb57..7671016 100644 --- a/rkward/plugin/rkstandardcomponent.h +++ b/rkward/plugin/rkstandardcomponent.h @@ -41,7 +41,7 @@ public: @param parent_component Parent component (or 0, if this is going to be a top-level component) @param parent_widget Parent widget (typically 0, if this is going to be a top-level component) @param filename Filename of the XML-file to construct this component from */ - RKStandardComponent (RKComponent *parent_component, QWidget *parent_widget, const QString &filename, RKComponentHandle *handle); + RKStandardComponent (RKComponent *parent_component, QWidget *parent_widget, const QString &filename, const QString &id); /** destructor */ ~RKStandardComponent (); /** reimplemented to update code on changes*/ @@ -65,10 +65,10 @@ public: /** set the GUI caption (if this is a top-level gui) */ void setCaption (const QString &caption); /** return the filename of the xml file */ - QString getFilename () { return filename; }; + QString getFilename () const { return filename; }; XMLHelper *getXmlHelper (); - RKComponentHandle *getHandle () { return handle; }; - bool haveHelp () { return have_help; }; + QString getId () const { return id; }; + bool haveHelp () const { return have_help; }; /** Submits the current code (by simulating a click on the ok button). @param in_chain The command chain to insert the command in (0 for regular command stack). @return false, if the plugin-code could not be submitted (e.g. plugin was not satisfied) */ @@ -109,7 +109,7 @@ private: ScriptBackend *backend; RKComponentScriptingProxy* scripting; RKStandardComponentGUI *gui; - RKComponentHandle *handle; + QString id; RKStandardComponentStack *wizard; bool update_pending; RCommandChain *command_chain; diff --git a/rkward/plugin/rkstandardcomponentgui.cpp b/rkward/plugin/rkstandardcomponentgui.cpp index 79d6884..b4a45b9 100644 --- a/rkward/plugin/rkstandardcomponentgui.cpp +++ b/rkward/plugin/rkstandardcomponentgui.cpp @@ -171,11 +171,11 @@ void RKStandardComponentGUI::ok () { // re-run link // This should be run in a separate command, in case the above command bails out with an error. Even in that case, the re-run link should be printed. command.clear (); - RKComponentHandle *handle = component->getHandle (); - if (handle->isAccessible ()) { + RKComponentHandle *handle = RKComponentMap::getComponentHandle (component->getId ()); + if (handle && handle->isAccessible ()) { RKComponent::PropertyValueMap map; component->serializeState (&map); - command.append (".rk.rerun.plugin.link(plugin=\"" + RKComponentMap::getComponentId (handle) + "\", settings=\"" + RKCommonFunctions::escape (RKComponent::valueMapToString (map)) + "\", label=\"" + i18n ("Run again") + "\")\n"); + command.append (".rk.rerun.plugin.link(plugin=\"" + component->getId () + "\", settings=\"" + RKCommonFunctions::escape (RKComponent::valueMapToString (map)) + "\", label=\"" + i18n ("Run again") + "\")\n"); // NOTE: the serialized state is quote-escape *again* for passing to R. } // separator line @@ -225,9 +225,7 @@ void RKStandardComponentGUI::copyCode () { void RKStandardComponentGUI::help () { RK_TRACE (PLUGIN); - QString id = RKComponentMap::getComponentId (component->getHandle ()); - - QString path = id.split ("::").join ("/"); + QString path = component->getId ().split ("::").join ("/"); RKWorkplace::mainWorkplace ()->openHelpWindow (KUrl ("rkward://component/" + path)); } |
From: Thomas F. <tho...@ru...> - 2015-01-05 21:25:16
|
Git commit 83535025835988de1d77b557482828cf4573d796 by Thomas Friedrichsmeier. Committed on 05/01/2015 at 21:11. Pushed by tfry into branch 'master'. Remove some unused code. M +1 -3 rkward/plugin/rkcomponentcontext.cpp M +8 -12 rkward/plugin/rkcomponentmap.cpp M +1 -3 rkward/plugin/rkcomponentmap.h http://commits.kde.org/rkward/83535025835988de1d77b557482828cf4573d796 diff --git a/rkward/plugin/rkcomponentcontext.cpp b/rkward/plugin/rkcomponentcontext.cpp index d210759..4a44855 100644 --- a/rkward/plugin/rkcomponentcontext.cpp +++ b/rkward/plugin/rkcomponentcontext.cpp @@ -33,9 +33,7 @@ RKContextHandler *RKComponentGUIXML::makeContextHandler (QObject *parent, bool c const QStringList ids = components (); for (int i = 0; i < ids.size (); ++i) { RKComponentHandle *handle = RKComponentMap::getComponentHandle (ids[i]); - if (handle->isPlugin ()) { - handler->addAction (ids[i], handle); - } + handler->addAction (ids[i], handle); } } return handler; diff --git a/rkward/plugin/rkcomponentmap.cpp b/rkward/plugin/rkcomponentmap.cpp index 982e24e..5ed7cf7 100644 --- a/rkward/plugin/rkcomponentmap.cpp +++ b/rkward/plugin/rkcomponentmap.cpp @@ -89,7 +89,7 @@ void RKComponentGUIXML::resolveComponentLabelsAndSortMenu (Menu *menu, const QSt Entry *entry = group->entries[j]; if (!entry->is_menu) { RKComponentHandle* handle = RKComponentMap::getComponentHandle (entry->id); - if ((!handle) || (!handle->isPlugin ())) { + if (!handle) { RK_DEBUG (PLUGIN, DL_ERROR, "No such component found while creating menu-entries or component is not a standalone plugin: \"%s\". No entry created.", qPrintable (entry->id)); delete (group->entries.takeAt (j)); --j; @@ -650,7 +650,7 @@ RKPluginMapParseResult RKComponentMap::addPluginMap (const QString& plugin_map_f } QString filename = xml.getStringAttribute((*it), "file", QString (), DL_WARNING); - int type = xml.getMultiChoiceAttribute ((*it), "type", "standard", 0, DL_WARNING); + xml.getMultiChoiceAttribute ((*it), "type", "standard", 0, DL_WARNING); // unused, but documented for future extension; TODO: remove? QString label = xml.i18nStringAttribute ((*it), "label", i18n ("(no label)"), DL_WARNING); if (local_components.contains (id)) { @@ -663,7 +663,7 @@ RKPluginMapParseResult RKComponentMap::addPluginMap (const QString& plugin_map_f ret.addAndPrintError (DL_ERROR, i18n ("Specified file '%1' for component id \"%2\" does not exist or is not readable. Ignoring.", filename, id)); } else { // create and initialize component handle - RKComponentHandle *handle = new RKComponentHandle (pluginmap_file_desc, filename, label, (RKComponentType) type); + RKComponentHandle *handle = new RKComponentHandle (pluginmap_file_desc, filename, label); XMLChildList attributes_list = xml.getChildElements (*it, "attribute", DL_DEBUG); for (XMLChildList::const_iterator ait=attributes_list.begin (); ait != attributes_list.end (); ++ait) { handle->addAttribute (xml.getStringAttribute (*ait, "id", "noid", DL_WARNING), xml.getStringAttribute (*ait, "value", QString (), DL_ERROR), xml.i18nStringAttribute (*ait, "label", QString (), DL_ERROR)); @@ -716,12 +716,10 @@ void RKComponentMap::activateComponent () { void RKComponentMap::addedEntry (const QString &id, RKComponentHandle *handle) { RK_TRACE (PLUGIN); - if (handle->isPlugin ()) { - handle->setAccessible (true); - KAction *action = actionCollection ()->addAction (id, this, SLOT (activateComponent())); - action->setText (handle->getLabel ()); - action->setShortcutConfigurable (true); - } + handle->setAccessible (true); + KAction *action = actionCollection ()->addAction (id, this, SLOT (activateComponent())); + action->setText (handle->getLabel ()); + action->setShortcutConfigurable (true); } void RKComponentGUIXML::appendPluginToList (const QString& id, QStringList* list) { @@ -778,10 +776,9 @@ void RKComponentMap::setPluginStatus (const QStringList& ids, const QStringList& #include "rkstandardcomponent.h" -RKComponentHandle::RKComponentHandle (RKPluginMapFile *pluginmap, const QString &rel_filename, const QString &label, RKComponentType type) { +RKComponentHandle::RKComponentHandle (RKPluginMapFile *pluginmap, const QString &rel_filename, const QString &label) { RK_TRACE (PLUGIN); - RKComponentHandle::type = type; RKComponentHandle::filename = rel_filename; RKComponentHandle::label = label; RKComponentHandle::plugin_map = pluginmap; @@ -795,7 +792,6 @@ RKComponentHandle::~RKComponentHandle () { RKStandardComponent *RKComponentHandle::invoke (RKComponent *parent_component, QWidget *parent_widget) { RK_TRACE (PLUGIN); - RK_ASSERT (isPlugin ()); return (new RKStandardComponent (parent_component, parent_widget, getFilename (), this)); } diff --git a/rkward/plugin/rkcomponentmap.h b/rkward/plugin/rkcomponentmap.h index 8bb9bf1..e41314a 100644 --- a/rkward/plugin/rkcomponentmap.h +++ b/rkward/plugin/rkcomponentmap.h @@ -71,13 +71,11 @@ class KActionCollection; */ class RKComponentHandle { public: - RKComponentHandle (RKPluginMapFile *pluginmap, const QString &rel_filename, const QString &label, RKComponentType type); + RKComponentHandle (RKPluginMapFile *pluginmap, const QString &rel_filename, const QString &label); virtual ~RKComponentHandle (); QString getFilename () const { return plugin_map->makeFileName (filename); }; QString getLabel () const { return label; }; - RKComponentType getType () const { return type; }; - bool isPlugin () const { return (type == Standard); }; QString getPluginmapFilename () const; RKStandardComponent *invoke (RKComponent *parent_component, QWidget *parent_widget); |
From: Thomas F. <tho...@ru...> - 2015-01-05 19:54:30
|
Git commit 1b739959742a014ae7804aa23a0c22b9a405b399 by Thomas Friedrichsmeier. Committed on 05/01/2015 at 19:54. Pushed by tfry into branch 'master'. Fix a hang on exit M +1 -0 ChangeLog M +1 -0 rkward/rbackend/rkfrontendtransmitter.cpp http://commits.kde.org/rkward/1b739959742a014ae7804aa23a0c22b9a405b399 diff --git a/ChangeLog b/ChangeLog index 250d3c0..5960d9d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +- Fix a hang-on-exit issue - Add R function rk.set.plugin.status() to allow further customization of loaded plugins (hiding of individual menu entries) - TODO: With the improved interface to plugins from R, make sure plugins can actually be modified at runtime without crashing (close and re-open them) - Pluginmap-management was reworked, partially, and moved to Settings->Manage R packages and plugins diff --git a/rkward/rbackend/rkfrontendtransmitter.cpp b/rkward/rbackend/rkfrontendtransmitter.cpp index d6b50f8..99eab9b 100644 --- a/rkward/rbackend/rkfrontendtransmitter.cpp +++ b/rkward/rbackend/rkfrontendtransmitter.cpp @@ -125,6 +125,7 @@ void RKFrontendTransmitter::run () { connection->close (); backend->waitForFinished (); + delete backend; // otherwise it will be deleted via the constructor from the main thread, which can cause hangs. } void RKFrontendTransmitter::connectAndEnterLoop () { |
From: Thomas F. <tho...@ru...> - 2015-01-05 19:50:08
|
Git commit e816e415e77d6548f6bbbc5e5ae9b0669f5de352 by Thomas Friedrichsmeier. Committed on 05/01/2015 at 19:49. Pushed by tfry into branch 'master'. Finish implementing rk.set.plugin.status(). M +1 -0 ChangeLog M +28 -0 rkward/plugin/rkcomponentmap.cpp M +2 -1 rkward/plugin/rkcomponentmap.h M +11 -3 rkward/rbackend/rpackages/rkward/R/rk.plugin-functions.R A +58 -0 rkward/rbackend/rpackages/rkward/man/rk.list.plugins.Rd M +1 -0 rkward/rkward.h http://commits.kde.org/rkward/e816e415e77d6548f6bbbc5e5ae9b0669f5de352 diff --git a/ChangeLog b/ChangeLog index 136df96..250d3c0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +- Add R function rk.set.plugin.status() to allow further customization of loaded plugins (hiding of individual menu entries) - TODO: With the improved interface to plugins from R, make sure plugins can actually be modified at runtime without crashing (close and re-open them) - Pluginmap-management was reworked, partially, and moved to Settings->Manage R packages and plugins - Provide more detailed information on loaded plugins in rk.list.plugins() diff --git a/rkward/plugin/rkcomponentmap.cpp b/rkward/plugin/rkcomponentmap.cpp index 5594cd5..982e24e 100644 --- a/rkward/plugin/rkcomponentmap.cpp +++ b/rkward/plugin/rkcomponentmap.cpp @@ -279,6 +279,21 @@ int RKComponentGUIXML::addEntries (RKComponentGUIXML::Menu *menu, XMLHelper &xml continue; } + // check if there is an override hiding this plugin (TODO: what if there is more than one override?) + bool hidden = false; + OverrideMap::const_iterator ov = overrides.constFind (id); + while (ov != overrides.constEnd () && ov.key () == id) { + const ComponentOverride &over = ov.value (); + if (over.context.isEmpty () || over.context == context) { + if (over.hidden) { + hidden = true; + break; + } + } + ++ov; + } + if (hidden) continue; + Entry *plug = new Entry (); plug->id = id; insertEntry (menu, plug, add_to); @@ -295,6 +310,17 @@ int RKComponentGUIXML::addEntries (RKComponentGUIXML::Menu *menu, XMLHelper &xml // static QMultiMap<QString, RKComponentGUIXML::ComponentOverride> RKComponentGUIXML::overrides; void RKComponentGUIXML::addOverride (const QString& id, const QString& context, bool visible) { + + OverrideMap::iterator ov = overrides.find (id); + while (ov != overrides.end () && ov.key () == id) { + const ComponentOverride &over = ov.value (); + if (over.context == context) { + overrides.erase (ov); + break; + } + ++ov; + } + ComponentOverride over; over.context = context; over.hidden = !visible; @@ -742,6 +768,8 @@ void RKComponentMap::setPluginStatus (const QStringList& ids, const QStringList& for (int i = 0; i < ids.size (); ++i) { addOverride (ids[i], _contexts[i], (_visible[i] == "1")); } + + RKWardMainWindow::getMain ()->initPlugins (); } diff --git a/rkward/plugin/rkcomponentmap.h b/rkward/plugin/rkcomponentmap.h index 6ade57b..8bb9bf1 100644 --- a/rkward/plugin/rkcomponentmap.h +++ b/rkward/plugin/rkcomponentmap.h @@ -183,7 +183,8 @@ private: QString context; bool hidden; }; - static QMultiMap<QString, ComponentOverride> overrides; + typedef QMultiMap<QString, ComponentOverride> OverrideMap; + static OverrideMap overrides; QString context; void appendPluginToList (const QString &id, QStringList *list); diff --git a/rkward/rbackend/rpackages/rkward/R/rk.plugin-functions.R b/rkward/rbackend/rpackages/rkward/R/rk.plugin-functions.R index 6a0387a..eaef8d4 100644 --- a/rkward/rbackend/rpackages/rkward/R/rk.plugin-functions.R +++ b/rkward/rbackend/rpackages/rkward/R/rk.plugin-functions.R @@ -133,13 +133,21 @@ #' meaning the plugin will be affected in all contexts it occurs in, or a character vector #' of the same length as id. #' @param visible logical, controlling whether the plugin should be shown (\code{TRUE}) or -#' hidden (\code{FALSE}). +#' hidden (\code{FALSE}). Hidden plugins are essentially removed from the menu. They may still +#' be accessible embedded into other plugins. #' #' @return \code{rk.list.plugins} returns a data.frame listing plugin ids, context, menu path #' (tab-separated), and label of the plugin. If a plugin is available in more #' than one context, it will be listed several times. The exact layout (number and order of columns) #' of this data.frame might be subject to change. However, the \bold{names} of the columns in the -#' returned data.frame are expected to remain stable. \code {rk.set.plugin.status} returns \code{NULL}, invisibly +#' returned data.frame are expected to remain stable. +#' \code{rk.set.plugin.status} returns \code{NULL}, invisibly +#' +#' \bold{Note}: Each call to \code{rk.set.plugin.status} will result in a complete rebuild of the +#' menu (in the current implementation). While this should be hardly noticeable in interactive +#' use, it could be an issue when changing the status of many plugins, programatically. +#' In this case, make sure to do all changes in \bold{one} call to \code{rk.set.plugin.status}, +#' rather than many separate calls. #' #' @author Thomas Friedrichsmeier \email{rkward-devel@@lists.sourceforge.net} #' @keywords utilities @@ -152,7 +160,7 @@ #' #' ## NOT RUN #' ## hide t.test plugin -#' rk.set.plugin.status ("t_test", visible=FALSE) +#' rk.set.plugin.status ("rkward::t_test", visible=FALSE) #' ## END NOT RUN #' #' @export diff --git a/rkward/rbackend/rpackages/rkward/man/rk.list.plugins.Rd b/rkward/rbackend/rpackages/rkward/man/rk.list.plugins.Rd new file mode 100644 index 0000000..363bd0b --- /dev/null +++ b/rkward/rbackend/rpackages/rkward/man/rk.list.plugins.Rd @@ -0,0 +1,58 @@ +% Generated by roxygen2 (4.0.2): do not edit by hand +\name{rk.list.plugins} +\alias{rk.list.plugins} +\alias{rk.set.plugin.status} +\title{List of modify loaded plugins} +\usage{ +rk.list.plugins() + +rk.set.plugin.status(id, context = "", visible = TRUE) +} +\arguments{ +\item{id}{vector of ids (character) of the plugins to modify} + +\item{context}{in which the plugin should be shown / hidden. This can either be "", +meaning the plugin will be affected in all contexts it occurs in, or a character vector +of the same length as id.} + +\item{visible}{logical, controlling whether the plugin should be shown (\code{TRUE}) or + hidden (\code{FALSE}). Hidden plugins are essentially removed from the menu. They may still + be accessible embedded into other plugins.} +} +\value{ +\code{rk.list.plugins} returns a data.frame listing plugin ids, context, menu path + (tab-separated), and label of the plugin. If a plugin is available in more + than one context, it will be listed several times. The exact layout (number and order of columns) + of this data.frame might be subject to change. However, the \bold{names} of the columns in the + returned data.frame are expected to remain stable. + \code{rk.set.plugin.status} returns \code{NULL}, invisibly + +\bold{Note}: Each call to \code{rk.set.plugin.status} will result in a complete rebuild of the + menu (in the current implementation). While this should be hardly noticeable in interactive + use, it could be an issue when changing the status of many plugins, programatically. + In this case, make sure to do all changes in \bold{one} call to \code{rk.set.plugin.status}, + rather than many separate calls. +} +\description{ +\code{rk.list.plugins} returns the a list of all currently +registered plugins (in loaded pluginmaps). +\code{rk.set.plugin.status} allows to control the status of the given plugin(s). Currently, + only visibility can be controlled. +} +\examples{ +## list all current plugins +rk.list.plugins () + +## NOT RUN +## hide t.test plugin +rk.set.plugin.status ("rkward::t_test", visible=FALSE) +## END NOT RUN +} +\author{ +Thomas Friedrichsmeier \email{rkw...@li...} +} +\seealso{ +\code{\link{rk.call.plugin}} for invoking a plugin, programatically +} +\keyword{utilities} + diff --git a/rkward/rkward.h b/rkward/rkward.h index 2edb558..5ba9701 100644 --- a/rkward/rkward.h +++ b/rkward/rkward.h @@ -176,6 +176,7 @@ private: friend class RKSettingsModule; friend class RKSettingsModulePlugins; friend class RKSettings; + friend class RKComponentMap; /** Finds plugins and inserts them into the menu-structure */ void initPlugins (const QStringList &automatically_added = QStringList ()); |
From: Thomas F. <tho...@ru...> - 2015-01-04 21:14:39
|
Git commit 1066746667bb0b46cbe06990d37ee1f4ed9c7e38 by Thomas Friedrichsmeier. Committed on 04/01/2015 at 21:12. Pushed by tfry into branch 'master'. Start working on allowing to override some plugin aspects (visibility, for now) from R. Not functional, yet. In the process, merge RKContextMap into RKComponentGUIXML, and rework rk.list.plugins(), somewhat. M +1 -0 ChangeLog M +2 -2 rkward/dialogs/rkimportdialog.h M +7 -25 rkward/plugin/rkcomponentcontext.cpp M +2 -27 rkward/plugin/rkcomponentcontext.h M +56 -26 rkward/plugin/rkcomponentmap.cpp M +26 -10 rkward/plugin/rkcomponentmap.h M +8 -0 rkward/rbackend/rinterface.cpp M +1 -0 rkward/rbackend/rpackages/rkward/NAMESPACE M +55 -19 rkward/rbackend/rpackages/rkward/R/rk.plugin-functions.R M +3 -16 rkward/rbackend/rpackages/rkward/man/rk.call.plugin.Rd M +1 -1 rkward/windows/rkwindowcatcher.cpp http://commits.kde.org/rkward/1066746667bb0b46cbe06990d37ee1f4ed9c7e38 diff --git a/ChangeLog b/ChangeLog index 39aa452..136df96 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ + - TODO: With the improved interface to plugins from R, make sure plugins can actually be modified at runtime without crashing (close and re-open them) - Pluginmap-management was reworked, partially, and moved to Settings->Manage R packages and plugins - Provide more detailed information on loaded plugins in rk.list.plugins() - Allow to override plugins from a different pluginmap (the plugin with the highest specified version is used) diff --git a/rkward/dialogs/rkimportdialog.h b/rkward/dialogs/rkimportdialog.h index ed5f007..71be040 100644 --- a/rkward/dialogs/rkimportdialog.h +++ b/rkward/dialogs/rkimportdialog.h @@ -25,7 +25,7 @@ #include <khbox.h> class QComboBox; -class RKContextMap; +class RKComponentGUIXML; class RKImportDialogFormatSelector; /** This dialog is designed to allow the user to select a file, and file format. After that a suitable plugin @@ -53,7 +53,7 @@ private: QStringList format_labels; QStringList filters; QStringList component_ids; - RKContextMap *context; + RKComponentGUIXML *context; }; /** Internal helper class to RKImportDialog. Needed solely to work around a design flaw in the KFileDialog API */ diff --git a/rkward/plugin/rkcomponentcontext.cpp b/rkward/plugin/rkcomponentcontext.cpp index 254b179..d210759 100644 --- a/rkward/plugin/rkcomponentcontext.cpp +++ b/rkward/plugin/rkcomponentcontext.cpp @@ -2,7 +2,7 @@ rkcomponentcontext - description ------------------- begin : Mon Jan 22 2007 - copyright : (C) 2007, 2014 by Thomas Friedrichsmeier + copyright : (C) 2007, 2014, 2015 by Thomas Friedrichsmeier email : tf...@us... ***************************************************************************/ @@ -25,40 +25,22 @@ #include "../debug.h" -RKContextMap::RKContextMap (const QString &id) : RKComponentGUIXML () { +RKContextHandler *RKComponentGUIXML::makeContextHandler (QObject *parent, bool create_actions) { RK_TRACE (PLUGIN); - RKContextMap::id = id; -} - -RKContextMap::~RKContextMap () { - RK_TRACE (PLUGIN); -} - -RKContextHandler *RKContextMap::makeContextHandler (QObject *parent, bool create_actions) { - RK_TRACE (PLUGIN); - - RKContextHandler *handler = new RKContextHandler (parent, gui_xml, id); + RKContextHandler *handler = new RKContextHandler (parent, gui_xml, context); if (create_actions) { - for (QStringList::const_iterator it = component_ids.constBegin (); it != component_ids.constEnd (); ++it) { - RKComponentHandle *handle = RKComponentMap::getComponentHandle (*it); + const QStringList ids = components (); + for (int i = 0; i < ids.size (); ++i) { + RKComponentHandle *handle = RKComponentMap::getComponentHandle (ids[i]); if (handle->isPlugin ()) { - handler->addAction (*it, handle); + handler->addAction (ids[i], handle); } } } return handler; } -void RKContextMap::addedEntry (const QString &id, RKComponentHandle *) { - RK_TRACE (PLUGIN); - - component_ids.append (id); -} - -/////////////////// END RKContextMap ///////////////////// -//////////////// BEGIN RKContextHandler ////////////////// - RKContextHandler::RKContextHandler (QObject *parent, const QDomDocument &gui_xml, const QString &id) : QObject (parent), RKComponentBase (), KXMLGUIClient () { RK_TRACE (PLUGIN); diff --git a/rkward/plugin/rkcomponentcontext.h b/rkward/plugin/rkcomponentcontext.h index fc841fd..184c192 100644 --- a/rkward/plugin/rkcomponentcontext.h +++ b/rkward/plugin/rkcomponentcontext.h @@ -2,7 +2,7 @@ rkcomponentcontext - description ------------------- begin : Mon Jan 22 2007 - copyright : (C) 2007, 2014 by Thomas Friedrichsmeier + copyright : (C) 2007, 2014, 2015 by Thomas Friedrichsmeier email : tf...@us... ***************************************************************************/ @@ -24,31 +24,6 @@ #include "rkcomponent.h" class QDomElement; -class RKContextHandler; -class XMLHelper; - -/** This class keeps a list of components that are useable in a certain context (e.g. x11 device). It also keeps a description of the menu structure(s) that should be used for that context. Note that in order to use the XML-GUI, you should create an RKContextHandler using makeContextHandler(). - -@author Thomas Friedrichsmeier -*/ -class RKContextMap : public RKComponentGUIXML { -public: -/** constructor -@param id The id of the context */ - RKContextMap (const QString &id); -/** destructor */ - ~RKContextMap (); -/** Create a context handler for this context. */ - RKContextHandler *makeContextHandler (QObject *parent, bool create_actions=true); - QStringList components () { return component_ids; }; -protected: - void addedEntry (const QString &id, RKComponentHandle * /* handle */); -private: - QStringList component_ids; - QString id; -}; - -class KAction; /** An RKContextHandler can be thought of as an instance of a context. E.g. the x11 device context by itself is just an abstract description. To actually use the context for a given device, an RKContextHandler is used. The normal way to construct an instance of this class is using RKContextMap::makeContextHandler(). @@ -63,7 +38,7 @@ The last part (providing context information) is the most important one in this */ class RKContextHandler : public QObject, public RKComponentBase, public KXMLGUIClient { Q_OBJECT -friend class RKContextMap; +friend class RKComponentGUIXML; public: void invokeComponent (RKComponentHandle *handle); int type () { return ComponentContextHandler; }; diff --git a/rkward/plugin/rkcomponentmap.cpp b/rkward/plugin/rkcomponentmap.cpp index e53e066..5594cd5 100644 --- a/rkward/plugin/rkcomponentmap.cpp +++ b/rkward/plugin/rkcomponentmap.cpp @@ -2,7 +2,7 @@ rkcomponentmap.cpp - description ------------------- begin : Thu May 12 2005 - copyright : (C) 2005-2014 by Thomas Friedrichsmeier + copyright : (C) 2005-2015 by Thomas Friedrichsmeier email : tf...@us... ***************************************************************************/ @@ -57,9 +57,10 @@ RKComponentAboutData RKPluginMapFile::getAboutData () { return *about; } -RKComponentGUIXML::RKComponentGUIXML () { +RKComponentGUIXML::RKComponentGUIXML (const QString &context_id) { RK_TRACE (PLUGIN); + context = context_id; clearGUIDescription (); } @@ -72,6 +73,7 @@ void RKComponentGUIXML::clearGUIDescription () { gui_xml.setContent (QString ("<!DOCTYPE kpartgui>\n<kpartgui name=\"rkwardcomponents\" version=\"063\">\n<MenuBar>\n\n</MenuBar>\n</kpartgui>")); toplevel_menu.clear (); + component_menus.clear (); } bool compareMenuEntries (const RKComponentGUIXML::Entry *a, const RKComponentGUIXML::Entry *b) { @@ -96,7 +98,7 @@ void RKComponentGUIXML::resolveComponentLabelsAndSortMenu (Menu *menu, const QSt // The reason that handling of label is delayed to this point is that if a plugin is overridden, we want to use the label specified for the effective plugin (which might have changed WRT the overridden plugin, too). entry->label = handle->getLabel (); addedEntry (entry->id, handle); - component_menus.insert (handle, menu_path); + component_menus.insert (entry->id, menu_path); } } else { resolveComponentLabelsAndSortMenu (static_cast<Menu*> (entry), menu_path.isEmpty () ? entry->label : menu_path + "\t" + entry->label); @@ -290,6 +292,19 @@ int RKComponentGUIXML::addEntries (RKComponentGUIXML::Menu *menu, XMLHelper &xml return leaves; } +// static +QMultiMap<QString, RKComponentGUIXML::ComponentOverride> RKComponentGUIXML::overrides; +void RKComponentGUIXML::addOverride (const QString& id, const QString& context, bool visible) { + ComponentOverride over; + over.context = context; + over.hidden = !visible; + overrides.insert (id, over); +} + +void RKComponentGUIXML::clearOverrides () { + overrides.clear (); +} + /////////////////////////// END RKComponentXMLGUIClient ///////////////////////////////// ////////////////////////////// Bhttp://apps.sourceforge.net/mediawiki/rkward/nfs/project/r/rk/rkward/6/6d/RKWardApplicationDetached.pngEGIN RKComponentMap ///////////////////////////////////// @@ -303,11 +318,12 @@ void RKComponentMap::initialize () { component_map = new RKComponentMap (); } -RKComponentMap::RKComponentMap () : QObject (), RKComponentGUIXML (), KXMLGUIClient () { +RKComponentMap::RKComponentMap () : QObject (), RKComponentGUIXML ("global"), KXMLGUIClient () { RK_TRACE (PLUGIN); setComponentData (KGlobal::mainComponent ()); actionCollection ()->setConfigGroup ("Plugin Shortcuts"); + contexts.insert ("global", this); } RKComponentMap::~RKComponentMap () { @@ -334,32 +350,26 @@ void RKComponentMap::clearAll () { component_attributes.clear (); component_dependencies.clear (); for (RKComponentContextMap::const_iterator it = contexts.constBegin (); it != contexts.constEnd (); ++it) { - delete (it.value ()); + if (it.value () != this) delete (it.value ()); } contexts.clear (); + contexts.insert ("global", this); clearGUIDescription (); setXMLGUIBuildDocument (gui_xml); } -RKContextMap *RKComponentMap::getContext (const QString &id) { +RKComponentGUIXML *RKComponentMap::getContext (const QString &id) { RK_TRACE (PLUGIN); - RKContextMap *context = getMap ()->getContextLocal (id); + RKComponentGUIXML *context = getMap ()->contexts.value (id); if (context) return context; RK_DEBUG (PLUGIN, DL_WARNING, "no such context %s", id.toLatin1 ().data ()); return (0); } -RKContextMap *RKComponentMap::getContextLocal (const QString &id) { - RK_TRACE (PLUGIN); - - if (contexts.contains (id)) return (contexts[id]); - return 0; -} - RKComponentHandle* RKComponentMap::getComponentHandle (const QString &id) { RK_TRACE (PLUGIN); @@ -514,7 +524,7 @@ void RKComponentMap::finalizeAll () { finalize (); setXMLGUIBuildDocument (gui_xml); actionCollection ()->readSettings (); - foreach (RKContextMap *ctx, getMap()->contexts) { + foreach (RKComponentGUIXML *ctx, getMap()->contexts) { ctx->finalize (); } } @@ -651,9 +661,9 @@ RKPluginMapParseResult RKComponentMap::addPluginMap (const QString& plugin_map_f for (XMLChildList::const_iterator it=list.constBegin (); it != list.constEnd (); ++it) { QString id = xml.getStringAttribute (*it, "id", QString::null, DL_ERROR); - RKContextMap *context = getContextLocal (id); + RKComponentGUIXML *context = contexts.value (id); if (!context) { - context = new RKContextMap (id); + context = new RKComponentGUIXML (id); contexts.insert (id, context); } ret.valid_plugins += context->createMenus (xml, *it, cnamespace); @@ -688,6 +698,18 @@ void RKComponentMap::addedEntry (const QString &id, RKComponentHandle *handle) { } } +void RKComponentGUIXML::appendPluginToList (const QString& id, QStringList* list) { + list->append (id); + list->append (context); + list->append (component_menus.value (id)); + RKComponentHandle *handle = RKComponentMap::getComponentHandle (id); + if (handle) list->append (handle->getLabel ()); + else { + RK_ASSERT (handle); + list->append (QString ()); + } +} + QStringList RKComponentMap::listPlugins () { RK_TRACE (PLUGIN); @@ -696,24 +718,32 @@ QStringList RKComponentMap::listPlugins () { ret.reserve (components.size () * 4); #endif for (ComponentMap::const_iterator it = components.constBegin (); it != components.constEnd (); ++it) { - ret.append (it.key ()); - ret.append ("global"); // context - ret.append (component_menus.value (it.value ())); - ret.append (it.value ()->getLabel ()); + // RKComponentMap (in contrast to other contexts) will also contain plugins not added to the menu, + // and is listed separately, for this reason + getMap ()->appendPluginToList (it.key (), &ret); } for (RKComponentContextMap::const_iterator ctx = contexts.constBegin (); ctx != contexts.constEnd (); ++ctx) { + RKComponentGUIXML *context = ctx.value (); + if (context == getMap ()) continue; + QStringList ids = ctx.value ()->components (); for (int i = 0; i < ids.size (); ++i) { - ret.append (ids[i]); - ret.append (ctx.key ()); - RKComponentHandle *handle = getComponentHandle (ids[i]); - ret.append (ctx.value ()->component_menus.value (handle)); - ret.append (handle->getLabel ()); + context->appendPluginToList (ids[i], &ret); } } return ret; } +void RKComponentMap::setPluginStatus (const QStringList& ids, const QStringList& _contexts, const QStringList& _visible) { + RK_TRACE (PLUGIN); + RK_ASSERT (ids.size () == _contexts.size ()); + RK_ASSERT (_contexts.size () == _visible.size ()); + + for (int i = 0; i < ids.size (); ++i) { + addOverride (ids[i], _contexts[i], (_visible[i] == "1")); + } +} + ///########################### END RKComponentMap ############################### ///########################### BEGIN RKComponentHandle ############################ diff --git a/rkward/plugin/rkcomponentmap.h b/rkward/plugin/rkcomponentmap.h index df53ae6..6ade57b 100644 --- a/rkward/plugin/rkcomponentmap.h +++ b/rkward/plugin/rkcomponentmap.h @@ -2,7 +2,7 @@ rkcomponentmap.h - description ------------------- begin : Thu May 12 2005 - copyright : (C) 2005-2014 by Thomas Friedrichsmeier + copyright : (C) 2005-2015 by Thomas Friedrichsmeier email : tf...@us... ***************************************************************************/ @@ -115,10 +115,11 @@ private: class QDomElement; class XMLHelper; +class RKContextHandler; /** This class keeps a QDomDocument that is a represenation of the GUI using KDEs XML-GUI format (a ui.rc). Use createMenus () to have it parse the menu descriptions from a .pluginmap file. It will adjust the XML description accordingly. When done, you can use to generated gui_xml to set it as the xmlGUIBuildDocument of a KXMLGUIClient. -This class represents the common functionality between RKComponentMap and RKContextMap. +One instance of this class is generally around, persistently: The RKComonentMap (with context "global"). Further instances are around one for each context. @author Thomas Friedrichsmeier */ @@ -151,8 +152,12 @@ public: @returns number of plugins/menu-entries added successfully */ int createMenus (XMLHelper &xml, const QDomElement& hierarchy_description, const QString& cnamespace); void finalize (); + +/** Create a context handler for this context. */ + RKContextHandler *makeContextHandler (QObject *parent, bool create_actions=true); + QStringList components () { return component_menus.keys (); }; protected: - RKComponentGUIXML (); + RKComponentGUIXML (const QString &context_id); virtual ~RKComponentGUIXML (); /** reset the xml file */ @@ -164,15 +169,26 @@ protected: /** The generated XML GUI description in KDEs ui.rc format */ QDomDocument gui_xml; friend class RKComponentMap; - QMap<RKComponentHandle*, QString> component_menus; + QMap<QString, QString> component_menus; + +/** Add a component override, e.g. hiding component "t_test" in context "global". Overrides are persistent per session. */ + static void addOverride (const QString &id, const QString &context, bool visible); +/** Clear component overrides (see addOverride()). */ + static void clearOverrides (); private: int addEntries (RKComponentGUIXML::Menu *menu, XMLHelper &xml, const QDomElement description, const QString& cnamespace); void menuItemsToXml (const RKComponentGUIXML::Menu *menu, QDomElement &xml); void resolveComponentLabelsAndSortMenu (Menu *menu, const QString &menu_path=QString ()); -}; + struct ComponentOverride { + QString context; + bool hidden; + }; + static QMultiMap<QString, ComponentOverride> overrides; + QString context; + void appendPluginToList (const QString &id, QStringList *list); +}; -class RKContextMap; class RKPluginMapParseResult { public: @@ -218,7 +234,7 @@ public: static RKComponentMap *getMap () { return component_map; }; static void initialize (); /** returns the context identified by id */ - static RKContextMap *getContext (const QString &id); + static RKComponentGUIXML *getContext (const QString &id); enum ComponentInvocationMode { ManualSubmit, @@ -230,6 +246,7 @@ public: static bool invokeComponent (const QString &component_id, const QStringList &serialized_settings, ComponentInvocationMode submit_mode = ManualSubmit, QString *message=0, RCommandChain *in_chain = 0); /** @returns for rk.list.plugins(): Return a list of all currently registered component ids, their context, menu, and label (i.e. current four strings per component) */ QStringList listPlugins (); + void setPluginStatus (const QStringList &ids, const QStringList &contexts, const QStringList& visible); bool isPluginMapLoaded (const QString& abs_filename) const; public slots: /** Slot called, when a menu-item for a component is selected. Responsible for creating the GUI. */ @@ -242,16 +259,15 @@ private: RKComponentHandle* getComponentHandleLocal (const QString &id); QString getComponentIdLocal (RKComponentHandle* component); - RKContextMap *getContextLocal (const QString &id); - typedef QMap<QString, RKContextMap*> RKComponentContextMap; + typedef QMap<QString, RKComponentGUIXML*> RKComponentContextMap; RKComponentContextMap contexts; QList<RKPluginMapFile*> pluginmapfiles; static RKComponentMap *component_map; friend class RKComponentHandle; - // most components have neither attributes specific dependencies (other than dependencies shared by all plugins in a pluginmap). + // most components have neither attributes nor specific dependencies (other than dependencies shared by all plugins in a pluginmap). // therefore, it saves a few bytes to store attributes and specific dependencies in a central map, rather than keeping structures // per plugin struct AttributeValueMap { diff --git a/rkward/rbackend/rinterface.cpp b/rkward/rbackend/rinterface.cpp index 3021e37..c181886 100644 --- a/rkward/rbackend/rinterface.cpp +++ b/rkward/rbackend/rinterface.cpp @@ -580,6 +580,14 @@ QStringList RInterface::processPlainGenericRequest (const QStringList &calllist) } else if (call == "listPlugins") { RK_ASSERT (calllist.count () == 1); return RKComponentMap::getMap ()->listPlugins (); + } else if (call == "setPluginStatus") { + QStringList params = calllist.mid (1); + RK_ASSERT ((params.size () % 3) == 0); + const int rows = params.size () / 3; + QStringList ids = params.mid (0, rows); + QStringList contexts = params.mid (rows, rows); + QStringList visible = params.mid (rows*2, rows); + RKComponentMap::getMap ()->setPluginStatus (ids, contexts, visible); } else if (call == "loadPluginMaps") { bool force = (calllist.value (1) == "force"); bool reload = (calllist.value (2) == "reload"); diff --git a/rkward/rbackend/rpackages/rkward/NAMESPACE b/rkward/rbackend/rpackages/rkward/NAMESPACE index 7ce14d3..5e5ca8d 100644 --- a/rkward/rbackend/rpackages/rkward/NAMESPACE +++ b/rkward/rbackend/rpackages/rkward/NAMESPACE @@ -103,6 +103,7 @@ export(rk.select.list) export(rk.sessionInfo) export(rk.set.label) export(rk.set.output.html.file) +export(rk.set.plugin.status) export(rk.show.files) export(rk.show.html) export(rk.show.message) diff --git a/rkward/rbackend/rpackages/rkward/R/rk.plugin-functions.R b/rkward/rbackend/rpackages/rkward/R/rk.plugin-functions.R index 4fb9dc9..6a0387a 100644 --- a/rkward/rbackend/rpackages/rkward/R/rk.plugin-functions.R +++ b/rkward/rbackend/rpackages/rkward/R/rk.plugin-functions.R @@ -1,9 +1,9 @@ -#' Call or list built-in RKWard plugin(s) +#' Call built-in RKWard plugin(s) #' #' \code{rk.call.plugin} provides a high level wrapper to call any plugin #' available in RKWard. The exact string to be used as \code{plugin}, and the #' list of arguments available for a particular plugin, are generally not -#' transparent to the user.\code{rk.list.plugins} can be used to obtain a list +#' transparent to the user. \code{rk.list.plugins} can be used to obtain a list #' of current plugins. For plugin arguments, it is recommended to run the #' plugin, and inspect the "Run again" link that is generated on the output. #' @@ -20,10 +20,6 @@ #' run in the global context. Any local variables of the calling context are #' not available to the plugin. #' -#' \code{rk.list.plugins} returns the a list of all currently -#' registered plugins (in loaded pluginmaps). -#' -#' @aliases rk.call.plugin rk.list.plugins #' @param plugin character string, giving the name of the plugin to call. See #' Details. #' @param \dots arguments passed to the \code{plugin} @@ -40,18 +36,11 @@ #' an error. #' @return \code{rk.call.plugin} returns \code{TRUE} invisibly. #' -#' \code{rk.list.plugins} returns a data.frame listing plugin ids, context, menu path -#' (tab-separated), and label of the plugin. If a plugin is available in more -#' than one context, it will be listed several times. #' @author Thomas Friedrichsmeier \email{rkward-devel@@lists.sourceforge.net} #' @seealso \code{\link{rk.results}}, \url{rkward://page/rkward_output} #' @keywords utilities -#' @rdname rk.call.plugin #' @examples #' -#' ## list all current plugins -#' rk.list.plugins () -#' #' ## "t_test_two_vars" plugin: #' ## see the output: Windows->Show Output #' local({ @@ -65,12 +54,6 @@ #' }) #' #' @export -rk.list.plugins <- function () { - plugs <- .rk.do.plain.call("listPlugins") - as.data.frame (matrix (plugs, ncol=4, byrow=TRUE, dimnames=list (1:(length (plugs) / 4), c ("ID", "Context", "Menupath", "Label"))), stringsAsFactors=FALSE) -} - -#' @export #' @rdname rk.call.plugin "rk.call.plugin" <- function (plugin, ..., submit.mode = c ("manual", "auto", "submit")) { # prepare arguments @@ -137,3 +120,56 @@ rk.list.plugins <- function () { "rk.load.pluginmaps" <- function (pluginmap.files=NULL, force.add = TRUE, force.reload = TRUE) { .rk.do.plain.call ("loadPluginMaps", c (ifelse (isTRUE (force.add), "force", "noforce"), ifelse (isTRUE (force.reload), "reload", "noreload"), as.character (pluginmap.files)), synchronous=FALSE) } + +#' List of modify loaded plugins +#' +#' \code{rk.list.plugins} returns the a list of all currently +#' registered plugins (in loaded pluginmaps). +#' \code{rk.set.plugin.status} allows to control the status of the given plugin(s). Currently, +#' only visibility can be controlled. +#' +#' @param id vector of ids (character) of the plugins to modify +#' @param context in which the plugin should be shown / hidden. This can either be "", +#' meaning the plugin will be affected in all contexts it occurs in, or a character vector +#' of the same length as id. +#' @param visible logical, controlling whether the plugin should be shown (\code{TRUE}) or +#' hidden (\code{FALSE}). +#' +#' @return \code{rk.list.plugins} returns a data.frame listing plugin ids, context, menu path +#' (tab-separated), and label of the plugin. If a plugin is available in more +#' than one context, it will be listed several times. The exact layout (number and order of columns) +#' of this data.frame might be subject to change. However, the \bold{names} of the columns in the +#' returned data.frame are expected to remain stable. \code {rk.set.plugin.status} returns \code{NULL}, invisibly +#' +#' @author Thomas Friedrichsmeier \email{rkward-devel@@lists.sourceforge.net} +#' @keywords utilities +#' +#' @seealso \code{\link{rk.call.plugin}} for invoking a plugin, programatically +#' +#' @examples +#' ## list all current plugins +#' rk.list.plugins () +#' +#' ## NOT RUN +#' ## hide t.test plugin +#' rk.set.plugin.status ("t_test", visible=FALSE) +#' ## END NOT RUN +#' +#' @export +#' @rdname rk.list.plugins +#' @aliases rk.list.plugins rk.set.plugin.status +"rk.list.plugins" <- function () { + plugs <- .rk.do.plain.call("listPlugins") + columns = c ("ID", "Context", "Menupath", "Label") + as.data.frame (matrix (plugs, ncol=length (columns), byrow=TRUE, dimnames=list (1:(length (plugs)/length (columns)), columns)), stringsAsFactors=FALSE) +} + +#' @export +#' @rdname rk.list.plugins +"rk.set.plugin.status" <- function (id, context="", visible=TRUE) { + id <- as.character (id) + context <- rep (as.character (context), length.out=length (id)) + visible <- rep (as.character (as.numeric (visible)), length.out=length (id)) + .rk.do.plain.call ("setPluginStatus", c (id, context, visible)) + invisible (NULL) +} diff --git a/rkward/rbackend/rpackages/rkward/man/rk.call.plugin.Rd b/rkward/rbackend/rpackages/rkward/man/rk.call.plugin.Rd index 9e7225c..0cddcf2 100644 --- a/rkward/rbackend/rpackages/rkward/man/rk.call.plugin.Rd +++ b/rkward/rbackend/rpackages/rkward/man/rk.call.plugin.Rd @@ -1,11 +1,8 @@ % Generated by roxygen2 (4.0.2): do not edit by hand -\name{rk.list.plugins} +\name{rk.call.plugin} \alias{rk.call.plugin} -\alias{rk.list.plugins} -\title{Call or list built-in RKWard plugin(s)} +\title{Call built-in RKWard plugin(s)} \usage{ -rk.list.plugins() - rk.call.plugin(plugin, ..., submit.mode = c("manual", "auto", "submit")) } \arguments{ @@ -28,16 +25,12 @@ an error.} } \value{ \code{rk.call.plugin} returns \code{TRUE} invisibly. - -\code{rk.list.plugins} returns a data.frame listing plugin ids, context, menu path - (tab-separated), and label of the plugin. If a plugin is available in more - than one context, it will be listed several times. } \description{ \code{rk.call.plugin} provides a high level wrapper to call any plugin available in RKWard. The exact string to be used as \code{plugin}, and the list of arguments available for a particular plugin, are generally not -transparent to the user.\code{rk.list.plugins} can be used to obtain a list +transparent to the user. \code{rk.list.plugins} can be used to obtain a list of current plugins. For plugin arguments, it is recommended to run the plugin, and inspect the "Run again" link that is generated on the output. } @@ -54,14 +47,8 @@ tests, cross-references, and scripted tutorials. \bold{Note}: Even when using \code{"submit.mode=submit"}, the plugin code is run in the global context. Any local variables of the calling context are not available to the plugin. - -\code{rk.list.plugins} returns the a list of all currently -registered plugins (in loaded pluginmaps). } \examples{ -## list all current plugins -rk.list.plugins () - ## "t_test_two_vars" plugin: ## see the output: Windows->Show Output local({ diff --git a/rkward/windows/rkwindowcatcher.cpp b/rkward/windows/rkwindowcatcher.cpp index aa9d341..c79a52c 100644 --- a/rkward/windows/rkwindowcatcher.cpp +++ b/rkward/windows/rkwindowcatcher.cpp @@ -708,7 +708,7 @@ RKCaughtX11WindowPart::RKCaughtX11WindowPart (RKCaughtX11Window *window) : KPart action->setVisible (false); // initialize context for plugins - RKContextMap *context = RKComponentMap::getContext ("x11"); + RKComponentGUIXML *context = RKComponentMap::getContext ("x11"); if (!context) return; RKContextHandler *context_handler = context->makeContextHandler (this); insertChildClient (context_handler); |
From: Thomas F. <tho...@ru...> - 2015-01-03 19:48:18
|
Git commit 4ad503893c11616116dbdbc0553a137b76036c2f by Thomas Friedrichsmeier. Committed on 03/01/2015 at 19:46. Pushed by tfry into branch 'master'. Fix loading of newly registered pluginmaps. M +1 -1 rkward/settings/rksettingsmoduleplugins.h http://commits.kde.org/rkward/4ad503893c11616116dbdbc0553a137b76036c2f diff --git a/rkward/settings/rksettingsmoduleplugins.h b/rkward/settings/rksettingsmoduleplugins.h index 7f690ea..6e1baa7 100644 --- a/rkward/settings/rksettingsmoduleplugins.h +++ b/rkward/settings/rksettingsmoduleplugins.h @@ -60,7 +60,7 @@ public: * @param force_reload If true, plugin maps are always reloaded, even if no maps were added * @param suppress_reload If true (and force_reload is false), do not reload plugin maps, even if maps were added */ - static void registerPluginMaps (const QStringList &maps, bool force_add, bool force_reload, bool suppress_reload=true); + static void registerPluginMaps (const QStringList &maps, bool force_add, bool force_reload, bool suppress_reload=false); /** Looks for the given id among known plugin maps */ static QString findPluginMapById (const QString &id); /** marks given map as broken (in this version), and deactivates it. @Returns false is the map was already known to be broken, true otherwise. */ |
From: m.eik m. <mei...@un...> - 2015-01-02 21:55:59
|
Git commit 38857891a9b20d5fe736c2cda292783f9e26e128 by m.eik michalke. Committed on 02/01/2015 at 21:53. Pushed by meikm into branch 'master'. make using global JS variables more robust by dividing definition and initialisation (through a helper function) M +8 -3 packages/rkwarddev/ChangeLog M +4 -4 packages/rkwarddev/DESCRIPTION M +7 -4 packages/rkwarddev/R/rk-internal.R M +23 -5 packages/rkwarddev/R/rk.JS.doc.R M +4 -2 packages/rkwarddev/R/rk.paste.JS.R M +2 -2 packages/rkwarddev/R/rkwarddev-package.R M +1 -1 packages/rkwarddev/man/i18n.Rd M +1 -1 packages/rkwarddev/man/rk.JS.doc.Rd M +2 -2 packages/rkwarddev/man/rk.XML.vars.Rd M +5 -1 packages/rkwarddev/man/rk.paste.JS.Rd M +2 -2 packages/rkwarddev/man/rkwarddev-package.Rd http://commits.kde.org/rkward/38857891a9b20d5fe736c2cda292783f9e26e128 diff --git a/packages/rkwarddev/ChangeLog b/packages/rkwarddev/ChangeLog index c2424c1..a761708 100644 --- a/packages/rkwarddev/ChangeLog +++ b/packages/rkwarddev/ChangeLog @@ -1,6 +1,6 @@ ChangeLog for package rkwarddev -changes in version 0.06-6 (2014-12-17) +changes in version 0.06-6 (2015-01-02) fixed: - rk.XML.optionset() does now allow to re-use objects defined in the same function call (i.e., refer to optioncolumns in the logic section) @@ -20,8 +20,8 @@ fixed: - join() referenced a wrong object name if "var" was of class rk.JS.arr - rk.XML.about() had a malformed error message - rk.plugin.component() called XMLAttrs() with too many arguments - - rk.XML.values() and rk.XML.vars() do now handle all combinations of "horiz" - and "add.nodes" properly + - rk.XML.values() and rk.XML.vars() do now handle all combinations of + "horiz" and "add.nodes" properly added: - all "help" values can now be a list of character strings or XiMpLe nodes, to have more control over the markup @@ -43,6 +43,8 @@ added: - added documentation to the used S4 classes - enhanced rk.XML.values() to also accept "options" and "duplicates", and rk.XML.vars() to also accept "duplicates" + - new argument "var" in rk.paste.JS() to define whether the JS keyword + "var" should be used or omitted for rk.JS.var objects changed: - function i18n() was changed to be used in JavaScript generation only; this breaks code using the function introduced with 0.06-4, but that was to @@ -57,6 +59,9 @@ changed: they're more obvious to find and check - rk.XML.input() now checks wheter "size" is exactly one of "small", "medium" or "large" + - rk.JS.doc() now uses a more robust method to set global variables, namely + by defining an additional function setGlobalVars() and calling that + inside preprocess() removed: - the functions rk.set.language() rk.get.language() were no longer useful and therefore removed diff --git a/packages/rkwarddev/DESCRIPTION b/packages/rkwarddev/DESCRIPTION index 52687bd..a86a3ae 100644 --- a/packages/rkwarddev/DESCRIPTION +++ b/packages/rkwarddev/DESCRIPTION @@ -8,16 +8,16 @@ Depends: Suggests: testthat Enhances: rkward -Description: Provides functions to create plugin skeletons and XML - structures for RKWard. +Description: Provides functions to create plugin skeletons and XML structures + for RKWard. License: GPL (>= 3) Encoding: UTF-8 LazyLoad: yes -URL: http://rkward.kde.org +URL: http://rkward.sourceforge.net Authors@R: c(person(given="m.eik", family="michalke", email="mei...@hh...", role=c("aut", "cre"))) Version: 0.06-6 -Date: 2014-12-17 +Date: 2015-01-02 Collate: '00_class_01_rk.JS.arr.R' '00_class_02_rk.JS.var.R' diff --git a/packages/rkwarddev/R/rk-internal.R b/packages/rkwarddev/R/rk-internal.R index b5b2687..637e73f 100644 --- a/packages/rkwarddev/R/rk-internal.R +++ b/packages/rkwarddev/R/rk-internal.R @@ -948,8 +948,9 @@ paste.JS.options <- function(object, level=2, indent.by="\t", array=NULL, funct= # append.modifier: if a modifier is given, should that become part of the variable name? this is mostly # important for "checkbox", which has "state" as default modifier, but using the checkbox object will not # notice this. works only for the first modifier given. +# var: if FALSE, the variable is assumed to be already defined (globally?) and "var " will be omitted paste.JS.var <- function(object, level=2, indent.by="\t", JS.prefix=NULL, modifiers=NULL, default=NULL, append.modifier=NULL, - join=NULL, getter=NULL, names.only=FALSE, check.modifiers=FALSE){ + join=NULL, getter=NULL, names.only=FALSE, check.modifiers=FALSE, var=TRUE){ # paste several objects results <- unlist(sapply(slot(object, "vars"), function(this.obj){ paste.JS.var(this.obj, @@ -961,7 +962,9 @@ paste.JS.var <- function(object, level=2, indent.by="\t", JS.prefix=NULL, modifi append.modifier=append.modifier, join=join, getter=getter, - names.only=names.only)})) + names.only=names.only, + check.modifiers=check.modifiers, + var=var)})) if(!isTRUE(names.only) & !is.null(results)){ results <- paste(results, collapse="\n") } @@ -1006,7 +1009,7 @@ paste.JS.var <- function(object, level=2, indent.by="\t", JS.prefix=NULL, modifi if(isTRUE(names.only)){ results <- c(results, camelCode(c(JS.prefix, JS.var))) } else { - results <- paste0(main.indent, "var ", camelCode(c(JS.prefix, JS.var)), " = ", getter, "(\"", XML.var, "\")", join.code, ";") + results <- paste0(main.indent, ifelse(isTRUE(var), "var ", ""), camelCode(c(JS.prefix, JS.var)), " = ", getter, "(\"", XML.var, "\")", join.code, ";") } } else {} if(length(modifiers) > 0){ @@ -1024,7 +1027,7 @@ paste.JS.var <- function(object, level=2, indent.by="\t", JS.prefix=NULL, modifi if(isTRUE(names.only)){ return(this.name) } else { - return(paste0(main.indent, "var ", this.name, + return(paste0(main.indent, ifelse(isTRUE(var), "var ", ""), this.name, " = ", getter, "(\"", XML.var, ".", this.modif, "\")", join.code, ";")) } }) diff --git a/packages/rkwarddev/R/rk.JS.doc.R b/packages/rkwarddev/R/rk.JS.doc.R index 461c0d4..9bbf9d5 100644 --- a/packages/rkwarddev/R/rk.JS.doc.R +++ b/packages/rkwarddev/R/rk.JS.doc.R @@ -22,7 +22,7 @@ #' #' @param require A character vector with names of R packages that the dialog depends on. #' @param variables Either a character string to be included to read in all needed variables from the dialog (see \code{\link{rk.JS.scan}}), -#' or an object of class \code{rk.JS.var} which will be coerced into character. These variables will be defined in +#' or a (list of) objects of class \code{rk.JS.var} which will be coerced into character. These variables will be defined in #' the \code{calculate()} and/or \code{doPrintout()} functions. #' @param globals Like \code{variables}, but these variables will be defined globally. If \code{variables} is set as well, #' the function tries to remove duplicate definitions. @@ -61,19 +61,36 @@ rk.JS.doc <- function(require=c(), variables=NULL, globals=NULL, results.header=NULL, header.add=list(), preprocess=NULL, calculate=NULL, printout=NULL, doPrintout=NULL, load.silencer=NULL, gen.info=TRUE, indent.by="\t", guess.getter=FALSE){ + # variable to determine whether to add setGlobalVars() to preprocess() later + addSetGlobalVars <- FALSE # some data transformation + if(all(sapply(variables, function(x){inherits(x, "rk.JS.var")}))){ + variables <- rk.paste.JS( + paste0(unlist(sapply(variables, function(x){rk.paste.JS(x, var=FALSE)}))) + ) + } else {} if(inherits(variables, "rk.JS.var")){ - variables <- rk.paste.JS(variables) } else {} - if(inherits(globals, "rk.JS.var")){ - globals <- rk.paste.JS(globals, level=1) + if(all(sapply(globals, function(x){inherits(x, "rk.JS.var")}))){ + globalNames <- paste0("var ", unlist(sapply(globals, function(x){paste.JS.var(x, names.only=TRUE)})), ";", collapse="\n") + globalFunction <- paste0( + "function setGlobalVars(){\n", + paste0( + unlist(sapply(globals, function(x){rk.paste.JS(x, var=FALSE, level=2)})), + collapse="\n" + ), + "\n}", + collapse="\n" + ) + globals <- paste0(globalNames, "\n\n", globalFunction) + addSetGlobalVars <- TRUE } else {} js.gen.info <- ifelse(isTRUE(gen.info), rk.paste.JS(generator.info, level=1), "") if(!is.null(globals)){ - js.globals <- paste( + js.globals <- paste0( "// define variables globally\n", paste0(globals, collapse="")) if(!is.null(variables)){ @@ -107,6 +124,7 @@ rk.JS.doc <- function(require=c(), variables=NULL, globals=NULL, results.header= return(req.result) })) js.preprocess <- paste0("function preprocess(){\n", + ifelse(isTRUE(addSetGlobalVars), paste0(indent(2, by=indent.by), "setGlobalVars();\n"), ""), indent(2, by=indent.by), "// add requirements etc. here\n", paste(js.require, collapse=""), "\n", diff --git a/packages/rkwarddev/R/rk.paste.JS.R b/packages/rkwarddev/R/rk.paste.JS.R index 2e9304a..5ce5f6c 100644 --- a/packages/rkwarddev/R/rk.paste.JS.R +++ b/packages/rkwarddev/R/rk.paste.JS.R @@ -40,6 +40,8 @@ #' @param getter For \code{rk.JS.var} objects only: A character string, naming the JavaScript function which should be used to get the #' values in the actual plugin. Depending on the XML element, \code{"getString"}, \code{"getBool"} or \code{"getList"} can be #' useful alternatives. For backwards compatibility, the default is set to \code{"getValue"}. +#' @param var For \code{rk.JS.var} objects only: Logical, if \code{FALSE} the variable(s) are assumed to already be defined (globally?) +#' and the JS keyword "var" will be omitted. #' @param empty.e For \code{rk.JS.ite} objects only: Logical, if \code{TRUE} will force to add empty \code{else \{\}} brackets when #' there is no \code{else} statement defined, which is considered to enhance code readability by some. #' @return A character string. @@ -60,7 +62,7 @@ #' @export rk.paste.JS <- function(..., level=2, indent.by="\t", funct=NULL, array=NULL, - var.prefix=NULL, modifiers=NULL, default=NULL, join=NULL, getter=NULL, empty.e=FALSE){ + var.prefix=NULL, modifiers=NULL, default=NULL, join=NULL, getter=NULL, var=TRUE, empty.e=FALSE){ stopifnot(level > 0) all.objects <- list(...) @@ -81,7 +83,7 @@ rk.paste.JS <- function(..., level=2, indent.by="\t", funct=NULL, array=NULL, result <- paste.JS.optionsset(this.object, level=level, indent.by=indent.by) } else if(inherits(this.object, "rk.JS.var")){ result <- paste.JS.var(this.object, level=level, indent.by=indent.by, JS.prefix=var.prefix, - modifiers=modifiers, default=default, join=join, getter=getter) + modifiers=modifiers, default=default, join=join, getter=getter, var=var) } else if(inherits(this.object, "rk.JS.echo")){ result <- slot(this.object, "value") } else if(inherits(this.object, "rk.JS.i18n")){ diff --git a/packages/rkwarddev/R/rkwarddev-package.R b/packages/rkwarddev/R/rkwarddev-package.R index 0ea7606..4e03bf0 100644 --- a/packages/rkwarddev/R/rkwarddev-package.R +++ b/packages/rkwarddev/R/rkwarddev-package.R @@ -4,13 +4,13 @@ #' Package: \tab rkwarddev\cr #' Type: \tab Package\cr #' Version: \tab 0.06-6\cr -#' Date: \tab 2014-12-17\cr +#' Date: \tab 2015-01-02\cr #' Depends: \tab R (>= 2.9.0),methods,XiMpLe (>= 0.03-21),rkward (>= 0.5.7)\cr #' Enhances: \tab rkward\cr #' Encoding: \tab UTF-8\cr #' License: \tab GPL (>= 3)\cr #' LazyLoad: \tab yes\cr -#' URL: \tab http://rkward.kde.org\cr +#' URL: \tab http://rkward.sourceforge.net\cr #' } #' #' Provides functions to create plugin skeletons and XML structures for RKWard. diff --git a/packages/rkwarddev/man/i18n.Rd b/packages/rkwarddev/man/i18n.Rd index bf9cc14..ef30f5d 100644 --- a/packages/rkwarddev/man/i18n.Rd +++ b/packages/rkwarddev/man/i18n.Rd @@ -9,7 +9,7 @@ i18n(msgid, ..., context = NULL, plural = NULL, newline = "") \item{msgid}{Character string, the message to be translated (if applicable, its singular form).} -\item{...}{Either character string wich will be pasted unquoted to be used in conjunctions with +\item{...}{Either character string which will be pasted unquoted to be used in conjunctions with placeholders in msgid, or XiMpLe.node objects of which the JavaScript variable name will be used.} diff --git a/packages/rkwarddev/man/rk.JS.doc.Rd b/packages/rkwarddev/man/rk.JS.doc.Rd index dacdb39..4e1129b 100644 --- a/packages/rkwarddev/man/rk.JS.doc.Rd +++ b/packages/rkwarddev/man/rk.JS.doc.Rd @@ -13,7 +13,7 @@ rk.JS.doc(require = c(), variables = NULL, globals = NULL, \item{require}{A character vector with names of R packages that the dialog depends on.} \item{variables}{Either a character string to be included to read in all needed variables from the dialog (see \code{\link{rk.JS.scan}}), -or an object of class \code{rk.JS.var} which will be coerced into character. These variables will be defined in +or a (list of) objects of class \code{rk.JS.var} which will be coerced into character. These variables will be defined in the \code{calculate()} and/or \code{doPrintout()} functions.} \item{globals}{Like \code{variables}, diff --git a/packages/rkwarddev/man/rk.XML.vars.Rd b/packages/rkwarddev/man/rk.XML.vars.Rd index 39b36f9..9720ba0 100644 --- a/packages/rkwarddev/man/rk.XML.vars.Rd +++ b/packages/rkwarddev/man/rk.XML.vars.Rd @@ -108,7 +108,7 @@ cat(pasteXML(test.vars)) } \seealso{ \code{\link[rkwarddev:rk.XML.varslot]{rk.XML.varslot}}, - \code{\link[rkwarddev:rk.XML.varselector]{rk.XML.varselector}}, - and the \href{help:rkwardplugins}{Introduction to Writing Plugins for RKWard} + \code{\link[rkwarddev:rk.XML.varselector]{rk.XML.varselector}}, + and the \href{help:rkwardplugins}{Introduction to Writing Plugins for RKWard} } diff --git a/packages/rkwarddev/man/rk.paste.JS.Rd b/packages/rkwarddev/man/rk.paste.JS.Rd index 520e69f..600b58b 100644 --- a/packages/rkwarddev/man/rk.paste.JS.Rd +++ b/packages/rkwarddev/man/rk.paste.JS.Rd @@ -5,7 +5,7 @@ \usage{ rk.paste.JS(..., level = 2, indent.by = "\\t", funct = NULL, array = NULL, var.prefix = NULL, modifiers = NULL, default = NULL, - join = NULL, getter = NULL, empty.e = FALSE) + join = NULL, getter = NULL, var = TRUE, empty.e = FALSE) } \arguments{ \item{...}{Objects of class \code{rk.JS.ite}, \code{rk.JS.arr}, \code{rk.JS.opt}, @@ -48,6 +48,10 @@ values in the actual plugin. Depending on the XML element, \code{"getString"}, useful alternatives. For backwards compatibility, the default is set to \code{"getValue"}.} +\item{var}{For \code{rk.JS.var} objects only: Logical, + if \code{FALSE} the variable(s) are assumed to already be defined (globally?) +and the JS keyword "var" will be omitted.} + \item{empty.e}{For \code{rk.JS.ite} objects only: Logical, if \code{TRUE} will force to add empty \code{else \{\}} brackets when there is no \code{else} statement defined, diff --git a/packages/rkwarddev/man/rkwarddev-package.Rd b/packages/rkwarddev/man/rkwarddev-package.Rd index 56d5bc0..9808c2a 100644 --- a/packages/rkwarddev/man/rkwarddev-package.Rd +++ b/packages/rkwarddev/man/rkwarddev-package.Rd @@ -11,13 +11,13 @@ A collection of tools for RKWard plugin development. Package: \tab rkwarddev\cr Type: \tab Package\cr Version: \tab 0.06-6\cr -Date: \tab 2014-12-17\cr +Date: \tab 2015-01-02\cr Depends: \tab R (>= 2.9.0),methods,XiMpLe (>= 0.03-21),rkward (>= 0.5.7)\cr Enhances: \tab rkward\cr Encoding: \tab UTF-8\cr License: \tab GPL (>= 3)\cr LazyLoad: \tab yes\cr -URL: \tab http://rkward.kde.org\cr +URL: \tab http://rkward.sourceforge.net\cr } Provides functions to create plugin skeletons and XML structures for RKWard. |
From: m.eik m. <mei...@un...> - 2015-01-02 18:42:16
|
Git commit 94f21d91c4fee0146883c745e03313dc2150eea1 by m.eik michalke. Committed on 02/01/2015 at 18:41. Pushed by meikm into branch 'master'. fixed a bug in automatic JS header generation M +1 -1 packages/rkwarddev/R/rk.plugin.component.R http://commits.kde.org/rkward/94f21d91c4fee0146883c745e03313dc2150eea1 diff --git a/packages/rkwarddev/R/rk.plugin.component.R b/packages/rkwarddev/R/rk.plugin.component.R index 1aa8d3f..7d60223 100644 --- a/packages/rkwarddev/R/rk.plugin.component.R +++ b/packages/rkwarddev/R/rk.plugin.component.R @@ -175,7 +175,7 @@ rk.plugin.component <- function(about, xml=list(), js=list(), rkh=list(), } else {} } if(!"results.header" %in% got.JS.options) { - js[["results.header"]] <- paste0("\"", name.orig, " results\"") + js[["results.header"]] <- paste0(name.orig, " results") } else {} js <- js.try.scan(XML.plugin=XML.plugin, scan=scan, js=js, guess.getter=guess.getter) JS.code <- rk.JS.doc( |
From: Thomas F. <tho...@ru...> - 2015-01-02 08:43:40
|
Git commit a70dba97dff9d83f716dd272613900d7d0549f16 by Thomas Friedrichsmeier. Committed on 02/01/2015 at 08:42. Pushed by tfry into branch 'master'. Fix build on qt < 4.7 M +1 -1 ChangeLog M +1 -1 rkward/plugin/rkcomponentmap.cpp http://commits.kde.org/rkward/a70dba97dff9d83f716dd272613900d7d0549f16 diff --git a/ChangeLog b/ChangeLog index 6b99c93..39aa452 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,7 +11,7 @@ - Restructure layout of CSV-import dialog - Allow to open (any number of) R script files and rkward://-urls from the command line - Add command line option --reuse for reusing an existing instance of RKWard -- Be slightly(!) smarter about when to ask for saving workspace on workspace load (e.g. not directly after workspace has been saved) +- Be slightly(!) smarter about when (not) to ask for saving workspace on workspace load (e.g. not directly after workspace has been saved) - Change default in Workspace browser to showing only .GlobalEnv, initially - Support automatically generating a printable header parameter from most plugin elements - New Object based convience method for printing headers from plugins diff --git a/rkward/plugin/rkcomponentmap.cpp b/rkward/plugin/rkcomponentmap.cpp index 014327a..e53e066 100644 --- a/rkward/plugin/rkcomponentmap.cpp +++ b/rkward/plugin/rkcomponentmap.cpp @@ -692,7 +692,7 @@ QStringList RKComponentMap::listPlugins () { RK_TRACE (PLUGIN); QStringList ret; -#if QT_VERSION >= 0x040500 +#if QT_VERSION >= 0x040700 ret.reserve (components.size () * 4); #endif for (ComponentMap::const_iterator it = components.constBegin (); it != components.constEnd (); ++it) { |
From: Thomas F. <tho...@ru...> - 2015-01-01 21:12:31
|
Git commit c031a7b0a905c4fe2419d174d123099317aa691f by Thomas Friedrichsmeier. Committed on 01/01/2015 at 21:12. Pushed by tfry into branch 'master'. Bookkeeping M +2 -0 ChangeLog http://commits.kde.org/rkward/c031a7b0a905c4fe2419d174d123099317aa691f diff --git a/ChangeLog b/ChangeLog index ec078bd..6b99c93 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,5 @@ +- Pluginmap-management was reworked, partially, and moved to Settings->Manage R packages and plugins +- Provide more detailed information on loaded plugins in rk.list.plugins() - Allow to override plugins from a different pluginmap (the plugin with the highest specified version is used) - Fixed: Error when using fix() or trace(...edit=TRUE) with default settings on some systems - When the RKWard installation has moved on disk, try to adjust stored .pluginmaps paths, accordingly |
From: Thomas F. <tho...@ru...> - 2015-01-01 21:12:31
|
Git commit d64697b36e050caf11b8d3f72b28e13ddd688b29 by Thomas Friedrichsmeier. Committed on 01/01/2015 at 21:06. Pushed by tfry into branch 'master'. Provide much more information (context, menu-path, label) in rk.list.plugins() M +31 -2 rkward/plugin/rkcomponentmap.cpp M +5 -3 rkward/plugin/rkcomponentmap.h M +1 -1 rkward/rbackend/rinterface.cpp M +7 -7 rkward/rbackend/rpackages/rkward/R/rk.plugin-functions.R M +5 -4 rkward/rbackend/rpackages/rkward/man/rk.call.plugin.Rd http://commits.kde.org/rkward/d64697b36e050caf11b8d3f72b28e13ddd688b29 diff --git a/rkward/plugin/rkcomponentmap.cpp b/rkward/plugin/rkcomponentmap.cpp index 4dc1cf2..014327a 100644 --- a/rkward/plugin/rkcomponentmap.cpp +++ b/rkward/plugin/rkcomponentmap.cpp @@ -78,7 +78,7 @@ bool compareMenuEntries (const RKComponentGUIXML::Entry *a, const RKComponentGUI return (QString::localeAwareCompare (a->label, b->label) < 0); } -void RKComponentGUIXML::resolveComponentLabelsAndSortMenu (Menu *menu) { +void RKComponentGUIXML::resolveComponentLabelsAndSortMenu (Menu *menu, const QString &menu_path) { RK_TRACE (PLUGIN); for (int i = 0; i < menu->groups.size (); ++i) { @@ -96,9 +96,10 @@ void RKComponentGUIXML::resolveComponentLabelsAndSortMenu (Menu *menu) { // The reason that handling of label is delayed to this point is that if a plugin is overridden, we want to use the label specified for the effective plugin (which might have changed WRT the overridden plugin, too). entry->label = handle->getLabel (); addedEntry (entry->id, handle); + component_menus.insert (handle, menu_path); } } else { - resolveComponentLabelsAndSortMenu (static_cast<Menu*> (entry)); + resolveComponentLabelsAndSortMenu (static_cast<Menu*> (entry), menu_path.isEmpty () ? entry->label : menu_path + "\t" + entry->label); } } qSort (group->entries.begin (), group->entries.end (), compareMenuEntries); @@ -149,6 +150,7 @@ void RKComponentGUIXML::finalize () { QDomElement xmlgui_menubar_element = gui_xml.documentElement ().firstChildElement ("MenuBar"); resolveComponentLabelsAndSortMenu (&toplevel_menu); menuItemsToXml (&toplevel_menu, xmlgui_menubar_element); + toplevel_menu.clear (); // no longer needed } RKComponentGUIXML::Group::~Group () { @@ -686,6 +688,33 @@ void RKComponentMap::addedEntry (const QString &id, RKComponentHandle *handle) { } } +QStringList RKComponentMap::listPlugins () { + RK_TRACE (PLUGIN); + + QStringList ret; +#if QT_VERSION >= 0x040500 + ret.reserve (components.size () * 4); +#endif + for (ComponentMap::const_iterator it = components.constBegin (); it != components.constEnd (); ++it) { + ret.append (it.key ()); + ret.append ("global"); // context + ret.append (component_menus.value (it.value ())); + ret.append (it.value ()->getLabel ()); + } + for (RKComponentContextMap::const_iterator ctx = contexts.constBegin (); ctx != contexts.constEnd (); ++ctx) { + QStringList ids = ctx.value ()->components (); + for (int i = 0; i < ids.size (); ++i) { + ret.append (ids[i]); + ret.append (ctx.key ()); + RKComponentHandle *handle = getComponentHandle (ids[i]); + ret.append (ctx.value ()->component_menus.value (handle)); + ret.append (handle->getLabel ()); + } + } + return ret; +} + + ///########################### END RKComponentMap ############################### ///########################### BEGIN RKComponentHandle ############################ diff --git a/rkward/plugin/rkcomponentmap.h b/rkward/plugin/rkcomponentmap.h index 1c3f0d1..df53ae6 100644 --- a/rkward/plugin/rkcomponentmap.h +++ b/rkward/plugin/rkcomponentmap.h @@ -163,10 +163,12 @@ protected: /** The generated XML GUI description in KDEs ui.rc format */ QDomDocument gui_xml; +friend class RKComponentMap; + QMap<RKComponentHandle*, QString> component_menus; private: int addEntries (RKComponentGUIXML::Menu *menu, XMLHelper &xml, const QDomElement description, const QString& cnamespace); void menuItemsToXml (const RKComponentGUIXML::Menu *menu, QDomElement &xml); - void resolveComponentLabelsAndSortMenu (Menu *menu); + void resolveComponentLabelsAndSortMenu (Menu *menu, const QString &menu_path=QString ()); }; @@ -226,8 +228,8 @@ public: /** invokes the specified component as toplevel @param message If a non-null pointer to QString is given, error messages are written into this string *instead* of being displayed */ static bool invokeComponent (const QString &component_id, const QStringList &serialized_settings, ComponentInvocationMode submit_mode = ManualSubmit, QString *message=0, RCommandChain *in_chain = 0); -/** @returns a list of all currently registered component ids */ - QStringList allComponentIds () { return components.keys(); }; +/** @returns for rk.list.plugins(): Return a list of all currently registered component ids, their context, menu, and label (i.e. current four strings per component) */ + QStringList listPlugins (); bool isPluginMapLoaded (const QString& abs_filename) const; public slots: /** Slot called, when a menu-item for a component is selected. Responsible for creating the GUI. */ diff --git a/rkward/rbackend/rinterface.cpp b/rkward/rbackend/rinterface.cpp index 009b57a..3021e37 100644 --- a/rkward/rbackend/rinterface.cpp +++ b/rkward/rbackend/rinterface.cpp @@ -579,7 +579,7 @@ QStringList RInterface::processPlainGenericRequest (const QStringList &calllist) if (res != KMessageBox::Continue) return (QStringList ("FALSE")); } else if (call == "listPlugins") { RK_ASSERT (calllist.count () == 1); - return RKComponentMap::getMap ()->allComponentIds (); + return RKComponentMap::getMap ()->listPlugins (); } else if (call == "loadPluginMaps") { bool force = (calllist.value (1) == "force"); bool reload = (calllist.value (2) == "reload"); diff --git a/rkward/rbackend/rpackages/rkward/R/rk.plugin-functions.R b/rkward/rbackend/rpackages/rkward/R/rk.plugin-functions.R index db928fa..4fb9dc9 100644 --- a/rkward/rbackend/rpackages/rkward/R/rk.plugin-functions.R +++ b/rkward/rbackend/rpackages/rkward/R/rk.plugin-functions.R @@ -20,8 +20,8 @@ #' run in the global context. Any local variables of the calling context are #' not available to the plugin. #' -#' \code{rk.list.plugins} returns the list of the names of all currently -#' registered plugins. +#' \code{rk.list.plugins} returns the a list of all currently +#' registered plugins (in loaded pluginmaps). #' #' @aliases rk.call.plugin rk.list.plugins #' @param plugin character string, giving the name of the plugin to call. See @@ -40,8 +40,9 @@ #' an error. #' @return \code{rk.call.plugin} returns \code{TRUE} invisibly. #' -#' \code{rk.list.plugins} returns a character vector of plugin names. If none -#' found, \code{NULL} is returned. +#' \code{rk.list.plugins} returns a data.frame listing plugin ids, context, menu path +#' (tab-separated), and label of the plugin. If a plugin is available in more +#' than one context, it will be listed several times. #' @author Thomas Friedrichsmeier \email{rkward-devel@@lists.sourceforge.net} #' @seealso \code{\link{rk.results}}, \url{rkward://page/rkward_output} #' @keywords utilities @@ -63,11 +64,10 @@ #' submit.mode="submit") #' }) #' -# list all available plugins in RKWard; this is a companion function for rk.call.plugin: -# the output provides possible strings for "plugin" argument in rk.call.plugin #' @export rk.list.plugins <- function () { - .rk.do.plain.call ("listPlugins") + plugs <- .rk.do.plain.call("listPlugins") + as.data.frame (matrix (plugs, ncol=4, byrow=TRUE, dimnames=list (1:(length (plugs) / 4), c ("ID", "Context", "Menupath", "Label"))), stringsAsFactors=FALSE) } #' @export diff --git a/rkward/rbackend/rpackages/rkward/man/rk.call.plugin.Rd b/rkward/rbackend/rpackages/rkward/man/rk.call.plugin.Rd index 01e0916..9e7225c 100644 --- a/rkward/rbackend/rpackages/rkward/man/rk.call.plugin.Rd +++ b/rkward/rbackend/rpackages/rkward/man/rk.call.plugin.Rd @@ -29,8 +29,9 @@ an error.} \value{ \code{rk.call.plugin} returns \code{TRUE} invisibly. -\code{rk.list.plugins} returns a character vector of plugin names. If none - found, \code{NULL} is returned. +\code{rk.list.plugins} returns a data.frame listing plugin ids, context, menu path + (tab-separated), and label of the plugin. If a plugin is available in more + than one context, it will be listed several times. } \description{ \code{rk.call.plugin} provides a high level wrapper to call any plugin @@ -54,8 +55,8 @@ tests, cross-references, and scripted tutorials. run in the global context. Any local variables of the calling context are not available to the plugin. -\code{rk.list.plugins} returns the list of the names of all currently -registered plugins. +\code{rk.list.plugins} returns the a list of all currently +registered plugins (in loaded pluginmaps). } \examples{ ## list all current plugins |
From: Thomas F. <tho...@ru...> - 2015-01-01 21:12:31
|
Git commit b8a3594883fa5277e590ce67d2ef4dd01b6244a3 by Thomas Friedrichsmeier. Committed on 01/01/2015 at 21:11. Pushed by tfry into branch 'master'. Clearer labels M +3 -3 rkward/dialogs/rkloadlibsdialog.cpp M +2 -2 rkward/rkward.cpp http://commits.kde.org/rkward/b8a3594883fa5277e590ce67d2ef4dd01b6244a3 diff --git a/rkward/dialogs/rkloadlibsdialog.cpp b/rkward/dialogs/rkloadlibsdialog.cpp index fd6df3d..96493da 100644 --- a/rkward/dialogs/rkloadlibsdialog.cpp +++ b/rkward/dialogs/rkloadlibsdialog.cpp @@ -64,13 +64,13 @@ RKLoadLibsDialog::RKLoadLibsDialog (QWidget *parent, RCommandChain *chain, bool setButtons (KDialog::Ok | KDialog::Apply | KDialog::Cancel); LoadUnloadWidget *luwidget = new LoadUnloadWidget (this); - addChild (luwidget, i18n ("Local packages")); + addChild (luwidget, i18n ("Load / Unload R packages")); connect (this, SIGNAL (installedPackagesChanged()), luwidget, SLOT (updateInstalledPackages())); install_packages_widget = new InstallPackagesWidget (this); - install_packages_pageitem = addChild (install_packages_widget, i18n ("Install / Update / Remove")); + install_packages_pageitem = addChild (install_packages_widget, i18n ("Install / Update / Remove R packages")); - configure_pluginmaps_pageitem = addChild (new RKPluginMapSelectionWidget (this), i18n ("Manage Plugins")); + configure_pluginmaps_pageitem = addChild (new RKPluginMapSelectionWidget (this), i18n ("Manage RKWard Plugins")); connect (this, SIGNAL (currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)), this, SLOT (slotPageChanged())); QTimer::singleShot (0, this, SLOT (slotPageChanged())); diff --git a/rkward/rkward.cpp b/rkward/rkward.cpp index fc6f567..e62dff1 100644 --- a/rkward/rkward.cpp +++ b/rkward/rkward.cpp @@ -476,11 +476,11 @@ void RKWardMainWindow::initActions() { // These two currently do the same thing action = actionCollection ()->addAction ("load_unload_libs", this, SLOT (slotFileLoadLibs())); - action->setText (i18n ("Manage R packages...")); + action->setText (i18n ("Manage R packages and plugins...")); action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionConfigurePackages)); action = actionCollection ()->addAction ("configure_packages", this, SLOT (slotFileLoadLibs())); - action->setText (i18n ("Manage R packages...")); + action->setText (i18n ("Manage R packages and plugins...")); action->setIcon (RKStandardIcons::getIcon (RKStandardIcons::ActionConfigurePackages)); setStandardToolBarMenuEnabled (true); |
From: Thomas F. <tho...@ru...> - 2015-01-01 21:12:30
|
Git commit cbfdda9d928c24678dc38755f2e2606c5976e8f4 by Thomas Friedrichsmeier. Committed on 01/01/2015 at 19:15. Pushed by tfry into branch 'master'. Fix missing initialization M +4 -1 rkward/plugin/rkcomponentmeta.cpp http://commits.kde.org/rkward/cbfdda9d928c24678dc38755f2e2606c5976e8f4 diff --git a/rkward/plugin/rkcomponentmeta.cpp b/rkward/plugin/rkcomponentmeta.cpp index 6643154..167c912 100644 --- a/rkward/plugin/rkcomponentmeta.cpp +++ b/rkward/plugin/rkcomponentmeta.cpp @@ -34,7 +34,10 @@ QLatin1String any_max_version_tag ("max_version"); RKComponentAboutData::RKComponentAboutData (const QDomElement& e, XMLHelper &xml) { RK_TRACE (PLUGIN); - if (e.isNull ()) return; + if (e.isNull ()) { + valid = false; + return; + } valid = true; name = xml.i18nStringAttribute (e, "name", QString (), DL_INFO); |
From: Thomas F. <tho...@ru...> - 2015-01-01 18:31:55
|
Git commit 4e6a75451291db72698f7fa43edc0fc8f62e02ea by Thomas Friedrichsmeier. Committed on 01/01/2015 at 18:25. Pushed by tfry into branch 'development/plugin_management_to_loadlibs'. Bump version number, in order to trigger re-scan of installed pluginmaps. M +1 -1 VERSION.cmake M +1 -1 rkward/rbackend/rpackages/rkward/R/ver.R http://commits.kde.org/rkward/4e6a75451291db72698f7fa43edc0fc8f62e02ea diff --git a/VERSION.cmake b/VERSION.cmake index 86ca56b..761b188 100644 --- a/VERSION.cmake +++ b/VERSION.cmake @@ -1,3 +1,3 @@ # DO NOT CHANGE THIS FILE MANUALLY! # It will be overwritten by scripts/set_dist_version.sh -SET(RKVERSION_NUMBER 0.6.2z+0.6.3+devel1) +SET(RKVERSION_NUMBER 0.6.2z+0.6.3+devel2) diff --git a/rkward/rbackend/rpackages/rkward/R/ver.R b/rkward/rbackend/rpackages/rkward/R/ver.R index db0129f..f0c2847 100644 --- a/rkward/rbackend/rpackages/rkward/R/ver.R +++ b/rkward/rbackend/rpackages/rkward/R/ver.R @@ -3,4 +3,4 @@ # rkward/SetVersionNumber.cmake #' @export -".rk.app.version" <- "0.6.2z+0.6.3+devel1" +".rk.app.version" <- "0.6.2z+0.6.3+devel2" |
From: Thomas F. <tho...@ru...> - 2015-01-01 18:31:55
|
Git commit e6440ba38253616b81faa636ae950a748a21222b by Thomas Friedrichsmeier. Committed on 01/01/2015 at 18:29. Pushed by tfry into branch 'master'. Merge branch 'development/plugin_management_to_loadlibs' http://commits.kde.org/rkward/e6440ba38253616b81faa636ae950a748a21222b |
From: Thomas F. <tho...@ru...> - 2014-12-31 21:03:08
|
Git commit 55da894fc726f903d84f54ccf70ed909a62fffdf by Thomas Friedrichsmeier. Committed on 31/12/2014 at 20:56. Pushed by tfry into branch 'development/plugin_management_to_loadlibs'. Move pluginmap management to the load libs dialog for good. M +41 -16 rkward/dialogs/rkloadlibsdialog.cpp M +5 -0 rkward/dialogs/rkloadlibsdialog.h M +17 -15 rkward/settings/rksettingsmoduleplugins.cpp M +4 -2 rkward/settings/rksettingsmoduleplugins.h http://commits.kde.org/rkward/55da894fc726f903d84f54ccf70ed909a62fffdf diff --git a/rkward/dialogs/rkloadlibsdialog.cpp b/rkward/dialogs/rkloadlibsdialog.cpp index 63c6078..fd6df3d 100644 --- a/rkward/dialogs/rkloadlibsdialog.cpp +++ b/rkward/dialogs/rkloadlibsdialog.cpp @@ -64,13 +64,13 @@ RKLoadLibsDialog::RKLoadLibsDialog (QWidget *parent, RCommandChain *chain, bool setButtons (KDialog::Ok | KDialog::Apply | KDialog::Cancel); LoadUnloadWidget *luwidget = new LoadUnloadWidget (this); - addPage (luwidget, i18n ("Local packages")); + addChild (luwidget, i18n ("Local packages")); connect (this, SIGNAL (installedPackagesChanged()), luwidget, SLOT (updateInstalledPackages())); install_packages_widget = new InstallPackagesWidget (this); - install_packages_pageitem = addPage (install_packages_widget, i18n ("Install / Update / Remove")); + install_packages_pageitem = addChild (install_packages_widget, i18n ("Install / Update / Remove")); - addPage (new RKPluginMapSelectionWidget (this), i18n ("Manage Plugins")); + configure_pluginmaps_pageitem = addChild (new RKPluginMapSelectionWidget (this), i18n ("Manage Plugins")); connect (this, SIGNAL (currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)), this, SLOT (slotPageChanged())); QTimer::singleShot (0, this, SLOT (slotPageChanged())); @@ -87,6 +87,16 @@ RKLoadLibsDialog::~RKLoadLibsDialog () { else KPageDialog::reject (); } +KPageWidgetItem* RKLoadLibsDialog::addChild (QWidget *child_page, const QString &caption) { + RK_TRACE (DIALOGS); + + connect (this, SIGNAL (okClicked()), child_page, SLOT (ok())); + connect (this, SIGNAL (applyClicked()), child_page, SLOT (apply())); + connect (this, SIGNAL (cancelClicked()), child_page, SLOT (cancel())); + connect (child_page, SIGNAL (destroyed()), this, SLOT (childDeleted())); + return addPage (child_page, caption); +} + void RKLoadLibsDialog::slotPageChanged () { RK_TRACE (DIALOGS); @@ -106,6 +116,15 @@ void RKLoadLibsDialog::showInstallPackagesModal (QWidget *parent, RCommandChain RK_TRACE (DIALOGS); } +// static +void RKLoadLibsDialog::showPluginmapConfig (QWidget* parent, RCommandChain* chain) { + RK_TRACE (DIALOGS); + + RKLoadLibsDialog *dialog = new RKLoadLibsDialog (parent, chain, false); + dialog->setCurrentPage (dialog->configure_pluginmaps_pageitem); + dialog->show (); +} + void RKLoadLibsDialog::automatedInstall () { RK_TRACE (DIALOGS); @@ -429,11 +448,6 @@ LoadUnloadWidget::LoadUnloadWidget (RKLoadLibsDialog *dialog) : QWidget (0) { connect (loaded_view, SIGNAL (itemSelectionChanged()), this, SLOT (updateButtons())); connect (installed_view, SIGNAL (itemSelectionChanged()), this, SLOT (updateButtons())); - connect (dialog, SIGNAL (okClicked()), this, SLOT (ok())); - connect (dialog, SIGNAL (applyClicked()), this, SLOT (apply())); - connect (dialog, SIGNAL (cancelClicked()), this, SLOT (cancel())); - connect (this, SIGNAL (destroyed()), dialog, SLOT (childDeleted())); - updateInstalledPackages (); updateButtons (); } @@ -674,11 +688,6 @@ InstallPackagesWidget::InstallPackagesWidget (RKLoadLibsDialog *dialog) : QWidge buttonvbox->addStretch (1); buttonvbox->addWidget (install_params); buttonvbox->addStretch (1); - - connect (dialog, SIGNAL (okClicked()), this, SLOT (ok())); - connect (dialog, SIGNAL (applyClicked()), this, SLOT (apply())); - connect (dialog, SIGNAL (cancelClicked()), this, SLOT (cancel())); - connect (this, SIGNAL (destroyed()), dialog, SLOT (childDeleted())); } InstallPackagesWidget::~InstallPackagesWidget () { @@ -1207,6 +1216,7 @@ void RKRPackageInstallationStatusSortFilterModel::setRKWardOnly (bool only) { RKPluginMapSelectionWidget::RKPluginMapSelectionWidget (RKLoadLibsDialog* dialog) : QWidget (dialog) { RK_TRACE (DIALOGS); model = 0; + changes_pending = false; QVBoxLayout *vbox = new QVBoxLayout (this); vbox->setContentsMargins (0, 0, 0, 0); @@ -1226,21 +1236,36 @@ void RKPluginMapSelectionWidget::activated () { model = new RKSettingsModulePluginsModel (this); model->init (RKSettingsModulePlugins::knownPluginmaps ()); selector->setModel (model, 1); + connect (selector, SIGNAL (insertNewStrings(int)), model, SLOT (insertNewStrings(int))); + connect (selector, SIGNAL (swapRows(int,int)), model, SLOT (swapRows(int,int))); + connect (selector, SIGNAL (listChanged()), this, SLOT (changed())); } } void RKPluginMapSelectionWidget::apply () { + RK_TRACE (DIALOGS); + if (!changes_pending) return; + RK_ASSERT (model); + RKSettingsModulePlugins::PluginMapList new_list = RKSettingsModulePlugins::setPluginMaps (model->pluginMaps ()); + selector->setModel (0); // we don't want any extra change notification for this + model->init (new_list); + selector->setModel (model, 1); + changes_pending = false; } void RKPluginMapSelectionWidget::cancel () { - + RK_TRACE (DIALOGS); + deleteLater (); } void RKPluginMapSelectionWidget::ok () { + RK_TRACE (DIALOGS); + if (!changes_pending) return; + RK_ASSERT (model); + RKSettingsModulePlugins::setPluginMaps (model->pluginMaps ()); + deleteLater (); } - #include "rkloadlibsdialog.moc" - diff --git a/rkward/dialogs/rkloadlibsdialog.h b/rkward/dialogs/rkloadlibsdialog.h index d8cbc25..3809363 100644 --- a/rkward/dialogs/rkloadlibsdialog.h +++ b/rkward/dialogs/rkloadlibsdialog.h @@ -63,6 +63,7 @@ public: @param chain RCommandChain to run the necessary commands in @param package_name name of the required package */ static void showInstallPackagesModal (QWidget *parent, RCommandChain *chain, const QString &package_name); + static void showPluginmapConfig (QWidget *parent=0, RCommandChain *chain=0); QStringList currentLibraryLocations () const { return library_locations; }; signals: void downloadComplete (); @@ -87,12 +88,14 @@ private: void addLibraryLocation (const QString &new_loc); void tryDestruct (); void runInstallationCommand (const QString& command, bool as_root, const QString& message, const QString& title); + KPageWidgetItem* addChild (QWidget *child_page, const QString &caption); friend class LoadUnloadWidget; friend class InstallPackagesWidget; RCommandChain *chain; InstallPackagesWidget *install_packages_widget; // needed for automated installation KPageWidgetItem *install_packages_pageitem; + KPageWidgetItem *configure_pluginmaps_pageitem; QStringList library_locations; @@ -297,9 +300,11 @@ public slots: void apply (); void cancel (); void activated (); + void changed () { changes_pending = true; }; private: RKMultiStringSelectorV2* selector; RKSettingsModulePluginsModel* model; + bool changes_pending; }; #endif diff --git a/rkward/settings/rksettingsmoduleplugins.cpp b/rkward/settings/rksettingsmoduleplugins.cpp index 0d6ca52..9f9ea79 100644 --- a/rkward/settings/rksettingsmoduleplugins.cpp +++ b/rkward/settings/rksettingsmoduleplugins.cpp @@ -22,9 +22,6 @@ #include <kmessagebox.h> #include <khbox.h> #include <kdeversion.h> -#include <ktar.h> -#include <kzip.h> -#include <kio/deletejob.h> #include <qlayout.h> #include <qlabel.h> @@ -42,6 +39,7 @@ #include "../misc/rkspinbox.h" #include "../misc/xmlhelper.h" #include "../plugin/rkcomponentmap.h" +#include "../dialogs/rkloadlibsdialog.h" #include "rksettingsmodulegeneral.h" #include "../debug.h" @@ -107,15 +105,11 @@ RKSettingsModulePlugins::RKSettingsModulePlugins (RKSettings *gui, QWidget *pare main_vbox->addSpacing (2*RKGlobals::spacingHint ()); + QPushButton *pluginmap_config_button = new QPushButton (i18n ("Configure Active Plugins"), this); + connect (pluginmap_config_button, SIGNAL (clicked()), this, SLOT (configurePluginmaps())); + main_vbox->addWidget (pluginmap_config_button); - map_choser = new RKMultiStringSelectorV2 (i18n ("Select .pluginmap file(s)"), this); - map_model = new RKSettingsModulePluginsModel (this); - map_model->init (known_plugin_maps); - map_choser->setModel (map_model, 1); - connect (map_choser, SIGNAL (insertNewStrings(int)), map_model, SLOT (insertNewStrings(int))); - connect (map_choser, SIGNAL (swapRows(int,int)), map_model, SLOT (swapRows(int,int))); - connect (map_choser, SIGNAL (listChanged()), this, SLOT (settingChanged())); - main_vbox->addWidget (map_choser); + main_vbox->addStretch (); } RKSettingsModulePlugins::~RKSettingsModulePlugins() { @@ -135,16 +129,24 @@ QString RKSettingsModulePlugins::caption () { void RKSettingsModulePlugins::applyChanges () { RK_TRACE (SETTINGS); - known_plugin_maps = map_model->pluginMaps (); interface_pref = static_cast<PluginPrefs> (button_group->checkedId ()); show_code = show_code_box->isChecked (); code_size = code_size_box->intValue (); +} + +RKSettingsModulePlugins::PluginMapList RKSettingsModulePlugins::setPluginMaps (const RKSettingsModulePlugins::PluginMapList new_list) { + RK_TRACE (SETTINGS); + known_plugin_maps = new_list; fixPluginMapLists (); RKWardMainWindow::getMain ()->initPlugins(); - map_choser->setModel (0); // we don't want any extra change notification for this - map_model->init (known_plugin_maps); - map_choser->setModel (map_model, 1); + return known_plugin_maps; +} + +void RKSettingsModulePlugins::configurePluginmaps () { + RK_TRACE (SETTINGS); + + RKLoadLibsDialog::showPluginmapConfig (this, commandChain ()); } void RKSettingsModulePlugins::save (KConfig *config) { diff --git a/rkward/settings/rksettingsmoduleplugins.h b/rkward/settings/rksettingsmoduleplugins.h index 91998ce..7f690ea 100644 --- a/rkward/settings/rksettingsmoduleplugins.h +++ b/rkward/settings/rksettingsmoduleplugins.h @@ -87,9 +87,8 @@ public: static void parsePluginMapBasics (const QString &filename, QString *id, int *priority); public slots: void settingChanged (); + void configurePluginmaps (); private: - RKMultiStringSelectorV2 *map_choser; - RKSettingsModulePluginsModel *map_model; QButtonGroup *button_group; QCheckBox *show_code_box; RKSpinBox *code_size_box; @@ -104,6 +103,9 @@ private: /* TODO: This one is currently unused (leftover of GHNS-based plugin installation), but might still be of interest */ static QStringList findPluginMapsRecursive (const QString &basedir); static void fixPluginMapLists (); +friend class RKPluginMapSelectionWidget; +/** Sets the new list of plugins. Potentially removes unreadable ones, and returns the effective list. */ + static PluginMapList setPluginMaps (const PluginMapList new_list); }; class RKSettingsModulePluginsModel : public QAbstractTableModel { |
From: Thomas F. <tho...@ru...> - 2014-12-31 21:03:08
|
Git commit c5440c8c7a6dd1602fae4874818eedb91081149b by Thomas Friedrichsmeier. Committed on 31/12/2014 at 20:12. Pushed by tfry into branch 'development/plugin_management_to_loadlibs'. Don't show "hidden" pluginmaps as checkable. For now, they are still shown, though, as it might make some sense to be able to add / replace them. To be reconsidered. M +6 -1 rkward/settings/rksettingsmoduleplugins.cpp M +2 -2 rkward/settings/rksettingsmoduleplugins.h http://commits.kde.org/rkward/c5440c8c7a6dd1602fae4874818eedb91081149b diff --git a/rkward/settings/rksettingsmoduleplugins.cpp b/rkward/settings/rksettingsmoduleplugins.cpp index f3720f4..0d6ca52 100644 --- a/rkward/settings/rksettingsmoduleplugins.cpp +++ b/rkward/settings/rksettingsmoduleplugins.cpp @@ -441,6 +441,8 @@ QVariant RKSettingsModulePluginsModel::data (const QModelIndex& index, int role) if (inf.broken_in_this_version) return Qt::red; if (inf.quirky_in_this_version) return Qt::yellow; return (QVariant ()); + } else if (role == Qt::ForegroundRole) { + if (inf.priority < RKSettingsModulePlugins::PriorityLow) return Qt::gray; } else if (role == Qt::ToolTipRole) { const PluginMapMetaInfo &meta = const_cast<RKSettingsModulePluginsModel*> (this)->getPluginMapMetaInfo (inf.filename); QString desc = meta.about->toHtml (); @@ -454,6 +456,7 @@ QVariant RKSettingsModulePluginsModel::data (const QModelIndex& index, int role) if (col == COLUMN_CHECKED) { if (role == Qt::CheckStateRole) { + if (inf.priority < RKSettingsModulePlugins::PriorityLow) return QVariant (); return (inf.active ? Qt::Checked : Qt::Unchecked); } } else if (col == COLUMN_ID) { @@ -484,7 +487,9 @@ QVariant RKSettingsModulePluginsModel::data (const QModelIndex& index, int role) Qt::ItemFlags RKSettingsModulePluginsModel::flags (const QModelIndex& index) const { // RK_TRACE (SETTINGS); Qt::ItemFlags flags = QAbstractItemModel::flags (index); - if (index.isValid () && (index.column () == COLUMN_CHECKED)) flags |= Qt::ItemIsUserCheckable | Qt::ItemIsEditable; + if (index.isValid () && (index.column () == COLUMN_CHECKED)) { + if (plugin_maps[index.row ()].priority > RKSettingsModulePlugins::PriorityHidden) flags |= Qt::ItemIsUserCheckable | Qt::ItemIsEditable; + } return flags; } diff --git a/rkward/settings/rksettingsmoduleplugins.h b/rkward/settings/rksettingsmoduleplugins.h index 36227b6..91998ce 100644 --- a/rkward/settings/rksettingsmoduleplugins.h +++ b/rkward/settings/rksettingsmoduleplugins.h @@ -69,6 +69,8 @@ public: static bool markPluginMapAsQuirky (const QString &map); /** Clears the broken or quirky flags. E.g. after the map was loaded, successfully */ static void markPluginMapAsWorking (const QString &map); + + enum PluginMapPriority { PriorityHidden = 0, PriorityLow, PriorityMedium, PriorityHigh }; /** Helper struct used by RKSettingsModulePlugins to keep track of plugin map files. */ struct PluginMapStoredInfo { PluginMapStoredInfo (const QString &_filename) : filename (_filename), active (false), broken_in_this_version (false), quirky_in_this_version (false) {}; @@ -86,8 +88,6 @@ public: public slots: void settingChanged (); private: - enum PluginMapPriority { PriorityHidden = 0, PriorityLow, PriorityMedium, PriorityHigh }; - RKMultiStringSelectorV2 *map_choser; RKSettingsModulePluginsModel *map_model; QButtonGroup *button_group; |
From: Thomas F. <tho...@ru...> - 2014-12-31 21:03:08
|
Git commit dc9e2e8c1f7ff33d50865a33ad9c31185c7c235a by Thomas Friedrichsmeier. Committed on 31/12/2014 at 21:02. Pushed by tfry into branch 'development/plugin_management_to_loadlibs'. When clearing component map, also clear contexts. M +5 -1 rkward/plugin/rkcomponentmap.cpp http://commits.kde.org/rkward/dc9e2e8c1f7ff33d50865a33ad9c31185c7c235a diff --git a/rkward/plugin/rkcomponentmap.cpp b/rkward/plugin/rkcomponentmap.cpp index e0692b8..4dc1cf2 100644 --- a/rkward/plugin/rkcomponentmap.cpp +++ b/rkward/plugin/rkcomponentmap.cpp @@ -318,7 +318,7 @@ void RKComponentMap::clearAll () { RK_TRACE (PLUGIN); actionCollection ()->clear (); - for (ComponentMap::iterator it = components.begin (); it != components.end (); ++it) { + for (ComponentMap::const_iterator it = components.constBegin (); it != components.constEnd (); ++it) { delete (it.value ()); /* TODO: this is not technically correct, as there may be several actions for this id, and we're only deleting one. But practically this should not really be relevant. */ delete (actionCollection ()->action (it.key ())); @@ -331,6 +331,10 @@ void RKComponentMap::clearAll () { pluginmapfiles.clear (); component_attributes.clear (); component_dependencies.clear (); + for (RKComponentContextMap::const_iterator it = contexts.constBegin (); it != contexts.constEnd (); ++it) { + delete (it.value ()); + } + contexts.clear (); clearGUIDescription (); |
From: Thomas F. <tho...@ru...> - 2014-12-31 21:03:04
|
Git commit 6b3a955c7f43473447e5f9bc9d0ac83f93b66e0c by Thomas Friedrichsmeier. Committed on 31/12/2014 at 19:36. Pushed by tfry into branch 'development/plugin_management_to_loadlibs'. Move the "Configure Repositories"-button to the tab it applies to. M +20 -15 rkward/dialogs/rkloadlibsdialog.cpp M +1 -0 rkward/dialogs/rkloadlibsdialog.h http://commits.kde.org/rkward/6b3a955c7f43473447e5f9bc9d0ac83f93b66e0c diff --git a/rkward/dialogs/rkloadlibsdialog.cpp b/rkward/dialogs/rkloadlibsdialog.cpp index 14c39af..63c6078 100644 --- a/rkward/dialogs/rkloadlibsdialog.cpp +++ b/rkward/dialogs/rkloadlibsdialog.cpp @@ -61,7 +61,7 @@ RKLoadLibsDialog::RKLoadLibsDialog (QWidget *parent, RCommandChain *chain, bool setFaceType (KPageDialog::Tabbed); setModal (modal); setCaption (i18n ("Configure Packages")); - setButtons (KDialog::Ok | KDialog::Apply | KDialog::Cancel | KDialog::User1); + setButtons (KDialog::Ok | KDialog::Apply | KDialog::Cancel); LoadUnloadWidget *luwidget = new LoadUnloadWidget (this); addPage (luwidget, i18n ("Local packages")); @@ -70,8 +70,6 @@ RKLoadLibsDialog::RKLoadLibsDialog (QWidget *parent, RCommandChain *chain, bool install_packages_widget = new InstallPackagesWidget (this); install_packages_pageitem = addPage (install_packages_widget, i18n ("Install / Update / Remove")); - setButtonText (KDialog::User1, i18n ("Configure Repositories")); - addPage (new RKPluginMapSelectionWidget (this), i18n ("Manage Plugins")); connect (this, SIGNAL (currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)), this, SLOT (slotPageChanged())); @@ -146,9 +144,6 @@ void RKLoadLibsDialog::slotButtonClicked (int button) { case KDialog::Apply: emit (applyClicked ()); break; - case KDialog::User1: - RKSettings::configureSettings (RKSettings::PageRPackages, this, chain); - break; } } @@ -627,14 +622,14 @@ InstallPackagesWidget::InstallPackagesWidget (RKLoadLibsDialog *dialog) : QWidge RK_TRACE (DIALOGS); InstallPackagesWidget::parent = dialog; - QVBoxLayout *mvbox = new QVBoxLayout (this); - mvbox->setContentsMargins (0, 0, 0, 0); - QLabel *label = new QLabel (i18n ("Many packages are available on CRAN (Comprehensive R Archive Network), and other repositories<br>(click \"Configure Repositories\" to add more sources)."), this); - mvbox->addWidget (label); - QHBoxLayout *hbox = new QHBoxLayout (); - mvbox->addLayout (hbox); + QHBoxLayout *hbox = new QHBoxLayout (this); hbox->setContentsMargins (0, 0, 0, 0); + QVBoxLayout *vbox = new QVBoxLayout (); + vbox->setContentsMargins (0, 0, 0, 0); + hbox->addLayout (vbox); + hbox->setStretchFactor (vbox, 2); + packages_status = new RKRPackageInstallationStatus (this); packages_view = new QTreeView (this); packages_view->setSortingEnabled (true); @@ -645,13 +640,18 @@ InstallPackagesWidget::InstallPackagesWidget (RKLoadLibsDialog *dialog) : QWidge packages_view->setModel (model); packages_view->setEnabled (false); packages_view->setMinimumHeight (packages_view->sizeHintForRow (0) * 15); // force a decent height - hbox->addWidget (packages_view); - hbox->setStretchFactor (packages_view, 2); + packages_view->setMinimumWidth (packages_view->fontMetrics ().width ("This is to force a sensible min width for the packages view (empty on construction)")); + vbox->addWidget (packages_view); + + QPushButton *configure_repos_button = new QPushButton (i18n ("Configure Repositories"), this); + RKCommonFunctions::setTips (i18n ("Many packages are available on CRAN (Comprehensive R Archive Network), and other repositories.<br>Click this to add more sources."), configure_repos_button); + connect (configure_repos_button, SIGNAL (clicked()), this, SLOT(configureRepositories())); + vbox->addWidget (configure_repos_button); QVBoxLayout *buttonvbox = new QVBoxLayout (); hbox->addLayout (buttonvbox); buttonvbox->setContentsMargins (0, 0, 0, 0); - label = new QLabel (i18n ("Show only packages matching:"), this); + QLabel *label = new QLabel (i18n ("Show only packages matching:"), this); filter_edit = new QLineEdit (QString (), this); RKCommonFunctions::setTips (i18n ("<p>You can limit the packages displayed in the list to with names or titles matching a filter string.</p><p><b>Note:</b> To limit the search to matches at the start of the string, start the filter with '^', e.g. ('^rk.'). To limit searches to the end of the string, append '$' at the end of the filter.</p>"), label, filter_edit); connect (filter_edit, SIGNAL (textChanged(QString)), this, SLOT (filterChanged())); @@ -785,6 +785,11 @@ void InstallPackagesWidget::cancel () { deleteLater (); } +void InstallPackagesWidget::configureRepositories () { + RK_TRACE (DIALOGS); + RKSettings::configureSettings (RKSettings::PageRPackages, this, parent->chain); +} + /////////////////////// PackageInstallParamsWidget ////////////////////////// #include <qcombobox.h> diff --git a/rkward/dialogs/rkloadlibsdialog.h b/rkward/dialogs/rkloadlibsdialog.h index 55af834..d8cbc25 100644 --- a/rkward/dialogs/rkloadlibsdialog.h +++ b/rkward/dialogs/rkloadlibsdialog.h @@ -248,6 +248,7 @@ public slots: void filterChanged (); void activated (); void markAllUpdates (); + void configureRepositories (); private: void doInstall (bool refresh); QTreeView *packages_view; |
From: Thomas F. <tho...@ru...> - 2014-12-31 15:30:53
|
Git commit e19c1e972e4e548e925519f23fc82ddb07aa1b23 by Thomas Friedrichsmeier. Committed on 31/12/2014 at 15:30. Pushed by tfry into branch 'development/plugin_management_to_loadlibs'. Ignore all.pluginmap, in case it is still present. M +3 -1 rkward/settings/rksettingsmoduleplugins.cpp http://commits.kde.org/rkward/e19c1e972e4e548e925519f23fc82ddb07aa1b23 diff --git a/rkward/settings/rksettingsmoduleplugins.cpp b/rkward/settings/rksettingsmoduleplugins.cpp index 46397c7..f3720f4 100644 --- a/rkward/settings/rksettingsmoduleplugins.cpp +++ b/rkward/settings/rksettingsmoduleplugins.cpp @@ -339,10 +339,12 @@ void RKSettingsModulePlugins::registerPluginMaps (const QStringList &maps, bool void RKSettingsModulePlugins::fixPluginMapLists () { RK_TRACE (SETTINGS); + // Users who installed versions before 0.6.3, manually, are likely to have all.pluginmap left over. Let's handle this, on the fly. + const QString obosolete_map = RKCommonFunctions::getRKWardDataDir () + "all.pluginmap"; for (int i = 0; i < known_plugin_maps.size (); ++i) { PluginMapStoredInfo &inf = known_plugin_maps[i]; QFileInfo info (inf.filename); - if (!info.isReadable ()) { + if ((!info.isReadable ()) || (inf.filename == obosolete_map)) { known_plugin_maps.removeAt (i); --i; continue; |
From: Thomas F. <tho...@ru...> - 2014-12-31 15:30:53
|
Git commit 2bf246dbfd247b46f277814f8f3224d10065d22f by Thomas Friedrichsmeier. Committed on 31/12/2014 at 15:14. Pushed by tfry into branch 'development/plugin_management_to_loadlibs'. Provide (minimal) descriptions for all official plugin maps. M +2 -2 rkward/plugins/analysis.pluginmap M +10 -0 rkward/plugins/data.pluginmap M +10 -0 rkward/plugins/distributions.pluginmap M +9 -1 rkward/plugins/embedded.pluginmap M +10 -0 rkward/plugins/import_export.pluginmap M +10 -0 rkward/plugins/irt.pluginmap M +10 -0 rkward/plugins/menu.pluginmap M +10 -0 rkward/plugins/plots.pluginmap M +11 -4 rkward/plugins/under_development.pluginmap M +11 -0 rkward/plugins/x11device.pluginmap http://commits.kde.org/rkward/2bf246dbfd247b46f277814f8f3224d10065d22f diff --git a/rkward/plugins/analysis.pluginmap b/rkward/plugins/analysis.pluginmap index 096336b..c1c8da9 100644 --- a/rkward/plugins/analysis.pluginmap +++ b/rkward/plugins/analysis.pluginmap @@ -3,8 +3,8 @@ <document base_prefix="" namespace="rkward" id="analysis" po_id="analysis"> <include file="pluginmap_meta.inc"/> <about - name="Analysis plugins" - shortinfo="Part of the official RKWard distribution" + name="Analysis" + shortinfo="Assorted plugins for univariate and multivariate data analysis. Part of the official RKWard distribution" version="0.6.3" license="GPL" url="http://rkward.kde.org"> diff --git a/rkward/plugins/data.pluginmap b/rkward/plugins/data.pluginmap index ccd00b1..a48c77e 100644 --- a/rkward/plugins/data.pluginmap +++ b/rkward/plugins/data.pluginmap @@ -2,6 +2,16 @@ <document base_prefix="" namespace="rkward" id="data"> <include file="pluginmap_meta.inc"/> + <about + name="Data transformation and conversion" + shortinfo="Plugins for transforming, subsetting, recoding, etc. of data. Part of the official RKWard distribution" + version="0.6.3" + license="GPL" + url="http://rkward.kde.org"> + <insert snippet="author_rkward_team"/> + </about> + <insert snippet="rkward_version_guard"/> + <require file="menu.pluginmap"/> <components> diff --git a/rkward/plugins/distributions.pluginmap b/rkward/plugins/distributions.pluginmap index 56f7877..921afe3 100644 --- a/rkward/plugins/distributions.pluginmap +++ b/rkward/plugins/distributions.pluginmap @@ -2,6 +2,16 @@ <document base_prefix="distributions/" namespace="rkward" id="distributions"> <include file="pluginmap_meta.inc"/> + <about + name="Distributions" + shortinfo="Distribution functions, plots, tests of (normal) distribution, central limit theorem. Part of the official RKWard distribution" + version="0.6.3" + license="GPL" + url="http://rkward.kde.org"> + <insert snippet="author_rkward_team"/> + </about> + <insert snippet="rkward_version_guard"/> + <require file="../menu.pluginmap"/> <components> diff --git a/rkward/plugins/embedded.pluginmap b/rkward/plugins/embedded.pluginmap index 9956dc3..30b504e 100644 --- a/rkward/plugins/embedded.pluginmap +++ b/rkward/plugins/embedded.pluginmap @@ -2,7 +2,15 @@ <document base_prefix="" namespace="rkward" id="embedded" priority="hidden"> <include file="pluginmap_meta.inc"/> - <require file="menu.pluginmap"/> + <about + name="Embedded plugins" + shortinfo="Not for direct use: Utility plugins that can be included by other plugins. Part of the official RKWard distribution" + version="0.6.3" + license="GPL" + url="http://rkward.kde.org"> + <insert snippet="author_rkward_team"/> + </about> + <insert snippet="rkward_version_guard"/> <components> <!-- These are meant to be embedded, and are not shown in the menu --> diff --git a/rkward/plugins/import_export.pluginmap b/rkward/plugins/import_export.pluginmap index 1b33a1b..cd5bca5 100644 --- a/rkward/plugins/import_export.pluginmap +++ b/rkward/plugins/import_export.pluginmap @@ -2,6 +2,16 @@ <document base_prefix="00saveload/" namespace="rkward" id="import_export"> <include file="pluginmap_meta.inc"/> + <about + name="Data Import and Export" + shortinfo="Plugins for reading and writing data in various formats. Part of the official RKWard distribution" + version="0.6.3" + license="GPL" + url="http://rkward.kde.org"> + <insert snippet="author_rkward_team"/> + </about> + <insert snippet="rkward_version_guard"/> + <require file="../menu.pluginmap"/> <components> diff --git a/rkward/plugins/irt.pluginmap b/rkward/plugins/irt.pluginmap index f69a852..95ba9cc 100644 --- a/rkward/plugins/irt.pluginmap +++ b/rkward/plugins/irt.pluginmap @@ -2,6 +2,16 @@ <document base_prefix="" namespace="rkward" id="irt"> <include file="pluginmap_meta.inc"/> + <about + name="Item Response Theory" + shortinfo="Item Response Theory Plugins. Part of the official RKWard distribution" + version="0.6.3" + license="GPL" + url="http://rkward.kde.org"> + <insert snippet="author_rkward_team"/> + </about> + <insert snippet="rkward_version_guard"/> + <require file="menu.pluginmap"/> <components> diff --git a/rkward/plugins/menu.pluginmap b/rkward/plugins/menu.pluginmap index 555d17f..bd96ea9 100644 --- a/rkward/plugins/menu.pluginmap +++ b/rkward/plugins/menu.pluginmap @@ -2,6 +2,16 @@ <!-- The point of this pluginmap is to pre-define the layout (and labels) of some menus --> <document base_prefix="" namespace="rkward" id="rkward_menu_hierarchy" priority="hidden"> <include file="pluginmap_meta.inc"/> + <about + name="Menu structure definition" + shortinfo="Not for direct use: Defines the names and order of top level menus. Part of the official RKWard distribution" + version="0.6.3" + license="GPL" + url="http://rkward.kde.org"> + <insert snippet="author_rkward_team"/> + </about> + <insert snippet="rkward_version_guard"/> + <hierarchy> <!-- Define a group before and after each top-level menu to allow inserting top-level menus at defined positions --> <group id="before_data"/> diff --git a/rkward/plugins/plots.pluginmap b/rkward/plugins/plots.pluginmap index 1a3f4ea..235873b 100644 --- a/rkward/plugins/plots.pluginmap +++ b/rkward/plugins/plots.pluginmap @@ -2,6 +2,16 @@ <document base_prefix="plots/" namespace="rkward" id="plots"> <include file="pluginmap_meta.inc"/> + <about + name="Plots" + shortinfo="Plugins for procuding various plots. Part of the official RKWard distribution" + version="0.6.3" + license="GPL" + url="http://rkward.kde.org"> + <insert snippet="author_rkward_team"/> + </about> + <insert snippet="rkward_version_guard"/> + <require file="../menu.pluginmap"/> <components> diff --git a/rkward/plugins/under_development.pluginmap b/rkward/plugins/under_development.pluginmap index c970b91..c9aac2b 100644 --- a/rkward/plugins/under_development.pluginmap +++ b/rkward/plugins/under_development.pluginmap @@ -1,9 +1,18 @@ <!DOCTYPE rkpluginmap> -<document base_prefix="" namespace="rkward"> +<document base_prefix="" namespace="rkward" priority="low" id="under_development"> <include file="pluginmap_meta.inc"/> - <require file="menu.pluginmap"/> + <about + name="Plugins under development" + shortinfo="Plugins that are under development, experimental, or meant for testing, only. Part of the official RKWard distribution" + version="0.6.3" + license="GPL" + url="http://rkward.kde.org"> + <insert snippet="author_rkward_team"/> + </about> + <insert snippet="rkward_version_guard"/> + <require file="menu.pluginmap"/> <components> <component type="standard" id="simple_anova" file="simple_anova/description.xml" label="Simple Anova" /> <component type="standard" id="sieve_plot" file="plots/sieve_plot.xml" label="Extended Sieve Plot" /> @@ -34,8 +43,6 @@ </menu> <menu id="data" label="Data"> <group id="testing" group="bottom" separated="true"/> - <entry component="generate_random" group="testing"/> - <entry component="sort_data" group="testing"/> <entry component="sort_data2" group="testing"/> </menu> <menu id="analysis" label="Analysis"> diff --git a/rkward/plugins/x11device.pluginmap b/rkward/plugins/x11device.pluginmap index d856441..919bcfd 100644 --- a/rkward/plugins/x11device.pluginmap +++ b/rkward/plugins/x11device.pluginmap @@ -2,6 +2,17 @@ <document base_prefix="x11device/" namespace="rkward" id="x11device"> <include file="pluginmap_meta.inc"/> + <about + name="Graphics Device add-ons" + shortinfo="Plugins for use in graphics device (e.g. X11()) windows. Part of the official RKWard distribution" + version="0.6.3" + license="GPL" + url="http://rkward.kde.org"> + <insert snippet="author_rkward_team"/> + </about> + <insert snippet="rkward_version_guard"/> + + <require file="../menu.pluginmap"/> <components> <component type="standard" id="export_x11_device" file="export.xml" label="Export..." /> |
From: Thomas F. <tho...@ru...> - 2014-12-30 21:36:46
|
Git commit 6bd123ec8ff50b7dc7fe0ec767f7a62e667afeff by Thomas Friedrichsmeier. Committed on 30/12/2014 at 21:34. Pushed by tfry into branch 'development/plugin_management_to_loadlibs'. In the new setup, there will be no "all" pluginmap, but rather each toplevel pluginmap will stand for itself (and be active by default). Therefore, each pluginmap will have to include meaningful meta-data. Start preparing for that. D +0 -13 rkward/plugins/all.pluginmap M +10 -0 rkward/plugins/analysis.pluginmap M +12 -13 rkward/plugins/pluginmap_meta.inc M +12 -20 rkward/settings/rksettingsmoduleplugins.cpp M +2 -1 rkward/settings/rksettingsmoduleplugins.h M +19 -0 scripts/set_dist_version.sh http://commits.kde.org/rkward/6bd123ec8ff50b7dc7fe0ec767f7a62e667afeff diff --git a/rkward/plugins/all.pluginmap b/rkward/plugins/all.pluginmap deleted file mode 100644 index 81d4d9f..0000000 --- a/rkward/plugins/all.pluginmap +++ /dev/null @@ -1,13 +0,0 @@ -<!DOCTYPE rkpluginmap> - -<document base_prefix="" namespace="rkward" id="all_rkward_plugins"> - <include file="pluginmap_meta.inc"/> - - <require file="import_export.pluginmap"/> - <require file="analysis.pluginmap"/> - <require file="distributions.pluginmap"/> - <require file="plots.pluginmap"/> - <require file="x11device.pluginmap"/> - <require file="irt.pluginmap"/> - <require file="data.pluginmap"/> -</document> diff --git a/rkward/plugins/analysis.pluginmap b/rkward/plugins/analysis.pluginmap index cc73d33..096336b 100644 --- a/rkward/plugins/analysis.pluginmap +++ b/rkward/plugins/analysis.pluginmap @@ -2,6 +2,16 @@ <document base_prefix="" namespace="rkward" id="analysis" po_id="analysis"> <include file="pluginmap_meta.inc"/> + <about + name="Analysis plugins" + shortinfo="Part of the official RKWard distribution" + version="0.6.3" + license="GPL" + url="http://rkward.kde.org"> + <insert snippet="author_rkward_team"/> + </about> + <insert snippet="rkward_version_guard"/> + <require file="menu.pluginmap"/> <components> diff --git a/rkward/plugins/pluginmap_meta.inc b/rkward/plugins/pluginmap_meta.inc index 92dcc69..eb46123 100644 --- a/rkward/plugins/pluginmap_meta.inc +++ b/rkward/plugins/pluginmap_meta.inc @@ -1,16 +1,15 @@ <document> - <about - name="RKWard pluginmap" - shortinfo="Part of the official RKWard distribution" - version="0.6.3" - license="GPL" - url="http://rkward.kde.org"> - <author - name="RKWard Team" - email="rkw...@li..." - url="http://rkward.kde.org" /> - </about> - <!-- Guard against accidental inclusion of pluginmaps in a different installed version of RKWard --> - <dependencies rkward_min_version="0.6.2z" rkward_max_version="0.6.3y" /> + <snippets> + <snippet id="author_rkward_team"> + <author + name="RKWard Team" + email="rkw...@li..." + url="http://rkward.kde.org" /> + </snippet> + <snippet id="rkward_version_guard"> + <!-- Guard against accidental inclusion of pluginmaps in a different installed version of RKWard --> + <dependencies rkward_min_version="0.6.2z" rkward_max_version="0.6.3y" /> + </snippet> + </snippets> </document> diff --git a/rkward/settings/rksettingsmoduleplugins.cpp b/rkward/settings/rksettingsmoduleplugins.cpp index 97e729a..46397c7 100644 --- a/rkward/settings/rksettingsmoduleplugins.cpp +++ b/rkward/settings/rksettingsmoduleplugins.cpp @@ -207,6 +207,15 @@ void RKSettingsModulePlugins::loadSettings (KConfig *config) { known_plugin_maps.append (inf); } } + if (RKSettingsModuleGeneral::rkwardVersionChanged ()) { + // if it is the first start this version, scan the installation for new pluginmaps + QDir def_plugindir (RKCommonFunctions::getRKWardDataDir ()); + QStringList def_pluginmaps = def_plugindir.entryList (QStringList ("*.pluginmap")); + for (int i = 0; i < def_pluginmaps.size (); ++i) { + def_pluginmaps[i] = def_plugindir.absoluteFilePath (def_pluginmaps[i]); + } + registerPluginMaps (def_pluginmaps, false, false, true); + } fixPluginMapLists (); // removes any maps which don't exist any more interface_pref = static_cast<PluginPrefs> (cg.readEntry ("Interface Preferences", static_cast<int> (PreferRecommended))); @@ -292,7 +301,7 @@ QStringList RKSettingsModulePlugins::pluginMaps () { } // static -void RKSettingsModulePlugins::registerPluginMaps (const QStringList &maps, bool force_add, bool force_reload) { +void RKSettingsModulePlugins::registerPluginMaps (const QStringList &maps, bool force_add, bool force_reload, bool suppress_reload) { RK_TRACE (SETTINGS); QStringList added; @@ -321,6 +330,7 @@ void RKSettingsModulePlugins::registerPluginMaps (const QStringList &maps, bool } } + if (suppress_reload) return; if (force_reload || (!added.isEmpty ())) { RKWardMainWindow::getMain ()->initPlugins (added); } @@ -329,10 +339,6 @@ void RKSettingsModulePlugins::registerPluginMaps (const QStringList &maps, bool void RKSettingsModulePlugins::fixPluginMapLists () { RK_TRACE (SETTINGS); - QFileInfo default_pluginmap (RKCommonFunctions::getRKWardDataDir () + "/all.pluginmap"); - int default_pluginmap_index = -1; - bool any_active_pluginmap = false; - for (int i = 0; i < known_plugin_maps.size (); ++i) { PluginMapStoredInfo &inf = known_plugin_maps[i]; QFileInfo info (inf.filename); @@ -341,8 +347,6 @@ void RKSettingsModulePlugins::fixPluginMapLists () { --i; continue; } - if (inf.active) any_active_pluginmap = true; - if ((default_pluginmap_index < 0) && (info == default_pluginmap)) default_pluginmap_index = i; if (info.lastModified () != inf.last_modified) { inf.broken_in_this_version = false; @@ -355,18 +359,6 @@ void RKSettingsModulePlugins::fixPluginMapLists () { parsePluginMapBasics (inf.filename, &inf.id, &inf.priority); } } - - // make sure the default plugin map is in the list (unless it is non-readable) - if ((default_pluginmap_index < 0) && (default_pluginmap.isReadable ())) { - PluginMapStoredInfo inf (default_pluginmap.absoluteFilePath ()); - known_plugin_maps.prepend (inf); - default_pluginmap_index = 0; - } - - // if no other pluginmap is active, activate the default map - if (!any_active_pluginmap && (default_pluginmap_index >= 0)) { - known_plugin_maps[default_pluginmap_index].active = true; - } } void RKSettingsModulePlugins::parsePluginMapBasics (const QString &filename, QString *id, int *priority) { @@ -453,8 +445,8 @@ QVariant RKSettingsModulePluginsModel::data (const QModelIndex& index, int role) if (!meta.dependencies.isEmpty ()) { desc.append ("<b>" + i18n ("Dependencies") + "</b>"); desc.append (RKComponentDependency::depsToHtml (meta.dependencies)); - desc.append ("<p>" + inf.filename + "</p>"); } + desc.append ("<p>" + inf.filename + "</p>"); return desc; } diff --git a/rkward/settings/rksettingsmoduleplugins.h b/rkward/settings/rksettingsmoduleplugins.h index b37078a..36227b6 100644 --- a/rkward/settings/rksettingsmoduleplugins.h +++ b/rkward/settings/rksettingsmoduleplugins.h @@ -58,8 +58,9 @@ public: * @param maps Plugin maps (filenames) to add * @param force_add If true, maps are added, even if they are not "new", and had previously been disabled by the user * @param force_reload If true, plugin maps are always reloaded, even if no maps were added + * @param suppress_reload If true (and force_reload is false), do not reload plugin maps, even if maps were added */ - static void registerPluginMaps (const QStringList &maps, bool force_add, bool force_reload); + static void registerPluginMaps (const QStringList &maps, bool force_add, bool force_reload, bool suppress_reload=true); /** Looks for the given id among known plugin maps */ static QString findPluginMapById (const QString &id); /** marks given map as broken (in this version), and deactivates it. @Returns false is the map was already known to be broken, true otherwise. */ diff --git a/scripts/set_dist_version.sh b/scripts/set_dist_version.sh index 2c59441..c5cc6b8 100755 --- a/scripts/set_dist_version.sh +++ b/scripts/set_dist_version.sh @@ -4,9 +4,28 @@ # VERSION=${1} +if [ "`echo -n ${VERSION} | grep "\\+"`" != "" ]; then + TARGET_VERSION=`echo -n ${VERSION} | sed -e 's/[^+]*+\([^+]*\).*/\1/g'` + PRIOR_VERSION=`echo -n ${VERSION} | sed -e 's/\([^+]*\).*/\1/g'` +else + TARGET_VERSION=${VERSION} + PRIOR_VERSION=${VERSION} +fi + +echo "Full version name: ${VERSION}" +echo "Target version name: ${TARGET_VERSION}" +echo "Prior version name: ${PRIOR_VERSION}" + cd `dirname $0`/.. BASEDIR=`pwd` echo "# DO NOT CHANGE THIS FILE MANUALLY! # It will be overwritten by scripts/set_dist_version.sh SET(RKVERSION_NUMBER $VERSION)" > $BASEDIR/VERSION.cmake + +cd ${BASEDIR}/rkward/plugins/ +for pluginmap in *.pluginmap pluginmap_meta.inc; do + sed -i -e "s/\(\s\)version=\"[^\"]*\"/\1version=\"${TARGET_VERSION}\"/" \ + -e "s/rkward_min_version=\"[^\"]*\"/rkward_min_version=\"${PRIOR_VERSION}\"/" \ + -e "s/rkward_max_version=\"[^\"]*\"/rkward_max_version=\"${TARGET_VERSION}y\"/" $pluginmap +done |
From: Thomas F. <tho...@ru...> - 2014-12-30 21:27:08
|
Git commit a95473a8b062ca4868ed35592f0cb4a0b43da108 by Thomas Friedrichsmeier. Committed on 30/12/2014 at 21:26. Pushed by tfry into branch 'development/plugin_management_to_loadlibs'. Fix menu ordering when groups are appended to "bottom" group. M +6 -2 rkward/plugin/rkcomponentmap.cpp http://commits.kde.org/rkward/a95473a8b062ca4868ed35592f0cb4a0b43da108 diff --git a/rkward/plugin/rkcomponentmap.cpp b/rkward/plugin/rkcomponentmap.cpp index ed33c8e..e0692b8 100644 --- a/rkward/plugin/rkcomponentmap.cpp +++ b/rkward/plugin/rkcomponentmap.cpp @@ -166,11 +166,15 @@ void RKComponentGUIXML::Menu::clear () { RKComponentGUIXML::Group *findOrCreateGroup (RKComponentGUIXML::Menu *parent, const QString group) { // try to find group + int bottom_index = -1; QList<RKComponentGUIXML::Group*> &list = parent->groups; for (int i = 0; i < list.size (); ++i) { if (list[i]->id == group) { return list[i]; } + if (list[i]->id == QLatin1String ("bottom")) { + bottom_index = i; + } } RK_TRACE (PLUGIN); @@ -182,10 +186,10 @@ RKComponentGUIXML::Group *findOrCreateGroup (RKComponentGUIXML::Menu *parent, co } else if (group == QLatin1String ("bottom")) { list.append (new_group); } else { - if (list.isEmpty () || list.last ()->id != QLatin1String ("bottom")) { // no "bottom" is defined, yet + if (bottom_index < 0) { // no "bottom" is defined, yet list.append (new_group); } else { // a bottom group already exists, add new group _above_ that - list.insert (list.size () - 1, new_group); + list.insert (bottom_index, new_group); } } return new_group; |
From: Thomas F. <tho...@ru...> - 2014-12-29 21:56:43
|
Git commit 8691f363bd8810aed4bd07032633b3894c31165d by Thomas Friedrichsmeier. Committed on 29/12/2014 at 21:51. Pushed by tfry into branch 'development/plugin_management_to_loadlibs'. Start moving pluginmap management to R package dialog M +42 -1 rkward/dialogs/rkloadlibsdialog.cpp M +18 -0 rkward/dialogs/rkloadlibsdialog.h M +1 -1 rkward/plugin/rkcomponentmap.h M +1 -1 rkward/plugins/embedded.pluginmap M +1 -1 rkward/plugins/menu.pluginmap M +30 -11 rkward/settings/rksettingsmoduleplugins.cpp M +3 -1 rkward/settings/rksettingsmoduleplugins.h http://commits.kde.org/rkward/8691f363bd8810aed4bd07032633b3894c31165d diff --git a/rkward/dialogs/rkloadlibsdialog.cpp b/rkward/dialogs/rkloadlibsdialog.cpp index 73d8c16..14c39af 100644 --- a/rkward/dialogs/rkloadlibsdialog.cpp +++ b/rkward/dialogs/rkloadlibsdialog.cpp @@ -72,9 +72,11 @@ RKLoadLibsDialog::RKLoadLibsDialog (QWidget *parent, RCommandChain *chain, bool setButtonText (KDialog::User1, i18n ("Configure Repositories")); + addPage (new RKPluginMapSelectionWidget (this), i18n ("Manage Plugins")); + connect (this, SIGNAL (currentPageChanged(KPageWidgetItem*,KPageWidgetItem*)), this, SLOT (slotPageChanged())); QTimer::singleShot (0, this, SLOT (slotPageChanged())); - num_child_widgets = 3; + num_child_widgets = 4; accepted = false; RKGlobals::rInterface ()->issueCommand (".libPaths ()", RCommand::App | RCommand::GetStringVector, QString (), this, GET_CURRENT_LIBLOCS_COMMAND, chain); @@ -1195,6 +1197,45 @@ void RKRPackageInstallationStatusSortFilterModel::setRKWardOnly (bool only) { if (rkward_only != old_only) invalidate (); } +///////////////////////// +#include "../misc/multistringselector.h" +RKPluginMapSelectionWidget::RKPluginMapSelectionWidget (RKLoadLibsDialog* dialog) : QWidget (dialog) { + RK_TRACE (DIALOGS); + model = 0; + + QVBoxLayout *vbox = new QVBoxLayout (this); + vbox->setContentsMargins (0, 0, 0, 0); + vbox->addWidget (new QLabel (i18n ("Installed plugin groups (.pluginmap files)"), this)); + selector = new RKMultiStringSelectorV2 (QString (), this); + vbox->addWidget (selector); +} + +RKPluginMapSelectionWidget::~RKPluginMapSelectionWidget () { + RK_TRACE (DIALOGS); +} + +void RKPluginMapSelectionWidget::activated () { + RK_TRACE (DIALOGS); + + if (!model) { + model = new RKSettingsModulePluginsModel (this); + model->init (RKSettingsModulePlugins::knownPluginmaps ()); + selector->setModel (model, 1); + } +} + +void RKPluginMapSelectionWidget::apply () { + +} + +void RKPluginMapSelectionWidget::cancel () { + +} + +void RKPluginMapSelectionWidget::ok () { + +} + #include "rkloadlibsdialog.moc" diff --git a/rkward/dialogs/rkloadlibsdialog.h b/rkward/dialogs/rkloadlibsdialog.h index c5b79d4..55af834 100644 --- a/rkward/dialogs/rkloadlibsdialog.h +++ b/rkward/dialogs/rkloadlibsdialog.h @@ -283,4 +283,22 @@ private: QCheckBox *suggested_packages; }; + +#include "../settings/rksettingsmoduleplugins.h" + +class RKPluginMapSelectionWidget : public QWidget { +Q_OBJECT +public: + RKPluginMapSelectionWidget (RKLoadLibsDialog *dialog); + virtual ~RKPluginMapSelectionWidget (); +public slots: + void ok (); + void apply (); + void cancel (); + void activated (); +private: + RKMultiStringSelectorV2* selector; + RKSettingsModulePluginsModel* model; +}; + #endif diff --git a/rkward/plugin/rkcomponentmap.h b/rkward/plugin/rkcomponentmap.h index 98e02c2..1c3f0d1 100644 --- a/rkward/plugin/rkcomponentmap.h +++ b/rkward/plugin/rkcomponentmap.h @@ -37,7 +37,7 @@ public: QList<RKComponentDependency> getDependencies () const { return dependencies; }; static QString parseId (const QDomElement &e, XMLHelper &xml); const RKMessageCatalog *messageCatalog () const { return catalog; }; - // Get the about data for this pluginmap. + /** Get the about data for this pluginmap. */ RKComponentAboutData getAboutData (); private: friend class RKComponentMap; diff --git a/rkward/plugins/embedded.pluginmap b/rkward/plugins/embedded.pluginmap index f0d0cdb..9956dc3 100644 --- a/rkward/plugins/embedded.pluginmap +++ b/rkward/plugins/embedded.pluginmap @@ -1,6 +1,6 @@ <!DOCTYPE rkpluginmap> -<document base_prefix="" namespace="rkward" id="embedded"> +<document base_prefix="" namespace="rkward" id="embedded" priority="hidden"> <include file="pluginmap_meta.inc"/> <require file="menu.pluginmap"/> diff --git a/rkward/plugins/menu.pluginmap b/rkward/plugins/menu.pluginmap index ff33602..555d17f 100644 --- a/rkward/plugins/menu.pluginmap +++ b/rkward/plugins/menu.pluginmap @@ -1,6 +1,6 @@ <!DOCTYPE rkpluginmap> <!-- The point of this pluginmap is to pre-define the layout (and labels) of some menus --> -<document base_prefix="" namespace="rkward" id="rkward_menu_hierarchy"> +<document base_prefix="" namespace="rkward" id="rkward_menu_hierarchy" priority="hidden"> <include file="pluginmap_meta.inc"/> <hierarchy> <!-- Define a group before and after each top-level menu to allow inserting top-level menus at defined positions --> diff --git a/rkward/settings/rksettingsmoduleplugins.cpp b/rkward/settings/rksettingsmoduleplugins.cpp index f0b48ee..97e729a 100644 --- a/rkward/settings/rksettingsmoduleplugins.cpp +++ b/rkward/settings/rksettingsmoduleplugins.cpp @@ -352,10 +352,7 @@ void RKSettingsModulePlugins::fixPluginMapLists () { } if (inf.id.isEmpty ()) { - XMLHelper xml (inf.filename); - QDomElement de = xml.openXMLFile (DL_WARNING); - inf.id = RKPluginMapFile::parseId (de, xml); - inf.priority = xml.getMultiChoiceAttribute (de, "priority", "hidden;low;medium;high", (int) PriorityMedium, DL_WARNING); + parsePluginMapBasics (inf.filename, &inf.id, &inf.priority); } } @@ -372,6 +369,17 @@ void RKSettingsModulePlugins::fixPluginMapLists () { } } +void RKSettingsModulePlugins::parsePluginMapBasics (const QString &filename, QString *id, int *priority) { + RK_TRACE (SETTINGS); + RK_ASSERT (id); + RK_ASSERT (priority); + + XMLHelper xml (filename); + QDomElement de = xml.openXMLFile (DL_WARNING); + *id = RKPluginMapFile::parseId (de, xml); + *priority = xml.getMultiChoiceAttribute (de, "priority", "hidden;low;medium;high", (int) PriorityMedium, DL_WARNING); +} + QStringList RKSettingsModulePlugins::findPluginMapsRecursive (const QString &basedir) { RK_TRACE (SETTINGS); @@ -393,7 +401,7 @@ QStringList RKSettingsModulePlugins::findPluginMapsRecursive (const QString &bas return ret; } -RKSettingsModulePluginsModel::RKSettingsModulePluginsModel (RKSettingsModulePlugins* parent) : QAbstractTableModel (parent) { +RKSettingsModulePluginsModel::RKSettingsModulePluginsModel (QObject* parent) : QAbstractTableModel (parent) { RK_TRACE (SETTINGS); } @@ -417,9 +425,10 @@ int RKSettingsModulePluginsModel::rowCount (const QModelIndex& parent) const { } #define COLUMN_CHECKED 0 -#define COLUMN_FILENAME 1 -#define COLUMN_STATUS 2 -#define COLUMN_COUNT 3 +#define COLUMN_TITLE 1 +#define COLUMN_ID 2 +#define COLUMN_STATUS 3 +#define COLUMN_COUNT 4 int RKSettingsModulePluginsModel::columnCount (const QModelIndex& parent) const { // RK_TRACE (SETTINGS); @@ -444,6 +453,7 @@ QVariant RKSettingsModulePluginsModel::data (const QModelIndex& index, int role) if (!meta.dependencies.isEmpty ()) { desc.append ("<b>" + i18n ("Dependencies") + "</b>"); desc.append (RKComponentDependency::depsToHtml (meta.dependencies)); + desc.append ("<p>" + inf.filename + "</p>"); } return desc; } @@ -452,8 +462,15 @@ QVariant RKSettingsModulePluginsModel::data (const QModelIndex& index, int role) if (role == Qt::CheckStateRole) { return (inf.active ? Qt::Checked : Qt::Unchecked); } - } else if (col == COLUMN_FILENAME) { - if (role == Qt::DisplayRole) return inf.filename; + } else if (col == COLUMN_ID) { + if (role == Qt::DisplayRole) { + return inf.id; + } + } else if (col == COLUMN_TITLE) { + if (role == Qt::DisplayRole) { + const PluginMapMetaInfo &meta = const_cast<RKSettingsModulePluginsModel*> (this)->getPluginMapMetaInfo (inf.filename); + return meta.about->name; + } } else if (col == COLUMN_STATUS) { if (role == Qt::DisplayRole) { if (inf.broken_in_this_version) return i18n ("Broken"); @@ -481,7 +498,8 @@ QVariant RKSettingsModulePluginsModel::headerData (int section, Qt::Orientation // RK_TRACE (SETTINGS); if ((role == Qt::DisplayRole) && (orientation == Qt::Horizontal)) { if (section == COLUMN_CHECKED) return i18n ("Active"); - if (section == COLUMN_FILENAME) return i18n ("Filename"); + if (section == COLUMN_ID) return i18n ("ID"); + if (section == COLUMN_TITLE) return i18n ("Title"); if (section == COLUMN_STATUS) return i18n ("Status"); RK_ASSERT (false); } @@ -523,6 +541,7 @@ void RKSettingsModulePluginsModel::insertNewStrings (int above_row) { for (int i = files.size () - 1; i >= 0; --i) { RKSettingsModulePlugins::PluginMapStoredInfo inf (files[i]); inf.active = true; + RKSettingsModulePlugins::parsePluginMapBasics (files[i], &(inf.id), &(inf.priority)); plugin_maps.insert (above_row, inf); } endInsertRows (); diff --git a/rkward/settings/rksettingsmoduleplugins.h b/rkward/settings/rksettingsmoduleplugins.h index a22d23e..b37078a 100644 --- a/rkward/settings/rksettingsmoduleplugins.h +++ b/rkward/settings/rksettingsmoduleplugins.h @@ -80,6 +80,8 @@ public: QDateTime last_modified; }; typedef QList<PluginMapStoredInfo> PluginMapList; + static PluginMapList knownPluginmaps () { return known_plugin_maps; }; + static void parsePluginMapBasics (const QString &filename, QString *id, int *priority); public slots: void settingChanged (); private: @@ -106,7 +108,7 @@ private: class RKSettingsModulePluginsModel : public QAbstractTableModel { Q_OBJECT public: - RKSettingsModulePluginsModel (RKSettingsModulePlugins* parent); + RKSettingsModulePluginsModel (QObject* parent); virtual ~RKSettingsModulePluginsModel (); /** (re-)initialize the model */ void init (const RKSettingsModulePlugins::PluginMapList &known_plugin_maps); |