Changeset 956 for XmlTools2/trunk


Ignore:
Timestamp:
Feb 12, 2014, 11:15:52 PM (11 years ago)
Author:
s10k
Message:

XmlTools
removed QJSEngine defines

Location:
XmlTools2/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • XmlTools2/trunk/xmlpatch.cpp

    r955 r956  
    243243        QString currXmlFileString;
    244244
    245 #ifdef _USE_OLD_JS_ENGINE
    246245        QScriptEngine engine;
    247246        QScriptValue engineResult; // variable to check for js_errors
    248 #else
    249         QJSEngine engine;
    250         QJSValue engineResult; // variable to check for js_errors
    251 #endif
    252247
    253248        // Add echo function so user can debug the code
     
    277272        engineResult=engine.evaluate("main(); function main() {"+jsString+"}"); // main funtion allows to use return to exit prematurely from user code
    278273
    279 #ifdef _USE_OLD_JS_ENGINE
    280274        if (engine.hasUncaughtException()) {
    281275            displayJsException(engine,engineResult);
    282276        }
    283 #else
    284         checkForJsException(engineResult);
    285 #endif
    286277
    287278        if(!currXmlFile.open(QFile::WriteOnly | QFile::Text | QIODevice::Truncate)){
     
    291282        engineResult=engine.globalObject().property("$xmlData");
    292283
    293 #ifdef _USE_OLD_JS_ENGINE
    294284        if (engine.hasUncaughtException()) {
    295285            displayJsException(engine,engineResult);
    296286        }
    297 #else
    298         checkForJsException(engineResult);
    299 #endif
    300287
    301288        QTextStream(&currXmlFile) << engineResult.toString(); // retreive the modified xml by javascript and save it to the file
     
    511498}
    512499
    513 #ifdef _USE_OLD_JS_ENGINE
    514500void XmlPatch::displayJsException(QScriptEngine &engine, QScriptValue &engineResult){
    515501    if (engine.hasUncaughtException()) {
     
    517503    }
    518504}
    519 #else
    520 void XmlPatch::checkForJsException(QJSValue &engineResult){
    521     if (engineResult.isError()) {
    522         UtilXmlTools::displayErrorMessage("@CUSTOM_CODE","Uncaught js exception (user code):\n" + engineResult.toString());
    523     }
    524 }
    525 #endif
  • XmlTools2/trunk/xmlpatch.h

    r953 r956  
    2424    void checkPatchVersion(const QString &file, QTextStream &fileStream);
    2525    void checkAndProcessValidCommands(QTextStream &fileStream);
    26 #ifdef _USE_OLD_JS_ENGINE
    2726    void displayJsException(QScriptEngine &engine, QScriptValue &engineResult);
    28 #else
    29     void checkForJsException(QJSValue &engineResult);
    30 #endif
    3127};
    3228
  • XmlTools2/trunk/xmltools.h

    r923 r956  
    22#define XMLTOOLS_H
    33
    4 #define _USE_OLD_JS_ENGINE
    54
    65#include <string>
    76#include <QtCore>
    87#include <stdio.h>
    9 #ifdef _USE_OLD_JS_ENGINE // Needs to test each one in terms of performance... At first look seems old engine is faster for the xml parsing method used!
    108#include <QScriptEngine>
    11 #else
    12 #include <QJSEngine>
    13 #endif
    149
    1510#include "utilxmltools.h"
Note: See TracChangeset for help on using the changeset viewer.