Commit d9f246e8 authored by Herman van Hazendonk's avatar Herman van Hazendonk

VoiceCall: Make it work without Mer specific bits

Other distros such as LuneOS uses VoiceCall as well. To date LuneOS was
always maintaining patches to make sure that the Mer specific bits not
available in LuneOS were disabled.

Made the code more flexible so Voicecall can be used by simply enabling
or disabling some flags in the build and in this way a single codebase
can be shared between Mer and LuneOS for Voicecall.

Signed-off-by: Herman van Hazendonk github.com@herrie.org
parent c15b7f95
......@@ -5,6 +5,10 @@ QT = core dbus
CONFIG += c++11
enable-debug {
DEFINES += WANT_TRACE
}
HEADERS += \
common.h \
voicecallmanagerinterface.h \
......
......@@ -5,7 +5,14 @@ QT = core dbus qml multimedia
TARGET = voicecall
uri = org.nemomobile.voicecall
PKGCONFIG += ngf-qt5
enable-debug {
DEFINES += WANT_TRACE
}
enable-ngf {
PKGCONFIG += ngf-qt5
DEFINES += WITH_NGF
}
HEADERS += \
voicecallaudiorecorder.h \
......
#include "common.h"
#include "voicecallmanager.h"
#ifdef WITH_NGF
#include <NgfClient>
#endif
#include <QQmlInfo>
#include <QQmlEngine>
......@@ -22,7 +24,9 @@ public:
voicecalls(NULL),
providers(NULL),
activeVoiceCall(NULL),
#ifdef WITH_NGF
ngf(0),
#endif
eventId(0),
connected(false)
{ /*...*/ }
......@@ -36,7 +40,10 @@ public:
VoiceCallHandler* activeVoiceCall;
#ifdef WITH_NGF
Ngf::Client *ngf;
#endif
quint32 eventId;
bool connected;
......@@ -74,8 +81,10 @@ void VoiceCallManager::initialize(bool notifyError)
Q_D(VoiceCallManager);
bool success = false;
#ifdef WITH_NGF
d->ngf = new Ngf::Client(this);
d->ngf->connect();
#endif
if(d->interface->isValid())
{
......@@ -287,11 +296,14 @@ bool VoiceCallManager::startDtmfTone(const QString &tone)
QMap<QString, QVariant> properties;
properties.insert("tonegen.value", toneId);
#ifdef WITH_NGF
if (d->eventId > 0)
{
d->ngf->stop(d->eventId);
}
d->eventId = d->ngf->play("dtmf", properties);
#endif
return true;
}
......@@ -303,7 +315,9 @@ bool VoiceCallManager::stopDtmfTone()
if (d->eventId > 0)
{
#ifdef WITH_NGF
d->ngf->stop(d->eventId);
#endif
d->eventId = 0;
}
......
......@@ -4,6 +4,10 @@ QT += dbus
DEFINES += PLUGIN_NAME=\\\"voicecall-playback-manager-plugin\\\"
enable-debug {
DEFINES += WANT_TRACE
}
HEADERS += \
playbackmanagerplugin.h
......
TEMPLATE = subdirs
SUBDIRS = declarative providers ngf playback-manager mce
SUBDIRS = declarative providers playback-manager mce
enable-ngf {
SUBDIRS += ngf
}
......@@ -4,6 +4,10 @@ QT += dbus
PKGCONFIG += qofono-qt5
enable-debug {
DEFINES += WANT_TRACE
}
HEADERS += \
ofonovoicecallhandler.h \
ofonovoicecallprovider.h \
......
TEMPLATE = subdirs
SUBDIRS = ofono telepathy
SUBDIRS = ofono
enable-telepathy {
SUBDIRS += telepathy
}
......@@ -76,6 +76,7 @@ BuildRequires: pkgconfig(qofono-qt5)
%qmake5
qmake -qt=5 CONFIG+=enable-ngf CONFIG+=enable-audiopolicy CONFIG+=enable-telepathy CONFIG+=enable-nemo-devicelock CONFIG+=install-servicefiles
make %{?_smp_mflags}
%install
......
......@@ -5,7 +5,10 @@ CONFIG += link_pkgconfig
INCLUDEPATH += ../lib/src
PKGCONFIG += libresourceqt5 nemodevicelock
enable-nemo-devicelock {
PKGCONFIG += libresourceqt5 nemodevicelock
DEFINES += WITH_NEMO_DEVICELOCK
}
packagesExist(qt5-boostable) {
DEFINES += HAS_BOOSTER
......@@ -14,26 +17,28 @@ packagesExist(qt5-boostable) {
warning("qt5-boostable not available; startup times will be slower")
}
QT += multimedia # for basic ringtone plugin.
LIBS += -L../lib/src -lvoicecall
HEADERS += \
dbus/voicecallmanagerdbusservice.h \
basicvoicecallconfigurator.h \
audiocallpolicyproxy.h \
voicecallmanager.h \
basicringtonenotificationprovider.h
SOURCES += \
dbus/voicecallmanagerdbusservice.cpp \
basicvoicecallconfigurator.cpp \
audiocallpolicyproxy.cpp \
voicecallmanager.cpp \
main.cpp \
basicringtonenotificationprovider.cpp
enable-audiopolicy {
HEADERS += audiocallpolicyproxy.h
SOURCES += audiocallpolicyproxy.cpp
DEFINES += WITH_AUDIOPOLICY
}
target.path = /usr/bin
INSTALLS += target
......@@ -43,5 +48,6 @@ OTHER_FILES += voicecall-manager.desktop voicecall-manager.service
systemd_service_entry.files = voicecall-manager.service
systemd_service_entry.path = /usr/lib/systemd/user
INSTALLS += autostart_entry systemd_service_entry
install-servicefiles {
INSTALLS += systemd_service_entry
}
......@@ -23,9 +23,15 @@
#include <QHash>
#include <QUuid>
#include <QSettings>
#ifdef WITH_NEMO_DEVICELOCK
#include <nemo-devicelock/devicelock.h>
#endif
#ifdef WITH_AUDIOPOLICY
#include "audiocallpolicyproxy.h"
#endif
class VoiceCallManagerPrivate
{
......@@ -45,7 +51,10 @@ public:
AbstractVoiceCallHandler *activeVoiceCall;
#ifdef WITH_NEMO_DEVICELOCK
NemoDeviceLock::DeviceLock deviceLock;
#endif
QString audioMode;
bool isAudioRouted;
bool isMicrophoneMuted;
......@@ -327,8 +336,12 @@ void VoiceCallManager::onVoiceCallAdded(AbstractVoiceCallHandler *handler)
TRACE
Q_D(VoiceCallManager);
#ifdef WITH_NEMO_DEVICELOCK
if (!handler->isEmergency()
&& d->deviceLock.state() == NemoDeviceLock::DeviceLock::ManagerLockout) {
#else
if (!handler->isEmergency()) {
#endif
handler->hangup();
return;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment