Skip to content

Commit

Permalink
VoiceCall: Make it work without Mer specific bits
Browse files Browse the repository at this point in the history
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
  • Loading branch information
Herrie82 committed May 27, 2019
1 parent c15b7f9 commit d9f246e
Show file tree
Hide file tree
Showing 10 changed files with 71 additions and 10 deletions.
4 changes: 4 additions & 0 deletions lib/src/src.pro
Expand Up @@ -5,6 +5,10 @@ QT = core dbus

CONFIG += c++11

enable-debug {
DEFINES += WANT_TRACE
}

HEADERS += \
common.h \
voicecallmanagerinterface.h \
Expand Down
9 changes: 8 additions & 1 deletion plugins/declarative/src/src.pro
Expand Up @@ -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 \
Expand Down
14 changes: 14 additions & 0 deletions plugins/declarative/src/voicecallmanager.cpp
@@ -1,7 +1,9 @@
#include "common.h"
#include "voicecallmanager.h"

#ifdef WITH_NGF
#include <NgfClient>
#endif

#include <QQmlInfo>
#include <QQmlEngine>
Expand All @@ -22,7 +24,9 @@ class VoiceCallManagerPrivate
voicecalls(NULL),
providers(NULL),
activeVoiceCall(NULL),
#ifdef WITH_NGF
ngf(0),
#endif
eventId(0),
connected(false)
{ /*...*/ }
Expand All @@ -36,7 +40,10 @@ class VoiceCallManagerPrivate

VoiceCallHandler* activeVoiceCall;

#ifdef WITH_NGF
Ngf::Client *ngf;
#endif

quint32 eventId;

bool connected;
Expand Down Expand Up @@ -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())
{
Expand Down Expand Up @@ -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;
}
Expand All @@ -303,7 +315,9 @@ bool VoiceCallManager::stopDtmfTone()

if (d->eventId > 0)
{
#ifdef WITH_NGF
d->ngf->stop(d->eventId);
#endif
d->eventId = 0;
}

Expand Down
4 changes: 4 additions & 0 deletions plugins/playback-manager/src/src.pro
Expand Up @@ -4,6 +4,10 @@ QT += dbus

DEFINES += PLUGIN_NAME=\\\"voicecall-playback-manager-plugin\\\"

enable-debug {
DEFINES += WANT_TRACE
}

HEADERS += \
playbackmanagerplugin.h

Expand Down
6 changes: 5 additions & 1 deletion plugins/plugins.pro
@@ -1,2 +1,6 @@
TEMPLATE = subdirs
SUBDIRS = declarative providers ngf playback-manager mce
SUBDIRS = declarative providers playback-manager mce

enable-ngf {
SUBDIRS += ngf
}
4 changes: 4 additions & 0 deletions plugins/providers/ofono/src/src.pro
Expand Up @@ -4,6 +4,10 @@ QT += dbus

PKGCONFIG += qofono-qt5

enable-debug {
DEFINES += WANT_TRACE
}

HEADERS += \
ofonovoicecallhandler.h \
ofonovoicecallprovider.h \
Expand Down
6 changes: 5 additions & 1 deletion plugins/providers/providers.pro
@@ -1,2 +1,6 @@
TEMPLATE = subdirs
SUBDIRS = ofono telepathy
SUBDIRS = ofono

enable-telepathy {
SUBDIRS += telepathy
}
1 change: 1 addition & 0 deletions rpm/voicecall-qt5.spec
Expand Up @@ -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
Expand Down
20 changes: 13 additions & 7 deletions src/src.pro
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
}
13 changes: 13 additions & 0 deletions src/voicecallmanager.cpp
Expand Up @@ -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
{
Expand All @@ -45,7 +51,10 @@ class VoiceCallManagerPrivate

AbstractVoiceCallHandler *activeVoiceCall;

#ifdef WITH_NEMO_DEVICELOCK
NemoDeviceLock::DeviceLock deviceLock;
#endif

QString audioMode;
bool isAudioRouted;
bool isMicrophoneMuted;
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit d9f246e

Please sign in to comment.