summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Sterna <tomek@xiaoka.com>2014-08-01 12:57:32 +0200
committerTomasz Sterna <tomek@xiaoka.com>2014-08-02 00:55:17 +0200
commit006d08310e5fafa8b66520318598122603e32d8c (patch)
tree7aeabca8467991449d69fbaa49994b2be6bae820
parent38370fcf6213e4c8961dae6e55bccb951795865f (diff)
Provide Settings object via constructor
-rw-r--r--daemon/daemon.cpp7
-rw-r--r--daemon/manager.cpp2
-rw-r--r--daemon/notificationmanager.cpp11
-rw-r--r--daemon/notificationmanager.h3
-rw-r--r--daemon/voicecallmanager.cpp4
-rw-r--r--daemon/voicecallmanager.h5
6 files changed, 13 insertions, 19 deletions
diff --git a/daemon/daemon.cpp b/daemon/daemon.cpp
index 520e8f2..252e715 100644
--- a/daemon/daemon.cpp
+++ b/daemon/daemon.cpp
@@ -77,12 +77,11 @@ int main(int argc, char *argv[])
Log4Qt::Logger::logger(QLatin1String("Main Logger"))->info() << argv[0] << APP_VERSION;
+ Settings settings;
watch::WatchConnector watch;
DBusConnector dbus;
- VoiceCallManager voice;
- NotificationManager notifications;
- Settings settings;
-
+ VoiceCallManager voice(&settings);
+ NotificationManager notifications(&settings);
Manager manager(&watch, &dbus, &voice, &notifications, &settings);
signal(SIGINT, signalhandler);
diff --git a/daemon/manager.cpp b/daemon/manager.cpp
index bdda77b..bd9fc4a 100644
--- a/daemon/manager.cpp
+++ b/daemon/manager.cpp
@@ -9,8 +9,6 @@ Manager::Manager(watch::WatchConnector *watch, DBusConnector *dbus, VoiceCallMan
QObject(0), watch(watch), dbus(dbus), voice(voice), notifications(notifications), commands(new WatchCommands(watch, this)),
settings(settings), notification(MNotification::DeviceEvent)
{
- notifications->setSettings(settings);;
-
connect(settings, SIGNAL(valueChanged(QString)), SLOT(onSettingChanged(const QString&)));
connect(settings, SIGNAL(valuesChanged()), SLOT(onSettingsChanged()));
//connect(settings, SIGNAL(silentWhenConnectedChanged(bool)), SLOT(onSilentWhenConnectedChanged(bool)));
diff --git a/daemon/notificationmanager.cpp b/daemon/notificationmanager.cpp
index ad2c98f..9050605 100644
--- a/daemon/notificationmanager.cpp
+++ b/daemon/notificationmanager.cpp
@@ -25,15 +25,15 @@ public:
bool connected;
};
-NotificationManager::NotificationManager(QObject *parent)
- : QObject(parent), d_ptr(new NotificationManagerPrivate(this))
+NotificationManager::NotificationManager(Settings *settings, QObject *parent)
+ : QObject(parent), d_ptr(new NotificationManagerPrivate(this)), settings(settings)
{
Q_D(NotificationManager);
QDBusConnection::sessionBus().registerObject("/org/freedesktop/Notifications", this, QDBusConnection::ExportAllSlots);
d->interface = new QDBusInterface("org.freedesktop.DBus",
"/org/freedesktop/DBus",
- "org.freedesktop.DBus");
+ "org.freedesktop.DBus");
d->interface->call("AddMatch", "interface='org.freedesktop.Notifications',member='Notify',type='method_call',eavesdrop='true'");
@@ -104,11 +104,6 @@ QStringHash NotificationManager::getCategoryParams(QString category)
return QStringHash();
}
-void NotificationManager::setSettings(Settings *settings)
-{
- this->settings = settings;
-}
-
void NotificationManager::Notify(const QString &app_name, uint replaces_id, const QString &app_icon,
const QString &summary, const QString &body, const QStringList &actions, const QVariantHash &hints, int expire_timeout)
{
diff --git a/daemon/notificationmanager.h b/daemon/notificationmanager.h
index 10c4d2e..ab9895a 100644
--- a/daemon/notificationmanager.h
+++ b/daemon/notificationmanager.h
@@ -18,7 +18,7 @@ class NotificationManager : public QObject
Q_PROPERTY(QDBusInterface* interface READ interface)
public:
- explicit NotificationManager(QObject *parent = 0);
+ explicit NotificationManager(Settings *settings, QObject *parent = 0);
~NotificationManager();
QDBusInterface* interface() const;
@@ -32,7 +32,6 @@ Q_SIGNALS:
public Q_SLOTS:
void Notify(const QString &app_name, uint replaces_id, const QString &app_icon, const QString &summary, const QString &body, const QStringList &actions, const QVariantHash &hints, int expire_timeout);
- void setSettings(Settings *settings);
protected Q_SLOTS:
void initialize(bool notifyError = false);
diff --git a/daemon/voicecallmanager.cpp b/daemon/voicecallmanager.cpp
index 21d3d49..419ecff 100644
--- a/daemon/voicecallmanager.cpp
+++ b/daemon/voicecallmanager.cpp
@@ -29,8 +29,8 @@ public:
bool connected;
};
-VoiceCallManager::VoiceCallManager(QObject *parent)
- : QObject(parent), d_ptr(new VoiceCallManagerPrivate(this))
+VoiceCallManager::VoiceCallManager(Settings *settings, QObject *parent)
+ : QObject(parent), d_ptr(new VoiceCallManagerPrivate(this)), settings(settings)
{
Q_D(VoiceCallManager);
d->interface = new QDBusInterface("org.nemomobile.voicecall",
diff --git a/daemon/voicecallmanager.h b/daemon/voicecallmanager.h
index c078e68..b7241ef 100644
--- a/daemon/voicecallmanager.h
+++ b/daemon/voicecallmanager.h
@@ -2,6 +2,7 @@
#define VOICECALLMANAGER_H
#include "voicecallhandler.h"
+#include "settings.h"
#include <QObject>
#include <QDBusInterface>
@@ -44,7 +45,7 @@ class VoiceCallManager : public QObject
Q_PROPERTY(bool isSpeakerMuted READ isSpeakerMuted WRITE setMuteSpeaker NOTIFY speakerMutedChanged)
public:
- explicit VoiceCallManager(QObject *parent = 0);
+ explicit VoiceCallManager(Settings *settings, QObject *parent = 0);
~VoiceCallManager();
QDBusInterface* interface() const;
@@ -100,6 +101,8 @@ protected Q_SLOTS:
private:
class VoiceCallManagerPrivate *d_ptr;
+ Settings *settings;
+
Q_DISABLE_COPY(VoiceCallManager)
Q_DECLARE_PRIVATE(VoiceCallManager)
};