[rkward-cvs] SF.net SVN: rkward-code:[4984] trunk/rkward

tfry at users.sf.net tfry at users.sf.net
Mon Nov 3 13:29:46 UTC 2014


Revision: 4984
          http://sourceforge.net/p/rkward/code/4984
Author:   tfry
Date:     2014-11-03 13:29:43 +0000 (Mon, 03 Nov 2014)
Log Message:
-----------
Also use pre-compiled scripts in UI scripting.

Modified Paths:
--------------
    trunk/rkward/ChangeLog
    trunk/rkward/po/Messages.sh
    trunk/rkward/rkward/scriptbackends/rkcomponentscripting.cpp

Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog	2014-11-03 13:18:31 UTC (rev 4983)
+++ trunk/rkward/ChangeLog	2014-11-03 13:29:43 UTC (rev 4984)
@@ -1,3 +1,4 @@
+- Pre-compile the common js code included in every plugin (only when compiled with Qt >= 4.7)
 - Improve crash recovery dialog to not prompt again for the same files
 - Fixed potential crash while the "RKWard Debug Messages" window is visible
 - Fixed display of file paths containing non-ascii characters in the title bar and startup dialog
@@ -19,6 +20,11 @@
    - i18n calls
     - wcgrep getStringAttribute.*i18n
     - element text
+   - i18n in JS:
+     - should return strings quoted, by default. Safer and less typing.
+       - enforces suggested policy of not i18n'ing functional parts of the code (variable / function names)
+     - Additional function comment(), equivalent to printIndented ("#", i18n (noquote ("something")))
+     - An elegant (object based?) way to fix the makeHeaderCode()-mess?
 
 --- Version 0.6.2 - Oct-20-2014
 - In data editor, indicate NAs, explicitly

Modified: trunk/rkward/po/Messages.sh
===================================================================
--- trunk/rkward/po/Messages.sh	2014-11-03 13:18:31 UTC (rev 4983)
+++ trunk/rkward/po/Messages.sh	2014-11-03 13:29:43 UTC (rev 4984)
@@ -63,4 +63,5 @@
 cd ${BASEDIR}
 # For testing purposes, extract analysis.pluginmap, only
 python ../scripts/extract_plugin_messages.py --outdir=../po/plugins/ plugins/analysis.pluginmap
+python ../scripts/extract_plugin_messages.py --outdir=../po/plugins/ --default_po=testing plugins/under_development.pluginmap
 echo "Done"

Modified: trunk/rkward/rkward/scriptbackends/rkcomponentscripting.cpp
===================================================================
--- trunk/rkward/rkward/scriptbackends/rkcomponentscripting.cpp	2014-11-03 13:18:31 UTC (rev 4983)
+++ trunk/rkward/rkward/scriptbackends/rkcomponentscripting.cpp	2014-11-03 13:29:43 UTC (rev 4984)
@@ -25,8 +25,11 @@
 #include "../plugin/rkcomponent.h"
 #include "../core/robjectlist.h"
 #include "../misc/rkcommonfunctions.h"
+#include "../misc/xmlhelper.h"
 #include "../rkglobals.h"
 #include "../rbackend/rinterface.h"
+#include "qtscriptbackend.h"
+#include "qtscripti18n.h"
 
 #include "../debug.h"
 
@@ -38,6 +41,7 @@
 
 	QScriptValue backend_object = engine.newQObject (this);
 	engine.globalObject ().setProperty ("_rkward", backend_object);
+	RKMessageCatalogObject::addI18nToScriptEngine (&engine, component->xmlHelper ()->messageCatalog ());
 }
 
 RKComponentScriptingProxy::~RKComponentScriptingProxy () {
@@ -57,9 +61,17 @@
 		_scriptfile = file;
 	}
 	QDir files_path (RKCommonFunctions::getRKWardDataDir () + "phpfiles/");
+#ifdef USE_Q_SCRIPT_PROGRAM
+	if (!RKPrecompiledQtScripts::loadCommonScript (&engine, files_path.absoluteFilePath ("rkcomponentscripting.js"))) {
+		engine.evaluate (i18n ("Error opening script file %1", files_path.absoluteFilePath ("rkcomponentscripting.js")));
+	} else if (!RKPrecompiledQtScripts::loadCommonScript (&engine, files_path.absoluteFilePath ("common.js"))) {
+		engine.evaluate (i18n ("Error opening script file %1", files_path.absoluteFilePath ("common.js")));
+	}
+#else
 	_command.prepend ("_rkward.include('" + files_path.absoluteFilePath ("rkcomponentscripting.js") + "');\n");
 	_command.prepend ("_rkward.include('" + files_path.absoluteFilePath ("common.js") + "');\n");
 	evaluate (_command);
+#endif
 }
 
 void RKComponentScriptingProxy::handleScriptError (const QString& current_file) {





More information about the rkward-tracker mailing list