Showing the changes to libraries/script-engine/src/ScriptEngine.cpp (1 of 39 files). Show all
Unified · Split
| @@ -472,20 +472,24 @@ void ScriptEngine::scriptErrorMessage(const QString& message) { · 471 unmodified lines | ||
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | void ScriptEngine::scriptWarningMessage(const QString& message) { |
| 475 | − qCWarning(scriptengine) << message; | |
| 475 | + qCWarning(scriptengine) << qPrintable(message); | |
| 476 | 476 | emit warningMessage(message, getFilename()); |
| 477 | 477 | } |
| 478 | 478 | |
| 479 | 479 | void ScriptEngine::scriptInfoMessage(const QString& message) { |
| 480 | − qCInfo(scriptengine) << message; | |
| 480 | + qCInfo(scriptengine) << qPrintable(message); | |
| 481 | 481 | emit infoMessage(message, getFilename()); |
| 482 | 482 | } |
| 483 | 483 | |
| 484 | 484 | void ScriptEngine::scriptPrintedMessage(const QString& message) { |
| 485 | − qCDebug(scriptengine) << message; | |
| 485 | + qCDebug(scriptengine) << qPrintable(message); | |
| 486 | 486 | emit printedMessage(message, getFilename()); |
| 487 | 487 | } |
| 488 | 488 | |
| 489 | +void ScriptEngine::clearDebugLogWindow() { | |
| 490 | + emit clearDebugWindow(); | |
| 491 | +} | |
| 492 | + | |
| 489 | 493 | // Even though we never pass AnimVariantMap directly to and from javascript, the queued invokeMethod of |
| 490 | 494 | // callAnimationStateHandler requires that the type be registered. |
| 491 | 495 | // These two are meaningful, if we ever do want to use them... |
| @@ -668,8 +672,18 @@ void ScriptEngine::init() { · 176 unmodified lines | ||
| 668 | 672 | registerGlobalObject("Mat4", &_mat4Library); |
| 669 | 673 | registerGlobalObject("Uuid", &_uuidLibrary); |
| 670 | 674 | registerGlobalObject("Messages", DependencyManager::get<MessagesClient>().data()); |
| 671 | − | |
| 672 | 675 | registerGlobalObject("File", new FileScriptingInterface(this)); |
| 676 | + registerGlobalObject("console", &_consoleScriptingInterface); | |
| 677 | + registerFunction("console", "info", ConsoleScriptingInterface::info, currentContext()->argumentCount()); | |
| 678 | + registerFunction("console", "log", ConsoleScriptingInterface::log, currentContext()->argumentCount()); | |
| 679 | + registerFunction("console", "debug", ConsoleScriptingInterface::debug, currentContext()->argumentCount()); | |
| 680 | + registerFunction("console", "warn", ConsoleScriptingInterface::warn, currentContext()->argumentCount()); | |
| 681 | + registerFunction("console", "error", ConsoleScriptingInterface::error, currentContext()->argumentCount()); | |
| 682 | + registerFunction("console", "exception", ConsoleScriptingInterface::exception, currentContext()->argumentCount()); | |
| 683 | + registerFunction("console", "assert", ConsoleScriptingInterface::assertion, currentContext()->argumentCount()); | |
| 684 | + registerFunction("console", "group", ConsoleScriptingInterface::group, 1); | |
| 685 | + registerFunction("console", "groupCollapsed", ConsoleScriptingInterface::groupCollapsed, 1); | |
| 686 | + registerFunction("console", "groupEnd", ConsoleScriptingInterface::groupEnd, 0); | |
| 673 | 687 | |
| 674 | 688 | qScriptRegisterMetaType(this, animVarMapToScriptValue, animVarMapFromScriptValue); |
| 675 | 689 | qScriptRegisterMetaType(this, resultHandlerToScriptValue, resultHandlerFromScriptValue); |