Skip to content
Snippets Groups Projects
Commit a196513d authored by Ming Rui Zhang's avatar Ming Rui Zhang
Browse files

settings: refactor for SettingsView - stage one

1. Add account config QML properties and use them
   in settings directly to avoid manual update
2. Rough clean up for video/audio settings
3. Remove settingsAdapter entirely and split the
   responsibility

Change-Id: Icf81b91d5a3a0dd9f2a52824159cd222367b801f
parent 8e1736fd
No related branches found
No related tags found
No related merge requests found
Showing
with 469 additions and 1483 deletions
...@@ -60,7 +60,6 @@ set(COMMON_SOURCES ...@@ -60,7 +60,6 @@ set(COMMON_SOURCES
${SRC_DIR}/avadapter.cpp ${SRC_DIR}/avadapter.cpp
${SRC_DIR}/contactadapter.cpp ${SRC_DIR}/contactadapter.cpp
${SRC_DIR}/pluginadapter.cpp ${SRC_DIR}/pluginadapter.cpp
${SRC_DIR}/settingsadapter.cpp
${SRC_DIR}/deviceitemlistmodel.cpp ${SRC_DIR}/deviceitemlistmodel.cpp
${SRC_DIR}/pluginitemlistmodel.cpp ${SRC_DIR}/pluginitemlistmodel.cpp
${SRC_DIR}/pluginhandleritemlistmodel.cpp ${SRC_DIR}/pluginhandleritemlistmodel.cpp
...@@ -117,7 +116,6 @@ set(COMMON_HEADERS ...@@ -117,7 +116,6 @@ set(COMMON_HEADERS
${SRC_DIR}/avadapter.h ${SRC_DIR}/avadapter.h
${SRC_DIR}/contactadapter.h ${SRC_DIR}/contactadapter.h
${SRC_DIR}/pluginadapter.h ${SRC_DIR}/pluginadapter.h
${SRC_DIR}/settingsadapter.h
${SRC_DIR}/deviceitemlistmodel.h ${SRC_DIR}/deviceitemlistmodel.h
${SRC_DIR}/pluginitemlistmodel.h ${SRC_DIR}/pluginitemlistmodel.h
${SRC_DIR}/pluginhandleritemlistmodel.h ${SRC_DIR}/pluginhandleritemlistmodel.h
......
...@@ -116,7 +116,7 @@ ApplicationWindow { ...@@ -116,7 +116,7 @@ ApplicationWindow {
function close(force = false) { function close(force = false) {
// If we're in the onboarding wizard or 'MinimizeOnClose' // If we're in the onboarding wizard or 'MinimizeOnClose'
// is set, then we can quit // is set, then we can quit
if (force || !SettingsAdapter.getAppValue(Settings.MinimizeOnClose) || if (force || !UtilsAdapter.getAppValue(Settings.MinimizeOnClose) ||
!UtilsAdapter.getAccountListSize()) { !UtilsAdapter.getAccountListSize()) {
Qt.quit() Qt.quit()
} else } else
...@@ -158,7 +158,7 @@ ApplicationWindow { ...@@ -158,7 +158,7 @@ ApplicationWindow {
onLoaded: { onLoaded: {
// Quiet check for updates on start if set to. // Quiet check for updates on start if set to.
if (SettingsAdapter.getAppValue(Settings.AutoUpdate)) { if (UtilsAdapter.getAppValue(Settings.AutoUpdate)) {
UpdateManager.checkForUpdates(true) UpdateManager.checkForUpdates(true)
UpdateManager.setAutoUpdateCheck(true) UpdateManager.setAutoUpdateCheck(true)
} }
......
...@@ -324,6 +324,20 @@ AccountAdapter::setCurrentAccountAvatarBase64(const QString& data) ...@@ -324,6 +324,20 @@ AccountAdapter::setCurrentAccountAvatarBase64(const QString& data)
}); });
} }
void
AccountAdapter::setDefaultModerator(const QString& accountId,
const QString& peerURI,
const bool& state)
{
lrcInstance_->accountModel().setDefaultModerator(accountId, peerURI, state);
}
QStringList
AccountAdapter::getDefaultModerators(const QString& accountId)
{
return lrcInstance_->accountModel().getDefaultModerators(accountId);
}
bool bool
AccountAdapter::hasPassword() AccountAdapter::hasPassword()
{ {
......
...@@ -85,6 +85,10 @@ public: ...@@ -85,6 +85,10 @@ public:
Q_INVOKABLE void setCurrAccDisplayName(const QString& text); Q_INVOKABLE void setCurrAccDisplayName(const QString& text);
Q_INVOKABLE void setCurrentAccountAvatarFile(const QString& source); Q_INVOKABLE void setCurrentAccountAvatarFile(const QString& source);
Q_INVOKABLE void setCurrentAccountAvatarBase64(const QString& source = {}); Q_INVOKABLE void setCurrentAccountAvatarBase64(const QString& source = {});
Q_INVOKABLE void setDefaultModerator(const QString& accountId,
const QString& peerURI,
const bool& state);
Q_INVOKABLE QStringList getDefaultModerators(const QString& accountId);
Q_SIGNALS: Q_SIGNALS:
// Trigger other components to reconnect account related signals. // Trigger other components to reconnect account related signals.
......
...@@ -21,6 +21,9 @@ ...@@ -21,6 +21,9 @@
#include "avadapter.h" #include "avadapter.h"
#include "qtutils.h" #include "qtutils.h"
#include "api/newcodecmodel.h"
#include "api/newdevicemodel.h"
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
#include "xrectsel.h" #include "xrectsel.h"
#endif #endif
...@@ -339,3 +342,51 @@ AvAdapter::getScreenNumber() const ...@@ -339,3 +342,51 @@ AvAdapter::getScreenNumber() const
#endif #endif
return display; return display;
} }
void
AvAdapter::setDeviceName(const QString& deviceName)
{
lrcInstance_->getCurrentAccountInfo().deviceModel->setCurrentDeviceName(deviceName);
}
void
AvAdapter::setCurrentVideoDeviceRateAndResolution(qreal rate, const QString& resolution)
{
auto settings = lrcInstance_->avModel().getDeviceSettings(
lrcInstance_->avModel().getCurrentVideoCaptureDevice());
settings.rate = rate;
settings.size = resolution;
lrcInstance_->avModel().setDeviceSettings(settings);
}
QString
AvAdapter::getVideoSettingsSize(const QString& deviceId)
{
return lrcInstance_->avModel().getDeviceSettings(deviceId).size;
}
int
AvAdapter::getCurrentVideoDeviceCapabilitiesSize()
{
return lrcInstance_->avModel()
.getDeviceCapabilities(lrcInstance_->avModel().getCurrentVideoCaptureDevice())
.size();
}
void
AvAdapter::enableCodec(unsigned int id, bool isToEnable)
{
lrcInstance_->getCurrentAccountInfo().codecModel->enable(id, isToEnable);
}
void
AvAdapter::increaseCodecPriority(unsigned int id, bool isVideo)
{
lrcInstance_->getCurrentAccountInfo().codecModel->increasePriority(id, isVideo);
}
void
AvAdapter::decreaseCodecPriority(unsigned int id, bool isVideo)
{
lrcInstance_->getCurrentAccountInfo().codecModel->decreasePriority(id, isVideo);
}
...@@ -75,6 +75,15 @@ protected: ...@@ -75,6 +75,15 @@ protected:
Q_INVOKABLE void startAudioMeter(); Q_INVOKABLE void startAudioMeter();
Q_INVOKABLE void stopAudioMeter(); Q_INVOKABLE void stopAudioMeter();
Q_INVOKABLE void setDeviceName(const QString& deviceName);
Q_INVOKABLE void setCurrentVideoDeviceRateAndResolution(qreal rate, const QString& resolution);
Q_INVOKABLE QString getVideoSettingsSize(const QString& deviceId);
Q_INVOKABLE int getCurrentVideoDeviceCapabilitiesSize();
Q_INVOKABLE void enableCodec(unsigned int id, bool isToEnable);
Q_INVOKABLE void increaseCodecPriority(unsigned int id, bool isVideo);
Q_INVOKABLE void decreaseCodecPriority(unsigned int id, bool isVideo);
private Q_SLOTS: private Q_SLOTS:
void onAudioDeviceEvent(); void onAudioDeviceEvent();
void onVideoDeviceEvent(); void onVideoDeviceEvent();
......
...@@ -29,10 +29,8 @@ import "../commoncomponents" ...@@ -29,10 +29,8 @@ import "../commoncomponents"
BaseDialog { BaseDialog {
id: root id: root
property int profileType: SettingsAdapter.getCurrentAccount_Profile_Info_Type()
property bool isSIP: { property bool isSIP: {
switch (profileType) { switch (CurrentAccount.type) {
case Profile.Type.SIP: case Profile.Type.SIP:
return true; return true;
default: default:
...@@ -42,13 +40,6 @@ BaseDialog { ...@@ -42,13 +40,6 @@ BaseDialog {
signal accepted signal accepted
function openDialog() {
profileType = SettingsAdapter.getCurrentAccount_Profile_Info_Type()
labelBestId.text = SettingsAdapter.getAccountBestName()
labelAccountHash.text = SettingsAdapter.getCurrentAccount_Profile_Info_Uri()
open()
}
title: JamiStrings.deleteAccount title: JamiStrings.deleteAccount
contentItem: Rectangle { contentItem: Rectangle {
...@@ -67,7 +58,8 @@ BaseDialog { ...@@ -67,7 +58,8 @@ BaseDialog {
id: labelDeletion id: labelDeletion
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: deleteAccountContentRect.width - JamiTheme.preferredMarginSize * 2 Layout.preferredWidth: deleteAccountContentRect.width -
JamiTheme.preferredMarginSize * 2
color: JamiTheme.textColor color: JamiTheme.textColor
text: JamiStrings.confirmDeleteQuestion text: JamiStrings.confirmDeleteQuestion
...@@ -84,10 +76,11 @@ BaseDialog { ...@@ -84,10 +76,11 @@ BaseDialog {
id: labelBestId id: labelBestId
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: deleteAccountContentRect.width - JamiTheme.preferredMarginSize * 2 Layout.preferredWidth: deleteAccountContentRect.width -
JamiTheme.preferredMarginSize * 2
color: JamiTheme.textColor color: JamiTheme.textColor
text: SettingsAdapter.getAccountBestName() text: CurrentAccount.bestName
font.pointSize: JamiTheme.textFontSize font.pointSize: JamiTheme.textFontSize
font.kerning: true font.kerning: true
...@@ -102,10 +95,11 @@ BaseDialog { ...@@ -102,10 +95,11 @@ BaseDialog {
id: labelAccountHash id: labelAccountHash
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: deleteAccountContentRect.width - JamiTheme.preferredMarginSize * 2 Layout.preferredWidth: deleteAccountContentRect.width -
JamiTheme.preferredMarginSize * 2
color: JamiTheme.textColor color: JamiTheme.textColor
text: SettingsAdapter.getCurrentAccount_Profile_Info_Uri() text: CurrentAccount.uri
font.pointSize: JamiTheme.textFontSize font.pointSize: JamiTheme.textFontSize
font.kerning: true font.kerning: true
...@@ -121,7 +115,8 @@ BaseDialog { ...@@ -121,7 +115,8 @@ BaseDialog {
visible: !isSIP visible: !isSIP
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: deleteAccountContentRect.width - JamiTheme.preferredMarginSize * 2 Layout.preferredWidth: deleteAccountContentRect.width -
JamiTheme.preferredMarginSize * 2
text: JamiStrings.deleteAccountInfos text: JamiStrings.deleteAccountInfos
......
...@@ -131,6 +131,8 @@ Item { ...@@ -131,6 +131,8 @@ Item {
// AdvancedMediaSettings // AdvancedMediaSettings
property string media: qsTr("Media") property string media: qsTr("Media")
property string enableVideo: qsTr("Enable video") property string enableVideo: qsTr("Enable video")
property string videoCodecs: qsTr("Video Codecs")
property string audioCodecs: qsTr("Audio Codecs")
// AdvancedSDPSettings // AdvancedSDPSettings
property string sdpSettingsTitle: qsTr("SDP Session Negotiation (ICE Fallback)") property string sdpSettingsTitle: qsTr("SDP Session Negotiation (ICE Fallback)")
......
...@@ -25,7 +25,7 @@ import net.jami.Adapters 1.1 ...@@ -25,7 +25,7 @@ import net.jami.Adapters 1.1
import net.jami.Enums 1.1 import net.jami.Enums 1.1
Item { Item {
property bool darkTheme: SettingsAdapter.getAppValue(Settings.EnableDarkTheme) property bool darkTheme: UtilsAdapter.getAppValue(Settings.EnableDarkTheme)
// Jami theme colors // Jami theme colors
function rgba256(r, g, b, a) { function rgba256(r, g, b, a) {
......
...@@ -18,8 +18,11 @@ ...@@ -18,8 +18,11 @@
#include "currentaccount.h" #include "currentaccount.h"
CurrentAccount::CurrentAccount(LRCInstance* lrcInstance, QObject* parent) CurrentAccount::CurrentAccount(LRCInstance* lrcInstance,
AppSettingsManager* settingsManager,
QObject* parent)
: QObject(parent) : QObject(parent)
, settingsManager_(settingsManager)
, lrcInstance_(lrcInstance) , lrcInstance_(lrcInstance)
{ {
connect(&lrcInstance_->accountModel(), connect(&lrcInstance_->accountModel(),
...@@ -33,9 +36,64 @@ CurrentAccount::CurrentAccount(LRCInstance* lrcInstance, QObject* parent) ...@@ -33,9 +36,64 @@ CurrentAccount::CurrentAccount(LRCInstance* lrcInstance, QObject* parent)
&CurrentAccount::onAccountUpdated); &CurrentAccount::onAccountUpdated);
connect(lrcInstance_, &LRCInstance::currentAccountIdChanged, [this] { updateData(); }); connect(lrcInstance_, &LRCInstance::currentAccountIdChanged, [this] { updateData(); });
updateData(); updateData();
} }
void
CurrentAccount::set_enabled(bool enabled, bool initialize)
{
if (enabled_ != enabled) {
enabled_ = enabled;
if (!initialize)
lrcInstance_->accountModel().setAccountEnabled(lrcInstance_->get_currentAccountId(),
enabled);
Q_EMIT enabledChanged();
}
}
bool
CurrentAccount::get_enabled()
{
return enabled_;
}
void
CurrentAccount::set_isAllModeratorsEnabled(bool enabled, bool initialize)
{
if (enabled != isAllModeratorsEnabled_) {
isAllModeratorsEnabled_ = enabled;
if (!initialize)
lrcInstance_->accountModel().setAllModerators(lrcInstance_->get_currentAccountId(),
enabled);
Q_EMIT isAllModeratorsEnabledChanged();
}
}
bool
CurrentAccount::get_isAllModeratorsEnabled()
{
return isAllModeratorsEnabled_;
}
void
CurrentAccount::set_isLocalModeratorsEnabled(bool enabled, bool initialize)
{
if (enabled != isLocalModeratorsEnabled_) {
isLocalModeratorsEnabled_ = enabled;
if (!initialize)
lrcInstance_->accountModel().enableLocalModerators(lrcInstance_->get_currentAccountId(),
enabled);
Q_EMIT isLocalModeratorsEnabledChanged();
}
}
bool
CurrentAccount::get_isLocalModeratorsEnabled()
{
return isLocalModeratorsEnabled_;
}
void void
CurrentAccount::onAccountUpdated(const QString& id) CurrentAccount::onAccountUpdated(const QString& id)
{ {
...@@ -50,7 +108,9 @@ CurrentAccount::updateData() ...@@ -50,7 +108,9 @@ CurrentAccount::updateData()
{ {
set_id(lrcInstance_->get_currentAccountId()); set_id(lrcInstance_->get_currentAccountId());
try { try {
const auto& accInfo = lrcInstance_->getAccountInfo(id_); const auto& accConfig = lrcInstance_->getCurrAccConfig();
const auto& accInfo = lrcInstance_->getCurrentAccountInfo();
set_uri(accInfo.profileInfo.uri); set_uri(accInfo.profileInfo.uri);
set_registeredName(accInfo.registeredName); set_registeredName(accInfo.registeredName);
set_alias(accInfo.profileInfo.alias); set_alias(accInfo.profileInfo.alias);
...@@ -59,7 +119,96 @@ CurrentAccount::updateData() ...@@ -59,7 +119,96 @@ CurrentAccount::updateData()
set_hasAvatarSet(!accInfo.profileInfo.avatar.isEmpty()); set_hasAvatarSet(!accInfo.profileInfo.avatar.isEmpty());
set_status(accInfo.status); set_status(accInfo.status);
set_type(accInfo.profileInfo.type); set_type(accInfo.profileInfo.type);
set_enabled(accInfo.enabled, true);
set_managerUri(accConfig.managerUri);
set_keepAliveEnabled(accConfig.keepAliveEnabled, true);
set_peerDiscovery(accConfig.peerDiscovery, true);
set_sendReadReceipt(accConfig.sendReadReceipt, true);
set_isRendezVous(accConfig.isRendezVous, true);
set_autoAnswer(accConfig.autoAnswer, true);
set_proxyEnabled(accConfig.proxyEnabled, true);
set_upnpEnabled(accConfig.upnpEnabled, true);
set_publishedSameAsLocal(accConfig.publishedSameAsLocal, true);
set_allowIPAutoRewrite(accConfig.allowIPAutoRewrite, true);
set_proxyServer(accConfig.proxyServer, true);
set_routeset(accConfig.routeset, true);
set_username(accConfig.username, true);
set_hostname(accConfig.hostname, true);
set_password(accConfig.password, true);
set_mailbox(accConfig.mailbox, true);
set_publishedAddress(accConfig.publishedAddress, true);
set_localPort(accConfig.localPort, true);
set_publishedPort(accConfig.publishedPort, true);
// DHT
set_PublicInCallsDHT(accConfig.DHT.PublicInCalls, true);
// RingNS
set_uriRingNS(accConfig.RingNS.uri, true);
// TLS
set_enableTLS(accConfig.TLS.enable, true);
set_verifyServerTLS(accConfig.TLS.verifyServer, true);
set_verifyClientTLS(accConfig.TLS.verifyClient, true);
set_requireClientCertificateTLS(accConfig.TLS.requireClientCertificate, true);
set_certificateListFileTLS(accConfig.TLS.certificateListFile, true);
set_certificateFileTLS(accConfig.TLS.certificateFile, true);
set_privateKeyFileTLS(accConfig.TLS.privateKeyFile, true);
set_passwordTLS(accConfig.TLS.password, true);
set_serverNameTLS(accConfig.TLS.serverName, true);
set_methodTLS(accConfig.TLS.method, true);
set_negotiationTimeoutSecTLS(accConfig.TLS.negotiationTimeoutSec, true);
// SRTP
set_enableSRTP(accConfig.SRTP.enable, true);
set_rtpFallbackSRTP(accConfig.SRTP.rtpFallback, true);
set_keyExchangeSRTP(accConfig.SRTP.keyExchange, true);
// TURN
set_enableTURN(accConfig.TURN.enable, true);
set_serverTURN(accConfig.TURN.server, true);
set_usernameTURN(accConfig.TURN.username, true);
set_passwordTURN(accConfig.TURN.password, true);
set_realmTURN(accConfig.TURN.realm, true);
// STUN
set_enableSTUN(accConfig.STUN.enable, true);
set_serverSTUN(accConfig.STUN.server, true);
// Video & Audio
set_videoEnabledVideo(accConfig.Video.videoEnabled, true);
set_videoPortMinVideo(accConfig.Video.videoPortMin, true);
set_videoPortMaxVideo(accConfig.Video.videoPortMax, true);
set_audioPortMinAudio(accConfig.Audio.audioPortMin, true);
set_audioPortMaxAudio(accConfig.Audio.audioPortMax, true);
// Ringtone
set_ringtoneEnabledRingtone(accConfig.Ringtone.ringtoneEnabled, true);
set_ringtonePathRingtone(accConfig.Ringtone.ringtonePath, true);
// Registration
set_expireRegistration(accConfig.Registration.expire, true);
// Moderators
set_isAllModeratorsEnabled(lrcInstance_->accountModel().isAllModerators(
lrcInstance_->get_currentAccountId()),
true);
set_isLocalModeratorsEnabled(lrcInstance_->accountModel().isLocalModeratorsEnabled(
lrcInstance_->get_currentAccountId()),
true);
// NewAccount model
set_autoTransferFromTrusted(settingsManager_->getValue(Settings::Key::AutoAcceptFiles)
.toBool(),
true);
set_autoTransferFromUntrusted(settingsManager_->getValue(Settings::Key::AllowFromUntrusted)
.toBool(),
true);
set_autoTransferSizeThreshold(settingsManager_->getValue(Settings::Key::AcceptTransferBelow)
.toInt(),
true);
} catch (...) { } catch (...) {
qWarning() << "Can't update current account data for" << id_; qWarning() << "Can't update current account info data for" << id_;
} }
} }
...@@ -19,31 +19,208 @@ ...@@ -19,31 +19,208 @@
#pragma once #pragma once
#include "lrcinstance.h" #include "lrcinstance.h"
#include "qtutils.h"
#include "appsettingsmanager.h"
#include <QObject> #include <QObject>
#include <QString> #include <QString>
#define ACCOUNT_CONFIG_SETTINGS_PROPERTY_BASE(type, prop) \
PROPERTY_GETTER_BASE(type, prop) \
void set_##prop(const type& x = {}, bool initialize = false) \
{ \
if (prop##_ != x) { \
prop##_ = x; \
if (!initialize) { \
auto confProps = lrcInstance_->getCurrAccConfig(); \
confProps.prop = x; \
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->get_currentAccountId(), \
confProps); \
} \
Q_EMIT prop##Changed(); \
} \
}
#define NEW_ACCOUNT_MODEL_SETTINGS_PROPERTY_BASE(type, prop, appSettingName) \
PROPERTY_GETTER_BASE(type, prop) \
void set_##prop(const type& x = {}, bool initialize = false) \
{ \
if (prop##_ != x) { \
prop##_ = x; \
lrcInstance_->accountModel().prop = x; \
if (!initialize) { \
settingsManager_->setValue(Settings::Key::appSettingName, x); \
} \
Q_EMIT prop##Changed(); \
} \
}
#define ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY_BASE(type, prop, cate) \
type prop##cate##_ {}; \
\
public: \
Q_SIGNAL void prop##cate##Changed(); \
type get_##prop##cate() \
{ \
return prop##cate##_; \
} \
void set_##prop##cate(const type& x = {}, bool initialize = false) \
{ \
if (prop##cate##_ != x) { \
prop##cate##_ = x; \
if (!initialize) { \
auto confProps = lrcInstance_->getCurrAccConfig(); \
confProps.cate.prop = x; \
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->get_currentAccountId(), \
confProps); \
} \
Q_EMIT prop##cate##Changed(); \
} \
}
#define QML_ACCOUNT_CONFIG_SETTINGS_PROPERTY(type, prop) \
private: \
Q_PROPERTY(type prop READ get_##prop WRITE set_##prop NOTIFY prop##Changed); \
ACCOUNT_CONFIG_SETTINGS_PROPERTY_BASE(type, prop)
#define QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(type, prop, cate) \
private: \
Q_PROPERTY(type prop##_##cate READ get_##prop##cate WRITE set_##prop##cate NOTIFY \
prop##cate##Changed); \
ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY_BASE(type, prop, cate)
#define QML_NEW_ACCOUNT_MODEL_SETTINGS_PROPERTY(type, prop, appSettingName) \
private: \
Q_PROPERTY(type prop READ get_##prop WRITE set_##prop NOTIFY prop##Changed); \
NEW_ACCOUNT_MODEL_SETTINGS_PROPERTY_BASE(type, prop, appSettingName)
class CurrentAccount final : public QObject class CurrentAccount final : public QObject
{ {
Q_OBJECT Q_OBJECT
// Basic settings
Q_PROPERTY(bool enabled READ get_enabled WRITE set_enabled NOTIFY enabledChanged);
QML_RO_PROPERTY(QString, id) QML_RO_PROPERTY(QString, id)
QML_RO_PROPERTY(QString, uri) QML_RO_PROPERTY(QString, uri)
QML_RO_PROPERTY(QString, registeredName) QML_RO_PROPERTY(QString, registeredName)
QML_RO_PROPERTY(QString, alias) QML_RO_PROPERTY(QString, alias)
QML_RO_PROPERTY(QString, bestId) QML_RO_PROPERTY(QString, bestId)
QML_RO_PROPERTY(QString, bestName) QML_RO_PROPERTY(QString, bestName)
QML_RO_PROPERTY(QString, managerUri)
QML_RO_PROPERTY(bool, hasAvatarSet) QML_RO_PROPERTY(bool, hasAvatarSet)
QML_RO_PROPERTY(lrc::api::account::Status, status) QML_RO_PROPERTY(lrc::api::account::Status, status)
QML_RO_PROPERTY(lrc::api::profile::Type, type) QML_RO_PROPERTY(lrc::api::profile::Type, type)
QML_ACCOUNT_CONFIG_SETTINGS_PROPERTY(bool, keepAliveEnabled)
QML_ACCOUNT_CONFIG_SETTINGS_PROPERTY(bool, peerDiscovery)
QML_ACCOUNT_CONFIG_SETTINGS_PROPERTY(bool, sendReadReceipt)
QML_ACCOUNT_CONFIG_SETTINGS_PROPERTY(bool, isRendezVous)
QML_ACCOUNT_CONFIG_SETTINGS_PROPERTY(bool, autoAnswer)
QML_ACCOUNT_CONFIG_SETTINGS_PROPERTY(bool, proxyEnabled)
QML_ACCOUNT_CONFIG_SETTINGS_PROPERTY(bool, upnpEnabled)
QML_ACCOUNT_CONFIG_SETTINGS_PROPERTY(bool, publishedSameAsLocal)
QML_ACCOUNT_CONFIG_SETTINGS_PROPERTY(bool, allowIPAutoRewrite)
QML_ACCOUNT_CONFIG_SETTINGS_PROPERTY(QString, proxyServer)
QML_ACCOUNT_CONFIG_SETTINGS_PROPERTY(QString, routeset)
QML_ACCOUNT_CONFIG_SETTINGS_PROPERTY(QString, username)
QML_ACCOUNT_CONFIG_SETTINGS_PROPERTY(QString, hostname)
QML_ACCOUNT_CONFIG_SETTINGS_PROPERTY(QString, password)
QML_ACCOUNT_CONFIG_SETTINGS_PROPERTY(QString, mailbox)
QML_ACCOUNT_CONFIG_SETTINGS_PROPERTY(QString, publishedAddress)
QML_ACCOUNT_CONFIG_SETTINGS_PROPERTY(int, localPort)
QML_ACCOUNT_CONFIG_SETTINGS_PROPERTY(int, publishedPort)
// Moderator settings
Q_PROPERTY(bool isAllModeratorsEnabled READ get_isAllModeratorsEnabled WRITE
set_isAllModeratorsEnabled NOTIFY isAllModeratorsEnabledChanged)
Q_PROPERTY(bool isLocalModeratorsEnabled READ get_isLocalModeratorsEnabled WRITE
set_isLocalModeratorsEnabled NOTIFY isLocalModeratorsEnabledChanged)
// RingNS setting
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(QString, uri, RingNS)
// DHT settings
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(bool, PublicInCalls, DHT)
// TLS settings
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(bool, enable, TLS)
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(bool, verifyServer, TLS)
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(bool, verifyClient, TLS)
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(bool, requireClientCertificate, TLS)
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(QString, certificateListFile, TLS)
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(QString, certificateFile, TLS)
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(QString, privateKeyFile, TLS)
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(QString, password, TLS)
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(QString, serverName, TLS)
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(lrc::api::account::TlsMethod, method, TLS)
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(int, negotiationTimeoutSec, TLS)
// SRTP settings
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(bool, enable, SRTP)
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(bool, rtpFallback, SRTP)
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(lrc::api::account::KeyExchangeProtocol,
keyExchange,
SRTP)
// TURN settings
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(bool, enable, TURN)
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(QString, server, TURN)
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(QString, username, TURN)
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(QString, password, TURN)
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(QString, realm, TURN)
// STUN settings
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(bool, enable, STUN)
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(QString, server, STUN)
// Video & Audio settings
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(bool, videoEnabled, Video)
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(int, videoPortMin, Video)
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(int, videoPortMax, Video)
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(int, audioPortMin, Audio)
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(int, audioPortMax, Audio)
// Ringtone settings
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(bool, ringtoneEnabled, Ringtone)
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(QString, ringtonePath, Ringtone)
// Registration settings
QML_ACCOUNT_CONFIG_CATEGORY_SETTINGS_PROPERTY(int, expire, Registration)
// NewAccount model settings
QML_NEW_ACCOUNT_MODEL_SETTINGS_PROPERTY(bool, autoTransferFromTrusted, AutoAcceptFiles)
QML_NEW_ACCOUNT_MODEL_SETTINGS_PROPERTY(bool, autoTransferFromUntrusted, AllowFromUntrusted)
QML_NEW_ACCOUNT_MODEL_SETTINGS_PROPERTY(int, autoTransferSizeThreshold, AcceptTransferBelow)
public: public:
explicit CurrentAccount(LRCInstance* lrcInstance, QObject* parent = nullptr); explicit CurrentAccount(LRCInstance* lrcInstance,
AppSettingsManager* settingsManager,
QObject* parent = nullptr);
~CurrentAccount() = default; ~CurrentAccount() = default;
void set_enabled(bool enabled = false, bool initialize = false);
bool get_enabled();
void set_isAllModeratorsEnabled(bool enabled, bool initialize = false);
bool get_isAllModeratorsEnabled();
void set_isLocalModeratorsEnabled(bool enabled, bool initialize = false);
bool get_isLocalModeratorsEnabled();
Q_SIGNALS:
void enabledChanged();
void isAllModeratorsEnabledChanged();
void isLocalModeratorsEnabledChanged();
private Q_SLOTS: private Q_SLOTS:
void updateData(); void updateData();
void onAccountUpdated(const QString& id); void onAccountUpdated(const QString& id);
private: private:
bool enabled_;
bool isAllModeratorsEnabled_;
bool isLocalModeratorsEnabled_;
AppSettingsManager* settingsManager_;
LRCInstance* lrcInstance_; LRCInstance* lrcInstance_;
}; };
...@@ -68,7 +68,7 @@ Rectangle { ...@@ -68,7 +68,7 @@ Rectangle {
height = preferredHeight height = preferredHeight
if (isVideo) { if (isVideo) {
var device = AVModel.getDefaultDevice() var device = AVModel.getDefaultDevice()
var settings = SettingsAdapter.get_Video_Settings_Size(device) var settings = AvAdapter.getVideoSettingsSize(device)
var res = settings.split("x") var res = settings.split("x")
var aspectRatio = res[1] / res[0] var aspectRatio = res[1] / res[0]
if (aspectRatio) { if (aspectRatio) {
......
...@@ -28,7 +28,14 @@ ...@@ -28,7 +28,14 @@
MediaCodecListModel::MediaCodecListModel(QObject* parent) MediaCodecListModel::MediaCodecListModel(QObject* parent)
: AbstractListModelBase(parent) : AbstractListModelBase(parent)
{} {
connect(this, &MediaCodecListModel::lrcInstanceChanged, [this]() {
connect(lrcInstance_,
&LRCInstance::currentAccountIdChanged,
this,
&MediaCodecListModel::reset);
});
}
MediaCodecListModel::~MediaCodecListModel() {} MediaCodecListModel::~MediaCodecListModel() {}
...@@ -141,6 +148,13 @@ MediaCodecListModel::flags(const QModelIndex& index) const ...@@ -141,6 +148,13 @@ MediaCodecListModel::flags(const QModelIndex& index) const
return flags; return flags;
} }
void
MediaCodecListModel::reset()
{
beginResetModel();
endResetModel();
}
int int
MediaCodecListModel::mediaType() MediaCodecListModel::mediaType()
{ {
......
...@@ -46,6 +46,8 @@ public: ...@@ -46,6 +46,8 @@ public:
QModelIndex parent(const QModelIndex& child) const; QModelIndex parent(const QModelIndex& child) const;
Qt::ItemFlags flags(const QModelIndex& index) const; Qt::ItemFlags flags(const QModelIndex& index) const;
Q_INVOKABLE void reset();
int mediaType(); int mediaType();
void setMediaType(int mediaType); void setMediaType(int mediaType);
......
...@@ -530,6 +530,22 @@ MessagesAdapter::blockConversation(const QString& convUid) ...@@ -530,6 +530,22 @@ MessagesAdapter::blockConversation(const QString& convUid)
lrcInstance_->getCurrentConversationModel()->removeConversation(currentConvUid, true); lrcInstance_->getCurrentConversationModel()->removeConversation(currentConvUid, true);
} }
void
MessagesAdapter::unbanContact(int index)
{
auto& accountInfo = lrcInstance_->getCurrentAccountInfo();
auto bannedContactList = accountInfo.contactModel->getBannedContacts();
auto it = bannedContactList.begin();
std::advance(it, index);
try {
auto contactInfo = accountInfo.contactModel->getContact(*it);
accountInfo.contactModel->addContact(contactInfo);
} catch (const std::out_of_range& e) {
qDebug() << e.what();
}
}
void void
MessagesAdapter::clearConversationHistory(const QString& accountId, const QString& convUid) MessagesAdapter::clearConversationHistory(const QString& accountId, const QString& convUid)
{ {
......
...@@ -50,6 +50,7 @@ protected: ...@@ -50,6 +50,7 @@ protected:
Q_INVOKABLE void acceptInvitation(const QString& convId = {}); Q_INVOKABLE void acceptInvitation(const QString& convId = {});
Q_INVOKABLE void refuseInvitation(const QString& convUid = ""); Q_INVOKABLE void refuseInvitation(const QString& convUid = "");
Q_INVOKABLE void blockConversation(const QString& convUid = ""); Q_INVOKABLE void blockConversation(const QString& convUid = "");
Q_INVOKABLE void unbanContact(int index);
// JS Q_INVOKABLE. // JS Q_INVOKABLE.
Q_INVOKABLE void setDisplayLinks(); Q_INVOKABLE void setDisplayLinks();
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "contactadapter.h" #include "contactadapter.h"
#include "pluginadapter.h" #include "pluginadapter.h"
#include "messagesadapter.h" #include "messagesadapter.h"
#include "settingsadapter.h"
#include "utilsadapter.h" #include "utilsadapter.h"
#include "conversationsadapter.h" #include "conversationsadapter.h"
#include "currentconversation.h" #include "currentconversation.h"
...@@ -113,11 +112,10 @@ registerTypes(QQmlEngine* engine, ...@@ -113,11 +112,10 @@ registerTypes(QQmlEngine* engine,
auto avAdapter = new AvAdapter(lrcInstance, parent); auto avAdapter = new AvAdapter(lrcInstance, parent);
auto contactAdapter = new ContactAdapter(lrcInstance, parent); auto contactAdapter = new ContactAdapter(lrcInstance, parent);
auto accountAdapter = new AccountAdapter(appSettingsManager, lrcInstance, parent); auto accountAdapter = new AccountAdapter(appSettingsManager, lrcInstance, parent);
auto utilsAdapter = new UtilsAdapter(systemTray, lrcInstance, parent); auto utilsAdapter = new UtilsAdapter(appSettingsManager, systemTray, lrcInstance, parent);
auto settingsAdapter = new SettingsAdapter(appSettingsManager, lrcInstance, parent);
auto pluginAdapter = new PluginAdapter(lrcInstance, parent); auto pluginAdapter = new PluginAdapter(lrcInstance, parent);
auto currentConversation = new CurrentConversation(lrcInstance, parent); auto currentConversation = new CurrentConversation(lrcInstance, parent);
auto currentAccount = new CurrentAccount(lrcInstance, parent); auto currentAccount = new CurrentAccount(lrcInstance, appSettingsManager, parent);
// qml adapter registration // qml adapter registration
QML_REGISTERSINGLETONTYPE_POBJECT(NS_ADAPTERS, callAdapter, "CallAdapter"); QML_REGISTERSINGLETONTYPE_POBJECT(NS_ADAPTERS, callAdapter, "CallAdapter");
...@@ -127,7 +125,6 @@ registerTypes(QQmlEngine* engine, ...@@ -127,7 +125,6 @@ registerTypes(QQmlEngine* engine,
QML_REGISTERSINGLETONTYPE_POBJECT(NS_ADAPTERS, contactAdapter, "ContactAdapter"); QML_REGISTERSINGLETONTYPE_POBJECT(NS_ADAPTERS, contactAdapter, "ContactAdapter");
QML_REGISTERSINGLETONTYPE_POBJECT(NS_ADAPTERS, accountAdapter, "AccountAdapter"); QML_REGISTERSINGLETONTYPE_POBJECT(NS_ADAPTERS, accountAdapter, "AccountAdapter");
QML_REGISTERSINGLETONTYPE_POBJECT(NS_ADAPTERS, utilsAdapter, "UtilsAdapter"); QML_REGISTERSINGLETONTYPE_POBJECT(NS_ADAPTERS, utilsAdapter, "UtilsAdapter");
QML_REGISTERSINGLETONTYPE_POBJECT(NS_ADAPTERS, settingsAdapter, "SettingsAdapter");
QML_REGISTERSINGLETONTYPE_POBJECT(NS_ADAPTERS, pluginAdapter, "PluginAdapter"); QML_REGISTERSINGLETONTYPE_POBJECT(NS_ADAPTERS, pluginAdapter, "PluginAdapter");
QML_REGISTERSINGLETONTYPE_POBJECT(NS_ADAPTERS, currentConversation, "CurrentConversation"); QML_REGISTERSINGLETONTYPE_POBJECT(NS_ADAPTERS, currentConversation, "CurrentConversation");
QML_REGISTERSINGLETONTYPE_POBJECT(NS_ADAPTERS, currentAccount, "CurrentAccount"); QML_REGISTERSINGLETONTYPE_POBJECT(NS_ADAPTERS, currentAccount, "CurrentAccount");
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include <QObject> #include <QObject>
#define PROPERTY_BASE(type, prop) \ #define PROPERTY_GETTER_BASE(type, prop) \
type prop##_ {}; \ type prop##_ {}; \
\ \
public: \ public: \
...@@ -32,7 +32,9 @@ public: \ ...@@ -32,7 +32,9 @@ public: \
type get_##prop() \ type get_##prop() \
{ \ { \
return prop##_; \ return prop##_; \
} \ }
#define PROPERTY_SETTER_BASE(type, prop) \
void set_##prop(const type& x = {}) \ void set_##prop(const type& x = {}) \
{ \ { \
if (prop##_ != x) { \ if (prop##_ != x) { \
...@@ -41,6 +43,10 @@ public: \ ...@@ -41,6 +43,10 @@ public: \
} \ } \
} }
#define PROPERTY_BASE(type, prop) \
PROPERTY_GETTER_BASE(type, prop) \
PROPERTY_SETTER_BASE(type, prop)
#define QML_RO_PROPERTY(type, prop) \ #define QML_RO_PROPERTY(type, prop) \
private: \ private: \
Q_PROPERTY(type prop READ get_##prop NOTIFY prop##Changed); \ Q_PROPERTY(type prop READ get_##prop NOTIFY prop##Changed); \
......
This diff is collapsed.
/*
* Copyright (C) 2020 by Savoir-faire Linux
* Author: Yang Wang <yang.wang@savoirfairelinux.com>
*
* 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/>.
*/
#pragma once
#include <QObject>
#include "api/account.h"
#include "api/datatransfermodel.h"
#include "lrcinstance.h"
#include "typedefs.h"
#include "utils.h"
#include "qmladapterbase.h"
#include "appsettingsmanager.h"
class SettingsAdapter : public QmlAdapterBase
{
Q_OBJECT
#define LOGSLIMIT 10000
public:
explicit SettingsAdapter(AppSettingsManager* settingsManager,
LRCInstance* instance,
QObject* parent = nullptr);
void safeInit() override {}
// Getters of directories
Q_INVOKABLE QString getDir_Document();
Q_INVOKABLE QString getDir_Download();
Q_INVOKABLE QVariant getAppValue(const Settings::Key key);
Q_INVOKABLE void setAppValue(const Settings::Key key, const QVariant& value);
Q_INVOKABLE void setRunOnStartUp(bool state);
Q_INVOKABLE void setDownloadPath(QString dir);
// Getters of devices' Info and options
Q_INVOKABLE lrc::api::video::Capabilities get_DeviceCapabilities(const QString& device);
Q_INVOKABLE lrc::api::video::ResRateList get_ResRateList(lrc::api::video::Channel channel,
QString device);
Q_INVOKABLE int get_DeviceCapabilitiesSize(const QString& device);
// Getters of resolution and frame rates of current device
Q_INVOKABLE QVector<QString> getResolutions(const QString& device);
Q_INVOKABLE QVector<int> getFrameRates(const QString& device);
// Getters and setters: lrc video::setting
Q_INVOKABLE QString get_Video_Settings_Channel(const QString& deviceId);
Q_INVOKABLE QString get_Video_Settings_Name(const QString& deviceId);
Q_INVOKABLE QString get_Video_Settings_Id(const QString& deviceId);
Q_INVOKABLE qreal get_Video_Settings_Rate(const QString& deviceId);
Q_INVOKABLE QString get_Video_Settings_Size(const QString& deviceId);
Q_INVOKABLE void set_Video_Settings_Rate_And_Resolution(const QString& deviceId,
qreal rate,
const QString& resolution);
// Getters and setters of current account Info
const Q_INVOKABLE lrc::api::account::Info& getCurrentAccountInfo();
const Q_INVOKABLE lrc::api::profile::Info& getCurrentAccount_Profile_Info();
Q_INVOKABLE lrc::api::ContactModel* getContactModel();
Q_INVOKABLE lrc::api::NewDeviceModel* getDeviceModel();
Q_INVOKABLE QString get_CurrentAccountInfo_RegisteredName();
Q_INVOKABLE QString get_CurrentAccountInfo_Id();
Q_INVOKABLE bool get_CurrentAccountInfo_Enabled();
// Profile info
Q_INVOKABLE QString getCurrentAccount_Profile_Info_Uri();
Q_INVOKABLE QString getCurrentAccount_Profile_Info_Alias();
Q_INVOKABLE int getCurrentAccount_Profile_Info_Type();
Q_INVOKABLE QString getAccountBestName();
// Getters and setters of ConfProperties_t
// Getters
Q_INVOKABLE lrc::api::account::ConfProperties_t getAccountConfig();
Q_INVOKABLE QString getAccountConfig_Manageruri();
Q_INVOKABLE QString getAccountConfig_Username();
Q_INVOKABLE QString getAccountConfig_Hostname();
Q_INVOKABLE QString getAccountConfig_Password();
Q_INVOKABLE bool getAccountConfig_KeepAliveEnabled();
Q_INVOKABLE QString getAccountConfig_RouteSet();
Q_INVOKABLE QString getAccountConfig_ProxyServer();
Q_INVOKABLE bool getAccountConfig_ProxyEnabled();
Q_INVOKABLE bool getAccountConfig_PeerDiscovery();
Q_INVOKABLE bool getAccountConfig_DHT_PublicInCalls();
Q_INVOKABLE bool getAccountConfig_ReadReceipt();
Q_INVOKABLE bool getAccountConfig_RendezVous();
Q_INVOKABLE bool getAccountConfig_AutoAnswer();
Q_INVOKABLE QString getAccountConfig_RingNS_Uri();
Q_INVOKABLE QString getAccountConfig_TLS_CertificateListFile();
Q_INVOKABLE QString getAccountConfig_TLS_CertificateFile();
Q_INVOKABLE QString getAccountConfig_TLS_PrivateKeyFile();
Q_INVOKABLE bool getAccountConfig_TLS_Enable();
Q_INVOKABLE QString getAccountConfig_TLS_Password();
Q_INVOKABLE bool getAccountConfig_TLS_VerifyServer();
Q_INVOKABLE bool getAccountConfig_TLS_VerifyClient();
Q_INVOKABLE bool getAccountConfig_TLS_RequireClientCertificate();
Q_INVOKABLE int getAccountConfig_TLS_Method_inInt();
Q_INVOKABLE QString getAccountConfig_TLS_Servername();
Q_INVOKABLE int getAccountConfig_TLS_NegotiationTimeoutSec();
Q_INVOKABLE bool getAccountConfig_SRTP_Enabled();
Q_INVOKABLE int getAccountConfig_SRTP_KeyExchange();
Q_INVOKABLE bool getAccountConfig_SRTP_RtpFallback();
Q_INVOKABLE bool getAccountConfig_UpnpEnabled();
Q_INVOKABLE bool getAccountConfig_TURN_Enabled();
Q_INVOKABLE QString getAccountConfig_TURN_Server();
Q_INVOKABLE QString getAccountConfig_TURN_Username();
Q_INVOKABLE QString getAccountConfig_TURN_Password();
Q_INVOKABLE QString getAccountConfig_TURN_Realm();
Q_INVOKABLE bool getAccountConfig_STUN_Enabled();
Q_INVOKABLE QString getAccountConfig_STUN_Server();
Q_INVOKABLE bool getAccountConfig_Video_Enabled();
Q_INVOKABLE int getAccountConfig_Video_VideoPortMin();
Q_INVOKABLE int getAccountConfig_Video_VideoPortMax();
Q_INVOKABLE int getAccountConfig_Audio_AudioPortMin();
Q_INVOKABLE int getAccountConfig_Audio_AudioPortMax();
Q_INVOKABLE bool getAccountConfig_Ringtone_RingtoneEnabled();
Q_INVOKABLE QString getAccountConfig_Ringtone_RingtonePath();
Q_INVOKABLE int getAccountConfig_Registration_Expire();
Q_INVOKABLE int getAccountConfig_Localport();
Q_INVOKABLE bool getAccountConfig_PublishedSameAsLocal();
Q_INVOKABLE QString getAccountConfig_PublishedAddress();
Q_INVOKABLE int getAccountConfig_PublishedPort();
Q_INVOKABLE bool getAccountConfig_AllowIPAutoRewrite();
Q_INVOKABLE QString getAccountConfig_Mailbox();
// Setters
Q_INVOKABLE void setAccountConfig_Username(QString input);
Q_INVOKABLE void setAccountConfig_Hostname(QString input);
Q_INVOKABLE void setAccountConfig_Password(QString input);
Q_INVOKABLE void setAccountConfig_RouteSet(QString input);
Q_INVOKABLE void setAutoConnectOnLocalNetwork(bool state);
Q_INVOKABLE void setCallsUntrusted(bool state);
Q_INVOKABLE void setIsRendezVous(bool state);
Q_INVOKABLE void setAutoAnswerCalls(bool state);
Q_INVOKABLE void setSendReadReceipt(bool state);
Q_INVOKABLE void setEnableRingtone(bool state);
Q_INVOKABLE void setEnableProxy(bool state);
Q_INVOKABLE void setKeepAliveEnabled(bool state);
Q_INVOKABLE void setUseUPnP(bool state);
Q_INVOKABLE void setUseTURN(bool state);
Q_INVOKABLE void setUseSTUN(bool state);
Q_INVOKABLE void setVideoState(bool state);
Q_INVOKABLE void setUseSRTP(bool state);
Q_INVOKABLE void setUseSDES(bool state);
Q_INVOKABLE void setUseRTPFallback(bool state);
Q_INVOKABLE void setUseTLS(bool state);
Q_INVOKABLE void setVerifyCertificatesServer(bool state);
Q_INVOKABLE void setVerifyCertificatesClient(bool state);
Q_INVOKABLE void setRequireCertificatesIncomingTLS(bool state);
Q_INVOKABLE void setUseCustomAddressAndPort(bool state);
Q_INVOKABLE void setAllowIPAutoRewrite(bool state);
Q_INVOKABLE void setNameServer(QString text);
Q_INVOKABLE void setProxyAddress(QString text);
Q_INVOKABLE void setBootstrapAddress(QString text);
Q_INVOKABLE void setTURNAddress(QString text);
Q_INVOKABLE void setTURNUsername(QString text);
Q_INVOKABLE void setTURNPassword(QString text);
Q_INVOKABLE void setTURNRealm(QString text);
Q_INVOKABLE void setSTUNAddress(QString text);
Q_INVOKABLE void lineEditVoiceMailDialCodeEditFinished(QString text);
Q_INVOKABLE void outgoingTLSServerNameLineEditTextChanged(QString text);
Q_INVOKABLE void lineEditSIPCertPasswordLineEditTextChanged(QString text);
Q_INVOKABLE void lineEditSIPCustomAddressLineEditTextChanged(QString text);
Q_INVOKABLE void customPortSIPSpinBoxValueChanged(int value);
Q_INVOKABLE void negotiationTimeoutSpinBoxValueChanged(int value);
Q_INVOKABLE void registrationExpirationTimeSpinBoxValueChanged(int value);
Q_INVOKABLE void networkInterfaceSpinBoxValueChanged(int value);
Q_INVOKABLE void audioRTPMinPortSpinBoxEditFinished(int value);
Q_INVOKABLE void audioRTPMaxPortSpinBoxEditFinished(int value);
Q_INVOKABLE void videoRTPMinPortSpinBoxEditFinished(int value);
Q_INVOKABLE void videoRTPMaxPortSpinBoxEditFinished(int value);
Q_INVOKABLE void autoAcceptFiles(bool value);
Q_INVOKABLE void allowFromUntrusted(bool value);
Q_INVOKABLE void acceptTransferBelow(int value);
Q_INVOKABLE void tlsProtocolComboBoxIndexChanged(const int& index);
Q_INVOKABLE void setDeviceName(QString text);
Q_INVOKABLE void unbanContact(int index);
Q_INVOKABLE void audioCodecsStateChange(unsigned int id, bool isToEnable);
Q_INVOKABLE void videoCodecsStateChange(unsigned int id, bool isToEnable);
Q_INVOKABLE void decreaseAudioCodecPriority(unsigned int id);
Q_INVOKABLE void increaseAudioCodecPriority(unsigned int id);
Q_INVOKABLE void decreaseVideoCodecPriority(unsigned int id);
Q_INVOKABLE void increaseVideoCodecPriority(unsigned int id);
Q_INVOKABLE void set_RingtonePath(QString text);
Q_INVOKABLE void set_FileCACert(QString text);
Q_INVOKABLE void set_FileUserCert(QString text);
Q_INVOKABLE void set_FilePrivateKey(QString text);
Q_INVOKABLE void setDefaultModerator(const QString& accountID,
const QString& peerURI,
const bool& state);
Q_INVOKABLE void setAllModeratorsEnabled(const QString& accountId, bool enabled);
Q_INVOKABLE QStringList getDefaultModerators(const QString& accId);
Q_INVOKABLE void enableLocalModerators(const QString& accountID, const bool& isModEnabled);
Q_INVOKABLE bool isLocalModeratorsEnabled(const QString& accountId);
Q_INVOKABLE bool isAllModeratorsEnabled(const QString& accountId);
Q_INVOKABLE void monitor(const bool& continuous);
Q_INVOKABLE QString getLogs() const;
Q_INVOKABLE int getSizeOfLogs() const;
Q_INVOKABLE int getFirstLogLength() const;
Q_INVOKABLE void clearLogs();
Q_SIGNALS:
void debugMessageReceived(const QString& message);
private:
AppSettingsManager* settingsManager_;
QMetaObject::Connection debugMessageReceivedConnection_;
QStringList logList_;
};
Q_DECLARE_METATYPE(SettingsAdapter*)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment