I have made the following changes intended for : CE:Apps / voicecall Please review and accept or decline. BOSS has already run some checks on this request. See the "Messages from BOSS" section below.
https://build.pub.meego.com//request/show/5416 Thank You, tswindell [This message was auto-generated] --- Request # 5416: Messages from BOSS: State: review at 2012-08-05T19:10:58 by bossbot Reviews: accepted by bossbot : Prechecks succeeded. new for CE-maintainers : Please replace this text with a review and approve/reject the review (not the SR). BOSS will take care of the rest Changes: submit: home:tswindell:CE:Apps / voicecall -> CE:Apps / voicecall changes files: -------------- --- voicecall.changes +++ voicecall.changes @@ -0,0 +1,3 @@ +* Sun Aug 05 2012 Tom Swindell <[email protected]> - 0.1.4 +- Updated sources to latest upstream version. + old: ---- voicecall-0.1.3.tar.bz2 new: ---- voicecall-0.1.4.tar.gz spec files: ----------- --- voicecall.spec +++ voicecall.spec @@ -1,11 +1,11 @@ Name: voicecall Summary: Voice Call Suite -Version: 0.1.3 -Release: 2 +Version: 0.1.4 +Release: 1 Group: Communications/Telephony and IM License: Apache License, Version 2.0 -URL: http://gitorious.org/voicecall/voicecall -Source0: %{name}-%{version}.tar.bz2 +URL: http://github.com/nemomobile/voicecall +Source0: %{name}-%{version}.tar.gz Requires: tone-generator BuildRequires: pkgconfig(QtOpenGL) BuildRequires: pkgconfig(QtDeclarative) @@ -13,6 +13,8 @@ BuildRequires: pkgconfig(libresourceqt1) BuildRequires: pkgconfig(libpulse-mainloop-glib) BuildRequires: pkgconfig(ofono-qt) +BuildRequires: pkgconfig(TelepathyQt4) + Obsoletes: meego-handset-dialer < 0.2.4 Provides: meego-handset-dialer >= 0.2.4 @@ -48,6 +50,7 @@ %{_libdir}/voicecall/plugins/libvoicecall-ofono-plugin.so %{_libdir}/voicecall/plugins/libvoicecall-pulseaudio-plugin.so %{_libdir}/voicecall/plugins/libvoicecall-tonegend-plugin.so +%{_libdir}/voicecall/plugins/libvoicecall-telepathy-plugin.so %{_libdir}/qt4/imports/stage/rubyx/voicecall/libvoicecall.so %{_libdir}/qt4/imports/stage/rubyx/voicecall/qmldir %{_datadir}/voicecall-ui/qml other changes: -------------- ++++++ voicecall-0.1.3.tar.bz2 -> voicecall-0.1.4.tar.gz --- lib/src/abstractvoicecallprovider.h +++ lib/src/abstractvoicecallprovider.h @@ -47,7 +47,6 @@ void voiceCallsChanged(); void voiceCallAdded(AbstractVoiceCallHandler *handler); void voiceCallRemoved(const QString &handlerId); - void incomingVoiceCall(AbstractVoiceCallHandler *handler); public Q_SLOTS: virtual bool dial(const QString &msisdn) = 0; --- lib/src/dbus/voicecallmanagerdbusadapter.cpp +++ lib/src/dbus/voicecallmanagerdbusadapter.cpp @@ -53,8 +53,8 @@ QObject::connect(d->manager, SIGNAL(providersChanged()), SIGNAL(providersChanged())); QObject::connect(d->manager, SIGNAL(voiceCallsChanged()), SIGNAL(voiceCallsChanged())); QObject::connect(d->manager, SIGNAL(activeVoiceCallChanged()), SIGNAL(activeVoiceCallChanged())); - - QObject::connect(d->manager, SIGNAL(incomingVoiceCall(AbstractVoiceCallHandler*)), SLOT(onIncomingVoiceCall(AbstractVoiceCallHandler*))); // DEPRECATED + QObject::connect(d->manager, SIGNAL(muteMicrophoneChanged()), SIGNAL(muteMicrophoneChanged())); + QObject::connect(d->manager, SIGNAL(muteRingtoneChanged()), SIGNAL(muteRingtoneChanged())); } QStringList VoiceCallManagerDBusAdapter::providers() const @@ -70,6 +70,19 @@ return results; } +QStringList VoiceCallManagerDBusAdapter::voiceCalls() const +{ + TRACE + QStringList results; + + foreach(AbstractVoiceCallHandler *handler, d->manager->voiceCalls()) + { + results.append(handler->handlerId()); + } + + return results; +} + QString VoiceCallManagerDBusAdapter::activeVoiceCall() const { TRACE @@ -80,17 +93,30 @@ return QString::null; } -QStringList VoiceCallManagerDBusAdapter::voiceCalls() const +bool VoiceCallManagerDBusAdapter::muteMicrophone() const { TRACE - QStringList results; + return d->manager->muteMicrophone(); +} - foreach(AbstractVoiceCallHandler *handler, d->manager->voiceCalls()) - { - results.append(handler->handlerId()); - } +bool VoiceCallManagerDBusAdapter::muteRingtone() const +{ + TRACE + return d->manager->muteRingtone(); +} - return results; +bool VoiceCallManagerDBusAdapter::setMuteMicrophone(bool on) +{ + TRACE + d->manager->setMuteMicrophone(on); + return true; +} + +bool VoiceCallManagerDBusAdapter::setMuteRingtone(bool on) +{ + TRACE + d->manager->setMuteRingtone(on); + return true; } bool VoiceCallManagerDBusAdapter::dial(const QString &provider, const QString &msisdn) @@ -106,26 +132,16 @@ return true; } -void VoiceCallManagerDBusAdapter::silenceNotifications() -{ - TRACE - d->manager->silenceNotifications(); -} - -void VoiceCallManagerDBusAdapter::startDtmfTone(const QString &tone) +bool VoiceCallManagerDBusAdapter::startDtmfTone(const QString &tone) { TRACE d->manager->startDtmfTone(tone, 100); + return true; } -void VoiceCallManagerDBusAdapter::stopDtmfTone() +bool VoiceCallManagerDBusAdapter::stopDtmfTone() { TRACE d->manager->stopDtmfTone(); -} - -void VoiceCallManagerDBusAdapter::onIncomingVoiceCall(AbstractVoiceCallHandler *handler) -{ - TRACE - emit this->incomingVoiceCall(handler->provider()->providerId(), handler->handlerId()); + return true; } --- lib/src/dbus/voicecallmanagerdbusadapter.h +++ lib/src/dbus/voicecallmanagerdbusadapter.h @@ -35,9 +35,13 @@ Q_CLASSINFO("D-Bus Interface", "stage.rubyx.voicecall.VoiceCallManager") Q_PROPERTY(QStringList providers READ providers NOTIFY providersChanged) - Q_PROPERTY(QString activeVoiceCall READ activeVoiceCall NOTIFY activeVoiceCallChanged) Q_PROPERTY(QStringList voiceCalls READ voiceCalls NOTIFY voiceCallsChanged) + Q_PROPERTY(QString activeVoiceCall READ activeVoiceCall NOTIFY activeVoiceCallChanged) + + Q_PROPERTY(bool muteMicrophone READ muteMicrophone WRITE setMuteMicrophone NOTIFY muteMicrophoneChanged) + Q_PROPERTY(bool muteRingtone READ muteRingtone WRITE setMuteRingtone NOTIFY muteRingtoneChanged) + public: explicit VoiceCallManagerDBusAdapter(QObject *parent = 0); ~VoiceCallManagerDBusAdapter(); @@ -45,27 +49,31 @@ void configure(VoiceCallManagerInterface *manager); QStringList providers() const; - QString activeVoiceCall() const; QStringList voiceCalls() const; + QString activeVoiceCall() const; + + bool muteMicrophone() const; + bool muteRingtone() const; + Q_SIGNALS: void error(const QString &message); void providersChanged(); + void voiceCallsChanged(); void activeVoiceCallChanged(); - void voiceCallsChanged(); - void incomingVoiceCall(const QString &providerId, const QString &callId); + + void muteMicrophoneChanged(); + void muteRingtoneChanged(); public Q_SLOTS: bool dial(const QString &provider, const QString &msisdn); - void silenceNotifications(); - - void startDtmfTone(const QString &tone); - void stopDtmfTone(); + bool setMuteMicrophone(bool on = true); + bool setMuteRingtone(bool on = true); -protected Q_SLOTS: - void onIncomingVoiceCall(AbstractVoiceCallHandler *handler); + bool startDtmfTone(const QString &tone); + bool stopDtmfTone(); private: class VoiceCallManagerDBusAdapterPrivate *d; --- lib/src/voicecallmanagerinterface.h +++ lib/src/voicecallmanagerinterface.h @@ -36,6 +36,9 @@ Q_PROPERTY(AbstractVoiceCallHandler* activeVoiceCall READ activeVoiceCall NOTIFY activeVoiceCallChanged) + Q_PROPERTY(bool muteMicrophone READ muteMicrophone WRITE setMuteMicrophone NOTIFY muteMicrophoneChanged) + Q_PROPERTY(bool muteRingtone READ muteRingtone WRITE setMuteRingtone NOTIFY muteRingtoneChanged) + public: typedef enum { TONE_DIAL, @@ -60,6 +63,9 @@ virtual AbstractVoiceCallHandler* activeVoiceCall() const = 0; + virtual bool muteMicrophone() const = 0; + virtual bool muteRingtone() const = 0; + virtual QString errorString() const = 0; Q_SIGNALS: @@ -75,7 +81,11 @@ void activeVoiceCallChanged(); - void silenceRingtoneNotification(); + void muteMicrophoneChanged(); + void muteRingtoneChanged(); + + void setMuteMicrophoneRequested(bool on); + void setMuteRingtoneRequested(bool on); void startEventToneRequested(ToneType type, int volume); void stopEventToneRequested(); @@ -91,7 +101,8 @@ virtual bool dial(const QString &providerId, const QString &msisdn) = 0; - virtual void silenceNotifications() = 0; + virtual void setMuteMicrophone(bool on = true) = 0; + virtual void setMuteRingtone(bool on = true) = 0; virtual void startEventTone(ToneType type, int volume) = 0; virtual void stopEventTone() = 0; --- packaging/voicecall.spec +++ packaging/voicecall.spec @@ -1,10 +1,10 @@ Name: voicecall Summary: Voice Call Suite Version: 0.1.3 -Release: 1 +Release: 2 Group: Communications/Telephony and IM License: Apache License, Version 2.0 -URL: http://gitorious.org/voicecall-manager +URL: http://gitorious.org/voicecall/voicecall Source0: %{name}-%{version}.tar.bz2 Requires: tone-generator BuildRequires: pkgconfig(QtOpenGL) @@ -13,8 +13,10 @@ BuildRequires: pkgconfig(libresourceqt1) BuildRequires: pkgconfig(libpulse-mainloop-glib) BuildRequires: pkgconfig(ofono-qt) +BuildRequires: pkgconfig(TelepathyQt4) -%changelog +Obsoletes: meego-handset-dialer < 0.2.4 +Provides: meego-handset-dialer >= 0.2.4 %description Next Generation Dialer Application for Nemo Mobile @@ -22,30 +24,15 @@ %prep %setup -q -n %{name}-%{version} -# >> setup -# << setup - %build unset LD_AS_NEEDED -# >> build pre -# << build pre - %qmake - make %{?jobs:-j%jobs} -# >> build post -# << build post - %install rm -rf %{buildroot} -# >> install pre -# << install pre %qmake_install -# >> install post -# << install post - %post /sbin/ldconfig @@ -63,11 +50,11 @@ %{_libdir}/voicecall/plugins/libvoicecall-ofono-plugin.so %{_libdir}/voicecall/plugins/libvoicecall-pulseaudio-plugin.so %{_libdir}/voicecall/plugins/libvoicecall-tonegend-plugin.so +%{_libdir}/voicecall/plugins/libvoicecall-telepathy-plugin.so %{_libdir}/qt4/imports/stage/rubyx/voicecall/libvoicecall.so %{_libdir}/qt4/imports/stage/rubyx/voicecall/qmldir %{_datadir}/voicecall-ui/qml %{_datadir}/applications/voicecall-ui.desktop %config %{_sysconfdir}/xdg/autostart/voicecall-manager.desktop %config %{_sysconfdir}/xdg/autostart/voicecall-ui-prestart.desktop -# >> files -# << files + --- plugins/declarative/src/voicecallmanager.cpp +++ plugins/declarative/src/voicecallmanager.cpp @@ -10,6 +10,7 @@ public: VoiceCallManagerPrivate() : interface(NULL), + tonegend(NULL), voicecalls(NULL), providers(NULL), activeVoiceCall(NULL), @@ -17,6 +18,7 @@ { /*...*/ } QDBusInterface *interface; + QDBusInterface *tonegend; VoiceCallModel *voicecalls; VoiceCallProviderModel *providers; @@ -35,6 +37,11 @@ "stage.rubyx.voicecall.VoiceCallManager", QDBusConnection::sessionBus(), this); + d->tonegend = new QDBusInterface("com.Nokia.Telephony.Tones", + "/com/Nokia/Telephony/Tones", + "com.Nokia.Telephony.Tones", + QDBusConnection::systemBus(), + this); d->voicecalls = new VoiceCallModel(this); d->providers = new VoiceCallProviderModel(this); @@ -60,6 +67,8 @@ success &= QObject::connect(d->interface, SIGNAL(voiceCallsChanged()), SLOT(onVoiceCallsChanged())); success &= QObject::connect(d->interface, SIGNAL(providersChanged()), SLOT(onProvidersChanged())); success &= QObject::connect(d->interface, SIGNAL(activeVoiceCallChanged()), SLOT(onActiveVoiceCallChanged())); + success &= QObject::connect(d->interface, SIGNAL(muteMicrophoneChanged()), SIGNAL(muteMicrophoneChanged())); + success &= QObject::connect(d->interface, SIGNAL(muteRingtoneChanged()), SIGNAL(muteRingtoneChanged())); this->onActiveVoiceCallChanged(); } @@ -89,12 +98,33 @@ return d->providers; } +QString VoiceCallManager::defaultProviderId() const +{ + TRACE + if(d->providers->count() == 0) return QString::null; + return d->providers->id(0); //TODO: Add support for select default voice call provider. +} + VoiceCallHandler* VoiceCallManager::activeVoiceCall() const { TRACE return d->activeVoiceCall; } +bool VoiceCallManager::muteMicrophone() const +{ + TRACE + QDBusPendingReply<bool> reply = d->interface->call("muteMicrophone"); + return reply.isError() ? false : reply.value(); +} + +bool VoiceCallManager::muteRingtone() const +{ + TRACE + QDBusPendingReply<bool> reply = d->interface->call("muteRingtone"); + return reply.isError() ? false : reply.value(); +} + void VoiceCallManager::dial(const QString &provider, const QString &msisdn) { TRACE @@ -104,6 +134,13 @@ QObject::connect(watcher, SIGNAL(finished(QDBusPendingCallWatcher*)), SLOT(onPendingCallFinished(QDBusPendingCallWatcher*))); } +bool VoiceCallManager::setMuteMicrophone(bool on) +{ + TRACE + QDBusPendingReply<bool> reply = d->interface->call("setMuteMicrophone", on); + return reply.isError() ? false : reply.value(); +} + bool VoiceCallManager::setMuteRingtone(bool on) { TRACE @@ -114,15 +151,29 @@ bool VoiceCallManager::startDtmfTone(const QString &tone) { TRACE - QDBusPendingReply<bool> reply = d->interface->call("startDtmfTone", tone); - return reply.isError() ? false : reply.value(); + bool ok = true; + unsigned int toneId = tone.toInt(&ok); + + if(!ok) + { + if (tone == "*") toneId = 10; + else if(tone == "#") toneId = 11; + else if(tone == "A") toneId = 12; + else if(tone == "B") toneId = 13; + else if(tone == "C") toneId = 14; + else if(tone == "D") toneId = 15; + else return false; + } + + d->tonegend->call("StartEventTone", toneId, 0, (unsigned int)0); + return true; } bool VoiceCallManager::stopDtmfTone() { TRACE - QDBusPendingReply<bool> reply = d->interface->call("stopDtmfTone"); - return reply.isError() ? false : reply.value(); + d->tonegend->call("StopTone"); + return true; } void VoiceCallManager::onVoiceCallsChanged() --- plugins/declarative/src/voicecallmanager.h +++ plugins/declarative/src/voicecallmanager.h @@ -20,8 +20,11 @@ Q_PROPERTY(VoiceCallModel* voiceCalls READ voiceCalls NOTIFY voiceCallsChanged) Q_PROPERTY(VoiceCallProviderModel* providers READ providers NOTIFY providersChanged) + Q_PROPERTY(QString defaultProviderId READ defaultProviderId NOTIFY defaultProviderChanged) + Q_PROPERTY(VoiceCallHandler* activeVoiceCall READ activeVoiceCall NOTIFY activeVoiceCallChanged) + Q_PROPERTY(bool muteMicrophone READ muteMicrophone WRITE setMuteMicrophone NOTIFY muteMicrophoneChanged) Q_PROPERTY(bool muteRingtone READ muteRingtone WRITE setMuteRingtone NOTIFY muteRingtoneChanged) public: @@ -33,8 +36,11 @@ VoiceCallModel* voiceCalls() const; VoiceCallProviderModel* providers() const; + QString defaultProviderId() const; + VoiceCallHandler* activeVoiceCall() const; + bool muteMicrophone() const; bool muteRingtone() const; Q_SIGNALS: @@ -43,13 +49,17 @@ void providersChanged(); void voiceCallsChanged(); + void defaultProviderChanged(); + void activeVoiceCallChanged(); + void muteMicrophoneChanged(); void muteRingtoneChanged(); public Q_SLOTS: void dial(const QString &providerId, const QString &msisdn); + bool setMuteMicrophone(bool on = true); bool setMuteRingtone(bool on = true); bool startDtmfTone(const QString &tone); @@ -58,8 +68,8 @@ protected Q_SLOTS: void initialize(bool notifyError = false); - void onVoiceCallsChanged(); void onProvidersChanged(); + void onVoiceCallsChanged(); void onActiveVoiceCallChanged(); void onPendingCallFinished(QDBusPendingCallWatcher *watcher); --- plugins/declarative/src/voicecallplugin.cpp +++ plugins/declarative/src/voicecallplugin.cpp @@ -19,4 +19,3 @@ } Q_EXPORT_PLUGIN2(voicecall, VoiceCallPlugin) - --- plugins/declarative/src/voicecallprovidermodel.h +++ plugins/declarative/src/voicecallprovidermodel.h @@ -58,15 +58,15 @@ int count() const; int rowCount(const QModelIndex &parent) const; - QVariant data(const QModelIndex &instance, int role) const; + QVariant data(const QModelIndex &index, int role) const; Q_SIGNALS: void countChanged(); public Q_SLOTS: - QString id(int instance); - QString type(int instance); - QString label(int instance); + QString id(int index); + QString type(int index); + QString label(int index); protected Q_SLOTS: void onProvidersChanged(); --- plugins/ofono/src/ofonovoicecallprovider.cpp +++ plugins/ofono/src/ofonovoicecallprovider.cpp @@ -199,11 +199,6 @@ emit this->voiceCallsChanged(); emit this->voiceCallAdded(handler); - - if(handler->status() == OfonoVoiceCallHandler::STATUS_INCOMING) - { - emit this->incomingVoiceCall(handler); - } } void OfonoVoiceCallProvider::onCallRemoved(const QString &call) --- plugins/ofono/src/src.pro +++ plugins/ofono/src/src.pro @@ -4,13 +4,13 @@ QT = core dbus CONFIG += plugin link_pkgconfig +DEFINES += WANT_TRACE + INCLUDEPATH += ../../../lib/src LIBS += -L../../../lib/src -lvoicecall PKGCONFIG += ofono-qt -DEFINES += WANT_TRACE - HEADERS += \ common.h \ ofonovoicecallhandler.h \ --- plugins/plugins.pro +++ plugins/plugins.pro @@ -1,3 +1,3 @@ TEMPLATE = subdirs CONFIG = ordered -SUBDIRS = declarative ofono pulseaudio tonegend +SUBDIRS = declarative ofono pulseaudio tonegend telepathy --- plugins/pulseaudio/pulseaudio.pro +++ plugins/pulseaudio/pulseaudio.pro @@ -1,5 +1,4 @@ TEMPLATE = subdirs -CONFIG = ordered SUBDIRS = src OTHER_FILES += LICENSE --- plugins/pulseaudio/src/pacontrol.cpp +++ plugins/pulseaudio/src/pacontrol.cpp @@ -199,9 +199,12 @@ : QObject(parent) { m_manager = manager; + currentSource = NULL; + currentSink = NULL; status = SUCCESS; m_paState = false; m_isInitialized = false; + } PAControl::~PAControl() @@ -608,6 +611,8 @@ { paControl->routeSourceWithSink(source, speaker); paControl->routeSourceWithSink(mic, sink); + currentSource = mic; + currentSink = speaker; DEBUG_T("Create loopback modules successful"); } else @@ -637,6 +642,8 @@ } } + currentSource = NULL; + currentSink = NULL; m_audioRouted = false; m_btSourceReady = false; m_btSinkReady = false; --- plugins/pulseaudio/src/pacontrol.h +++ plugins/pulseaudio/src/pacontrol.h @@ -72,6 +72,9 @@ QList<PADevice*> sinkList; QList<PAModule*> moduleList; + PADevice *currentSource; + PADevice *currentSink; + public Q_SLOTS: void routeAudio(); void unrouteAudio(); --- plugins/pulseaudio/src/pulseaudioroutingplugin.cpp +++ plugins/pulseaudio/src/pulseaudioroutingplugin.cpp @@ -61,6 +61,7 @@ d->manager = manager; d->control = PAControl::instance(d->manager); QObject::connect(d->manager, SIGNAL(voiceCallsChanged()), d->control, SLOT(onCallsChanged())); + QObject::connect(d->manager, SIGNAL(setMuteMicrophoneRequested(bool)), SLOT(onSetMuteMicrophone(bool))); return true; } @@ -87,4 +88,10 @@ TRACE } +void PulseAudioRoutingPlugin::onSetMuteMicrophone(bool on) +{ + TRACE + d->control->toggleMuteSource(d->control->currentSource, on); +} + Q_EXPORT_PLUGIN2(voicecall-pulseaudio-plugin, PulseAudioRoutingPlugin) --- plugins/pulseaudio/src/pulseaudioroutingplugin.h +++ plugins/pulseaudio/src/pulseaudioroutingplugin.h @@ -31,6 +31,9 @@ bool resume(); void finalize(); +protected Q_SLOTS: + void onSetMuteMicrophone(bool on = true); + private: class PulseAudioRoutingPluginPrivate *d; }; --- plugins/pulseaudio/src/src.pro +++ plugins/pulseaudio/src/src.pro @@ -4,6 +4,8 @@ QT = core CONFIG += plugin link_pkgconfig +DEFINES += WANT_TRACE + INCLUDEPATH += ../../../lib/src LIBS += -L../../../lib/src -lvoicecall --- plugins/telepathy +++ plugins/telepathy +(directory) --- plugins/telepathy/src +++ plugins/telepathy/src +(directory) --- plugins/telepathy/src/src.pro +++ plugins/telepathy/src/src.pro @@ -0,0 +1,23 @@ +TEMPLATE = lib +TARGET = voicecall-telepathy-plugin + +QT = core +CONFIG += plugin link_pkgconfig + +INCLUDEPATH += ../../../lib/src +LIBS += -L../../../lib/src -lvoicecall + +PKGCONFIG += TelepathyQt4 + +HEADERS += \ + telepathyproviderplugin.h + +SOURCES += \ + telepathyproviderplugin.cpp + +DEFINES += PLUGIN_NAME=\\\"voicecall-telepathy-plugin\\\" +DEFINES += PLUGIN_VERSION=\\\"0.0.0.1\\\" + +target.path = /usr/lib/voicecall/plugins + +INSTALLS += target --- plugins/telepathy/src/telepathyproviderplugin.cpp +++ plugins/telepathy/src/telepathyproviderplugin.cpp @@ -0,0 +1,96 @@ +/* + * This file is a part of the Voice Call Manager Telepathy Plugin project. + * + * Copyright (C) 2011-2012 Tom Swindell <[email protected]> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +#include "common.h" +#include "telepathyproviderplugin.h" + +#include <QtPlugin> + +class TelepathyProviderPluginPrivate +{ +public: + TelepathyProviderPluginPrivate() + : manager(NULL) + {/* ... */} + + VoiceCallManagerInterface *manager; +}; + +TelepathyProviderPlugin::TelepathyProviderPlugin(QObject *parent) + : AbstractVoiceCallManagerPlugin(parent), d(new TelepathyProviderPluginPrivate) +{ + TRACE +} + +TelepathyProviderPlugin::~TelepathyProviderPlugin() +{ + TRACE + delete this->d; +} + +QString TelepathyProviderPlugin::pluginId() const +{ + TRACE + return PLUGIN_NAME; +} + +QString TelepathyProviderPlugin::pluginVersion() const +{ + TRACE + return PLUGIN_VERSION; +} + +bool TelepathyProviderPlugin::initialize() +{ + TRACE + return true; +} + +bool TelepathyProviderPlugin::configure(VoiceCallManagerInterface *manager) +{ + TRACE + d->manager = manager; + return true; +} + +bool TelepathyProviderPlugin::start() +{ + TRACE + return true; +} + +bool TelepathyProviderPlugin::suspend() +{ + TRACE + return true; +} + +bool TelepathyProviderPlugin::resume() +{ + TRACE + return true; +} + +void TelepathyProviderPlugin::finalize() +{ + TRACE +} + +Q_EXPORT_PLUGIN2(voicecall-telepathy-plugin, TelepathyProviderPlugin) --- plugins/telepathy/src/telepathyproviderplugin.h +++ plugins/telepathy/src/telepathyproviderplugin.h @@ -0,0 +1,31 @@ +#ifndef TELEPATHYPROVIDERPLUGIN_H +#define TELEPATHYPROVIDERPLUGIN_H + +#include <abstractvoicecallmanagerplugin.h> + +class TelepathyProviderPlugin : public AbstractVoiceCallManagerPlugin +{ + Q_OBJECT + Q_INTERFACES(AbstractVoiceCallManagerPlugin) +public: + explicit TelepathyProviderPlugin(QObject *parent = 0); + ~TelepathyProviderPlugin(); + + QString pluginId() const; + QString pluginVersion() const; + +public Q_SLOTS: + bool initialize(); + bool configure(VoiceCallManagerInterface *manager); + bool start(); + bool suspend(); + bool resume(); + void finalize(); + +protected Q_SLOTS: + +private: + class TelepathyProviderPluginPrivate *d; +}; + +#endif // TELEPATHYPROVIDERPLUGIN_H --- plugins/telepathy/telepathy.pro +++ plugins/telepathy/telepathy.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +SUBDIRS += src --- src/basicvoicecallconfigurator.cpp +++ src/basicvoicecallconfigurator.cpp @@ -57,7 +57,7 @@ // Install statically linked plugins. this->installPlugin(new VoiceCallManagerDBusService(this)); - this->installPlugin(new BasicRingtoneNotificationProvider(this)); + //this->installPlugin(new BasicRingtoneNotificationProvider(this)); QDir pluginPath("/usr/lib/voicecall/plugins"); --- src/voicecallmanager.cpp +++ src/voicecallmanager.cpp @@ -28,14 +28,17 @@ { public: VoiceCallManagerPrivate(VoiceCallManager *pInstance) - : instance(pInstance), activeVoiceCall(NULL) + : instance(pInstance), activeVoiceCall(NULL), muteMicrophone(false), muteRingtone(false) {/* ... */} VoiceCallManager *instance; + QHash<QString, AbstractVoiceCallProvider*> providers; + AbstractVoiceCallHandler *activeVoiceCall; - QHash<QString, AbstractVoiceCallProvider*> providers; + bool muteMicrophone; + bool muteRingtone; QString errorString; }; @@ -92,9 +95,6 @@ QObject::connect(provider, SIGNAL(voiceCallRemoved(QString)), SLOT(onVoiceCallRemoved(QString))); - QObject::connect(provider, - SIGNAL(incomingVoiceCall(AbstractVoiceCallHandler*)), - SIGNAL(incomingVoiceCall(AbstractVoiceCallHandler*))); d->providers.insert(provider->providerId(), provider); emit this->providersChanged(); @@ -119,10 +119,6 @@ SIGNAL(voiceCallRemoved(QString)), this, SLOT(onVoiceCallRemoved(QString))); - QObject::disconnect(provider, - SIGNAL(incomingVoiceCall(AbstractVoiceCallHandler*)), - this, - SIGNAL(incomingVoiceCall(AbstractVoiceCallHandler*))); d->providers.remove(provider->providerId()); emit this->providersChanged(); @@ -162,6 +158,32 @@ return results; } +bool VoiceCallManager::muteMicrophone() const +{ + TRACE + return d->muteMicrophone; +} + +bool VoiceCallManager::muteRingtone() const +{ + TRACE + return d->muteRingtone; +} + +void VoiceCallManager::setMuteMicrophone(bool on) +{ + TRACE + d->muteMicrophone = on; + emit this->setMuteMicrophoneRequested(on); +} + +void VoiceCallManager::setMuteRingtone(bool on) +{ + TRACE + d->muteRingtone = on; + emit this->setMuteRingtoneRequested(on); +} + bool VoiceCallManager::dial(const QString &providerId, const QString &msisdn) { TRACE @@ -182,12 +204,6 @@ return true; } -void VoiceCallManager::silenceNotifications() -{ - TRACE - emit this->silenceRingtoneNotification(); -} - void VoiceCallManager::startEventTone(ToneType type, int volume) { TRACE --- src/voicecallmanager.h +++ src/voicecallmanager.h @@ -35,15 +35,15 @@ QString generateHandlerId(); - AbstractVoiceCallHandler* activeVoiceCall() const; - int voiceCallCount() const; QList<AbstractVoiceCallHandler*> voiceCalls() const; - QString errorString() const; + AbstractVoiceCallHandler* activeVoiceCall() const; -Q_SIGNALS: - void incomingVoiceCall(AbstractVoiceCallHandler *handler); + bool muteMicrophone() const; + bool muteRingtone() const; + + QString errorString() const; public Q_SLOTS: void setError(const QString &errorString); @@ -53,7 +53,8 @@ bool dial(const QString &providerId, const QString &msisdn); - void silenceNotifications(); + void setMuteMicrophone(bool on); + void setMuteRingtone(bool on); void startEventTone(ToneType type, int volume); void stopEventTone(); @@ -65,7 +66,6 @@ void onVoiceCallAdded(AbstractVoiceCallHandler *handler); void onVoiceCallRemoved(const QString &handlerId); - private: class VoiceCallManagerPrivate *d; }; --- ui/qml/ActiveCallDialog.qml +++ ui/qml/ActiveCallDialog.qml @@ -141,7 +141,13 @@ CallDialogToolButton { visible:root.state == 'incoming' || root.state == 'active' iconSource:'images/icon-m-telephony-volume-off.svg' - onClicked: manager.activeVoiceCall.mute(); + onClicked: { + if(root.state == 'incoming') { + manager.setMuteRingtone(true); + } else { + manager.setMuteMicrophone(manager.muteMicrophone ? false : true); + } + } } CallDialogToolButton { --- ui/qml/CallDialogToolButton.qml +++ ui/qml/CallDialogToolButton.qml @@ -37,7 +37,7 @@ import com.nokia.meego 1.1 Button { - width:72;height:48 + width:72;height:72 platformStyle: ButtonStyle { background:'images/meegotouch-toolbar-button-background.png' pressedBackground:'images/meegotouch-toolbar-button-background.png' --- ui/qml/DialPage.qml +++ ui/qml/DialPage.qml @@ -41,6 +41,8 @@ orientationLock:PageOrientation.LockPortrait + property alias numberEntryText: iNumberEntry.text + BorderImage { anchors {fill:parent;topMargin:71} source:'images/meegotouch-page-background-inverted.png'; @@ -82,12 +84,16 @@ TextEdit { id:iNumberEntry anchors {left:parent.left;right:bBackspace.left;verticalCenter:parent.verticalCenter;leftMargin:30;rightMargin:20} - readOnly:true + readOnly:false + cursorVisible:false inputMethodHints:Qt.ImhDialableCharactersOnly + activeFocusOnPress:false color:main.appTheme.foregroundColor font.pixelSize:64 horizontalAlignment:TextEdit.AlignRight + property string previousCharacter + onTextChanged: { resizeText(); } @@ -107,13 +113,54 @@ } } - - function appendChar(character) + function insertChar(character) { if(iNumberEntry.text.length == 0) { iNumberEntry.text = character + iNumberEntry.cursorPosition = iNumberEntry.text.length } else { - iNumberEntry.text += character + var cpos = iNumberEntry.cursorPosition; + var text = iNumberEntry.text + iNumberEntry.text = text.slice(0,cpos) + character + text.slice(cpos,text.length); + iNumberEntry.cursorPosition = cpos + 1; + } + + iNumberEntry.previousCharacter = character; + interactionTimeoutTimer.restart(); + } + + function deleteChar() { + if(iNumberEntry.text.length == 0) return; + + var cpos = iNumberEntry.cursorPosition == 0 ? 1 : iNumberEntry.cursorPosition; + var text = iNumberEntry.text + iNumberEntry.text = text.slice(0,cpos-1) + text.slice(cpos,text.length) + iNumberEntry.cursorPosition = cpos-1; + + iNumberEntry.previousCharacter = ''; + interactionTimeoutTimer.restart(); + } + + function resetCursor() { + iNumberEntry.cursorPosition = iNumberEntry.text.length; + iNumberEntry.cursorVisible = false; + } + + Timer { + id:interactionTimeoutTimer + interval:4000 + running:false + repeat:false + onTriggered: iNumberEntry.resetCursor(); + } + + MouseArea { + anchors.fill:parent + + onPressed: { + iNumberEntry.cursorVisible = true; + interactionTimeoutTimer.restart(); + mouse.accepted = false; } } } @@ -125,11 +172,8 @@ MouseArea { anchors.fill:parent - onClicked: { - if(iNumberEntry.text.length > 0) { - iNumberEntry.text = iNumberEntry.text.substring(0, iNumberEntry.text.length - 1); - } - } + onClicked: iNumberEntry.deleteChar() + onPressAndHold: { if(iNumberEntry.text.length > 0) { iNumberEntry.text = ''; --- ui/qml/NumPadButton.qml +++ ui/qml/NumPadButton.qml @@ -58,17 +58,37 @@ MouseArea { anchors.fill:parent - onClicked: { - iNumberEntry.appendChar(model.key); + property bool waitingForDoubleClick: false + + Timer { + id:clickTimer + interval:520 + running:false + repeat:false + onTriggered:parent.waitingForDoubleClick = false; + } + + onClicked: { + if(waitingForDoubleClick && iNumberEntry.previousCharacter == model.key && model.alt) { + iNumberEntry.deleteChar(); + iNumberEntry.insertChar(model.alt); + waitingForDoubleClick = false; + clickTimer.stop(); + } else { + iNumberEntry.insertChar(model.key); + waitingForDoubleClick = true; + clickTimer.start(); + } } + onPressAndHold: { - iNumberEntry.appendChar(model.alt || model.key); + iNumberEntry.insertChar(model.alt || model.key); } // Audio feedback. onPressed: { - main.manager.startDtmfTone(model.key, 75); + main.manager.startDtmfTone(model.key); } onReleased: { main.manager.stopDtmfTone(); --- ui/qml/main.qml +++ ui/qml/main.qml @@ -104,6 +104,25 @@ theme.inverted = true; } + + Keys.onPressed: { + if(event.key == Qt.Key_Phone) { + console.log("*** QML *** Detected phone key press, processing."); + + if(manager.activeVoiceCall) { + var call = manager.activeVoiceCall; + + if(call.statusText == 'incoming') { + call.answer(); + } else { + call.hangup(); + } + } else if(pDialPage.numberEntryText.length > 0) { + main.dial(pDialPage.numberEntryText); + } + } + } + QueryDialog { id:dErrorDialog titleText:qsTr('Error')
