mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 11:28:07 +00:00
- Use of Map in Combobox. - QML Combobox: Differentiate what we are displaying and the internal Object. - Implement an equality operator for Objects (map).
279 lines
9.8 KiB
C++
279 lines
9.8 KiB
C++
/*
|
|
* Copyright (c) 2010-2024 Belledonne Communications SARL.
|
|
*
|
|
* This file is part of linphone-desktop
|
|
* (see https://www.linphone.org).
|
|
*
|
|
* This program is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program 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 General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#ifndef SETTINGS_CORE_H_
|
|
#define SETTINGS_CORE_H_
|
|
|
|
#include "model/setting/SettingsModel.hpp"
|
|
#include "tool/thread/SafeConnection.hpp"
|
|
|
|
#include <QCommandLineParser>
|
|
#include <QObject>
|
|
#include <QSettings>
|
|
#include <QVariantMap>
|
|
|
|
class SettingsCore : 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 captureGraphRunning READ getCaptureGraphRunning NOTIFY captureGraphRunningChanged)
|
|
|
|
Q_PROPERTY(QVariantList captureDevices READ getCaptureDevices NOTIFY captureDevicesChanged)
|
|
Q_PROPERTY(QVariantList playbackDevices READ getPlaybackDevices NOTIFY playbackDevicesChanged)
|
|
Q_PROPERTY(QVariantList ringerDevices READ getRingerDevices NOTIFY ringerDevicesChanged)
|
|
|
|
Q_PROPERTY(float playbackGain READ getPlaybackGain WRITE lSetPlaybackGain NOTIFY playbackGainChanged)
|
|
Q_PROPERTY(float captureGain READ getCaptureGain WRITE lSetCaptureGain NOTIFY captureGainChanged)
|
|
|
|
Q_PROPERTY(QVariantMap captureDevice READ getCaptureDevice WRITE lSetCaptureDevice NOTIFY captureDeviceChanged)
|
|
Q_PROPERTY(QVariantMap playbackDevice READ getPlaybackDevice WRITE lSetPlaybackDevice NOTIFY playbackDeviceChanged)
|
|
Q_PROPERTY(QVariantMap ringerDevice READ getRingerDevice WRITE lSetRingerDevice NOTIFY ringerDeviceChanged)
|
|
|
|
Q_PROPERTY(QStringList videoDevices READ getVideoDevices NOTIFY videoDevicesChanged)
|
|
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)
|
|
Q_PROPERTY(bool dnd READ dndEnabled WRITE lEnableDnd NOTIFY dndChanged)
|
|
|
|
public:
|
|
static QSharedPointer<SettingsCore> create();
|
|
SettingsCore(QObject *parent = Q_NULLPTR);
|
|
virtual ~SettingsCore();
|
|
|
|
void setSelf(QSharedPointer<SettingsCore> me);
|
|
|
|
QString getConfigPath(const QCommandLineParser &parser = QCommandLineParser());
|
|
|
|
Q_INVOKABLE void setFirstLaunch(bool first);
|
|
Q_INVOKABLE bool getFirstLaunch() const;
|
|
|
|
Q_INVOKABLE void setDisplayDeviceCheckConfirmation(bool display);
|
|
Q_INVOKABLE bool getDisplayDeviceCheckConfirmation() const;
|
|
|
|
// Used to restore the last active index on launch
|
|
Q_INVOKABLE void setLastActiveTabIndex(int index);
|
|
Q_INVOKABLE int getLastActiveTabIndex();
|
|
|
|
// Security. --------------------------------------------------------------------
|
|
bool getVfsEnabled() {
|
|
return mVfsEnabled;
|
|
}
|
|
|
|
// Call. --------------------------------------------------------------------
|
|
|
|
bool getVideoEnabled() {
|
|
return mVideoEnabled;
|
|
}
|
|
bool getEchoCancellationEnabled() {
|
|
return mEchoCancellationEnabled;
|
|
}
|
|
bool getAutomaticallyRecordCallsEnabled() {
|
|
return mAutomaticallyRecordCallsEnabled;
|
|
}
|
|
|
|
float getPlaybackGain() const;
|
|
|
|
float getCaptureGain() const;
|
|
|
|
QVariantList getCaptureDevices() const;
|
|
QVariantList getPlaybackDevices() const;
|
|
QVariantList getRingerDevices() const;
|
|
|
|
QVariantMap getCaptureDevice() const;
|
|
QVariantMap getPlaybackDevice() const;
|
|
QVariantMap 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 dndEnabled() const;
|
|
|
|
DECLARE_CORE_GETSET_MEMBER(bool, disableChatFeature, DisableChatFeature)
|
|
DECLARE_CORE_GETSET_MEMBER(bool, disableMeetingsFeature, DisableMeetingsFeature)
|
|
DECLARE_CORE_GETSET_MEMBER(bool, disableBroadcastFeature, DisableBroadcastFeature)
|
|
DECLARE_CORE_GETSET_MEMBER(bool, hideSettings, HideSettings)
|
|
DECLARE_CORE_GETSET_MEMBER(bool, hideAccountSettings, HideAccountSettings)
|
|
DECLARE_CORE_GETSET_MEMBER(bool, hideFps, HideFps)
|
|
DECLARE_CORE_GETSET_MEMBER(bool, disableCallRecordings, DisableCallRecordings)
|
|
DECLARE_CORE_GETSET_MEMBER(bool, assistantHideCreateAccount, AssistantHideCreateAccount)
|
|
DECLARE_CORE_GETSET_MEMBER(bool, assistantDisableQrCode, AssistantDisableQrCode)
|
|
DECLARE_CORE_GETSET_MEMBER(bool, assistantHideThirdPartyAccount, AssistantHideThirdPartyAccount)
|
|
DECLARE_CORE_GETSET_MEMBER(bool, onlyDisplaySipUriUsername, OnlyDisplaySipUriUsername)
|
|
DECLARE_CORE_GETSET_MEMBER(bool, darkModeAllowed, DarkModeAllowed)
|
|
DECLARE_CORE_GETSET_MEMBER(int, maxAccount, MaxAccount)
|
|
DECLARE_CORE_GETSET_MEMBER(bool,
|
|
assistantGoDirectlyToThirdPartySipAccountLogin,
|
|
AssistantGoDirectlyToThirdPartySipAccountLogin)
|
|
DECLARE_CORE_GETSET_MEMBER(QString, assistantThirdPartySipAccountDomain, AssistantThirdPartySipAccountDomain)
|
|
DECLARE_CORE_GETSET_MEMBER(QString, assistantThirdPartySipAccountTransport, AssistantThirdPartySipAccountTransport)
|
|
DECLARE_CORE_GETSET(bool, autoStart, AutoStart)
|
|
DECLARE_CORE_GETSET(bool, exitOnClose, ExitOnClose)
|
|
DECLARE_CORE_GETSET(bool, syncLdapContacts, SyncLdapContacts)
|
|
DECLARE_CORE_GETSET_MEMBER(bool, ipv6Enabled, Ipv6Enabled)
|
|
DECLARE_CORE_GETSET_MEMBER(QVariantList, audioCodecs, AudioCodecs)
|
|
DECLARE_CORE_GETSET_MEMBER(QVariantList, videoCodecs, VideoCodecs)
|
|
DECLARE_CORE_GETSET(QString, configLocale, ConfigLocale)
|
|
DECLARE_CORE_GETSET(QString, downloadFolder, DownloadFolder)
|
|
|
|
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 QVariantList &devices);
|
|
void playbackDevicesChanged(const QVariantList &devices);
|
|
void ringerDevicesChanged(const QVariantList &devices);
|
|
|
|
void lSetCaptureDevice(const QVariantMap &device);
|
|
void captureDeviceChanged(const QVariantMap &device);
|
|
|
|
void lSetPlaybackDevice(const QVariantMap &device);
|
|
void playbackDeviceChanged(const QVariantMap &device);
|
|
|
|
void lSetRingerDevice(const QVariantMap &device);
|
|
void ringerDeviceChanged(const QVariantMap &device);
|
|
|
|
void lSetVideoDevice(const QString &device);
|
|
void videoDeviceChanged();
|
|
void videoDevicesChanged();
|
|
|
|
void lSetCaptureGain(float gain);
|
|
void lSetPlaybackGain(float gain);
|
|
|
|
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 firstLaunchChanged(bool firstLaunch);
|
|
void showVerifyDeviceConfirmationChanged(bool showVerifyDeviceConfirmation);
|
|
|
|
void lastActiveTabIndexChanged();
|
|
|
|
void dndChanged();
|
|
void lEnableDnd(bool value);
|
|
|
|
void ldapConfigChanged();
|
|
|
|
private:
|
|
// Dummy properties (for properties that use values from core received through signals)
|
|
int _dummy_int = 0;
|
|
|
|
// Security
|
|
bool mVfsEnabled;
|
|
|
|
// Call
|
|
bool mVideoEnabled;
|
|
bool mEchoCancellationEnabled;
|
|
bool mAutomaticallyRecordCallsEnabled;
|
|
|
|
// Audio
|
|
QVariantList mCaptureDevices;
|
|
QVariantList mPlaybackDevices;
|
|
QVariantList mRingerDevices;
|
|
QVariantMap mCaptureDevice;
|
|
QVariantMap mPlaybackDevice;
|
|
QVariantMap mRingerDevice;
|
|
|
|
// Video
|
|
QStringList mVideoDevices;
|
|
QString mVideoDevice;
|
|
|
|
bool mCaptureGraphRunning;
|
|
float mCaptureGain;
|
|
float mPlaybackGain;
|
|
int mEchoCancellationCalibration;
|
|
|
|
// Debug logs
|
|
bool mLogsEnabled;
|
|
bool mFullLogsEnabled;
|
|
QString mLogsFolder;
|
|
QString mLogsEmail;
|
|
|
|
// DND
|
|
bool mDndEnabled;
|
|
|
|
QSettings mAppSettings;
|
|
QSharedPointer<SafeConnection<SettingsCore, SettingsModel>> mSettingsModelConnection;
|
|
|
|
DECLARE_ABSTRACT_OBJECT
|
|
};
|
|
#endif
|