[rkward-cvs] [rkward/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).

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Tue Dec 30 21:36:28 UTC 2014


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="rkward-devel at lists.sf.net"
-			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="rkward-devel at lists.sf.net"
+				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





More information about the rkward-tracker mailing list