File indexing completed on 2024-04-28 16:42:51

0001 // SPDX-FileCopyrightText: 2012 George Kiagiadakis <kiagiadakis.george@gmail.com>
0002 // SPDX-FileCopyrightText: 2021 Alexey Andreyev <aa13q@ya.ru>
0003 // SPDX-License-Identifier: LGPL-2.1-or-later
0004 
0005 #ifndef CALL_MANAGER_H
0006 #define CALL_MANAGER_H
0007 
0008 #include <QObject>
0009 #include <kTelephonyMetaTypes/dialer-types.h>
0010 
0011 #include "callutilsinterface.h"
0012 
0013 #include "dialer-utils.h"
0014 
0015 class DialerManager : public QObject
0016 {
0017     Q_OBJECT
0018 public:
0019     explicit DialerManager(QObject *parent = nullptr);
0020     ~DialerManager() override;
0021 
0022     void setCallUtils(org::kde::telephony::CallUtils *callUtils);
0023     void setDialerUtils(DialerUtils *dialerUtils);
0024 
0025 private Q_SLOTS:
0026     void onUtilsCallAdded(const QString &deviceUni,
0027                           const QString &callUni,
0028                           const DialerTypes::CallDirection &callDirection,
0029                           const DialerTypes::CallState &callState,
0030                           const DialerTypes::CallStateReason &callStateReason,
0031                           const QString communicationWith);
0032     void onUtilsCallsChanged(const DialerTypes::CallDataVector &calls);
0033     void onUtilsCallStateChanged(const DialerTypes::CallData &callData);
0034     void onUtilsMuteChanged(bool muted);
0035     void onUtilsSpeakerModeChanged(bool enabled);
0036     void onUtilsMuteRequested();
0037     void onUtilsSpeakerModeRequested();
0038 
0039 private:
0040     void pauseMedia();
0041     void unpauseMedia();
0042 
0043     org::kde::telephony::CallUtils *_callUtils;
0044     DialerUtils *_dialerUtils;
0045     QSet<QString> _pausedSources;
0046 
0047     bool _needsDefaultAudioMode;
0048 };
0049 
0050 #endif // CALL_MANAGER_H