/* * 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 . */ #ifndef SETTINGS_MODEL_H_ #define SETTINGS_MODEL_H_ #include "MediastreamerUtils.hpp" #include "tool/LinphoneEnums.hpp" #include #include #include #include #include "tool/AbstractObject.hpp" class SettingsModel : public QObject, public AbstractObject { Q_OBJECT public: SettingsModel(); virtual ~SettingsModel(); static std::shared_ptr create(); static std::shared_ptr getInstance(); bool isReadOnly(const std::string §ion, const std::string &name) const; std::string getEntryFullName(const std::string §ion, const std::string &name) const; // Return the full name of the entry : 'name/readonly' or 'name' static const std::string UiSection; static const std::string AppSection; static const std::string CardDAVSection; std::shared_ptr mConfig; bool getVfsEnabled() const; bool getVfsEncrypted() const; void setVfsEnabled(const bool enabled); bool getVideoEnabled() const; void setVideoEnabled(const bool enabled); bool getAutomaticallyRecordCallsEnabled() const; void setAutomaticallyRecordCallsEnabled(bool enabled); bool getEchoCancellationEnabled() const; void setEchoCancellationEnabled(bool enabled); void setAutoDownloadReceivedFiles(bool enabled); bool getAutoDownloadReceivedFiles() const; // Audio. -------------------------------------------------------------------- bool getIsInCall() const; void accessCallSettings(); void updateCallSettings(); void closeCallSettings(); void startCaptureGraph(); void stopCaptureGraph(); ; void stopCaptureGraphs(); void resetCaptureGraph(); void createCaptureGraph(); void deleteCaptureGraph(); bool getCaptureGraphRunning(); float getMicVolume(); float getPlaybackGain() const; void setPlaybackGain(float gain); float getCaptureGain() const; void setCaptureGain(float gain); QVariantList getCaptureDevices() const; QVariantList getPlaybackDevices() const; QVariantList getRingerDevices() const; QStringList getVideoDevices() const; // There is no VideoDevice API from SDK QVariantMap getCaptureDevice() const; void setCaptureDevice(const QVariantMap &device); QVariantMap getPlaybackDevice() const; void setPlaybackDevice(const QVariantMap &device); linphone::Conference::Layout getDefaultConferenceLayout() const; void setDefaultConferenceLayout(const linphone::Conference::Layout layout); linphone::MediaEncryption getDefaultMediaEncryption() const; void setDefaultMediaEncryption(const linphone::MediaEncryption encryption); bool getMediaEncryptionMandatory() const; void setMediaEncryptionMandatory(bool mandatory); bool getCreateEndToEndEncryptedMeetingsAndGroupCalls() const; void setCreateEndToEndEncryptedMeetingsAndGroupCalls(bool endtoend); int getCardDAVMinCharResearch() const; void setCardDAVMinCharResearch(int min); QVariantMap getRingerDevice() const; void setRingerDevice(QVariantMap device); void setRingtone(QString ringtonePath); QString getRingtone() const; QString getVideoDevice() const; void setVideoDevice(QString device); QString getDefaultDomain() const; //------------------------------------------------------------------------------------------------------------ void startEchoCancellerCalibration(); int getEchoCancellationCalibration() const; bool getCallToneIndicationsEnabled() const; void setCallToneIndicationsEnabled(bool enabled); //------------------------------------------------------------------------------------------------------------ bool getLogsEnabled() const; void setLogsEnabled(bool status); bool getFullLogsEnabled() const; void setFullLogsEnabled(bool status); static bool getLogsEnabled(const std::shared_ptr &config); static bool getFullLogsEnabled(const std::shared_ptr &config); QString getLogsFolder() const; void setLogsFolder(const QString &folder); static QString getLogsFolder(const std::shared_ptr &config); QString getSavedCallsFolder() const; QString getLogsUploadUrl() const; void setLogsUploadUrl(const QString &url); void cleanLogs() const; void sendLogs() const; bool dndEnabled() const; static bool dndEnabled(const std::shared_ptr &config); void enableDnd(bool value); void enableRinging(bool enable); QString getLogsEmail() const; static const std::shared_ptr getCardDAVListForNewFriends(); static void setCardDAVListForNewFriends(std::string listName); static QString getDeviceName(const std::shared_ptr &config); static bool clearLocalLdapFriendsUponStartup(const std::shared_ptr &config); QFont getEmojiFont() const; int getEmojiFontSize() const; QFont getTextMessageFont() const; int getTextMessageFontSize() const; bool isSystrayNotificationBlinkEnabled() const; bool isSystrayNotificationGlobal() const; bool isSystrayNotificationFiltered() const; bool getStandardChatEnabled() const; bool getSecureChatEnabled() const; bool getGroupChatEnabled() const; bool getLimeIsSupported() const; void setDisableMeetingsFeature(bool value); bool getDisableMeetingsFeature() const; bool isCheckForUpdateAvailable() const; bool isCheckForUpdateEnabled() const; void setCheckForUpdateEnabled(bool enable); QString getVersionCheckUrl(); void setVersionCheckUrl(const QString &url); void setVersionCheckType(const LinphoneEnums::VersionCheckType &type); // UI DECLARE_GETSET(bool, disableChatFeature, DisableChatFeature) DECLARE_GETSET(bool, disableBroadcastFeature, DisableBroadcastFeature) DECLARE_GETSET(bool, hideSettings, HideSettings) DECLARE_GETSET(bool, hideAccountSettings, HideAccountSettings) DECLARE_GETSET(bool, hideFps, HideFps) DECLARE_GETSET(bool, disableCallRecordings, DisableCallRecordings) DECLARE_GETSET(bool, assistantHideCreateAccount, AssistantHideCreateAccount) DECLARE_GETSET(bool, assistantDisableQrCode, AssistantDisableQrCode) DECLARE_GETSET(bool, assistantHideThirdPartyAccount, AssistantHideThirdPartyAccount) DECLARE_GETSET(bool, hideSipAddresses, HideSipAddresses) DECLARE_GETSET(bool, darkModeAllowed, DarkModeAllowed) DECLARE_GETSET(int, maxAccount, MaxAccount) DECLARE_GETSET(bool, assistantGoDirectlyToThirdPartySipAccountLogin, AssistantGoDirectlyToThirdPartySipAccountLogin) DECLARE_GETSET(QString, assistantThirdPartySipAccountDomain, AssistantThirdPartySipAccountDomain) DECLARE_GETSET(QString, assistantThirdPartySipAccountTransport, AssistantThirdPartySipAccountTransport) DECLARE_GETSET(bool, autoStart, AutoStart) DECLARE_GETSET(bool, exitOnClose, ExitOnClose) DECLARE_GETSET(bool, syncLdapContacts, SyncLdapContacts) DECLARE_GETSET(bool, ipv6Enabled, Ipv6Enabled) DECLARE_GETSET(QString, configLocale, ConfigLocale) DECLARE_GETSET(QString, downloadFolder, DownloadFolder) DECLARE_GETSET(int, shortcutCount, ShortcutCount) DECLARE_GETSET(QVariantList, shortcuts, Shortcuts) DECLARE_GETSET(bool, usernameOnlyForLdapLookupsInCalls, UsernameOnlyForLdapLookupsInCalls) DECLARE_GETSET(bool, usernameOnlyForCardDAVLookupsInCalls, UsernameOnlyForCardDAVLookupsInCalls) DECLARE_GETSET(QString, commandLine, CommandLine) DECLARE_GETSET(bool, disableCommandLine, DisableCommandLine) DECLARE_GETSET(bool, disableCallForward, DisableCallForward) DECLARE_GETSET(QString, callForwardToAddress, CallForwardToAddress) DECLARE_GETSET(QString, chatNotificationSoundPath, ChatNotificationSoundPath) DECLARE_GETSET(QString, themeMainColor, ThemeMainColor) DECLARE_GETSET(QString, themeAboutPictureUrl, ThemeAboutPictureUrl) signals: void logsUploadUrlChanged(); // VFS. -------------------------------------------------------------------- void vfsEnabledChanged(bool enabled); void videoEnabledChanged(bool enabled); // Call. -------------------------------------------------------------------- void captureGraphRunningChanged(bool running); void playbackGainChanged(float gain); void captureGainChanged(float gain); void captureDevicesChanged(QVariantList devices); void playbackDevicesChanged(QVariantList devices); void ringerDevicesChanged(QVariantList devices); void videoDevicesChanged(QStringList devices); void captureDeviceChanged(QVariantMap device); void playbackDeviceChanged(QVariantMap device); void ringerDeviceChanged(QVariantMap device); void videoDeviceChanged(QString device); void ringtoneChanged(QString ringtonePath); void conferenceLayoutChanged(); void mediaEncryptionChanged(); void mediaEncryptionMandatoryChanged(); void createEndToEndEncryptedMeetingsAndGroupCallsChanged(bool endtoend); void cardDAVMinCharResearchChanged(int min); void echoCancellationEnabledChanged(bool enabled); void automaticallyRecordCallsEnabledChanged(bool enabled); void callToneIndicationsEnabledChanged(bool enabled); void showAudioCodecsChanged(bool status); void micVolumeChanged(float volume); void logsEnabledChanged(bool status); void fullLogsEnabledChanged(bool status); void dndChanged(bool value); void disableMeetingsFeatureChanged(bool value); void checkForUpdateEnabledChanged(); void versionCheckUrlChanged(); // Messages. -------------------------------------------------------------------- void autoDownloadReceivedFilesChanged(bool enabled); private: void notifyConfigReady(); MediastreamerUtils::SimpleCaptureGraph *mSimpleCaptureGraph = nullptr; int mCaptureGraphListenerCount = 0; #ifdef ENABLE_QT_KEYCHAIN VfsUtils mVfsUtils; #endif void enableCallForward(QString destination); void disableCallForward(); static std::shared_ptr gSettingsModel; DECLARE_ABSTRACT_OBJECT }; #endif // SETTINGS_MODEL_H_