summaryrefslogtreecommitdiff
path: root/daemon/jskitmanager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'daemon/jskitmanager.cpp')
-rw-r--r--daemon/jskitmanager.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/daemon/jskitmanager.cpp b/daemon/jskitmanager.cpp
index 5c72acc..f6a3f24 100644
--- a/daemon/jskitmanager.cpp
+++ b/daemon/jskitmanager.cpp
@@ -5,7 +5,8 @@
#include "jskitobjects.h"
JSKitManager::JSKitManager(WatchConnector *watch, AppManager *apps, AppMsgManager *appmsg, Settings *settings, QObject *parent) :
- QObject(parent), _watch(watch), _apps(apps), _appmsg(appmsg), _settings(settings), _engine(0)
+ QObject(parent), l(metaObject()->className()),
+ _watch(watch), _apps(apps), _appmsg(appmsg), _settings(settings), _engine(0)
{
connect(_appmsg, &AppMsgManager::appStarted, this, &JSKitManager::handleAppStarted);
connect(_appmsg, &AppMsgManager::appStopped, this, &JSKitManager::handleAppStopped);
@@ -39,10 +40,10 @@ QString JSKitManager::describeError(QJSValue error)
void JSKitManager::showConfiguration()
{
if (_engine) {
- logger()->debug() << "requesting configuration";
+ qCDebug(l) << "requesting configuration";
_jspebble->invokeCallbacks("showConfiguration");
} else {
- logger()->warn() << "requested to show configuration, but JS engine is not running";
+ qCWarning(l) << "requested to show configuration, but JS engine is not running";
}
}
@@ -52,11 +53,11 @@ void JSKitManager::handleWebviewClosed(const QString &result)
QJSValue eventObj = _engine->newObject();
eventObj.setProperty("response", _engine->toScriptValue(result));
- logger()->debug() << "webview closed with the following result: " << result;
+ qCDebug(l) << "webview closed with the following result: " << result;
_jspebble->invokeCallbacks("webviewclosed", QJSValueList({eventObj}));
} else {
- logger()->warn() << "webview closed event, but JS engine is not running";
+ qCWarning(l) << "webview closed event, but JS engine is not running";
}
}
@@ -64,7 +65,7 @@ void JSKitManager::handleAppStarted(const QUuid &uuid)
{
AppInfo info = _apps->info(uuid);
if (!info.uuid().isNull() && info.isJSKit()) {
- logger()->debug() << "Preparing to start JSKit app" << info.uuid() << info.shortName();
+ qCDebug(l) << "Preparing to start JSKit app" << info.uuid() << info.shortName();
_curApp = info;
startJsApp();
}
@@ -74,7 +75,7 @@ void JSKitManager::handleAppStopped(const QUuid &uuid)
{
if (!_curApp.uuid().isNull()) {
if (_curApp.uuid() != uuid) {
- logger()->warn() << "Closed app with invalid UUID";
+ qCWarning(l) << "Closed app with invalid UUID";
}
stopJsApp();
@@ -85,10 +86,10 @@ void JSKitManager::handleAppStopped(const QUuid &uuid)
void JSKitManager::handleAppMessage(const QUuid &uuid, const QVariantMap &msg)
{
if (_curApp.uuid() == uuid) {
- logger()->debug() << "received a message for the current JSKit app";
+ qCDebug(l) << "received a message for the current JSKit app";
if (!_engine) {
- logger()->debug() << "but engine is stopped";
+ qCDebug(l) << "but engine is stopped";
return;
}
@@ -105,19 +106,19 @@ bool JSKitManager::loadJsFile(const QString &filename)
QFile file(filename);
if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
- logger()->warn() << "Failed to load JS file:" << file.fileName();
+ qCWarning(l) << "Failed to load JS file:" << file.fileName();
return false;
}
- logger()->debug() << "now parsing" << file.fileName();
+ qCDebug(l) << "now parsing" << file.fileName();
QJSValue result = _engine->evaluate(QString::fromUtf8(file.readAll()), file.fileName());
if (result.isError()) {
- logger()->warn() << "error while evaluating JS script:" << describeError(result);
+ qCWarning(l) << "error while evaluating JS script:" << describeError(result);
return false;
}
- logger()->debug() << "JS script evaluated";
+ qCDebug(l) << "JS script evaluated";
return true;
}
@@ -126,7 +127,7 @@ void JSKitManager::startJsApp()
{
if (_engine) stopJsApp();
if (_curApp.uuid().isNull()) {
- logger()->warn() << "Attempting to start JS app with invalid UUID";
+ qCWarning(l) << "Attempting to start JS app with invalid UUID";
return;
}
@@ -136,7 +137,7 @@ void JSKitManager::startJsApp()
_jsstorage = new JSKitLocalStorage(_curApp.uuid(), this);
_jsgeo = new JSKitGeolocation(this);
- logger()->debug() << "starting JS app";
+ qCDebug(l) << "starting JS app";
QJSValue globalObj = _engine->globalObject();
@@ -185,7 +186,7 @@ void JSKitManager::stopJsApp()
{
if (!_engine) return; // Nothing to do!
- logger()->debug() << "stopping JS app";
+ qCDebug(l) << "stopping JS app";
if (!_curApp.uuid().isNull()) {
_appmsg->clearMessageHandler(_curApp.uuid());