From b0169bece9cf78a78a3c000446b8d2ae58911ee8 Mon Sep 17 00:00:00 2001 From: Gaelle Braud Date: Wed, 12 Jun 2024 17:44:28 +0200 Subject: [PATCH] fix settings call --- Linphone/core/setting/SettingsCore.cpp | 385 ++++++++---------- Linphone/core/setting/SettingsCore.hpp | 185 +++++---- Linphone/view/App/CallsWindow.qml | 22 +- .../view/Item/Call/InCallSettingsPanel.qml | 26 +- Linphone/view/Item/Contact/Sticker.qml | 2 +- .../view/Layout/Call/ActiveSpeakerLayout.qml | 9 +- Linphone/view/Layout/Call/CallLayout.qml | 2 +- 7 files changed, 306 insertions(+), 325 deletions(-) diff --git a/Linphone/core/setting/SettingsCore.cpp b/Linphone/core/setting/SettingsCore.cpp index 6fcebea0c..9dc9ced04 100644 --- a/Linphone/core/setting/SettingsCore.cpp +++ b/Linphone/core/setting/SettingsCore.cpp @@ -41,29 +41,29 @@ QSharedPointer Settings::create() { Settings::Settings(QObject *parent) : QObject(parent) { mustBeInLinphoneThread(getClassName()); mSettingsModel = Utils::makeQObject_ptr(); - + // Security mVfsEnabled = mSettingsModel->getVfsEnabled(); - + // Call mVideoEnabled = mSettingsModel->getVideoEnabled(); mEchoCancellationEnabled = mSettingsModel->getEchoCancellationEnabled(); mAutomaticallyRecordCallsEnabled = mSettingsModel->getAutomaticallyRecordCallsEnabled(); // Audio - mCaptureDevices = mSettingsModel->getCaptureDevices(); + mCaptureDevices = mSettingsModel->getCaptureDevices(); mPlaybackDevices = mSettingsModel->getPlaybackDevices(); - mCaptureDevice = mSettingsModel->getCaptureDevice(); + mCaptureDevice = mSettingsModel->getCaptureDevice(); mPlaybackDevice = mSettingsModel->getPlaybackDevice(); - + mCaptureGain = mSettingsModel->getCaptureGain(); mPlaybackGain = mSettingsModel->getPlaybackGain(); // Video mVideoDevice = mSettingsModel->getVideoDevice(); mVideoDevices = mSettingsModel->getVideoDevices(); - - //Logs + + // Logs mLogsEnabled = mSettingsModel->getLogsEnabled(); mFullLogsEnabled = mSettingsModel->getFullLogsEnabled(); mLogsFolder = mSettingsModel->getLogsFolder(); @@ -77,202 +77,180 @@ void Settings::setSelf(QSharedPointer me) { mustBeInLinphoneThread(getClassName()); mSettingsModelConnection = QSharedPointer>( new SafeConnection(me, mSettingsModel), &QObject::deleteLater); - + // VFS mSettingsModelConnection->makeConnectToCore(&Settings::setVfsEnabled, [this](const bool enabled) { - mSettingsModelConnection->invokeToModel( - [this, enabled]() { mSettingsModel->setVfsEnabled(enabled); } - ); + mSettingsModelConnection->invokeToModel([this, enabled]() { mSettingsModel->setVfsEnabled(enabled); }); }); - + mSettingsModelConnection->makeConnectToModel(&SettingsModel::vfsEnabledChanged, [this](const bool enabled) { - mSettingsModelConnection->invokeToCore( - [this, enabled]() { - mVfsEnabled = enabled; - emit vfsEnabledChanged(); - } - ); + mSettingsModelConnection->invokeToCore([this, enabled]() { + mVfsEnabled = enabled; + emit vfsEnabledChanged(); + }); }); - + // Video Calls mSettingsModelConnection->makeConnectToCore(&Settings::setVideoEnabled, [this](const bool enabled) { - mSettingsModelConnection->invokeToModel( - [this, enabled]() { mSettingsModel->setVideoEnabled(enabled); } - ); + mSettingsModelConnection->invokeToModel([this, enabled]() { mSettingsModel->setVideoEnabled(enabled); }); }); - + mSettingsModelConnection->makeConnectToModel(&SettingsModel::videoEnabledChanged, [this](const bool enabled) { - mSettingsModelConnection->invokeToCore( - [this, enabled]() { - mVideoEnabled = enabled; - emit videoEnabledChanged(); - }); + mSettingsModelConnection->invokeToCore([this, enabled]() { + mVideoEnabled = enabled; + emit videoEnabledChanged(); + }); }); - + // Echo cancelling mSettingsModelConnection->makeConnectToCore(&Settings::setEchoCancellationEnabled, [this](const bool enabled) { mSettingsModelConnection->invokeToModel( - [this, enabled]() { mSettingsModel->setEchoCancellationEnabled(enabled); } - ); + [this, enabled]() { mSettingsModel->setEchoCancellationEnabled(enabled); }); }); - - mSettingsModelConnection->makeConnectToModel(&SettingsModel::echoCancellationEnabledChanged, [this](const bool enabled) { - mSettingsModelConnection->invokeToCore( - [this, enabled]() { - mEchoCancellationEnabled = enabled; - emit echoCancellationEnabledChanged(); - }); - }); - + + mSettingsModelConnection->makeConnectToModel(&SettingsModel::echoCancellationEnabledChanged, + [this](const bool enabled) { + mSettingsModelConnection->invokeToCore([this, enabled]() { + mEchoCancellationEnabled = enabled; + emit echoCancellationEnabledChanged(); + }); + }); + // Auto recording - mSettingsModelConnection->makeConnectToCore(&Settings::setAutomaticallyRecordCallsEnabled, [this](const bool enabled) { - mSettingsModelConnection->invokeToModel( - [this, enabled]() { mSettingsModel->setAutomaticallyRecordCallsEnabled(enabled); } - ); - }); - mSettingsModelConnection->makeConnectToModel(&SettingsModel::automaticallyRecordCallsEnabledChanged, [this](const bool enabled) { - mSettingsModelConnection->invokeToCore( - [this, enabled]() { - mAutomaticallyRecordCallsEnabled = enabled; - emit automaticallyRecordCallsEnabledChanged(); - }); - }); - + mSettingsModelConnection->makeConnectToCore(&Settings::setAutomaticallyRecordCallsEnabled, + [this](const bool enabled) { + mSettingsModelConnection->invokeToModel([this, enabled]() { + mSettingsModel->setAutomaticallyRecordCallsEnabled(enabled); + }); + }); + mSettingsModelConnection->makeConnectToModel(&SettingsModel::automaticallyRecordCallsEnabledChanged, + [this](const bool enabled) { + mSettingsModelConnection->invokeToCore([this, enabled]() { + mAutomaticallyRecordCallsEnabled = enabled; + emit automaticallyRecordCallsEnabledChanged(); + }); + }); + // Audio device(s) - mSettingsModelConnection->makeConnectToCore(&Settings::setCaptureDevice, [this](const QString id) { - mSettingsModelConnection->invokeToModel( - [this, id]() { mSettingsModel->setCaptureDevice(id); }); + mSettingsModelConnection->makeConnectToCore(&Settings::lSetCaptureDevice, [this](const QString id) { + mSettingsModelConnection->invokeToModel([this, id]() { mSettingsModel->setCaptureDevice(id); }); }); mSettingsModelConnection->makeConnectToModel(&SettingsModel::captureDeviceChanged, [this](const QString device) { - mSettingsModelConnection->invokeToCore( - [this, device]() { - mCaptureDevice = device; - emit captureDeviceChanged(device); - }); - }); - - mSettingsModelConnection->makeConnectToCore(&Settings::setPlaybackDevice, [this](const QString id) { - mSettingsModelConnection->invokeToModel( - [this, id]() { mSettingsModel->setPlaybackDevice(id); }); - }); - - mSettingsModelConnection->makeConnectToModel(&SettingsModel::playbackDeviceChanged, [this](const QString device) { - mSettingsModelConnection->invokeToCore( - [this, device]() { - mPlaybackDevice = device; - emit playbackDeviceChanged(device); - }); - }); - - mSettingsModelConnection->makeConnectToCore(&Settings::setPlaybackGain, [this](const float value) { - mSettingsModelConnection->invokeToModel( - [this, value]() { mSettingsModel->setPlaybackGain(value); }); - }); - - mSettingsModelConnection->makeConnectToModel(&SettingsModel::playbackGainChanged, [this](const float value) { - mSettingsModelConnection->invokeToCore( - [this, value]() { - mPlaybackGain = value; - emit playbackGainChanged(value); - }); - }); - - mSettingsModelConnection->makeConnectToCore(&Settings::setCaptureGain, [this](const float value) { - mSettingsModelConnection->invokeToModel( - [this, value]() { mSettingsModel->setCaptureGain(value); }); - }); - - mSettingsModelConnection->makeConnectToModel(&SettingsModel::captureGainChanged, [this](const float value) { - mSettingsModelConnection->invokeToCore( - [this, value]() { - mCaptureGain = value; - emit captureGainChanged(value); - }); - }); - - mSettingsModelConnection->makeConnectToModel(&SettingsModel::micVolumeChanged, [this](const float value) { - mSettingsModelConnection->invokeToCore( - [this, value]() { - emit micVolumeChanged(value); - }); - }); - - mSettingsModelConnection->makeConnectToModel(&SettingsModel::captureDevicesChanged, [this](const QStringList devices) { - mSettingsModelConnection->invokeToCore( - [this, devices]() { - mCaptureDevices = devices; - emit captureDevicesChanged(devices); - }); - }); - - mSettingsModelConnection->makeConnectToModel(&SettingsModel::playbackDevicesChanged, [this](const QStringList devices) { - mSettingsModelConnection->invokeToCore( - [this, devices]() { - mPlaybackDevices = devices; - emit playbackDevicesChanged(devices); - }); - }); - - // Video device(s) - mSettingsModelConnection->makeConnectToCore(&Settings::setVideoDevice, [this](const QString id) { - mSettingsModelConnection->invokeToModel( - [this, id]() { mSettingsModel->setVideoDevice(id); }); - }); - - mSettingsModelConnection->makeConnectToModel(&SettingsModel::videoDeviceChanged, [this](const QString device) { - mSettingsModelConnection->invokeToCore( - [this, device]() { - mVideoDevice = device; - emit videoDeviceChanged(); - }); - }); - - mSettingsModelConnection->makeConnectToModel(&SettingsModel::videoDevicesChanged, [this](const QStringList devices) { - mSettingsModelConnection->invokeToCore( - [this, devices]() { - mVideoDevices = devices; - emit videoDevicesChanged(); - }); - }); - - // Logs - mSettingsModelConnection->makeConnectToCore(&Settings::setLogsEnabled, [this](const bool status) { - mSettingsModelConnection->invokeToModel( - [this, status]() { mSettingsModel->setLogsEnabled(status); }); - }); - - mSettingsModelConnection->makeConnectToModel(&SettingsModel::logsEnabledChanged, [this](const bool status) { - mSettingsModelConnection->invokeToCore( - [this, status]() { - mLogsEnabled = status; - emit logsEnabledChanged(); - }); - }); - - mSettingsModelConnection->makeConnectToCore(&Settings::setFullLogsEnabled, [this](const bool status) { - mSettingsModelConnection->invokeToModel( - [this, status]() { mSettingsModel->setFullLogsEnabled(status); }); - }); - - mSettingsModelConnection->makeConnectToModel(&SettingsModel::fullLogsEnabledChanged, [this](const bool status) { - mSettingsModelConnection->invokeToCore( - [this, status]() { - mFullLogsEnabled = status; - emit fullLogsEnabledChanged(); - }); - }); - - auto coreModelConnection = QSharedPointer>( - new SafeConnection(me, CoreModel::getInstance()), &QObject::deleteLater); - - coreModelConnection->makeConnectToModel(&CoreModel::logCollectionUploadStateChanged, [this](auto core, auto state, auto info) { - mSettingsModelConnection->invokeToCore( - [this, state, info]() { - if (state == linphone::Core::LogCollectionUploadState::Delivered || state == linphone::Core::LogCollectionUploadState::NotDelivered) { - emit logsUploadTerminated(state == linphone::Core::LogCollectionUploadState::Delivered, Utils::coreStringToAppString(info)); - } + mSettingsModelConnection->invokeToCore([this, device]() { + mCaptureDevice = device; + emit captureDeviceChanged(device); }); }); + + mSettingsModelConnection->makeConnectToCore(&Settings::lSetPlaybackDevice, [this](const QString id) { + mSettingsModelConnection->invokeToModel([this, id]() { mSettingsModel->setPlaybackDevice(id); }); + }); + + mSettingsModelConnection->makeConnectToModel(&SettingsModel::playbackDeviceChanged, [this](const QString device) { + mSettingsModelConnection->invokeToCore([this, device]() { + mPlaybackDevice = device; + emit playbackDeviceChanged(device); + }); + }); + + mSettingsModelConnection->makeConnectToCore(&Settings::lSetPlaybackGain, [this](const float value) { + mSettingsModelConnection->invokeToModel([this, value]() { mSettingsModel->setPlaybackGain(value); }); + }); + + mSettingsModelConnection->makeConnectToModel(&SettingsModel::playbackGainChanged, [this](const float value) { + mSettingsModelConnection->invokeToCore([this, value]() { + mPlaybackGain = value; + emit playbackGainChanged(value); + }); + }); + + mSettingsModelConnection->makeConnectToCore(&Settings::lSetCaptureGain, [this](const float value) { + mSettingsModelConnection->invokeToModel([this, value]() { mSettingsModel->setCaptureGain(value); }); + }); + + mSettingsModelConnection->makeConnectToModel(&SettingsModel::captureGainChanged, [this](const float value) { + mSettingsModelConnection->invokeToCore([this, value]() { + mCaptureGain = value; + emit captureGainChanged(value); + }); + }); + + mSettingsModelConnection->makeConnectToModel(&SettingsModel::micVolumeChanged, [this](const float value) { + mSettingsModelConnection->invokeToCore([this, value]() { emit micVolumeChanged(value); }); + }); + + mSettingsModelConnection->makeConnectToModel(&SettingsModel::captureDevicesChanged, + [this](const QStringList devices) { + mSettingsModelConnection->invokeToCore([this, devices]() { + mCaptureDevices = devices; + emit captureDevicesChanged(devices); + }); + }); + + mSettingsModelConnection->makeConnectToModel(&SettingsModel::playbackDevicesChanged, + [this](const QStringList devices) { + mSettingsModelConnection->invokeToCore([this, devices]() { + mPlaybackDevices = devices; + emit playbackDevicesChanged(devices); + }); + }); + + // Video device(s) + mSettingsModelConnection->makeConnectToCore(&Settings::lSetVideoDevice, [this](const QString id) { + mSettingsModelConnection->invokeToModel([this, id]() { mSettingsModel->setVideoDevice(id); }); + }); + + mSettingsModelConnection->makeConnectToModel(&SettingsModel::videoDeviceChanged, [this](const QString device) { + mSettingsModelConnection->invokeToCore([this, device]() { + mVideoDevice = device; + emit videoDeviceChanged(); + }); + }); + + mSettingsModelConnection->makeConnectToModel(&SettingsModel::videoDevicesChanged, + [this](const QStringList devices) { + mSettingsModelConnection->invokeToCore([this, devices]() { + mVideoDevices = devices; + emit videoDevicesChanged(); + }); + }); + + // Logs + mSettingsModelConnection->makeConnectToCore(&Settings::setLogsEnabled, [this](const bool status) { + mSettingsModelConnection->invokeToModel([this, status]() { mSettingsModel->setLogsEnabled(status); }); + }); + + mSettingsModelConnection->makeConnectToModel(&SettingsModel::logsEnabledChanged, [this](const bool status) { + mSettingsModelConnection->invokeToCore([this, status]() { + mLogsEnabled = status; + emit logsEnabledChanged(); + }); + }); + + mSettingsModelConnection->makeConnectToCore(&Settings::setFullLogsEnabled, [this](const bool status) { + mSettingsModelConnection->invokeToModel([this, status]() { mSettingsModel->setFullLogsEnabled(status); }); + }); + + mSettingsModelConnection->makeConnectToModel(&SettingsModel::fullLogsEnabledChanged, [this](const bool status) { + mSettingsModelConnection->invokeToCore([this, status]() { + mFullLogsEnabled = status; + emit fullLogsEnabledChanged(); + }); + }); + + auto coreModelConnection = QSharedPointer>( + new SafeConnection(me, CoreModel::getInstance()), &QObject::deleteLater); + + coreModelConnection->makeConnectToModel( + &CoreModel::logCollectionUploadStateChanged, [this](auto core, auto state, auto info) { + mSettingsModelConnection->invokeToCore([this, state, info]() { + if (state == linphone::Core::LogCollectionUploadState::Delivered || + state == linphone::Core::LogCollectionUploadState::NotDelivered) { + emit logsUploadTerminated(state == linphone::Core::LogCollectionUploadState::Delivered, + Utils::coreStringToAppString(info)); + } + }); + }); } QString Settings::getConfigPath(const QCommandLineParser &parser) { @@ -295,6 +273,10 @@ QStringList Settings::getPlaybackDevices() const { return mPlaybackDevices; } +int Settings::getVideoDeviceIndex() const { + return mVideoDevices.indexOf(mVideoDevice); +} + QStringList Settings::getVideoDevices() const { return mVideoDevices; } @@ -341,53 +323,40 @@ void Settings::setFirstLaunch(bool first) { } void Settings::startEchoCancellerCalibration() { - mSettingsModelConnection->invokeToModel([this]() { - mSettingsModel->startEchoCancellerCalibration(); - }); + mSettingsModelConnection->invokeToModel([this]() { mSettingsModel->startEchoCancellerCalibration(); }); } - void Settings::accessCallSettings() { - mSettingsModelConnection->invokeToModel( - [this]() { mSettingsModel->accessCallSettings(); } - ); + mSettingsModelConnection->invokeToModel([this]() { mSettingsModel->accessCallSettings(); }); } void Settings::closeCallSettings() { - mSettingsModelConnection->invokeToModel( - [this]() { mSettingsModel->closeCallSettings(); } - ); + mSettingsModelConnection->invokeToModel([this]() { mSettingsModel->closeCallSettings(); }); } void Settings::updateMicVolume() const { - mSettingsModelConnection->invokeToModel( - [this]() { mSettingsModel->getMicVolume(); } - ); + mSettingsModelConnection->invokeToModel([this]() { mSettingsModel->getMicVolume(); }); } -bool Settings::getLogsEnabled () const { +bool Settings::getLogsEnabled() const { return mLogsEnabled; } -bool Settings::getFullLogsEnabled () const { +bool Settings::getFullLogsEnabled() const { return mFullLogsEnabled; } -void Settings::cleanLogs () const { - mSettingsModelConnection->invokeToModel( - [this]() { mSettingsModel->cleanLogs(); } - ); +void Settings::cleanLogs() const { + mSettingsModelConnection->invokeToModel([this]() { mSettingsModel->cleanLogs(); }); } -void Settings::sendLogs () const { - mSettingsModelConnection->invokeToModel( - [this]() { mSettingsModel->sendLogs(); } - ); +void Settings::sendLogs() const { + mSettingsModelConnection->invokeToModel([this]() { mSettingsModel->sendLogs(); }); } -QString Settings::getLogsEmail () const { +QString Settings::getLogsEmail() const { return mLogsEmail; } -QString Settings::getLogsFolder () const { +QString Settings::getLogsFolder() const { return mLogsFolder; } diff --git a/Linphone/core/setting/SettingsCore.hpp b/Linphone/core/setting/SettingsCore.hpp index 0c533f92e..8c879cd5d 100644 --- a/Linphone/core/setting/SettingsCore.hpp +++ b/Linphone/core/setting/SettingsCore.hpp @@ -31,39 +31,42 @@ class Settings : public QObject, public AbstractObject { Q_OBJECT - + // Security Q_PROPERTY(bool vfsEnabled READ getVfsEnabled WRITE setVfsEnabled NOTIFY vfsEnabledChanged) // Call Q_PROPERTY(bool videoEnabled READ getVideoEnabled WRITE setVideoEnabled NOTIFY videoEnabledChanged) - Q_PROPERTY(bool echoCancellationEnabled READ getEchoCancellationEnabled WRITE setEchoCancellationEnabled NOTIFY echoCancellationEnabledChanged) - Q_PROPERTY(int echoCancellationCalibration READ getEchoCancellationCalibration NOTIFY echoCancellationCalibrationChanged) - Q_PROPERTY(bool automaticallyRecordCallsEnabled READ getAutomaticallyRecordCallsEnabled WRITE setAutomaticallyRecordCallsEnabled NOTIFY automaticallyRecordCallsEnabledChanged) - + Q_PROPERTY(bool echoCancellationEnabled READ getEchoCancellationEnabled WRITE setEchoCancellationEnabled NOTIFY + echoCancellationEnabledChanged) + Q_PROPERTY( + int echoCancellationCalibration READ getEchoCancellationCalibration NOTIFY echoCancellationCalibrationChanged) + Q_PROPERTY(bool automaticallyRecordCallsEnabled READ getAutomaticallyRecordCallsEnabled WRITE + setAutomaticallyRecordCallsEnabled NOTIFY automaticallyRecordCallsEnabledChanged) + Q_PROPERTY(bool captureGraphRunning READ getCaptureGraphRunning NOTIFY captureGraphRunningChanged) - + Q_PROPERTY(QStringList captureDevices READ getCaptureDevices NOTIFY captureDevicesChanged) Q_PROPERTY(QStringList playbackDevices READ getPlaybackDevices NOTIFY playbackDevicesChanged) - - Q_PROPERTY(float playbackGain READ getPlaybackGain WRITE setPlaybackGain NOTIFY playbackGainChanged) - Q_PROPERTY(float captureGain READ getCaptureGain WRITE setCaptureGain NOTIFY captureGainChanged) - - Q_PROPERTY(QString captureDevice READ getCaptureDevice WRITE setCaptureDevice NOTIFY captureDeviceChanged) - Q_PROPERTY(QString playbackDevice READ getPlaybackDevice WRITE setPlaybackDevice NOTIFY playbackDeviceChanged) + + Q_PROPERTY(float playbackGain READ getPlaybackGain WRITE lSetPlaybackGain NOTIFY playbackGainChanged) + Q_PROPERTY(float captureGain READ getCaptureGain WRITE lSetCaptureGain NOTIFY captureGainChanged) + + Q_PROPERTY(QString captureDevice READ getCaptureDevice WRITE lSetCaptureDevice NOTIFY captureDeviceChanged) + Q_PROPERTY(QString playbackDevice READ getPlaybackDevice WRITE lSetPlaybackDevice NOTIFY playbackDeviceChanged) Q_PROPERTY(QString ringerDevice READ getRingerDevice WRITE setRingerDevice NOTIFY ringerDeviceChanged) - + Q_PROPERTY(QStringList videoDevices READ getVideoDevices NOTIFY videoDevicesChanged) - Q_PROPERTY(QString videoDevice READ getVideoDevice WRITE setVideoDevice NOTIFY videoDeviceChanged) - + Q_PROPERTY(QString videoDevice READ getVideoDevice WRITE lSetVideoDevice NOTIFY videoDeviceChanged) + Q_PROPERTY(int videoDeviceIndex READ getVideoDeviceIndex NOTIFY videoDeviceChanged) + Q_PROPERTY(float micVolume MEMBER _dummy_int NOTIFY micVolumeChanged) - + Q_PROPERTY(bool logsEnabled READ getLogsEnabled WRITE setLogsEnabled NOTIFY logsEnabledChanged) Q_PROPERTY(bool fullLogsEnabled READ getFullLogsEnabled WRITE setFullLogsEnabled NOTIFY fullLogsEnabledChanged) Q_PROPERTY(QString logsEmail READ getLogsEmail) Q_PROPERTY(QString logsFolder READ getLogsFolder) - public: static QSharedPointer create(); Settings(QObject *parent = Q_NULLPTR); @@ -75,111 +78,121 @@ public: Q_INVOKABLE void setFirstLaunch(bool first); Q_INVOKABLE bool getFirstLaunch() const; - + // Security. -------------------------------------------------------------------- - bool getVfsEnabled() { return mVfsEnabled; } - + bool getVfsEnabled() { + return mVfsEnabled; + } + // Call. -------------------------------------------------------------------- - - bool getVideoEnabled() { return mVideoEnabled; } - bool getEchoCancellationEnabled() { return mEchoCancellationEnabled; } - bool getAutomaticallyRecordCallsEnabled() { return mAutomaticallyRecordCallsEnabled; } - + + bool getVideoEnabled() { + return mVideoEnabled; + } + bool getEchoCancellationEnabled() { + return mEchoCancellationEnabled; + } + bool getAutomaticallyRecordCallsEnabled() { + return mAutomaticallyRecordCallsEnabled; + } + float getPlaybackGain() const; - + float getCaptureGain() const; - - QStringList getCaptureDevices () const; - QStringList getPlaybackDevices () const; - - QString getCaptureDevice () const; - - QString getPlaybackDevice () const; - - QString getRingerDevice () const; - - QString getVideoDevice() { return mVideoDevice; } + + QStringList getCaptureDevices() const; + QStringList getPlaybackDevices() const; + + QString getCaptureDevice() const; + + QString getPlaybackDevice() const; + + QString getRingerDevice() const; + + QString getVideoDevice() const { + return mVideoDevice; + } + int getVideoDeviceIndex() const; QStringList getVideoDevices() const; - + bool getCaptureGraphRunning(); Q_INVOKABLE void startEchoCancellerCalibration(); int getEchoCancellationCalibration() const; - + Q_INVOKABLE void accessCallSettings(); Q_INVOKABLE void closeCallSettings(); Q_INVOKABLE void updateMicVolume() const; - - bool getLogsEnabled () const; - bool getFullLogsEnabled () const; - - Q_INVOKABLE void cleanLogs () const; - Q_INVOKABLE void sendLogs () const; - QString getLogsEmail () const; - QString getLogsFolder () const; + bool getLogsEnabled() const; + bool getFullLogsEnabled() const; + + Q_INVOKABLE void cleanLogs() const; + Q_INVOKABLE void sendLogs() const; + QString getLogsEmail() const; + QString getLogsFolder() const; signals: - + // Security void setVfsEnabled(const bool enabled); void vfsEnabledChanged(); - + // Call void setVideoEnabled(const bool enabled); void videoEnabledChanged(); - + void setEchoCancellationEnabled(const bool enabled); void echoCancellationEnabledChanged(); - + void setAutomaticallyRecordCallsEnabled(const bool enabled); void automaticallyRecordCallsEnabledChanged(); - + void captureGraphRunningChanged(bool running); - + void playbackGainChanged(float gain); void captureGainChanged(float gain); - - void captureDevicesChanged (const QStringList &devices); - void playbackDevicesChanged (const QStringList &devices); - - void setCaptureDevice (const QString &device); - void captureDeviceChanged (const QString &device); - - void setPlaybackDevice (const QString &device); - void playbackDeviceChanged (const QString &device); - void ringerDeviceChanged (const QString &device); - void setVideoDevice(const QString &device); + void captureDevicesChanged(const QStringList &devices); + void playbackDevicesChanged(const QStringList &devices); + + void lSetCaptureDevice(const QString &device); + void captureDeviceChanged(const QString &device); + + void lSetPlaybackDevice(const QString &device); + void playbackDeviceChanged(const QString &device); + void ringerDeviceChanged(const QString &device); + + void lSetVideoDevice(const QString &device); void videoDeviceChanged(); void videoDevicesChanged(); - - void setCaptureGain(float gain); - void setPlaybackGain(float gain); - void setRingerDevice (const QString &device); + + void lSetCaptureGain(float gain); + void lSetPlaybackGain(float gain); + void setRingerDevice(const QString &device); void echoCancellationCalibrationChanged(); void micVolumeChanged(float volume); - - void logsEnabledChanged (); - void fullLogsEnabledChanged (); - - void setLogsEnabled (bool status); - void setFullLogsEnabled (bool status); - - void logsUploadTerminated (bool status, QString url); - void logsEmailChanged (const QString &email); - void logsFolderChanged (const QString &folder); + + void logsEnabledChanged(); + void fullLogsEnabledChanged(); + + void setLogsEnabled(bool status); + void setFullLogsEnabled(bool status); + + void logsUploadTerminated(bool status, QString url); + void logsEmailChanged(const QString &email); + void logsFolderChanged(const QString &folder); private: std::shared_ptr mSettingsModel; - + // Dummy properties (for properties that use values from core received through signals) int _dummy_int = 0; - + // Security bool mVfsEnabled; - + // Call bool mVideoEnabled; bool mEchoCancellationEnabled; @@ -191,22 +204,22 @@ private: QString mCaptureDevice; QString mPlaybackDevice; QString mRingerDevice; - + // Video QStringList mVideoDevices; QString mVideoDevice; - + bool mCaptureGraphRunning; float mCaptureGain; float mPlaybackGain; int mEchoCancellationCalibration; - - //Debug logs + + // Debug logs bool mLogsEnabled; bool mFullLogsEnabled; QString mLogsFolder; QString mLogsEmail; - + QSettings mAppSettings; QSharedPointer> mSettingsModelConnection; diff --git a/Linphone/view/App/CallsWindow.qml b/Linphone/view/App/CallsWindow.qml index df3e77a0f..3e908f45c 100644 --- a/Linphone/view/App/CallsWindow.qml +++ b/Linphone/view/App/CallsWindow.qml @@ -21,16 +21,9 @@ AppWindow { property int conferenceLayout: call && call.core.conferenceVideoLayout || 0 property bool callTerminatedByUser: false - property var callState: call && call.core.state + property var callState: call ? call.core.state : LinphoneEnums.CallState.Idle property var transferState: call && call.core.transferState - onCallChanged: { - // if conference, the main item is only - // displayed when state is connected - if (call && middleItemStackView.currentItem != inCallItem && conference) - middleItemStackView.replace(inCallItem) - } - onCallStateChanged: { if (callState === LinphoneEnums.CallState.Connected) { if (middleItemStackView.currentItem != inCallItem) { @@ -395,7 +388,7 @@ AppWindow { : "" } Button { - visible: mainWindow.call.core.recording + visible: mainWindow.call && mainWindow.call.core.recording text: qsTr("Arrêter l'enregistrement") onPressed: mainWindow.call.core.lStopRecording() } @@ -719,14 +712,17 @@ AppWindow { Component { id: settingsPanel Item { - Control.StackView.onActivated: rightPanel.headerTitleText = qsTr("Paramètres") + Control.StackView.onActivated: { + rightPanel.headerTitleText = qsTr("Paramètres") + } InCallSettingsPanel { + id: inSettingsPanel + call: mainWindow.call anchors.fill: parent anchors.topMargin: 16 * DefaultStyle.dp anchors.bottomMargin: 16 * DefaultStyle.dp anchors.leftMargin: 17 * DefaultStyle.dp anchors.rightMargin: 17 * DefaultStyle.dp - call: mainWindow.call } } } @@ -866,14 +862,14 @@ AppWindow { target: callStatusText when: middleItemStackView.currentItem === waitingRoomIn property: "text" - value: waitingRoomIn.conferenceInfo.core.subject + value: waitingRoomIn.conferenceInfo && waitingRoomIn.conferenceInfo.core.subject restoreMode: Binding.RestoreBindingOrValue } Binding { target: conferenceDate when: middleItemStackView.currentItem === waitingRoomIn property: "text" - value: waitingRoomIn.conferenceInfo.core.startEndDateString + value: waitingRoomIn.conferenceInfo && waitingRoomIn.conferenceInfo.core.startEndDateString } Connections { target: rightPanel diff --git a/Linphone/view/Item/Call/InCallSettingsPanel.qml b/Linphone/view/Item/Call/InCallSettingsPanel.qml index 1aacaa153..ea447976f 100644 --- a/Linphone/view/Item/Call/InCallSettingsPanel.qml +++ b/Linphone/view/Item/Call/InCallSettingsPanel.qml @@ -7,14 +7,11 @@ import SettingsCpp 1.0 ColumnLayout { id: mainItem property CallGui call - onCallChanged: { - if (call) { - call.core.lSetOutputAudioDevice(outputAudioDeviceCBox.currentText) - call.core.lSetSpeakerVolumeGain(speakerVolume.value) - call.core.lSetInputAudioDevice(inputAudioDeviceCBox.currentText) - call.core.lSetMicrophoneVolumeGain(microVolume.value) - } - } + property alias speakerVolume: speakerVolume.value + property string speakerDevice: outputAudioDeviceCBox.currentText + property alias micVolume: microVolume.value + property string microDevice: inputAudioDeviceCBox.currentText + RoundedBackgroundControl { Layout.alignment: Qt.AlignHCenter Control.StackView.onActivated: { @@ -54,6 +51,7 @@ ColumnLayout { model: SettingsCpp.playbackDevices onCurrentTextChanged: { if (mainItem.call) mainItem.call.core.lSetOutputAudioDevice(currentText) + SettingsCpp.lSetPlaybackDevice(currentText) } } Slider { @@ -61,9 +59,10 @@ ColumnLayout { Layout.fillWidth: true from: 0.0 to: 1.0 - value: mainItem.call ? mainItem.call.core.speakerVolumeGain : 0.5 + value: mainItem.call ? mainItem.call.core.speakerVolumeGain : SettingsCpp.playbackGain onMoved: { if (mainItem.call) mainItem.call.core.lSetSpeakerVolumeGain(value) + SettingsCpp.lSetPlaybackGain(value) } } } @@ -93,6 +92,7 @@ ColumnLayout { model: SettingsCpp.captureDevices onCurrentTextChanged: { if (mainItem.call) mainItem.call.core.lSetInputAudioDevice(currentText) + SettingsCpp.lSetCaptureDevice(currentText) } } Slider { @@ -100,9 +100,10 @@ ColumnLayout { Layout.fillWidth: true from: 0.0 to: 1.0 - value: mainItem.call ? mainItem.call.core.microphoneVolumeGain : 0.5 + value: mainItem.call ? mainItem.call.core.microphoneVolumeGain : SettingsCpp.captureGain onMoved: { if (mainItem.call) mainItem.call.core.lSetMicrophoneVolumeGain(value) + SettingsCpp.lSetCaptureGain(value) } } Timer { @@ -160,13 +161,14 @@ ColumnLayout { } } ComboBox { + id: videoDevicesCbox Layout.fillWidth: true Layout.preferredWidth: parent.width Layout.preferredHeight: 49 * DefaultStyle.dp model: SettingsCpp.videoDevices - currentIndex: SettingsCpp.currentVideoDeviceIndex + currentIndex: SettingsCpp.videoDeviceIndex onCurrentTextChanged: { - SettingsCpp.setVideoDevice(currentText) + SettingsCpp.lSetVideoDevice(currentText) } } } diff --git a/Linphone/view/Item/Contact/Sticker.qml b/Linphone/view/Item/Contact/Sticker.qml index ae8c6ebeb..c8bf568e6 100644 --- a/Linphone/view/Item/Contact/Sticker.qml +++ b/Linphone/view/Item/Contact/Sticker.qml @@ -81,8 +81,8 @@ Item { } Text { id: waitingTime - property int seconds visible: !UtilsCpp.isMe(mainItem.peerAddress) + property int seconds text: UtilsCpp.formatElapsedTime(seconds) color: DefaultStyle.grey_0 Layout.alignment: Qt.AlignHCenter diff --git a/Linphone/view/Layout/Call/ActiveSpeakerLayout.qml b/Linphone/view/Layout/Call/ActiveSpeakerLayout.qml index 91a0cb375..fad021603 100644 --- a/Linphone/view/Layout/Call/ActiveSpeakerLayout.qml +++ b/Linphone/view/Layout/Call/ActiveSpeakerLayout.qml @@ -19,10 +19,11 @@ Item{ } property var callState: call && call.core.state || undefined onCallStateChanged: if (callState === LinphoneEnums.CallState.End || callState === LinphoneEnums.CallState.Released) preview.visible = false - property string localAddress: call && call.conference - ? call.conference.core.me.core.sipAddress - : call.core.localAddress - || "" + property string localAddress: call + ? call.conference + ? call.conference.core.me.core.sipAddress + : call.core.localAddress + : "" // currently speaking address (for hiding in list view) property string activeSpeakerAddress diff --git a/Linphone/view/Layout/Call/CallLayout.qml b/Linphone/view/Layout/Call/CallLayout.qml index 9e360d260..950ef251d 100644 --- a/Linphone/view/Layout/Call/CallLayout.qml +++ b/Linphone/view/Layout/Call/CallLayout.qml @@ -79,7 +79,7 @@ Item { Layout.Layout.preferredHeight: parent.height Layout.Layout.alignment: Qt.AlignCenter Text { - text: qsTr(mainItem.call.core.lastErrorMessage) + text: mainItem.call ? mainItem.call.core.lastErrorMessage : "" Layout.Layout.alignment: Qt.AlignCenter color: DefaultStyle.grey_0 font.pixelSize: 40 * DefaultStyle.dp