1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-03 22:35:45 +02:00

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
This commit is contained in:
Ming Rui Zhang 2021-08-26 14:57:24 -04:00
parent 8e1736fd9e
commit a196513d2e
57 changed files with 1078 additions and 2132 deletions

View file

@ -60,7 +60,6 @@ set(COMMON_SOURCES
${SRC_DIR}/avadapter.cpp
${SRC_DIR}/contactadapter.cpp
${SRC_DIR}/pluginadapter.cpp
${SRC_DIR}/settingsadapter.cpp
${SRC_DIR}/deviceitemlistmodel.cpp
${SRC_DIR}/pluginitemlistmodel.cpp
${SRC_DIR}/pluginhandleritemlistmodel.cpp
@ -117,7 +116,6 @@ set(COMMON_HEADERS
${SRC_DIR}/avadapter.h
${SRC_DIR}/contactadapter.h
${SRC_DIR}/pluginadapter.h
${SRC_DIR}/settingsadapter.h
${SRC_DIR}/deviceitemlistmodel.h
${SRC_DIR}/pluginitemlistmodel.h
${SRC_DIR}/pluginhandleritemlistmodel.h

View file

@ -116,7 +116,7 @@ ApplicationWindow {
function close(force = false) {
// If we're in the onboarding wizard or 'MinimizeOnClose'
// is set, then we can quit
if (force || !SettingsAdapter.getAppValue(Settings.MinimizeOnClose) ||
if (force || !UtilsAdapter.getAppValue(Settings.MinimizeOnClose) ||
!UtilsAdapter.getAccountListSize()) {
Qt.quit()
} else
@ -158,7 +158,7 @@ ApplicationWindow {
onLoaded: {
// Quiet check for updates on start if set to.
if (SettingsAdapter.getAppValue(Settings.AutoUpdate)) {
if (UtilsAdapter.getAppValue(Settings.AutoUpdate)) {
UpdateManager.checkForUpdates(true)
UpdateManager.setAutoUpdateCheck(true)
}

View file

@ -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
AccountAdapter::hasPassword()
{

View file

@ -85,6 +85,10 @@ public:
Q_INVOKABLE void setCurrAccDisplayName(const QString& text);
Q_INVOKABLE void setCurrentAccountAvatarFile(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:
// Trigger other components to reconnect account related signals.

View file

@ -21,6 +21,9 @@
#include "avadapter.h"
#include "qtutils.h"
#include "api/newcodecmodel.h"
#include "api/newdevicemodel.h"
#ifdef Q_OS_LINUX
#include "xrectsel.h"
#endif
@ -339,3 +342,51 @@ AvAdapter::getScreenNumber() const
#endif
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);
}

View file

@ -75,6 +75,15 @@ protected:
Q_INVOKABLE void startAudioMeter();
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:
void onAudioDeviceEvent();
void onVideoDeviceEvent();

View file

@ -29,10 +29,8 @@ import "../commoncomponents"
BaseDialog {
id: root
property int profileType: SettingsAdapter.getCurrentAccount_Profile_Info_Type()
property bool isSIP: {
switch (profileType) {
switch (CurrentAccount.type) {
case Profile.Type.SIP:
return true;
default:
@ -42,13 +40,6 @@ BaseDialog {
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
contentItem: Rectangle {
@ -67,7 +58,8 @@ BaseDialog {
id: labelDeletion
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: deleteAccountContentRect.width - JamiTheme.preferredMarginSize * 2
Layout.preferredWidth: deleteAccountContentRect.width -
JamiTheme.preferredMarginSize * 2
color: JamiTheme.textColor
text: JamiStrings.confirmDeleteQuestion
@ -84,10 +76,11 @@ BaseDialog {
id: labelBestId
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: deleteAccountContentRect.width - JamiTheme.preferredMarginSize * 2
Layout.preferredWidth: deleteAccountContentRect.width -
JamiTheme.preferredMarginSize * 2
color: JamiTheme.textColor
text: SettingsAdapter.getAccountBestName()
text: CurrentAccount.bestName
font.pointSize: JamiTheme.textFontSize
font.kerning: true
@ -102,10 +95,11 @@ BaseDialog {
id: labelAccountHash
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: deleteAccountContentRect.width - JamiTheme.preferredMarginSize * 2
Layout.preferredWidth: deleteAccountContentRect.width -
JamiTheme.preferredMarginSize * 2
color: JamiTheme.textColor
text: SettingsAdapter.getCurrentAccount_Profile_Info_Uri()
text: CurrentAccount.uri
font.pointSize: JamiTheme.textFontSize
font.kerning: true
@ -121,7 +115,8 @@ BaseDialog {
visible: !isSIP
Layout.alignment: Qt.AlignHCenter
Layout.preferredWidth: deleteAccountContentRect.width - JamiTheme.preferredMarginSize * 2
Layout.preferredWidth: deleteAccountContentRect.width -
JamiTheme.preferredMarginSize * 2
text: JamiStrings.deleteAccountInfos

View file

@ -131,6 +131,8 @@ Item {
// AdvancedMediaSettings
property string media: qsTr("Media")
property string enableVideo: qsTr("Enable video")
property string videoCodecs: qsTr("Video Codecs")
property string audioCodecs: qsTr("Audio Codecs")
// AdvancedSDPSettings
property string sdpSettingsTitle: qsTr("SDP Session Negotiation (ICE Fallback)")

View file

@ -25,7 +25,7 @@ import net.jami.Adapters 1.1
import net.jami.Enums 1.1
Item {
property bool darkTheme: SettingsAdapter.getAppValue(Settings.EnableDarkTheme)
property bool darkTheme: UtilsAdapter.getAppValue(Settings.EnableDarkTheme)
// Jami theme colors
function rgba256(r, g, b, a) {

View file

@ -18,8 +18,11 @@
#include "currentaccount.h"
CurrentAccount::CurrentAccount(LRCInstance* lrcInstance, QObject* parent)
CurrentAccount::CurrentAccount(LRCInstance* lrcInstance,
AppSettingsManager* settingsManager,
QObject* parent)
: QObject(parent)
, settingsManager_(settingsManager)
, lrcInstance_(lrcInstance)
{
connect(&lrcInstance_->accountModel(),
@ -33,9 +36,64 @@ CurrentAccount::CurrentAccount(LRCInstance* lrcInstance, QObject* parent)
&CurrentAccount::onAccountUpdated);
connect(lrcInstance_, &LRCInstance::currentAccountIdChanged, [this] { 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
CurrentAccount::onAccountUpdated(const QString& id)
{
@ -50,7 +108,9 @@ CurrentAccount::updateData()
{
set_id(lrcInstance_->get_currentAccountId());
try {
const auto& accInfo = lrcInstance_->getAccountInfo(id_);
const auto& accConfig = lrcInstance_->getCurrAccConfig();
const auto& accInfo = lrcInstance_->getCurrentAccountInfo();
set_uri(accInfo.profileInfo.uri);
set_registeredName(accInfo.registeredName);
set_alias(accInfo.profileInfo.alias);
@ -59,7 +119,96 @@ CurrentAccount::updateData()
set_hasAvatarSet(!accInfo.profileInfo.avatar.isEmpty());
set_status(accInfo.status);
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 (...) {
qWarning() << "Can't update current account data for" << id_;
qWarning() << "Can't update current account info data for" << id_;
}
}

View file

@ -19,31 +19,208 @@
#pragma once
#include "lrcinstance.h"
#include "qtutils.h"
#include "appsettingsmanager.h"
#include <QObject>
#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
{
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, uri)
QML_RO_PROPERTY(QString, registeredName)
QML_RO_PROPERTY(QString, alias)
QML_RO_PROPERTY(QString, bestId)
QML_RO_PROPERTY(QString, bestName)
QML_RO_PROPERTY(QString, managerUri)
QML_RO_PROPERTY(bool, hasAvatarSet)
QML_RO_PROPERTY(lrc::api::account::Status, status)
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:
explicit CurrentAccount(LRCInstance* lrcInstance, QObject* parent = nullptr);
explicit CurrentAccount(LRCInstance* lrcInstance,
AppSettingsManager* settingsManager,
QObject* parent = nullptr);
~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:
void updateData();
void onAccountUpdated(const QString& id);
private:
bool enabled_;
bool isAllModeratorsEnabled_;
bool isLocalModeratorsEnabled_;
AppSettingsManager* settingsManager_;
LRCInstance* lrcInstance_;
};

View file

@ -68,7 +68,7 @@ Rectangle {
height = preferredHeight
if (isVideo) {
var device = AVModel.getDefaultDevice()
var settings = SettingsAdapter.get_Video_Settings_Size(device)
var settings = AvAdapter.getVideoSettingsSize(device)
var res = settings.split("x")
var aspectRatio = res[1] / res[0]
if (aspectRatio) {

View file

@ -28,7 +28,14 @@
MediaCodecListModel::MediaCodecListModel(QObject* parent)
: AbstractListModelBase(parent)
{}
{
connect(this, &MediaCodecListModel::lrcInstanceChanged, [this]() {
connect(lrcInstance_,
&LRCInstance::currentAccountIdChanged,
this,
&MediaCodecListModel::reset);
});
}
MediaCodecListModel::~MediaCodecListModel() {}
@ -141,6 +148,13 @@ MediaCodecListModel::flags(const QModelIndex& index) const
return flags;
}
void
MediaCodecListModel::reset()
{
beginResetModel();
endResetModel();
}
int
MediaCodecListModel::mediaType()
{

View file

@ -46,6 +46,8 @@ public:
QModelIndex parent(const QModelIndex& child) const;
Qt::ItemFlags flags(const QModelIndex& index) const;
Q_INVOKABLE void reset();
int mediaType();
void setMediaType(int mediaType);

View file

@ -530,6 +530,22 @@ MessagesAdapter::blockConversation(const QString& convUid)
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
MessagesAdapter::clearConversationHistory(const QString& accountId, const QString& convUid)
{

View file

@ -50,6 +50,7 @@ protected:
Q_INVOKABLE void acceptInvitation(const QString& convId = {});
Q_INVOKABLE void refuseInvitation(const QString& convUid = "");
Q_INVOKABLE void blockConversation(const QString& convUid = "");
Q_INVOKABLE void unbanContact(int index);
// JS Q_INVOKABLE.
Q_INVOKABLE void setDisplayLinks();

View file

@ -24,7 +24,6 @@
#include "contactadapter.h"
#include "pluginadapter.h"
#include "messagesadapter.h"
#include "settingsadapter.h"
#include "utilsadapter.h"
#include "conversationsadapter.h"
#include "currentconversation.h"
@ -113,11 +112,10 @@ registerTypes(QQmlEngine* engine,
auto avAdapter = new AvAdapter(lrcInstance, parent);
auto contactAdapter = new ContactAdapter(lrcInstance, parent);
auto accountAdapter = new AccountAdapter(appSettingsManager, lrcInstance, parent);
auto utilsAdapter = new UtilsAdapter(systemTray, lrcInstance, parent);
auto settingsAdapter = new SettingsAdapter(appSettingsManager, lrcInstance, parent);
auto utilsAdapter = new UtilsAdapter(appSettingsManager, systemTray, lrcInstance, parent);
auto pluginAdapter = new PluginAdapter(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_REGISTERSINGLETONTYPE_POBJECT(NS_ADAPTERS, callAdapter, "CallAdapter");
@ -127,7 +125,6 @@ registerTypes(QQmlEngine* engine,
QML_REGISTERSINGLETONTYPE_POBJECT(NS_ADAPTERS, contactAdapter, "ContactAdapter");
QML_REGISTERSINGLETONTYPE_POBJECT(NS_ADAPTERS, accountAdapter, "AccountAdapter");
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, currentConversation, "CurrentConversation");
QML_REGISTERSINGLETONTYPE_POBJECT(NS_ADAPTERS, currentAccount, "CurrentAccount");

View file

@ -24,7 +24,7 @@
#include <QObject>
#define PROPERTY_BASE(type, prop) \
#define PROPERTY_GETTER_BASE(type, prop) \
type prop##_ {}; \
\
public: \
@ -32,7 +32,9 @@ public: \
type get_##prop() \
{ \
return prop##_; \
} \
}
#define PROPERTY_SETTER_BASE(type, prop) \
void set_##prop(const type& x = {}) \
{ \
if (prop##_ != x) { \
@ -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) \
private: \
Q_PROPERTY(type prop READ get_##prop NOTIFY prop##Changed); \

File diff suppressed because it is too large Load diff

View file

@ -1,258 +0,0 @@
/*
* 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*)

View file

@ -47,8 +47,6 @@ Rectangle {
}
function setSelected(sel, recovery = false) {
profileType = SettingsAdapter.getCurrentAccount_Profile_Info_Type()
if(selectedMenu === sel && (!recovery)) { return }
switch(sel) {
case SettingsView.Account:
@ -57,7 +55,6 @@ Rectangle {
pageIdCurrentAccountSettings.updateAccountInfoDisplayed()
break
case SettingsView.General:
generalSettings.updateValues()
AccountAdapter.stopPreviewing()
selectedMenu = sel
break
@ -102,7 +99,6 @@ Rectangle {
}
}
property int profileType: SettingsAdapter.getCurrentAccount_Profile_Info_Type()
property int selectedMenu: SettingsView.Account
// signal to redirect the page to main view
signal settingsViewNeedToShowMainView()
@ -121,7 +117,7 @@ Rectangle {
signal stopBooth
property bool isSIP: {
switch (profileType) {
switch (CurrentAccount.type) {
case Profile.Type.SIP:
return true;
default:

View file

@ -36,10 +36,6 @@ ColumnLayout {
}
}
function updateAccountInfo() {
displayNameLineEdit.text = SettingsAdapter.getCurrentAccount_Profile_Info_Alias()
}
function stopBooth() {
currentAccountAvatar.stopBooth()
}
@ -77,6 +73,7 @@ ColumnLayout {
font.pointSize: JamiTheme.textFontSize
font.kerning: true
text: CurrentAccount.alias
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter

View file

@ -34,32 +34,9 @@ ColumnLayout {
property bool isSIP
property int itemWidth
function updateCallSettingsInfos() {
checkBoxUntrusted.checked = SettingsAdapter.getAccountConfig_DHT_PublicInCalls()
checkBoxRdv.checked = SettingsAdapter.getAccountConfig_RendezVous()
checkBoxAutoAnswer.checked = SettingsAdapter.getAccountConfig_AutoAnswer()
checkBoxCustomRingtone.checked = SettingsAdapter.getAccountConfig_Ringtone_RingtoneEnabled()
checkboxAllModerators.checked = SettingsAdapter.isAllModeratorsEnabled(LRCInstance.currentAccountId)
btnRingtone.enabled = SettingsAdapter.getAccountConfig_Ringtone_RingtoneEnabled()
btnRingtone.textField = UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_Ringtone_RingtonePath())
updateAndShowModeratorsSlot()
}
function changeRingtonePath(url) {
if(url.length !== 0) {
SettingsAdapter.set_RingtonePath(url)
btnRingtone.textField = UtilsAdapter.toFileInfoName(url)
} else if (SettingsAdapter.getAccountConfig_Ringtone_RingtonePath().length === 0){
btnRingtone.textField = JamiStrings.addCustomRingtone
}
}
function updateAndShowModeratorsSlot() {
toggleLocalModerators.checked = SettingsAdapter.isLocalModeratorsEnabled(
LRCInstance.currentAccountId)
moderatorListWidget.model.reset()
moderatorListWidget.visible = (moderatorListWidget.model.rowCount() > 0)
moderatorListWidget.visible = moderatorListWidget.model.rowCount() > 0
}
Connections {
@ -76,14 +53,16 @@ ColumnLayout {
mode: JamiFileDialog.OpenFile
title: JamiStrings.selectNewRingtone
folder: JamiQmlUtils.qmlFilePrefix + UtilsAdapter.toFileAbsolutepath(
SettingsAdapter.getAccountConfig_Ringtone_RingtonePath())
CurrentAccount.ringtonePath_Ringtone)
nameFilters: [qsTr("Audio Files") + " (*.wav *.ogg *.opus *.mp3 *.aiff *.wma)", qsTr(
"All files") + " (*)"]
nameFilters: [qsTr("Audio Files") + " (*.wav *.ogg *.opus *.mp3 *.aiff *.wma)",
qsTr("All files") + " (*)"]
onAccepted: {
var url = UtilsAdapter.getAbsPath(file.toString())
changeRingtonePath(url)
if(url.length !== 0)
CurrentAccount.ringtonePath_Ringtone = url
}
}
@ -106,9 +85,9 @@ ColumnLayout {
labelText: JamiStrings.allowCallsUnknownContacs
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: {
SettingsAdapter.setCallsUntrusted(checked)
}
checked: CurrentAccount.PublicInCalls_DHT
onSwitchToggled: CurrentAccount.PublicInCalls_DHT = checked
}
ToggleSwitch {
@ -117,9 +96,9 @@ ColumnLayout {
labelText: JamiStrings.autoAnswerCalls
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: {
SettingsAdapter.setAutoAnswerCalls(checked)
}
checked: CurrentAccount.autoAnswer
onSwitchToggled: CurrentAccount.autoAnswer = checked
}
ToggleSwitch {
@ -128,17 +107,21 @@ ColumnLayout {
labelText: JamiStrings.enableCustomRingtone
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: {
SettingsAdapter.setEnableRingtone(checked)
btnRingtone.enabled = checked
}
checked: CurrentAccount.ringtoneEnabled_Ringtone
onSwitchToggled: CurrentAccount.ringtoneEnabled_Ringtone = checked
}
SettingMaterialButton {
id: btnRingtone
Layout.fillWidth: true
Layout.minimumHeight: JamiTheme.preferredFieldHeight
enabled: checkBoxCustomRingtone.checked
textField: UtilsAdapter.toFileInfoName(CurrentAccount.ringtonePath_Ringtone)
titleField: JamiStrings.selectCustomRingtone
source: JamiResources.round_folder_24dp_svg
itemWidth: root.itemWidth
@ -147,14 +130,15 @@ ColumnLayout {
ToggleSwitch {
id: checkBoxRdv
visible: !isSIP
labelText: JamiStrings.rendezVous
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: {
SettingsAdapter.setIsRendezVous(checked)
}
checked: CurrentAccount.isRendezVous
onSwitchToggled: CurrentAccount.isRendezVous = checked
}
ToggleSwitch {
@ -163,8 +147,9 @@ ColumnLayout {
labelText: JamiStrings.enableLocalModerators
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: SettingsAdapter.enableLocalModerators(
LRCInstance.currentAccountId, checked)
checked: CurrentAccount.isLocalModeratorsEnabled
onSwitchToggled: CurrentAccount.isLocalModeratorsEnabled = checked
}
ElidedTextLabel {
@ -182,6 +167,8 @@ ColumnLayout {
Layout.fillWidth: true
Layout.preferredHeight: 160
visible: model.rowCount() > 0
model: ModeratorListModel {
lrcInstance: LRCInstance
}
@ -200,7 +187,7 @@ ColumnLayout {
onClicked: moderatorListWidget.currentIndex = index
onBtnContactClicked: {
SettingsAdapter.setDefaultModerator(
AccountAdapter.setDefaultModerator(
LRCInstance.currentAccountId, contactID, false)
updateAndShowModeratorsSlot()
}
@ -239,8 +226,9 @@ ColumnLayout {
labelText: JamiStrings.enableAllModerators
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: SettingsAdapter.setAllModeratorsEnabled(
LRCInstance.currentAccountId, checked)
checked: CurrentAccount.isAllModeratorsEnabled
onSwitchToggled: CurrentAccount.isAllModeratorsEnabled = checked
}
}
}

View file

@ -29,10 +29,6 @@ ColumnLayout {
property int itemWidth
function updateSettings() {
checkBoxSendDisplayed.checked = SettingsAdapter.getAccountConfig_ReadReceipt()
}
ElidedTextLabel {
Layout.fillWidth: true
@ -52,9 +48,9 @@ ColumnLayout {
labelText: JamiStrings.enableReadReceipts
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: {
SettingsAdapter.setSendReadReceipt(checked)
}
checked: CurrentAccount.sendReadReceipt
onSwitchToggled: CurrentAccount.sendReadReceipt = checked
}
}
}

View file

@ -31,23 +31,6 @@ ColumnLayout {
property int itemWidth
property bool isSIP
function updateConnectivityAccountInfos() {
autoRegistrationAfterExpired.checked = SettingsAdapter.getAccountConfig_KeepAliveEnabled()
registrationExpireTimeoutSpinBox.valueField = SettingsAdapter.getAccountConfig_Registration_Expire()
networkInterfaceSpinBox.valueField = SettingsAdapter.getAccountConfig_Localport()
checkBoxUPnP.checked = SettingsAdapter.getAccountConfig_UpnpEnabled()
checkBoxTurnEnable.checked = SettingsAdapter.getAccountConfig_TURN_Enabled()
lineEditTurnAddress.textField = SettingsAdapter.getAccountConfig_TURN_Server()
lineEditTurnUsername.textField = SettingsAdapter.getAccountConfig_TURN_Username()
lineEditTurnPassword.textField = SettingsAdapter.getAccountConfig_TURN_Password()
checkBoxSTUNEnable.checked = SettingsAdapter.getAccountConfig_STUN_Enabled()
lineEditSTUNAddress.textField = SettingsAdapter.getAccountConfig_STUN_Server()
lineEditTurnRealmSIP.textField = SettingsAdapter.getAccountConfig_TURN_Realm()
lineEditTurnRealmSIP.enabled = SettingsAdapter.getAccountConfig_TURN_Enabled()
lineEditSTUNAddress.enabled = SettingsAdapter.getAccountConfig_STUN_Enabled()
}
ElidedTextLabel {
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight
@ -70,11 +53,14 @@ ColumnLayout {
labelText: JamiStrings.autoRegistration
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: SettingsAdapter.setKeepAliveEnabled(checked)
checked: CurrentAccount.keepAliveEnabled
onSwitchToggled: CurrentAccount.keepAliveEnabled = checked
}
SettingSpinBox {
id: registrationExpireTimeoutSpinBox
visible: isSIP
title: JamiStrings.registrationExpirationTime
@ -82,11 +68,14 @@ ColumnLayout {
bottomValue: 0
topValue: 7*24*3600
onNewValue: SettingsAdapter.registrationExpirationTimeSpinBoxValueChanged(valueField)
valueField: CurrentAccount.expire_Registration
onNewValue: CurrentAccount.expire_Registration = valueField
}
SettingSpinBox {
id: networkInterfaceSpinBox
visible: isSIP
title: JamiStrings.networkInterface
@ -94,7 +83,14 @@ ColumnLayout {
bottomValue: 0
topValue: 65535
onNewValue: SettingsAdapter.networkInterfaceSpinBoxValueChanged(valueField)
valueField: CurrentAccount.localPort
onInputAcceptableChanged: {
if (!inputAcceptable && valueField.length !== 0)
valueField = Qt.binding(function() { return CurrentAccount.localPort })
}
onNewValue: CurrentAccount.localPort = valueField
}
ToggleSwitch {
@ -105,7 +101,9 @@ ColumnLayout {
labelText: JamiStrings.useUPnP
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: SettingsAdapter.setUseUPnP(checked)
checked: CurrentAccount.upnpEnabled
onSwitchToggled: CurrentAccount.upnpEnabled = checked
}
ToggleSwitch {
@ -116,15 +114,9 @@ ColumnLayout {
labelText: JamiStrings.useTURN
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: {
SettingsAdapter.setUseTURN(checked)
if (isSIP) {
lineEditTurnAddress.enabled = checked
lineEditTurnUsername.enabled = checked
lineEditTurnPassword.enabled = checked
lineEditTurnRealmSIP.enabled = checked
}
}
checked: CurrentAccount.enable_TURN
onSwitchToggled: CurrentAccount.enable_TURN = checked
}
SettingsMaterialLineEdit {
@ -132,9 +124,15 @@ ColumnLayout {
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight
enabled: checkBoxTurnEnable.checked
textField: CurrentAccount.server_TURN
itemWidth: root.itemWidth
titleField: JamiStrings.turnAdress
onEditFinished: SettingsAdapter.setTURNAddress(textField)
onEditFinished: CurrentAccount.server_TURN = textField
}
SettingsMaterialLineEdit {
@ -142,9 +140,15 @@ ColumnLayout {
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight
enabled: checkBoxTurnEnable.checked
textField: CurrentAccount.username_TURN
itemWidth: root.itemWidth
titleField: JamiStrings.turnUsername
onEditFinished: SettingsAdapter.setTURNUsername(textField)
onEditFinished: CurrentAccount.username_TURN = textField
}
SettingsMaterialLineEdit {
@ -152,9 +156,15 @@ ColumnLayout {
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight
enabled: checkBoxTurnEnable.checked
textField: CurrentAccount.password_TURN
itemWidth: root.itemWidth
titleField: JamiStrings.turnPassword
onEditFinished: SettingsAdapter.setTURNPassword(textField)
onEditFinished: CurrentAccount.password_TURN = textField
}
SettingsMaterialLineEdit {
@ -162,9 +172,15 @@ ColumnLayout {
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight
enabled: checkBoxTurnEnable.checked
textField: CurrentAccount.realm_TURN
itemWidth: root.itemWidth
titleField: JamiStrings.turnRealm
onEditFinished: SettingsAdapter.setTURNRealm(textField)
onEditFinished: CurrentAccount.realm_TURN = textField
}
ToggleSwitch {
@ -175,10 +191,9 @@ ColumnLayout {
labelText: JamiStrings.useSTUN
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: {
SettingsAdapter.setUseSTUN(checked)
lineEditSTUNAddress.enabled = checked
}
checked: CurrentAccount.enable_STUN
onSwitchToggled: CurrentAccount.enable_STUN = checked
}
SettingsMaterialLineEdit {
@ -186,9 +201,15 @@ ColumnLayout {
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight
enabled: checkBoxSTUNEnable.checked
textField: CurrentAccount.server_STUN
itemWidth: root.itemWidth
titleField: JamiStrings.stunAdress
onEditFinished: SettingsAdapter.setSTUNAddress(textField)
onEditFinished: CurrentAccount.server_STUN = textField
}
}
}

View file

@ -30,90 +30,58 @@ ColumnLayout {
property int itemWidth
function updateSecurityAccountInfos() {
btnCACert.textField = UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_TLS_CertificateListFile())
btnCACert.enabled = SettingsAdapter.getAccountConfig_TLS_Enable()
btnUserCert.textField = UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_TLS_CertificateFile())
btnUserCert.enabled = SettingsAdapter.getAccountConfig_TLS_Enable()
btnPrivateKey.textField = UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_TLS_PrivateKeyFile())
btnPrivateKey.enabled = SettingsAdapter.getAccountConfig_TLS_Enable()
}
function changeFileCACert(url){
if(url.length !== 0) {
SettingsAdapter.set_FileCACert(url)
btnCACert.textField = UtilsAdapter.toFileInfoName(url)
}
}
function changeFileUserCert(url){
if(url.length !== 0) {
SettingsAdapter.set_FileUserCert(url)
btnUserCert.textField = UtilsAdapter.toFileInfoName(url)
}
}
function changeFilePrivateKey(url){
if(url.length !== 0) {
SettingsAdapter.set_FilePrivateKey(url)
btnPrivateKey.textField = UtilsAdapter.toFileInfoName(url)
}
}
JamiFileDialog {
id: caCert_Dialog
property string oldPath : SettingsAdapter.getAccountConfig_TLS_CertificateListFile()
property string openPath : oldPath === "" ? (UtilsAdapter.getCurrentPath() + "/ringtones/") : (UtilsAdapter.toFileAbsolutepath(oldPath))
property string oldPath: CurrentAccount.certificateListFile_TLS
property string openPath: oldPath === "" ?
(UtilsAdapter.getCurrentPath() + "/ringtones/") :
(UtilsAdapter.toFileAbsolutepath(oldPath))
mode: JamiFileDialog.OpenFile
title: JamiStrings.selectCACert
folder: openPath
nameFilters: [qsTr("Certificate File") + " (*.crt)", qsTr(
"All files") + " (*)"]
nameFilters: [qsTr("Certificate File") + " (*.crt)",
qsTr("All files") + " (*)"]
onAccepted: {
var url = UtilsAdapter.getAbsPath(file.toString())
changeFileCACert(url)
}
onAccepted: CurrentAccount.certificateListFile_TLS =
UtilsAdapter.getAbsPath(file.toString())
}
JamiFileDialog {
id: userCert_Dialog
property string oldPath : SettingsAdapter.getAccountConfig_TLS_CertificateFile()
property string openPath : oldPath === "" ? (UtilsAdapter.getCurrentPath() + "/ringtones/") : (UtilsAdapter.toFileAbsolutepath(oldPath))
property string oldPath: CurrentAccount.certificateFile_TLS
property string openPath: oldPath === "" ?
(UtilsAdapter.getCurrentPath() + "/ringtones/") :
(UtilsAdapter.toFileAbsolutepath(oldPath))
mode: JamiFileDialog.OpenFile
title: JamiStrings.selectUserCert
folder: openPath
nameFilters: [qsTr("Certificate File") + " (*.crt)", qsTr(
"All files") + " (*)"]
nameFilters: [qsTr("Certificate File") + " (*.crt)",
qsTr("All files") + " (*)"]
onAccepted: {
var url = UtilsAdapter.getAbsPath(file.toString())
changeFileUserCert(url)
}
onAccepted: CurrentAccount.certificateFile_TLS =
UtilsAdapter.getAbsPath(file.toString())
}
JamiFileDialog {
id: privateKey_Dialog
property string oldPath : {
return SettingsAdapter.getAccountConfig_TLS_PrivateKeyFile()
}
property string openPath : oldPath === "" ? (UtilsAdapter.getCurrentPath() + "/ringtones/") : (UtilsAdapter.toFileAbsolutepath(oldPath))
property string oldPath: CurrentAccount.privateKeyFile_TLS
property string openPath: oldPath === "" ?
(UtilsAdapter.getCurrentPath() + "/ringtones/") :
(UtilsAdapter.toFileAbsolutepath(oldPath))
mode: JamiFileDialog.OpenFile
title: JamiStrings.selectPrivateKey
folder: openPath
nameFilters: [qsTr("Key File") + " (*.key)", qsTr(
"All files") + " (*)"]
nameFilters: [qsTr("Key File") + " (*.key)",
qsTr("All files") + " (*)"]
onAccepted: {
var url = UtilsAdapter.getAbsPath(file.toString())
changeFilePrivateKey(url)
}
onAccepted: CurrentAccount.privateKeyFile_TLS =
UtilsAdapter.getAbsPath(file.toString())
}
ElidedTextLabel {
@ -131,34 +99,46 @@ ColumnLayout {
SettingMaterialButton {
id: btnCACert
Layout.fillWidth: true
Layout.minimumHeight: JamiTheme.preferredFieldHeight
enabled: CurrentAccount.enable_TLS
textField: UtilsAdapter.toFileInfoName(CurrentAccount.certificateListFile_TLS)
titleField: JamiStrings.caCertificate
source: JamiResources.round_folder_24dp_svg
itemWidth: root.itemWidth
onClick: caCert_Dialog.open()
}
SettingMaterialButton {
id: btnUserCert
Layout.fillWidth: true
Layout.minimumHeight: JamiTheme.preferredFieldHeight
enabled: CurrentAccount.enable_TLS
textField: UtilsAdapter.toFileInfoName(CurrentAccount.certificateFile_TLS)
titleField: JamiStrings.userCertificate
source: JamiResources.round_folder_24dp_svg
itemWidth: root.itemWidth
onClick: userCert_Dialog.open()
}
SettingMaterialButton {
id: btnPrivateKey
Layout.fillWidth: true
Layout.minimumHeight: JamiTheme.preferredFieldHeight
enabled: CurrentAccount.enable_TLS
textField: UtilsAdapter.toFileInfoName(CurrentAccount.privateKeyFile_TLS)
titleField: JamiStrings.privateKey
source: JamiResources.round_folder_24dp_svg
itemWidth: root.itemWidth
onClick: privateKey_Dialog.open()
}
@ -167,8 +147,13 @@ ColumnLayout {
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight
itemWidth: root.itemWidth
titleField: JamiStrings.privateKeyPassword
textField: CurrentAccount.password_TLS
onEditFinished: CurrentAccount.password_TLS = textField
}
}
}

View file

@ -29,12 +29,6 @@ import "../../commoncomponents"
ColumnLayout {
id: root
function updateMediaConnectivityAccountInfos() {
videoCheckBox.checked = SettingsAdapter.getAccountConfig_Video_Enabled()
videoSettings.updateCodecs();
audioSettings.updateCodecs();
}
Label {
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight
@ -58,7 +52,9 @@ ColumnLayout {
labelText: JamiStrings.enableVideo
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: SettingsAdapter.setVideoState(checked)
checked: CurrentAccount.videoEnabled_Video
onSwitchToggled: CurrentAccount.videoEnabled_Video = checked
}
RowLayout {

View file

@ -30,10 +30,6 @@ ColumnLayout {
property int itemWidth
function updateNameServerInfos() {
lineEditNameServer.textField = SettingsAdapter.getAccountConfig_RingNS_Uri()
}
Text {
Layout.fillWidth: true
Layout.rightMargin: JamiTheme.preferredMarginSize / 2
@ -55,9 +51,12 @@ ColumnLayout {
Layout.fillWidth: true
Layout.leftMargin: JamiTheme.preferredMarginSize
Layout.preferredHeight: JamiTheme.preferredFieldHeight
itemWidth: root.itemWidth
titleField: qsTr("Address")
onEditFinished: SettingsAdapter.setNameServer(textField)
textField: CurrentAccount.uri_RingNS
onEditFinished: CurrentAccount.uri_RingNS = textField
}
}

View file

@ -30,13 +30,6 @@ ColumnLayout {
property int itemWidth
function updateOpenDHTSettingsInfos() {
checkAutoConnectOnLocalNetwork.checked = SettingsAdapter.getAccountConfig_PeerDiscovery()
checkBoxEnableProxy.checked = SettingsAdapter.getAccountConfig_ProxyEnabled()
lineEditProxy.textField = SettingsAdapter.getAccountConfig_ProxyServer()
lineEditBootstrap.textField = SettingsAdapter.getAccountConfig_Hostname()
}
Text {
Layout.fillWidth: true
Layout.rightMargin: JamiTheme.preferredMarginSize / 2
@ -65,9 +58,9 @@ ColumnLayout {
tooltipText: JamiStrings.tooltipPeerDiscovery
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: {
SettingsAdapter.setAutoConnectOnLocalNetwork(checked)
}
checked: CurrentAccount.peerDiscovery
onSwitchToggled: CurrentAccount.peerDiscovery = checked
}
ToggleSwitch {
@ -76,10 +69,9 @@ ColumnLayout {
labelText: JamiStrings.enableProxy
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: {
SettingsAdapter.setEnableProxy(checked)
lineEditProxy.enabled = checked
}
checked: CurrentAccount.proxyEnabled
onSwitchToggled: CurrentAccount.proxyEnabled = checked
}
SettingsMaterialLineEdit {
@ -87,10 +79,15 @@ ColumnLayout {
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight
enabled: checkBoxEnableProxy.checked
textField: CurrentAccount.proxyServer
itemWidth: root.itemWidth
titleField: JamiStrings.proxyAddress
onEditFinished: SettingsAdapter.setProxyAddress(textField)
onEditFinished: CurrentAccount.proxyServer = textField
}
SettingsMaterialLineEdit {
@ -98,10 +95,13 @@ ColumnLayout {
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight
textField: CurrentAccount.hostname
itemWidth: root.itemWidth
titleField: JamiStrings.bootstrap
onEditFinished: SettingsAdapter.setBootstrapAddress(textField)
onEditFinished: CurrentAccount.hostname = textField
}
}
}

View file

@ -30,19 +30,6 @@ ColumnLayout {
property int itemWidth
function updatePublicAddressAccountInfos() {
checkBoxAllowIPAutoRewrite.checked = SettingsAdapter.getAccountConfig_AllowIPAutoRewrite()
checkBoxCustomAddressPort.checked = !SettingsAdapter.getAccountConfig_PublishedSameAsLocal()
lineEditSIPCustomAddress.textField = SettingsAdapter.getAccountConfig_PublishedAddress()
customPortSIPSpinBox.valueField = SettingsAdapter.getAccountConfig_PublishedPort()
if (checkBoxAllowIPAutoRewrite.checked) {
checkBoxCustomAddressPort.visible = false
lineEditSIPCustomAddress.visible = false
customPortSIPSpinBox.visible = false
}
}
Text {
Layout.fillWidth: true
@ -67,12 +54,9 @@ ColumnLayout {
labelText: JamiStrings.allowIPAutoRewrite
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: {
SettingsAdapter.setAllowIPAutoRewrite(checked)
checkBoxCustomAddressPort.visible = !checked
lineEditSIPCustomAddress.visible = !checked
customPortSIPSpinBox.visible = !checked
}
checked: CurrentAccount.allowIPAutoRewrite
onSwitchToggled: CurrentAccount.allowIPAutoRewrite = checked
}
ToggleSwitch {
@ -81,11 +65,10 @@ ColumnLayout {
labelText: JamiStrings.useCustomAddress
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: {
SettingsAdapter.setUseCustomAddressAndPort(!checked)
lineEditSIPCustomAddress.enabled = checked
customPortSIPSpinBox.enabled = checked
}
visible: !checkBoxAllowIPAutoRewrite.checked
checked: CurrentAccount.publishedSameAsLocal
onSwitchToggled: CurrentAccount.publishedSameAsLocal = checked
}
SettingsMaterialLineEdit {
@ -93,10 +76,16 @@ ColumnLayout {
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight
visible: !checkBoxAllowIPAutoRewrite.checked
enabled: checkBoxCustomAddressPort.checked
itemWidth: root.itemWidth
titleField: JamiStrings.address
onEditFinished: SettingsAdapter.lineEditSIPCustomAddressLineEditTextChanged(textField)
textField: CurrentAccount.publishedAddress
onEditFinished: CurrentAccount.publishedAddress = textField
}
SettingSpinBox {
@ -107,7 +96,17 @@ ColumnLayout {
bottomValue: 0
topValue: 65535
onNewValue: SettingsAdapter.customPortSIPSpinBoxValueChanged(valueField)
visible: !checkBoxAllowIPAutoRewrite.checked
enabled: checkBoxCustomAddressPort.checked
valueField: CurrentAccount.publishedPort
onInputAcceptableChanged: {
if (!inputAcceptable && valueField.length !== 0)
valueField = Qt.binding(function() { return CurrentAccount.publishedPort })
}
onNewValue: CurrentAccount.publishedPort = valueField
}
}
}

View file

@ -30,45 +30,6 @@ ColumnLayout {
property int itemWidth
function updateSDPAccountInfos(){
audioRTPMinPortSpinBox.valueField = SettingsAdapter.getAccountConfig_Audio_AudioPortMin()
audioRTPMaxPortSpinBox.valueField = SettingsAdapter.getAccountConfig_Audio_AudioPortMax()
videoRTPMinPortSpinBox.valueField = SettingsAdapter.getAccountConfig_Video_VideoPortMin()
videoRTPMaxPortSpinBox.valueField = SettingsAdapter.getAccountConfig_Video_VideoPortMax()
}
function audioRTPMinPortSpinBoxEditFinished(value) {
if (SettingsAdapter.getAccountConfig_Audio_AudioPortMax() < value) {
audioRTPMinPortSpinBox.valueField = SettingsAdapter.getAccountConfig_Audio_AudioPortMin()
return
}
SettingsAdapter.audioRTPMinPortSpinBoxEditFinished(value)
}
function audioRTPMaxPortSpinBoxEditFinished(value) {
if (value <SettingsAdapter.getAccountConfig_Audio_AudioPortMin()) {
audioRTPMaxPortSpinBox.valueField = SettingsAdapter.getAccountConfig_Audio_AudioPortMax()
return
}
SettingsAdapter.audioRTPMaxPortSpinBoxEditFinished(value)
}
function videoRTPMinPortSpinBoxEditFinished(value) {
if (SettingsAdapter.getAccountConfig_Video_VideoPortMax() < value) {
videoRTPMinPortSpinBox.valueField = SettingsAdapter.getAccountConfig_Video_VideoPortMin()
return
}
SettingsAdapter.videoRTPMinPortSpinBoxEditFinished(value)
}
function videoRTPMaxPortSpinBoxEditFinished(value) {
if (value <SettingsAdapter.getAccountConfig_Video_VideoPortMin()) {
videoRTPMinPortSpinBox.valueField = SettingsAdapter.getAccountConfig_Video_VideoPortMin()
return
}
SettingsAdapter.videoRTPMaxPortSpinBoxEditFinished(value)
}
ElidedTextLabel {
Layout.preferredWidth: textWidth
Layout.preferredHeight: JamiTheme.preferredFieldHeight
@ -97,9 +58,16 @@ ColumnLayout {
title: JamiStrings.audioRTPMinPort
itemWidth: root.itemWidth
bottomValue: 0
topValue: 65535
topValue: audioRTPMaxPortSpinBox.valueField - 1
onNewValue: audioRTPMinPortSpinBoxEditFinished(valueField)
valueField: CurrentAccount.audioPortMin_Audio
onInputAcceptableChanged: {
if (!inputAcceptable && valueField.length !== 0)
valueField = Qt.binding(function() { return CurrentAccount.audioPortMin_Audio })
}
onNewValue: CurrentAccount.audioPortMin_Audio = valueField
}
SettingSpinBox {
@ -107,10 +75,17 @@ ColumnLayout {
title: JamiStrings.audioRTPMaxPort
itemWidth: root.itemWidth
bottomValue: 0
bottomValue: audioRTPMinPortSpinBox.valueField + 1
topValue: 65535
onNewValue: audioRTPMaxPortSpinBoxEditFinished(valueField)
valueField: CurrentAccount.audioPortMax_Audio
onInputAcceptableChanged: {
if (!inputAcceptable && valueField.length !== 0)
valueField = Qt.binding(function() { return CurrentAccount.audioPortMax_Audio })
}
onNewValue: CurrentAccount.audioPortMax_Audio = valueField
}
SettingSpinBox {
@ -119,9 +94,16 @@ ColumnLayout {
title: JamiStrings.videoRTPMinPort
itemWidth: root.itemWidth
bottomValue: 0
topValue: 65535
topValue: videoRTPMaxPortSpinBox.valueField - 1
onNewValue: videoRTPMinPortSpinBoxEditFinished(valueField)
valueField: CurrentAccount.videoPortMin_Video
onInputAcceptableChanged: {
if (!inputAcceptable && valueField.length !== 0)
valueField = Qt.binding(function() { return CurrentAccount.videoPortMin_Video })
}
onNewValue: CurrentAccount.videoPortMin_Video = valueField
}
SettingSpinBox {
@ -129,10 +111,17 @@ ColumnLayout {
title: JamiStrings.videoRTPMaxPort
itemWidth: root.itemWidth
bottomValue: 0
bottomValue: videoRTPMinPortSpinBox.valueField + 1
topValue: 65535
onNewValue: videoRTPMaxPortSpinBoxEditFinished(valueField)
valueField: CurrentAccount.videoPortMax_Video
onInputAcceptableChanged: {
if (!inputAcceptable && valueField.length !== 0)
valueField = Qt.binding(function() { return CurrentAccount.videoPortMax_Video })
}
onNewValue: CurrentAccount.videoPortMax_Video = valueField
}
}
}

View file

@ -31,107 +31,58 @@ ColumnLayout {
property int itemWidth
function updateSecurityAccountInfos() {
enableSDESToggle.enabled = SettingsAdapter.getAccountConfig_SRTP_Enabled()
fallbackRTPToggle.enabled = SettingsAdapter.getAccountConfig_SRTP_Enabled()
btnSIPCACert.enabled = SettingsAdapter.getAccountConfig_TLS_Enable()
btnSIPUserCert.enabled = SettingsAdapter.getAccountConfig_TLS_Enable()
btnSIPPrivateKey.enabled = SettingsAdapter.getAccountConfig_TLS_Enable()
lineEditSIPCertPassword.enabled = SettingsAdapter.getAccountConfig_TLS_Enable()
btnSIPCACert.textField = UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_TLS_CertificateListFile())
btnSIPUserCert.textField = UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_TLS_CertificateFile())
btnSIPPrivateKey.textField = UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_TLS_PrivateKeyFile())
lineEditSIPCertPassword.textField = SettingsAdapter.getAccountConfig_TLS_Password()
encryptMediaStreamsToggle.checked = SettingsAdapter.getAccountConfig_SRTP_Enabled()
enableSDESToggle.checked = (SettingsAdapter.getAccountConfig_SRTP_KeyExchange() === Account.KeyExchangeProtocol.SDES)
fallbackRTPToggle.checked = SettingsAdapter.getAccountConfig_SRTP_RtpFallback()
encryptNegotitationToggle.checked = SettingsAdapter.getAccountConfig_TLS_Enable()
verifyIncomingCertificatesServerToggle.checked = SettingsAdapter.getAccountConfig_TLS_VerifyServer()
verifyIncomingCertificatesClientToggle.checked = SettingsAdapter.getAccountConfig_TLS_VerifyClient()
requireCeritificateForTLSIncomingToggle.checked = SettingsAdapter.getAccountConfig_TLS_RequireClientCertificate()
var method = SettingsAdapter.getAccountConfig_TLS_Method_inInt()
tlsProtocolComboBox.setCurrentIndex(method)
outgoingTLSServerNameLineEdit.textField = SettingsAdapter.getAccountConfig_TLS_Servername()
negotiationTimeoutSpinBox.valueField = SettingsAdapter.getAccountConfig_TLS_NegotiationTimeoutSec()
}
function changeFileCACert(url){
if(url.length !== 0) {
SettingsAdapter.set_FileCACert(url)
btnSIPCACert.textField = UtilsAdapter.toFileInfoName(url)
}
}
function changeFileUserCert(url){
if(url.length !== 0) {
SettingsAdapter.set_FileUserCert(url)
btnSIPUserCert.textField = UtilsAdapter.toFileInfoName(url)
}
}
function changeFilePrivateKey(url){
if(url.length !== 0) {
SettingsAdapter.set_FilePrivateKey(url)
btnSIPPrivateKey.textField = UtilsAdapter.toFileInfoName(url)
}
}
JamiFileDialog {
id: caCert_Dialog_SIP
property string oldPath : SettingsAdapter.getAccountConfig_TLS_CertificateListFile()
property string openPath : oldPath === "" ? (UtilsAdapter.getCurrentPath() + "/ringtones/") : (UtilsAdapter.toFileAbsolutepath(oldPath))
property string oldPath: CurrentAccount.certificateListFile_TLS
property string openPath: oldPath === "" ?
(UtilsAdapter.getCurrentPath() + "/ringtones/") :
(UtilsAdapter.toFileAbsolutepath(oldPath))
mode: JamiFileDialog.OpenFile
title: JamiStrings.selectCACert
folder: openPath
nameFilters: [qsTr("Certificate File") + " (*.crt)", qsTr(
"All files") + " (*)"]
nameFilters: [qsTr("Certificate File") + " (*.crt)",
qsTr("All files") + " (*)"]
onAccepted: {
var url = UtilsAdapter.getAbsPath(file.toString())
changeFileCACert(url)
}
onAccepted: CurrentAccount.certificateListFile_TLS =
UtilsAdapter.getAbsPath(file.toString())
}
JamiFileDialog {
id: userCert_Dialog_SIP
property string oldPath : SettingsAdapter.getAccountConfig_TLS_CertificateFile()
property string openPath : oldPath === "" ? (UtilsAdapter.getCurrentPath() + "/ringtones/") : (UtilsAdapter.toFileAbsolutepath(oldPath))
property string oldPath: CurrentAccount.certificateFile_TLS
property string openPath: oldPath === "" ?
(UtilsAdapter.getCurrentPath() + "/ringtones/") :
(UtilsAdapter.toFileAbsolutepath(oldPath))
mode: JamiFileDialog.OpenFile
title: JamiStrings.selectUserCert
folder: openPath
nameFilters: [qsTr("Certificate File") + " (*.crt)", qsTr(
"All files") + " (*)"]
nameFilters: [qsTr("Certificate File") + " (*.crt)",
qsTr("All files") + " (*)"]
onAccepted: {
var url = UtilsAdapter.getAbsPath(file.toString())
changeFileUserCert(url)
}
onAccepted: CurrentAccount.certificateFile_TLS =
UtilsAdapter.getAbsPath(file.toString())
}
JamiFileDialog {
id: privateKey_Dialog_SIP
property string oldPath : SettingsAdapter.getAccountConfig_TLS_PrivateKeyFile()
property string openPath : oldPath === "" ? (UtilsAdapter.getCurrentPath() + "/ringtones/") : (UtilsAdapter.toFileAbsolutepath(oldPath))
property string oldPath: CurrentAccount.privateKeyFile_TLS
property string openPath: oldPath === "" ?
(UtilsAdapter.getCurrentPath() + "/ringtones/") :
(UtilsAdapter.toFileAbsolutepath(oldPath))
mode: JamiFileDialog.OpenFile
title: JamiStrings.selectPrivateKey
folder: openPath
nameFilters: [qsTr("Key File") + " (*.key)", qsTr(
"All files") + " (*)"]
nameFilters: [qsTr("Key File") + " (*.key)",
qsTr("All files") + " (*)"]
onAccepted: {
var url = UtilsAdapter.getAbsPath(file.toString())
changeFilePrivateKey(url)
}
onAccepted: CurrentAccount.privateKeyFile_TLS =
UtilsAdapter.getAbsPath(file.toString())
}
ElidedTextLabel {
@ -153,33 +104,35 @@ ColumnLayout {
labelText: JamiStrings.encryptMediaStream
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: {
SettingsAdapter.setUseSRTP(checked)
enableSDESToggle.enabled = checked
fallbackRTPToggle.enabled = checked
}
checked: CurrentAccount.enable_SRTP
onSwitchToggled: CurrentAccount.enable_SRTP = checked
}
ToggleSwitch {
id: enableSDESToggle
enabled: CurrentAccount.enable_SRTP
labelText: JamiStrings.enableSDES
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: {
SettingsAdapter.setUseSDES(checked)
}
checked: CurrentAccount.keyExchange_SRTP
onSwitchToggled: CurrentAccount.keyExchange_SRTP = Number(checked)
}
ToggleSwitch {
id: fallbackRTPToggle
enabled: CurrentAccount.enable_SRTP
labelText: JamiStrings.fallbackRTP
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: {
SettingsAdapter.setUseRTPFallback(checked)
}
checked: CurrentAccount.rtpFallback_SRTP
onSwitchToggled: CurrentAccount.rtpFallback_SRTP = checked
}
ToggleSwitch {
@ -188,45 +141,59 @@ ColumnLayout {
labelText: JamiStrings.encryptNegotiation
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: {
SettingsAdapter.setUseTLS(checked)
btnSIPCACert.enabled = checked
btnSIPUserCert.enabled = checked
btnSIPPrivateKey.enabled = checked
lineEditSIPCertPassword.enabled = checked
}
checked: CurrentAccount.enable_TLS
onSwitchToggled: CurrentAccount.enable_TLS = checked
}
SettingMaterialButton {
id: btnSIPCACert
Layout.fillWidth: true
Layout.minimumHeight: JamiTheme.preferredFieldHeight
enabled: CurrentAccount.enable_TLS
titleField: JamiStrings.caCertificate
source: JamiResources.round_folder_24dp_svg
itemWidth: root.itemWidth
textField: UtilsAdapter.toFileInfoName(CurrentAccount.certificateListFile_TLS)
onClick: caCert_Dialog_SIP.open()
}
SettingMaterialButton {
id: btnSIPUserCert
Layout.fillWidth: true
Layout.minimumHeight: JamiTheme.preferredFieldHeight
enabled: CurrentAccount.enable_TLS
titleField: JamiStrings.userCertificate
source: JamiResources.round_folder_24dp_svg
itemWidth: root.itemWidth
textField: UtilsAdapter.toFileInfoName(CurrentAccount.certificateFile_TLS)
onClick: userCert_Dialog_SIP.open()
}
SettingMaterialButton {
id: btnSIPPrivateKey
Layout.fillWidth: true
Layout.minimumHeight: JamiTheme.preferredFieldHeight
enabled: CurrentAccount.enable_TLS
titleField: JamiStrings.privateKey
source: JamiResources.round_folder_24dp_svg
itemWidth: root.itemWidth
textField: UtilsAdapter.toFileInfoName(CurrentAccount.privateKeyFile_TLS)
onClick: privateKey_Dialog_SIP.open()
}
@ -236,10 +203,15 @@ ColumnLayout {
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight
enabled: CurrentAccount.enable_TLS
itemWidth: root.itemWidth
titleField: JamiStrings.privateKeyPassword
onEditFinished: SettingsAdapter.lineEditSIPCertPasswordLineEditTextChanged(textField)
textField: CurrentAccount.password_TLS
onEditFinished: CurrentAccount.password_TLS = textField
}
ToggleSwitch {
@ -248,9 +220,9 @@ ColumnLayout {
labelText: JamiStrings.verifyCertificatesServer
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: {
SettingsAdapter.setVerifyCertificatesServer(checked)
}
checked: CurrentAccount.verifyServer_TLS
onSwitchToggled: CurrentAccount.verifyServer_TLS = checked
}
ToggleSwitch {
@ -259,9 +231,9 @@ ColumnLayout {
labelText: JamiStrings.verifyCertificatesClient
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: {
SettingsAdapter.setVerifyCertificatesClient(checked)
}
checked: CurrentAccount.verifyClient_TLS
onSwitchToggled: CurrentAccount.verifyClient_TLS = checked
}
ToggleSwitch {
@ -270,9 +242,9 @@ ColumnLayout {
labelText: JamiStrings.tlsRequireConnections
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: {
SettingsAdapter.setRequireCertificatesIncomingTLS(checked)
}
checked: CurrentAccount.requireClientCertificate_TLS
onSwitchToggled: CurrentAccount.requireClientCertificate_TLS = checked
}
SettingsComboBox {
@ -293,10 +265,10 @@ ColumnLayout {
tipText: JamiStrings.audioDeviceSelector
role: "textDisplay"
onIndexChanged: {
var indexOfOption = comboModel.get(modelIndex).secondArg
SettingsAdapter.tlsProtocolComboBoxIndexChanged(parseInt(indexOfOption))
}
modelIndex: CurrentAccount.method_TLS
onModelIndexChanged: CurrentAccount.method_TLS =
parseInt(comboModel.get(modelIndex).secondArg)
}
SettingsMaterialLineEdit {
@ -307,7 +279,9 @@ ColumnLayout {
itemWidth: root.itemWidth
titleField: JamiStrings.tlsServerName
onEditFinished: SettingsAdapter.outgoingTLSServerNameLineEditTextChanged(textField)
textField: CurrentAccount.serverName_TLS
onEditFinished: CurrentAccount.serverName_TLS = textField
}
SettingSpinBox {
@ -319,7 +293,14 @@ ColumnLayout {
bottomValue: 0
topValue: 3000
onNewValue: SettingsAdapter.negotiationTimeoutSpinBoxValueChanged(valueField)
valueField: CurrentAccount.negotiationTimeoutSec_TLS
onInputAcceptableChanged: {
if (!inputAcceptable && valueField.length !== 0)
valueField = Qt.binding(function() { return CurrentAccount.negotiationTimeoutSec_TLS })
}
onNewValue: CurrentAccount.negotiationTimeoutSec_TLS = valueField
}
}
}

View file

@ -33,20 +33,6 @@ ColumnLayout {
property alias settingsVisible: advancedSettingsView.visible
signal showAdvancedSettingsRequest
function updateAdvancedAccountInfos() {
advancedCallSettings.updateCallSettingsInfos()
advancedChatSettings.updateSettings()
advancedVoiceMailSettings.updateVoiceMailSettingsInfos()
advancedSIPSecuritySettings.updateSecurityAccountInfos()
advancedNameServerSettings.updateNameServerInfos()
advancedOpenDHTSettings.updateOpenDHTSettingsInfos()
advancedJamiSecuritySettings.updateSecurityAccountInfos()
advancedConnectivitySettings.updateConnectivityAccountInfos()
advancedPublicAddressSettings.updatePublicAddressAccountInfos()
advancedMediaSettings.updateMediaConnectivityAccountInfos()
advancedSDPStettings.updateSDPAccountInfos()
}
RowLayout {
id: rowAdvancedSettingsBtn
Layout.fillWidth: true
@ -82,8 +68,6 @@ ColumnLayout {
onClicked: {
advancedSettingsView.visible = !advancedSettingsView.visible
if(advancedSettingsView.visible)
updateAdvancedAccountInfos()
showAdvancedSettingsRequest()
}
}

View file

@ -31,10 +31,6 @@ ColumnLayout {
property int itemWidth
function updateVoiceMailSettingsInfos() {
lineEditVoiceMailDialCode.textField = SettingsAdapter.getAccountConfig_Mailbox()
}
ElidedTextLabel {
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight
@ -50,9 +46,12 @@ ColumnLayout {
Layout.fillWidth: true
Layout.leftMargin: JamiTheme.preferredMarginSize
Layout.preferredHeight: JamiTheme.preferredFieldHeight
itemWidth: root.itemWidth
titleField: JamiStrings.voiceMailDialCode
onEditFinished: SettingsAdapter.lineEditVoiceMailDialCodeEditFinished(textField)
textField: CurrentAccount.mailbox
onEditFinished: CurrentAccount.mailbox = textField
}
}

View file

@ -39,13 +39,14 @@ ColumnLayout {
}
function populateAudioSettings() {
inputComboBoxSetting.setCurrentIndex(inputComboBoxSetting.comboModel.getCurrentIndex())
outputComboBoxSetting.setCurrentIndex(outputComboBoxSetting.comboModel.getCurrentIndex())
ringtoneComboBoxSetting.setCurrentIndex(outputComboBoxSetting.comboModel.getCurrentIndex())
inputComboBoxSetting.modelIndex = inputComboBoxSetting.comboModel.getCurrentIndex()
outputComboBoxSetting.modelIndex = outputComboBoxSetting.comboModel.getCurrentIndex()
ringtoneComboBoxSetting.modelIndex = outputComboBoxSetting.comboModel.getCurrentIndex()
if(audioManagerComboBoxSetting.comboModel.rowCount() > 0) {
audioManagerComboBoxSetting.setCurrentIndex(audioManagerComboBoxSetting.comboModel.getCurrentSettingIndex())
audioManagerComboBoxSetting.modelIndex =
audioManagerComboBoxSetting.comboModel.getCurrentSettingIndex()
}
audioManagerComboBoxSetting.visible = (audioManagerComboBoxSetting.comboModel.rowCount() > 0)
audioManagerComboBoxSetting.visible = audioManagerComboBoxSetting.comboModel.rowCount() > 0
}
ElidedTextLabel {
@ -74,7 +75,7 @@ ColumnLayout {
tipText: JamiStrings.selectAudioInputDevice
role: "DeviceName"
onIndexChanged: {
onModelIndexChanged: {
AvAdapter.stopAudioMeter()
AVModel.setInputDevice(comboModel.data(
comboModel.index(modelIndex, 0),
@ -113,7 +114,7 @@ ColumnLayout {
tipText: JamiStrings.selectAudioOutputDevice
role: "DeviceName"
onIndexChanged: {
onModelIndexChanged: {
AvAdapter.stopAudioMeter()
AVModel.setOutputDevice(comboModel.data(
comboModel.index(modelIndex, 0),
@ -139,7 +140,7 @@ ColumnLayout {
tipText: JamiStrings.selectRingtoneOutputDevice
role: "DeviceName"
onIndexChanged: {
onModelIndexChanged: {
AvAdapter.stopAudioMeter()
AVModel.setRingtoneDevice(comboModel.data(
comboModel.index(modelIndex, 0),
@ -163,7 +164,7 @@ ColumnLayout {
widthOfComboBox: itemWidth
role: "ID_UTF8"
onIndexChanged: {
onModelIndexChanged: {
AvAdapter.stopAudioMeter()
var selectedAudioManager = comboModel.data(
comboModel.index(modelIndex, 0), AudioManagerListModel.AudioManagerID)

View file

@ -33,7 +33,7 @@ ColumnLayout {
visible: {
if (bannedListWidget.model.rowCount() <= 0)
return false
return true && !isSIP && SettingsAdapter.getAccountConfig_Manageruri() === ""
return true && !isSIP && CurrentAccount.managerUri === ""
}
Connections {
@ -68,10 +68,6 @@ ColumnLayout {
}
}
function unban(index) {
SettingsAdapter.unbanContact(index)
}
RowLayout {
id: bannedContactsBtn
@ -127,7 +123,7 @@ ColumnLayout {
btnToolTip: JamiStrings.reinstateContact
onClicked: bannedListWidget.currentIndex = index
onBtnContactClicked: unban(index)
onBtnContactClicked: MessagesAdapter.unbanContact(index)
}
}
}

View file

@ -50,14 +50,14 @@ ColumnLayout {
Layout.fillWidth: true
Layout.leftMargin: JamiTheme.preferredMarginSize
checked: SettingsAdapter.getAppValue(Settings.EnableTypingIndicator)
checked: UtilsAdapter.getAppValue(Settings.EnableTypingIndicator)
labelText: JamiStrings.enableTypingIndicator
fontPointSize: JamiTheme.settingsFontSize
tooltipText: JamiStrings.enableTypingIndicator
onSwitchToggled: SettingsAdapter.setAppValue(Settings.Key.EnableTypingIndicator, checked)
onSwitchToggled: UtilsAdapter.setAppValue(Settings.Key.EnableTypingIndicator, checked)
}
ToggleSwitch {
@ -66,7 +66,7 @@ ColumnLayout {
Layout.fillWidth: true
Layout.leftMargin: JamiTheme.preferredMarginSize
checked: SettingsAdapter.getAppValue(Settings.DisplayHyperlinkPreviews)
checked: UtilsAdapter.getAppValue(Settings.DisplayHyperlinkPreviews)
labelText: JamiStrings.displayHyperlinkPreviews
fontPointSize: JamiTheme.settingsFontSize
@ -74,7 +74,7 @@ ColumnLayout {
tooltipText: JamiStrings.displayHyperlinkPreviews
onSwitchToggled: {
SettingsAdapter.setAppValue(Settings.Key.DisplayHyperlinkPreviews, checked)
UtilsAdapter.setAppValue(Settings.Key.DisplayHyperlinkPreviews, checked)
MessagesAdapter.setDisplayLinks()
}
}

View file

@ -41,14 +41,7 @@ Rectangle {
signal advancedSettingsToggled(bool settingsVisible)
function updateAccountInfoDisplayed() {
accountEnableCheckBox.checked = SettingsAdapter.get_CurrentAccountInfo_Enabled()
accountProfile.updateAccountInfo()
userIdentity.updateAccountInfo()
bannedContacts.updateAndShowBannedContactsSlot()
advancedSettings.updateAdvancedAccountInfos()
var isJams = !isSIP && SettingsAdapter.getAccountConfig_Manageruri() !== ""
passwdPushButton.visible = !isJams
btnExportAccount.visible = !isJams
setPasswordButtonText()
}
@ -65,7 +58,7 @@ Rectangle {
}
function delAccountSlot() {
deleteAccountDialog.openDialog()
deleteAccountDialog.open()
}
function getAdvancedSettingsScrollPosition() {
@ -176,8 +169,9 @@ Rectangle {
labelText: JamiStrings.enableAccount
fontPointSize: JamiTheme.headerFontSize
onSwitchToggled: AccountAdapter.model.setAccountEnabled(
LRCInstance.currentAccountId, checked)
checked: CurrentAccount.enabled
onSwitchToggled: CurrentAccount.enabled = checked
}
AccountProfile {
@ -204,7 +198,7 @@ Rectangle {
MaterialButton {
id: passwdPushButton
visible: !isSIP && SettingsAdapter.getAccountConfig_Manageruri() === ""
visible: !isSIP && CurrentAccount.managerUri === ""
Layout.alignment: Qt.AlignHCenter
Layout.topMargin: JamiTheme.preferredMarginSize
@ -231,7 +225,7 @@ Rectangle {
MaterialButton {
id: btnExportAccount
visible: !isSIP && SettingsAdapter.getAccountConfig_Manageruri() === ""
visible: !isSIP && CurrentAccount.managerUri === ""
Layout.alignment: Qt.AlignHCenter
preferredWidth: JamiTheme.preferredFieldWidth

View file

@ -90,7 +90,7 @@ ItemDelegate {
backgroundColor: JamiTheme.editBackgroundColor
onEditingFinished: {
SettingsAdapter.setDeviceName(editDeviceName.text)
AvAdapter.setDeviceName(editDeviceName.text)
editable = !editable
}
onReadOnlyChanged: {

View file

@ -29,12 +29,6 @@ ColumnLayout {
property int itemWidth
function updateValues() {
acceptTransferBelowSpinBox.valueField = SettingsAdapter.getAppValue(Settings.AcceptTransferBelow)
allowFromUntrustedCheckbox.checked = SettingsAdapter.getAppValue(Settings.AllowFromUntrusted)
autoAcceptFilesCheckbox.checked = SettingsAdapter.getAppValue(Settings.AutoAcceptFiles)
}
Label {
Layout.fillWidth: true
@ -52,14 +46,14 @@ ColumnLayout {
Layout.fillWidth: true
Layout.leftMargin: JamiTheme.preferredMarginSize
checked: SettingsAdapter.getAppValue(Settings.AllowFromUntrusted)
checked: CurrentAccount.autoTransferFromUntrusted
labelText: JamiStrings.allowFromUntrusted
fontPointSize: JamiTheme.settingsFontSize
tooltipText: JamiStrings.allowFromUntrusted
onSwitchToggled: SettingsAdapter.allowFromUntrusted(checked)
onSwitchToggled: CurrentAccount.autoTransferFromUntrusted = checked
}
ToggleSwitch {
@ -67,14 +61,14 @@ ColumnLayout {
Layout.fillWidth: true
Layout.leftMargin: JamiTheme.preferredMarginSize
checked: SettingsAdapter.getAppValue(Settings.AutoAcceptFiles)
checked: CurrentAccount.autoTransferFromTrusted
labelText: JamiStrings.autoAcceptFiles
fontPointSize: JamiTheme.settingsFontSize
tooltipText: JamiStrings.autoAcceptFiles
onSwitchToggled: SettingsAdapter.autoAcceptFiles(checked)
onSwitchToggled: CurrentAccount.autoTransferFromTrusted = checked
}
SettingSpinBox {
@ -86,8 +80,10 @@ ColumnLayout {
tooltipText: JamiStrings.acceptTransferTooltip
itemWidth: root.itemWidth
bottomValue: 0
topValue: 99999999
topValue: Number.MAX_VALUE
onNewValue: SettingsAdapter.acceptTransferBelow(valueField)
valueField: CurrentAccount.autoTransferSizeThreshold
onNewValue: CurrentAccount.autoTransferSizeThreshold = valueField
}
}

View file

@ -35,10 +35,6 @@ Rectangle {
color: JamiTheme.secondaryBackgroundColor
function updateValues() {
fileTransferSettings.updateValues()
}
ColumnLayout {
id: generalSettingsColumnLayout

View file

@ -30,27 +30,12 @@ ColumnLayout {
id: root
property int itemWidth
property bool registeredIdNeedsSet: false
function updateAccountInfo() {
currentRingIDText.text = SettingsAdapter.getCurrentAccount_Profile_Info_Uri()
registeredIdNeedsSet = (SettingsAdapter.get_CurrentAccountInfo_RegisteredName() === "")
if(!registeredIdNeedsSet) {
currentRegisteredID.text = SettingsAdapter.get_CurrentAccountInfo_RegisteredName()
} else {
currentRegisteredID.text = ""
}
}
NameRegistrationDialog {
id : nameRegistrationDialog
onAccepted: {
registeredIdNeedsSet = false
currentRegisteredID.nameRegistrationState =
onAccepted: currentRegisteredID.nameRegistrationState =
UsernameLineEdit.NameRegistrationState.BLANK
}
}
// Identity
@ -106,7 +91,7 @@ ColumnLayout {
elideWidth: root.width - idLabel.width -
JamiTheme.preferredMarginSize * 4
text: SettingsAdapter.getCurrentAccount_Profile_Info_Uri()
text: CurrentAccount.uri
}
}
}
@ -145,21 +130,15 @@ ColumnLayout {
}
padding: 8
horizontalAlignment: registeredIdNeedsSet ?
Text.AlignLeft :
Text.AlignRight
horizontalAlignment: CurrentAccount.registeredName === "" ? Text.AlignLeft :
Text.AlignRight
verticalAlignment: Text.AlignVCenter
wrapMode: Text.NoWrap
placeholderText: registeredIdNeedsSet ?
JamiStrings.registerAUsername : ""
text: {
if (!registeredIdNeedsSet)
return SettingsAdapter.get_CurrentAccountInfo_RegisteredName()
else
return ""
}
readOnly: !registeredIdNeedsSet
font.bold: !registeredIdNeedsSet
placeholderText: CurrentAccount.registeredName === "" ?
JamiStrings.registerAUsername : ""
text: CurrentAccount.registeredName
readOnly: CurrentAccount.registeredName !== ""
font.bold: CurrentAccount.registeredName !== ""
loseFocusWhenEnterPressed: btnRegisterName.visible
onAccepted: {
@ -178,9 +157,9 @@ ColumnLayout {
preferredWidth: 120
preferredHeight: 30
visible: registeredIdNeedsSet &&
currentRegisteredID.nameRegistrationState ===
UsernameLineEdit.NameRegistrationState.FREE
visible: CurrentAccount.registeredName === "" &&
currentRegisteredID.nameRegistrationState ===
UsernameLineEdit.NameRegistrationState.FREE
text: JamiStrings.register
toolTipText: JamiStrings.registerUsername

View file

@ -30,19 +30,6 @@ import "../../commoncomponents"
ColumnLayout {
id:root
Connections {
id: accountConnections
target: AccountAdapter
enabled: root.visible
function onAccountStatusChanged(id) {
if (SettingsAdapter.getAccountConfig_Manageruri() === ""){
linkDevPushButton.visible = SettingsAdapter.get_CurrentAccountInfo_Enabled()
}
}
}
function removeDeviceSlot(index){
var idOfDevice = settingsListView.model.data(settingsListView.model.index(index,0),
DeviceItemListModel.DeviceID)
@ -122,6 +109,8 @@ ColumnLayout {
preferredWidth: JamiTheme.preferredFieldWidth
visible: CurrentAccount.managerUri === "" && CurrentAccount.enabled
color: JamiTheme.buttonTintedBlack
hoveredColor: JamiTheme.buttonTintedBlackHovered
pressedColor: JamiTheme.buttonTintedBlackPressed

View file

@ -43,38 +43,41 @@ Dialog {
property var lineSize: []
property var lineCounter: 0
function monitor(continuous) {
SettingsAdapter.monitor(continuous)
UtilsAdapter.monitor(continuous)
}
Connections{
target: SettingsAdapter
Connections {
target: UtilsAdapter
function onDebugMessageReceived(message) {
if (!root.visible) {
return;
return
}
var initialPosition = scrollView.ScrollBar.vertical.position
lineCounter += 1
lineSize.push(message.length)
if (!root.cancelPressed) {
logsText.append(message);
logsText.append(message)
}
if (lineCounter >= 10000){
if (lineCounter >= 10000) {
lineCounter -= 1
logsText.remove(0, lineSize[0])
lineSize.shift()
}
scrollView.ScrollBar.vertical.position = initialPosition > (.8*(1.0 - scrollView.ScrollBar.vertical.size)) ? 1.0 - scrollView.ScrollBar.vertical.size : initialPosition
scrollView.ScrollBar.vertical.position = initialPosition
> (.8 * (1.0 - scrollView.ScrollBar.vertical.size)) ?
1.0 - scrollView.ScrollBar.vertical.size : initialPosition
}
}
onVisibleChanged: {
if (visible && startStopToggle.checked) {
if (hasOpened && lineCounter == 0) {
logsText.append(SettingsAdapter.getLogs())
lineCounter = SettingsAdapter.getSizeOfLogs()
lineSize.push(SettingsAdapter.getFirstLogLength())
var logList = UtilsAdapter.logList
logsText.append(logList.join('\n'))
lineCounter = logList.length
lineSize.push(lineCounter ? logList[0].length : 0)
}
} else {
logsText.clear()
@ -111,12 +114,12 @@ Dialog {
border.color: color
border.width: 0
height: JamiTheme.preferredFieldHeight*2
height: JamiTheme.preferredFieldHeight * 2
RowLayout {
id: buttons
Layout.alignment: Qt.AlignTop| Qt.AlignHCenter
Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
anchors.centerIn: parent
ToggleSwitch {
@ -132,7 +135,7 @@ Dialog {
onSwitchToggled: {
logging = !logging
if (logging){
if (logging) {
isStopped = false
root.cancelPressed = false
monitor(true)
@ -165,7 +168,7 @@ Dialog {
logging = false
startStopToggle.checked = false
root.cancelPressed = true
SettingsAdapter.clearLogs()
UtilsAdapter.logList = []
monitor(false)
}
}
@ -185,7 +188,7 @@ Dialog {
outlined: true
text: JamiStrings.logsViewCopy
onClicked:{
onClicked: {
logsText.selectAll()
logsText.copy()
logsText.deselect()
@ -196,11 +199,11 @@ Dialog {
id: copiedToolTip
height: JamiTheme.preferredFieldHeight
TextArea{
TextArea {
text: JamiStrings.logsViewCopied
color: JamiTheme.textColor
}
background: Rectangle{
background: Rectangle {
color: JamiTheme.primaryBackgroundColor
}
}
@ -223,7 +226,8 @@ Dialog {
text: JamiStrings.logsViewReport
outlined: true
onClicked: Qt.openUrlExternally("https://jami.net/bugs-and-improvements/")
onClicked: Qt.openUrlExternally(
"https://jami.net/bugs-and-improvements/")
}
}
}
@ -236,20 +240,19 @@ Dialog {
Layout.fillWidth: true
Layout.fillHeight: true
color: JamiTheme.primaryBackgroundColor
color: JamiTheme.primaryBackgroundColor
border.color: color
border.width: 6
height: root.height - buttonRectangleBackground.height
ScrollView{
ScrollView {
id: scrollView
Layout.fillHeight: true
Layout.fillWidth: true
anchors.fill: flickableRectangleBackground
TextArea{
TextArea {
id: logsText
readOnly: true
@ -286,7 +289,3 @@ Dialog {
}
}
}

View file

@ -43,10 +43,7 @@ ColumnLayout {
var codecId = mediaListWidget.model.data(mediaListWidget.model.index(index,0),
MediaCodecListModel.MediaCodecID)
if (mediaType === MediaSettings.VIDEO)
SettingsAdapter.decreaseVideoCodecPriority(codecId)
else if (mediaType === MediaSettings.AUDIO)
SettingsAdapter.decreaseAudioCodecPriority(codecId)
AvAdapter.decreaseCodecPriority(codecId, mediaType === MediaSettings.VIDEO)
mediaListWidget.currentIndex = index + 1
updateCodecs()
}
@ -66,10 +63,7 @@ ColumnLayout {
var codecId = mediaListWidget.model.data(mediaListWidget.model.index(index,0),
MediaCodecListModel.MediaCodecID)
if (mediaType === MediaSettings.VIDEO)
SettingsAdapter.increaseVideoCodecPriority(codecId)
else if (mediaType === MediaSettings.AUDIO)
SettingsAdapter.increaseAudioCodecPriority(codecId)
AvAdapter.increaseCodecPriority(codecId, mediaType === MediaSettings.VIDEO)
mediaListWidget.currentIndex = index - 1
updateCodecs()
}
@ -86,9 +80,9 @@ ColumnLayout {
maxWidth: width
eText: {
if (mediaType === MediaSettings.VIDEO)
return "Video Codecs"
return JamiStrings.videoCodecs
else if (mediaType === MediaSettings.AUDIO)
return "Audio Codecs"
return JamiStrings.audioCodecs
}
fontSize: JamiTheme.settingsFontSize
}
@ -134,10 +128,7 @@ ColumnLayout {
}
onMediaCodecStateChange: {
if (mediaType === MediaSettings.VIDEO)
SettingsAdapter.videoCodecsStateChange(idToSet, isToBeEnabled)
if (mediaType === MediaSettings.AUDIO)
SettingsAdapter.audioCodecsStateChange(idToSet, isToBeEnabled)
AvAdapter.enableCodec(idToSet, isToBeEnabled)
updateCodecs()
}
}

View file

@ -31,7 +31,7 @@ ColumnLayout {
id:root
property int itemWidth
property string recordPath: SettingsAdapter.getDir_Document()
property string recordPath: UtilsAdapter.getDirDocument()
onRecordPathChanged: {
if(recordPath === "") return

View file

@ -30,22 +30,18 @@ ColumnLayout {
property int itemWidth
function updateAccountInfo() {
usernameSIP.textField = SettingsAdapter.getAccountConfig_Username()
hostnameSIP.textField = SettingsAdapter.getAccountConfig_Hostname()
passSIPlineEdit.textField = SettingsAdapter.getAccountConfig_Password()
proxySIP.textField = SettingsAdapter.getAccountConfig_RouteSet()
}
SettingsMaterialLineEdit {
id: usernameSIP
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight
textField: CurrentAccount.username
titleField: JamiStrings.username
itemWidth: root.itemWidth
onEditFinished: SettingsAdapter.setAccountConfig_Username(textField)
onEditFinished: CurrentAccount.username = textField
}
SettingsMaterialLineEdit {
@ -54,9 +50,12 @@ ColumnLayout {
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight
textField: CurrentAccount.hostname
titleField: JamiStrings.server
itemWidth: root.itemWidth
onEditFinished: SettingsAdapter.setAccountConfig_Hostname(textField)
onEditFinished: CurrentAccount.hostname = textField
}
SettingsMaterialLineEdit {
@ -65,20 +64,27 @@ ColumnLayout {
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight
textField: CurrentAccount.routeset
titleField: JamiStrings.proxy
itemWidth: root.itemWidth
onEditFinished: SettingsAdapter.setAccountConfig_RouteSet(textField)
onEditFinished: CurrentAccount.routeset = textField
}
SettingsMaterialLineEdit {
id: passSIPlineEdit
textField: CurrentAccount.password
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight
titleField: JamiStrings.password
itemWidth: root.itemWidth
onEditFinished: SettingsAdapter.setAccountConfig_Password(textField)
echoMode: TextInput.Password
onEditFinished:nCurrentAccount.password = textField
}
}

View file

@ -35,6 +35,7 @@ RowLayout {
property alias topValue: textFieldValidator.top
property alias valueField: textField.text
property alias tooltipText: toolTip.text
property alias inputAcceptable: textField.acceptableInput
property string borderColor: JamiTheme.greyBorderColor
property int itemWidth

View file

@ -33,19 +33,10 @@ RowLayout {
property alias placeholderText: comboBoxOfLayout.placeholderText
property alias enabled: comboBoxOfLayout.enabled
property alias fontPointSize: comboBoxOfLayout.font.pointSize
property alias modelIndex: comboBoxOfLayout.currentIndex
property int heightOfLayout: 30
property int widthOfComboBox: 50
property int modelIndex
signal indexChanged
function setCurrentIndex(index, emitIndexChanged = false) {
comboBoxOfLayout.currentIndex = index
modelIndex = index
if (emitIndexChanged)
indexChanged()
}
ElidedTextLabel {
id: label
@ -71,10 +62,5 @@ RowLayout {
textRole: role
tooltipText: tipText
onActivated: {
root.modelIndex = index
indexChanged()
}
}
}

View file

@ -32,11 +32,11 @@ ColumnLayout {
id:root
property int itemWidth
property string downloadPath: SettingsAdapter.getDir_Download()
property string downloadPath: UtilsAdapter.getDirDownload()
onDownloadPathChanged: {
if(downloadPath === "") return
SettingsAdapter.setDownloadPath(downloadPath)
UtilsAdapter.setDownloadPath(downloadPath)
}
FolderDialog {
@ -68,7 +68,7 @@ ColumnLayout {
Layout.fillWidth: true
Layout.leftMargin: JamiTheme.preferredMarginSize
checked: SettingsAdapter.getAppValue(Settings.EnableDarkTheme)
checked: UtilsAdapter.getAppValue(Settings.EnableDarkTheme)
labelText: qsTr("Enable dark theme")
fontPointSize: JamiTheme.settingsFontSize
@ -77,7 +77,7 @@ ColumnLayout {
onSwitchToggled: {
JamiTheme.setTheme(checked)
SettingsAdapter.setAppValue(Settings.Key.EnableDarkTheme, checked)
UtilsAdapter.setAppValue(Settings.Key.EnableDarkTheme, checked)
}
}
@ -86,26 +86,26 @@ ColumnLayout {
Layout.fillWidth: true
Layout.leftMargin: JamiTheme.preferredMarginSize
checked: SettingsAdapter.getAppValue(Settings.EnableNotifications)
checked: UtilsAdapter.getAppValue(Settings.EnableNotifications)
labelText: qsTr("Enable desktop notifications")
fontPointSize: JamiTheme.settingsFontSize
tooltipText: JamiStrings.enableNotifications
onSwitchToggled: SettingsAdapter.setAppValue(Settings.Key.EnableNotifications, checked)
onSwitchToggled: UtilsAdapter.setAppValue(Settings.Key.EnableNotifications, checked)
}
ToggleSwitch {
id: closeOrMinCheckBox
Layout.fillWidth: true
Layout.leftMargin: JamiTheme.preferredMarginSize
checked: SettingsAdapter.getAppValue(Settings.MinimizeOnClose)
checked: UtilsAdapter.getAppValue(Settings.MinimizeOnClose)
labelText: JamiStrings.keepMinimized
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: SettingsAdapter.setAppValue(Settings.Key.MinimizeOnClose, checked)
onSwitchToggled: UtilsAdapter.setAppValue(Settings.Key.MinimizeOnClose, checked)
}
ToggleSwitch {
@ -120,7 +120,7 @@ ColumnLayout {
tooltipText: JamiStrings.tipRunStartup
onSwitchToggled: SettingsAdapter.setRunOnStartUp(checked)
onSwitchToggled: UtilsAdapter.setRunOnStartUp(checked)
}
RowLayout {

View file

@ -26,15 +26,16 @@ import net.jami.Constants 1.1
import "../../commoncomponents"
ColumnLayout{
id:root
ColumnLayout {
id: root
property int itemWidth
LogsView{
LogsView {
id: logsView
}
Label{
Label {
Layout.fillWidth: true
text: JamiStrings.troubleshootTitle
@ -47,7 +48,9 @@ ColumnLayout{
}
RowLayout {
Text{
Layout.leftMargin: JamiTheme.preferredMarginSize
Text {
Layout.fillWidth: true
Layout.preferredHeight: 30
Layout.rightMargin: JamiTheme.preferredMarginSize
@ -81,4 +84,3 @@ ColumnLayout{
}
}
}

View file

@ -50,14 +50,14 @@ ColumnLayout {
Layout.fillWidth: true
Layout.leftMargin: JamiTheme.preferredMarginSize
checked: SettingsAdapter.getAppValue(Settings.Key.AutoUpdate)
checked: UtilsAdapter.getAppValue(Settings.Key.AutoUpdate)
labelText: JamiStrings.update
tooltipText: JamiStrings.enableAutoUpdates
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: {
SettingsAdapter.setAppValue(Settings.Key.AutoUpdate, checked)
UtilsAdapter.setAppValue(Settings.Key.AutoUpdate, checked)
UpdateManager.setAutoUpdateCheck(checked)
}
}

View file

@ -31,14 +31,6 @@ ColumnLayout {
property int itemWidth
property bool isSIP
function updateAccountInfo() {
if (!isSIP) {
jamiUserIdentity.updateAccountInfo()
} else {
sipUserIdentity.updateAccountInfo()
}
}
ElidedTextLabel {
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight

View file

@ -37,13 +37,19 @@ ColumnLayout {
Connections {
target: AvAdapter
enabled: root.visible
function onVideoDeviceListChanged() {
populateVideoSettings()
}
}
function startPreviewing(force = false) {
if (root.visible) {
AccountAdapter.startPreviewing(force)
previewAvailable = true
}
}
function populateVideoSettings() {
deviceComboBoxSetting.comboModel.reset()
@ -55,22 +61,26 @@ ColumnLayout {
fpsComboBoxSetting.enabled = count > 0
if (count === 0) {
resolutionComboBoxSetting.comboModel.reset()
fpsComboBoxSetting.comboModel.reset()
resolutionComboBoxSetting.reset()
fpsComboBoxSetting.reset()
} else {
deviceComboBoxSetting.setCurrentIndex(
deviceComboBoxSetting.comboModel.getCurrentIndex(), true)
deviceComboBoxSetting.modelIndex =
deviceComboBoxSetting.comboModel.getCurrentIndex()
}
hardwareAccelControl.checked = AVModel.getHardwareAcceleration()
}
function slotDeviceBoxCurrentIndexChanged(index) {
if(deviceComboBoxSetting.comboModel.deviceCount() <= 0)
if (deviceComboBoxSetting.comboModel.deviceCount() <= 0)
return
try {
var deviceId = deviceComboBoxSetting.comboModel.data(deviceComboBoxSetting.comboModel.index(index, 0), VideoInputDeviceModel.DeviceId)
var deviceName = deviceComboBoxSetting.comboModel.data(deviceComboBoxSetting.comboModel.index(index, 0), VideoInputDeviceModel.DeviceName)
var deviceId = deviceComboBoxSetting.comboModel.data(
deviceComboBoxSetting.comboModel.index(index, 0),
VideoInputDeviceModel.DeviceId)
var deviceName = deviceComboBoxSetting.comboModel.data(
deviceComboBoxSetting.comboModel.index(index, 0),
VideoInputDeviceModel.DeviceName)
if(deviceId.length === 0) {
console.warn("Couldn't find device: " + deviceName)
return
@ -81,60 +91,10 @@ ColumnLayout {
AVModel.setDefaultDevice(deviceId)
}
setFormatListForCurrentDevice()
startPreviewing()
resolutionComboBoxSetting.reset()
} catch(err){ console.warn(err.message) }
}
function startPreviewing(force = false) {
AccountAdapter.startPreviewing(force)
previewAvailable = true
}
function setFormatListForCurrentDevice() {
var device = AVModel.getCurrentVideoCaptureDevice()
try {
if (SettingsAdapter.get_DeviceCapabilitiesSize(device) === 0)
return
resolutionComboBoxSetting.comboModel.reset()
resolutionComboBoxSetting.setCurrentIndex(
resolutionComboBoxSetting.comboModel.getCurrentSettingIndex(), true)
} catch(err) { console.warn("Exception: " + err.message) }
}
function slotFormatCurrentIndexChanged(index, isResolutionIndex) {
var resolution
var rate
if(isResolutionIndex) {
fpsComboBoxSetting.comboModel.reset()
resolution = resolutionComboBoxSetting.comboModel.data(
resolutionComboBoxSetting.comboModel.index(index, 0),
VideoFormatResolutionModel.Resolution)
fpsComboBoxSetting.comboModel.currentResolution = resolution
fpsComboBoxSetting.setCurrentIndex(
fpsComboBoxSetting.comboModel.getCurrentSettingIndex(), true)
rate = fpsComboBoxSetting.comboModel.data(
fpsComboBoxSetting.comboModel.index(0, 0),
VideoFormatFpsModel.FPS)
} else {
resolution = resolutionComboBoxSetting.comboModel.data(
resolutionComboBoxSetting.comboModel.index(
resolutionComboBoxSetting.modelIndex, 0),
VideoFormatResolutionModel.Resolution)
fpsComboBoxSetting.comboModel.currentResolution = resolution
rate = fpsComboBoxSetting.comboModel.data(
fpsComboBoxSetting.comboModel.index(index, 0),
VideoFormatFpsModel.FPS)
}
try {
SettingsAdapter.set_Video_Settings_Rate_And_Resolution(
AVModel.getCurrentVideoCaptureDevice(),rate, resolution)
updatePreviewRatio(resolution)
} catch(error){ console.warn(error.message) }
}
function updatePreviewRatio(resolution) {
var res = resolution.split("x")
var ratio = res[1] / res[0]
@ -145,6 +105,11 @@ ColumnLayout {
}
}
onVisibleChanged: {
if (visible)
startPreviewing(true)
}
ElidedTextLabel {
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight
@ -170,9 +135,7 @@ ColumnLayout {
tipText: JamiStrings.selectVideoDevice
role: "DeviceName_UTF8"
onIndexChanged: {
slotDeviceBoxCurrentIndexChanged(modelIndex)
}
onModelIndexChanged: slotDeviceBoxCurrentIndexChanged(modelIndex)
placeholderText: JamiStrings.noVideoDevice
}
@ -180,6 +143,12 @@ ColumnLayout {
SettingsComboBox {
id: resolutionComboBoxSetting
function reset() {
modelIndex = -1
comboModel.reset()
modelIndex = 0
}
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight
Layout.leftMargin: JamiTheme.preferredMarginSize
@ -193,14 +162,34 @@ ColumnLayout {
tipText: JamiStrings.selectVideoResolution
role: "Resolution_UTF8"
onIndexChanged: {
slotFormatCurrentIndexChanged(modelIndex, true)
modelIndex: -1
onModelIndexChanged: {
if (modelIndex === -1)
return
var resolution = comboModel.data(comboModel.index(modelIndex, 0),
VideoFormatResolutionModel.Resolution)
fpsComboBoxSetting.comboModel.currentResolution = resolution
fpsComboBoxSetting.modelIndex = 0
var rate = fpsComboBoxSetting.comboModel.data(
fpsComboBoxSetting.comboModel.index(0, 0),
VideoFormatFpsModel.FPS)
AvAdapter.setCurrentVideoDeviceRateAndResolution(rate, resolution)
updatePreviewRatio(resolution)
}
}
SettingsComboBox {
id: fpsComboBoxSetting
function reset() {
modelIndex = -1
comboModel.reset()
modelIndex = 0
}
Layout.fillWidth: true
Layout.preferredHeight: JamiTheme.preferredFieldHeight
Layout.leftMargin: JamiTheme.preferredMarginSize
@ -214,8 +203,20 @@ ColumnLayout {
tipText: JamiStrings.selectFPS
role: "FPS_ToDisplay_UTF8"
onIndexChanged: {
slotFormatCurrentIndexChanged(modelIndex, false)
modelIndex: -1
onModelIndexChanged: {
if (modelIndex === -1)
return
var resolution = resolutionComboBoxSetting.comboModel.data(
resolutionComboBoxSetting.comboModel.index(
resolutionComboBoxSetting.modelIndex, 0),
VideoFormatResolutionModel.Resolution)
var rate = comboModel.data(comboModel.index(modelIndex, 0),
VideoFormatFpsModel.FPS)
AvAdapter.setCurrentVideoDeviceRateAndResolution(rate, resolution)
}
}

View file

@ -28,15 +28,20 @@
#include "version.h"
#include "api/pluginmodel.h"
#include "api/datatransfermodel.h"
#include <QApplication>
#include <QClipboard>
#include <QFileInfo>
UtilsAdapter::UtilsAdapter(SystemTray* systemTray, LRCInstance* instance, QObject* parent)
UtilsAdapter::UtilsAdapter(AppSettingsManager* settingsManager,
SystemTray* systemTray,
LRCInstance* instance,
QObject* parent)
: QmlAdapterBase(instance, parent)
, clipboard_(QApplication::clipboard())
, systemTray_(systemTray)
, settingsManager_(settingsManager)
{}
const QString
@ -319,3 +324,78 @@ UtilsAdapter::setSystemTrayIconVisible(bool visible)
{
systemTray_->setVisible(visible);
}
QVariant
UtilsAdapter::getAppValue(const Settings::Key key)
{
return settingsManager_->getValue(key);
}
void
UtilsAdapter::setAppValue(const Settings::Key key, const QVariant& value)
{
settingsManager_->setValue(key, value);
}
QString
UtilsAdapter::getDirDocument()
{
return QDir::toNativeSeparators(
QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation));
}
QString
UtilsAdapter::getDirDownload()
{
QString downloadPath = QDir::toNativeSeparators(lrcInstance_->accountModel().downloadDirectory);
if (downloadPath.isEmpty()) {
downloadPath = lrc::api::DataTransferModel::createDefaultDirectory();
setDownloadPath(downloadPath);
lrcInstance_->accountModel().downloadDirectory = downloadPath;
}
#ifdef Q_OS_WIN
int pos = downloadPath.lastIndexOf(QChar('\\'));
#else
int pos = downloadPath.lastIndexOf(QChar('/'));
#endif
if (pos == downloadPath.length() - 1)
downloadPath.truncate(pos);
return downloadPath;
}
void
UtilsAdapter::setRunOnStartUp(bool state)
{
if (Utils::CheckStartupLink(L"Jami")) {
if (!state) {
Utils::DeleteStartupLink(L"Jami");
}
} else if (state) {
Utils::CreateStartupLink(L"Jami");
}
}
void
UtilsAdapter::setDownloadPath(QString dir)
{
setAppValue(Settings::Key::DownloadPath, dir);
lrcInstance_->accountModel().downloadDirectory = dir + "/";
}
void
UtilsAdapter::monitor(const bool& continuous)
{
disconnect(debugMessageReceivedConnection_);
if (continuous)
debugMessageReceivedConnection_
= QObject::connect(&lrcInstance_->behaviorController(),
&lrc::api::BehaviorController::debugMessageReceived,
[this](const QString& data) {
logList_.append(data);
if (logList_.size() >= LOGSLIMIT) {
logList_.removeFirst();
}
Q_EMIT debugMessageReceived(data);
});
lrcInstance_->monitor(continuous);
}

View file

@ -26,15 +26,23 @@
#include <QObject>
#include "qmladapterbase.h"
#include "appsettingsmanager.h"
#include "qtutils.h"
class QClipboard;
class SystemTray;
#define LOGSLIMIT 10000
class UtilsAdapter final : public QmlAdapterBase
{
Q_OBJECT
QML_PROPERTY(QStringList, logList)
public:
explicit UtilsAdapter(SystemTray* systemTray, LRCInstance* instance, QObject* parent = nullptr);
explicit UtilsAdapter(AppSettingsManager* settingsManager,
SystemTray* systemTray,
LRCInstance* instance,
QObject* parent = nullptr);
~UtilsAdapter() = default;
void safeInit() override {}
@ -74,9 +82,22 @@ public:
Q_INVOKABLE bool isImage(const QString& fileExt);
Q_INVOKABLE QString humanFileSize(qint64 fileSize);
Q_INVOKABLE void setSystemTrayIconVisible(bool visible);
Q_INVOKABLE QVariant getAppValue(const Settings::Key key);
Q_INVOKABLE void setAppValue(const Settings::Key key, const QVariant& value);
Q_INVOKABLE QString getDirDocument();
Q_INVOKABLE QString getDirDownload();
Q_INVOKABLE void setRunOnStartUp(bool state);
Q_INVOKABLE void setDownloadPath(QString dir);
Q_INVOKABLE void monitor(const bool& continuous);
Q_SIGNALS:
void debugMessageReceived(const QString& message);
private:
QClipboard* clipboard_;
SystemTray* systemTray_;
AppSettingsManager* settingsManager_;
QMetaObject::Connection debugMessageReceivedConnection_;
};
Q_DECLARE_METATYPE(UtilsAdapter*)

View file

@ -290,7 +290,7 @@ WizardView {
compare(spyCloseWizardView.count, 1)
// Check alias text
compare(SettingsAdapter.getCurrentAccount_Profile_Info_Alias(), aliasText)
compare(CurrentAccount.alias, aliasText)
spyAccountStatusChanged.clear()
@ -364,7 +364,7 @@ WizardView {
compare(spyAccountConfigFinalized.count, 1)
// Check if it is a RendezVous acc
compare(SettingsAdapter.getAccountConfig_RendezVous(), true)
compare(CurrentAccount.isRendezVous, true)
aliasEdit.text = aliasText
saveProfileBtn.clicked()
@ -384,7 +384,7 @@ WizardView {
compare(spyCloseWizardView.count, 1)
// Check alias text
compare(SettingsAdapter.getCurrentAccount_Profile_Info_Alias(), aliasText)
compare(CurrentAccount.alias, aliasText)
spyAccountStatusChanged.clear()
@ -459,10 +459,10 @@ WizardView {
compare(spyAccountConfigFinalized.count, 1)
// Check if paras match with setup
compare(SettingsAdapter.getAccountConfig_RouteSet(), proxy)
compare(SettingsAdapter.getAccountConfig_Username(), userName)
compare(SettingsAdapter.getAccountConfig_Hostname(), serverName)
compare(SettingsAdapter.getAccountConfig_Password(), password)
compare(CurrentAccount.routeset, proxy)
compare(CurrentAccount.username, userName)
compare(CurrentAccount.hostname, serverName)
compare(CurrentAccount.password, password)
WizardViewStepModel.nextStep()
@ -1530,7 +1530,7 @@ WizardView {
compare(spyCloseWizardView.count, 1)
// Check alias text
compare(SettingsAdapter.getCurrentAccount_Profile_Info_Alias(), aliasName)
compare(CurrentAccount.alias, aliasName)
AccountAdapter.deleteCurrentAccount()