summaryrefslogtreecommitdiff
path: root/daemon/manager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'daemon/manager.cpp')
-rw-r--r--daemon/manager.cpp52
1 files changed, 26 insertions, 26 deletions
diff --git a/daemon/manager.cpp b/daemon/manager.cpp
index 32b313f..6498c68 100644
--- a/daemon/manager.cpp
+++ b/daemon/manager.cpp
@@ -6,7 +6,7 @@
#include "watch_adaptor.h"
Manager::Manager(Settings *settings, QObject *parent) :
- QObject(parent), settings(settings),
+ QObject(parent), l(metaObject()->className()), settings(settings),
proxy(new PebbledProxy(this)),
watch(new WatchConnector(this)),
dbus(new DBusConnector(this)),
@@ -80,7 +80,7 @@ Manager::Manager(Settings *settings, QObject *parent) :
notification.setImage("icon-system-bluetooth-device");
if (btDevice.isValid()) {
- logger()->debug() << "BT local name:" << btDevice.name();
+ qCDebug(l) << "BT local name:" << btDevice.name();
connect(dbus, SIGNAL(pebbleChanged()), SLOT(onPebbleChanged()));
dbus->findPebble();
}
@@ -92,12 +92,12 @@ Manager::~Manager()
void Manager::onSettingChanged(const QString &key)
{
- logger()->debug() << __FUNCTION__ << key << ":" << settings->property(qPrintable(key));
+ qCDebug(l) << __FUNCTION__ << key << ":" << settings->property(qPrintable(key));
}
void Manager::onSettingsChanged()
{
- logger()->warn() << __FUNCTION__ << "Not implemented!";
+ qCWarning(l) << __FUNCTION__ << "Not implemented!";
}
void Manager::onPebbleChanged()
@@ -105,7 +105,7 @@ void Manager::onPebbleChanged()
const QVariantMap & pebble = dbus->pebble();
QString name = pebble["Name"].toString();
if (name.isEmpty()) {
- logger()->debug() << "Pebble gone";
+ qCDebug(l) << "Pebble gone";
} else {
watch->deviceConnect(name, pebble["Address"].toString());
}
@@ -116,23 +116,23 @@ void Manager::onConnectedChanged()
QString message = QString("%1 %2")
.arg(watch->name().isEmpty() ? "Pebble" : watch->name())
.arg(watch->isConnected() ? "connected" : "disconnected");
- logger()->debug() << message;
+ qCDebug(l) << message;
if (notification.isPublished()) notification.remove();
notification.setBody(message);
if (!notification.publish()) {
- logger()->debug() << "Failed publishing notification";
+ qCDebug(l) << "Failed publishing notification";
}
}
void Manager::onActiveVoiceCallChanged()
{
- logger()->debug() << "Manager::onActiveVoiceCallChanged()";
+ qCDebug(l) << "Manager::onActiveVoiceCallChanged()";
QVariant incomingCallNotification = settings->property("incomingCallNotification");
if (incomingCallNotification.isValid() && !incomingCallNotification.toBool()) {
- logger()->debug() << "Ignoring ActiveVoiceCallChanged because of setting!";
+ qCDebug(l) << "Ignoring ActiveVoiceCallChanged because of setting!";
return;
}
@@ -148,12 +148,12 @@ void Manager::onActiveVoiceCallStatusChanged()
{
VoiceCallHandler* handler = voice->activeVoiceCall();
if (!handler) {
- logger()->debug() << "ActiveVoiceCall destroyed";
+ qCDebug(l) << "ActiveVoiceCall destroyed";
watch->endPhoneCall();
return;
}
- logger()->debug() << "handlerId:" << handler->handlerId()
+ qCDebug(l) << "handlerId:" << handler->handlerId()
<< "providerId:" << handler->providerId()
<< "status:" << handler->status()
<< "statusText:" << handler->statusText()
@@ -161,28 +161,28 @@ void Manager::onActiveVoiceCallStatusChanged()
<< "incoming:" << handler->isIncoming();
if (!watch->isConnected()) {
- logger()->debug() << "Watch is not connected";
+ qCDebug(l) << "Watch is not connected";
return;
}
switch ((VoiceCallHandler::VoiceCallStatus)handler->status()) {
case VoiceCallHandler::STATUS_ALERTING:
case VoiceCallHandler::STATUS_DIALING:
- logger()->debug() << "Tell outgoing:" << handler->lineId();
+ qCDebug(l) << "Tell outgoing:" << handler->lineId();
watch->ring(handler->lineId(), findPersonByNumber(handler->lineId()), false);
break;
case VoiceCallHandler::STATUS_INCOMING:
case VoiceCallHandler::STATUS_WAITING:
- logger()->debug() << "Tell incoming:" << handler->lineId();
+ qCDebug(l) << "Tell incoming:" << handler->lineId();
watch->ring(handler->lineId(), findPersonByNumber(handler->lineId()));
break;
case VoiceCallHandler::STATUS_NULL:
case VoiceCallHandler::STATUS_DISCONNECTED:
- logger()->debug() << "Endphone";
+ qCDebug(l) << "Endphone";
watch->endPhoneCall();
break;
case VoiceCallHandler::STATUS_ACTIVE:
- logger()->debug() << "Startphone";
+ qCDebug(l) << "Startphone";
watch->startPhoneCall();
break;
case VoiceCallHandler::STATUS_HELD:
@@ -208,7 +208,7 @@ QString Manager::findPersonByNumber(QString number)
void Manager::onVoiceError(const QString &message)
{
- logger()->error() << "Error:" << message;
+ qCCritical(l) << "Error:" << message;
}
@@ -262,11 +262,11 @@ QString Manager::getCurrentProfile() const
QDBusMessage::createMethodCall("com.nokia.profiled", "/com/nokia/profiled", "com.nokia.profiled", "get_profile"));
if (profile.isValid()) {
QString currentProfile = profile.value();
- logger()->debug() << "Got profile" << currentProfile;
+ qCDebug(l) << "Got profile" << currentProfile;
return currentProfile;
}
- logger()->error() << profile.error().message();
+ qCCritical(l) << profile.error().message();
return QString();
}
@@ -294,11 +294,11 @@ void Manager::applyProfile()
<< newProfile);
if (res.isValid()) {
if (!res.value()) {
- logger()->error() << "Unable to set profile" << newProfile;
+ qCCritical(l) << "Unable to set profile" << newProfile;
}
}
else {
- logger()->error() << res.error().message();
+ qCCritical(l) << res.error().message();
}
}
}
@@ -309,11 +309,11 @@ void Manager::transliterateMessage(const QString &text)
UErrorCode status = U_ZERO_ERROR;
transliterator.reset(icu::Transliterator::createInstance(icu::UnicodeString::fromUTF8("Any-Latin; Latin-ASCII"),UTRANS_FORWARD, status));
if (U_FAILURE(status)) {
- logger()->warn() << "Error creaing ICU Transliterator \"Any-Latin; Latin-ASCII\":" << u_errorName(status);
+ qCWarning(l) << "Error creaing ICU Transliterator \"Any-Latin; Latin-ASCII\":" << u_errorName(status);
}
}
if (!transliterator.isNull()) {
- logger()->debug() << "String before transliteration:" << text;
+ qCDebug(l) << "String before transliteration:" << text;
icu::UnicodeString uword = icu::UnicodeString::fromUTF8(text.toStdString());
transliterator->transliterate(uword);
@@ -322,7 +322,7 @@ void Manager::transliterateMessage(const QString &text)
uword.toUTF8String(translited);
const_cast<QString&>(text) = QString::fromStdString(translited);
- logger()->debug() << "String after transliteration:" << text;
+ qCDebug(l) << "String after transliteration:" << text;
}
}
@@ -413,14 +413,14 @@ QString PebbledProxy::StartAppConfiguration(const QString &uuid)
QDBusConnection conn = connection();
if (manager()->currentAppUuid != uuid) {
- logger()->warn() << "Called StartAppConfiguration but the uuid" << uuid << "is not running";
+ qCWarning(l) << "Called StartAppConfiguration but the uuid" << uuid << "is not running";
sendErrorReply(msg.interface() + ".Error.AppNotRunning",
"The requested app is not currently opened in the watch");
return QString();
}
if (!manager()->js->isJSKitAppRunning()) {
- logger()->warn() << "Called StartAppConfiguration but the uuid" << uuid << "is not a JS app";
+ qCWarning(l) << "Called StartAppConfiguration but the uuid" << uuid << "is not a JS app";
sendErrorReply(msg.interface() + ".Error.JSNotActive",
"The requested app is not a PebbleKit JS application");
return QString();