1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-09-07 18:43:34 +02:00

accountadapter: move current account id and type properties to lrcinstance

Change-Id: I609452e83edd55a909d0f30aa6cb0daa3687ff3c
This commit is contained in:
Ming Rui Zhang 2021-05-13 17:47:23 -04:00
parent 76eb198b9c
commit 9d0f84d8be
32 changed files with 289 additions and 223 deletions

View file

@ -45,13 +45,11 @@ void
AccountAdapter::safeInit()
{
connect(lrcInstance_,
&LRCInstance::currentAccountChanged,
&LRCInstance::currentAccountIdChanged,
this,
&AccountAdapter::onCurrentAccountChanged);
auto accountId = lrcInstance_->getCurrAccId();
setProperties(accountId);
connectAccount(accountId);
connectAccount(lrcInstance_->getCurrentAccountId());
}
lrc::api::NewAccountModel*
@ -71,7 +69,7 @@ AccountAdapter::changeAccount(int row)
{
auto accountList = lrcInstance_->accountModel().getAccountList();
if (accountList.size() > row) {
lrcInstance_->setSelectedAccountId(accountList.at(row));
lrcInstance_->setCurrentAccountId(accountList.at(row));
}
}
@ -228,7 +226,7 @@ AccountAdapter::createJAMSAccount(const QVariantMap& settings)
void
AccountAdapter::deleteCurrentAccount()
{
lrcInstance_->accountModel().removeAccount(lrcInstance_->getCurrAccId());
lrcInstance_->accountModel().removeAccount(lrcInstance_->getCurrentAccountId());
Q_EMIT lrcInstance_->accountListChanged();
}
@ -297,24 +295,24 @@ AccountAdapter::setCurrAccAvatar(bool fromFile, const QString& source)
void
AccountAdapter::onCurrentAccountChanged()
{
auto accountId = lrcInstance_->getCurrAccId();
setProperties(accountId);
connectAccount(accountId);
connectAccount(lrcInstance_->getCurrentAccountId());
}
bool
AccountAdapter::hasPassword()
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
return confProps.archiveHasPassword;
}
void
AccountAdapter::setArchiveHasPassword(bool isHavePassword)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.archiveHasPassword = isHavePassword;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
bool
AccountAdapter::exportToFile(const QString& accountId,
@ -408,12 +406,3 @@ AccountAdapter::connectAccount(const QString& accountId)
qWarning() << "Couldn't get account: " << accountId;
}
}
void
AccountAdapter::setProperties(const QString& accountId)
{
setProperty("currentAccountId", accountId);
auto accountType = lrcInstance_->getAccountInfo(accountId).profileInfo.type;
setProperty("currentAccountType", lrc::api::profile::to_string(accountType));
Q_EMIT deviceModelChanged();
}

View file

@ -36,10 +36,6 @@ class AccountAdapter final : public QmlAdapterBase
Q_PROPERTY(lrc::api::NewAccountModel* model READ getModel NOTIFY modelChanged)
Q_PROPERTY(lrc::api::NewDeviceModel* deviceModel READ getDeviceModel NOTIFY deviceModelChanged)
Q_PROPERTY(QString currentAccountId MEMBER currentAccountId_ NOTIFY currentAccountIdChanged)
Q_PROPERTY(lrc::api::profile::Type currentAccountType MEMBER currentAccountType_ NOTIFY
currentAccountTypeChanged)
Q_PROPERTY(int accountListSize MEMBER accountListSize_ NOTIFY accountListSizeChanged)
public:
lrc::api::NewAccountModel* getModel();
@ -48,9 +44,6 @@ public:
Q_SIGNALS:
void modelChanged();
void deviceModelChanged();
void currentAccountIdChanged();
void currentAccountTypeChanged();
void accountListSizeChanged();
public:
explicit AccountAdapter(AppSettingsManager* settingsManager,
@ -114,16 +107,9 @@ private Q_SLOTS:
void onCurrentAccountChanged();
private:
QString currentAccountId_ {};
lrc::api::profile::Type currentAccountType_ {};
int accountListSize_ {};
// Make account signal connections.
void connectAccount(const QString& accountId);
// Make account signal connections.
void setProperties(const QString& accountId);
// Implement what to do when account creation fails.
void connectFailure();

View file

@ -64,7 +64,7 @@ public:
// Accept all contacts in conversation list filtered with account type, except those in a call.
auto index = sourceModel()->index(sourceRow, 0, sourceParent);
auto accountID = sourceModel()->data(index, AccountList::ID);
return accountID != lrcInstance_->getCurrAccId();
return accountID != lrcInstance_->getCurrentAccountId();
}
protected:

View file

@ -36,7 +36,7 @@ CallAdapter::CallAdapter(SystemTray* systemTray, LRCInstance* instance, QObject*
, oneSecondTimer_(new QTimer(this))
, systemTray_(systemTray)
{
accountId_ = lrcInstance_->getCurrAccId();
accountId_ = lrcInstance_->getCurrentAccountId();
if (!accountId_.isEmpty())
connectCallModel(accountId_);
@ -50,7 +50,10 @@ CallAdapter::CallAdapter(SystemTray* systemTray, LRCInstance* instance, QObject*
this,
&CallAdapter::onShowCallView);
connect(lrcInstance_, &LRCInstance::currentAccountChanged, this, &CallAdapter::onAccountChanged);
connect(lrcInstance_,
&LRCInstance::currentAccountIdChanged,
this,
&CallAdapter::onAccountChanged);
#ifdef Q_OS_LINUX
// notification responses (gnu/linux currently)
@ -79,7 +82,7 @@ CallAdapter::CallAdapter(SystemTray* systemTray, LRCInstance* instance, QObject*
void
CallAdapter::onAccountChanged()
{
accountId_ = lrcInstance_->getCurrAccId();
accountId_ = lrcInstance_->getCurrentAccountId();
connectCallModel(accountId_);
}
@ -197,7 +200,7 @@ CallAdapter::onShowIncomingCallView(const QString& accountId, const QString& con
if (convInfo.uid.isEmpty()) {
return;
}
auto selectedAccountId = lrcInstance_->getCurrAccId();
auto selectedAccountId = lrcInstance_->getCurrentAccountId();
auto* callModel = lrcInstance_->getCurrentCallModel();
// new call

View file

@ -69,7 +69,7 @@ BaseDialog {
var success = false
if (path.length > 0) {
success = AccountAdapter.exportToFile(
AccountAdapter.currentAccountId,
LRCInstance.currentAccountId,
path,
currentPasswordEdit.text)
}
@ -80,7 +80,7 @@ BaseDialog {
function savePasswordQML() {
var success = false
success = AccountAdapter.savePassword(
AccountAdapter.currentAccountId,
LRCInstance.currentAccountId,
currentPasswordEdit.text,
passwordEdit.text)
if (success) {

View file

@ -66,7 +66,7 @@ ColumnLayout {
}
function setAvatarImage(mode = AvatarImage.Mode.FromAccount,
imageId = AccountAdapter.currentAccountId){
imageId = LRCInstance.currentAccountId){
if (mode !== AvatarImage.Mode.FromBase64)
avatarImg.enableAnimation = true
else

View file

@ -36,7 +36,7 @@ ContactAdapter::getContactSelectableModel(int type)
if (listModeltype_ == SmartListModel::Type::CONVERSATION) {
defaultModerators_ = lrcInstance_->accountModel().getDefaultModerators(
lrcInstance_->getCurrAccId());
lrcInstance_->getCurrentAccountId());
smartListModel_.reset(new SmartListModel(this, listModeltype_, lrcInstance_));
smartListModel_->fillConversationsList();
} else {
@ -64,7 +64,8 @@ ContactAdapter::getContactSelectableModel(int type)
const auto& conv = lrcInstance_->getConversationFromConvUid(
lrcInstance_->get_selectedConvUid());
if (!conv.participants.isEmpty()) {
QString calleeDisplayId = lrcInstance_->getAccountInfo(lrcInstance_->getCurrAccId())
QString calleeDisplayId = lrcInstance_
->getAccountInfo(lrcInstance_->getCurrentAccountId())
.contactModel->bestIdForContact(conv.participants[0]);
QRegExp matchExcept = QRegExp(QString("\\b(?!" + calleeDisplayId + "\\b)\\w+"));
@ -172,7 +173,7 @@ ContactAdapter::contactSelected(int index)
return;
}
lrcInstance_->accountModel().setDefaultModerator(lrcInstance_->getCurrAccId(),
lrcInstance_->accountModel().setDefaultModerator(lrcInstance_->getCurrentAccountId(),
contactUri,
true);
Q_EMIT defaultModeratorsUpdated();

View file

@ -164,7 +164,7 @@ ConversationsAdapter::safeInit()
Qt::UniqueConnection);
connect(lrcInstance_,
&LRCInstance::currentAccountChanged,
&LRCInstance::currentAccountIdChanged,
this,
&ConversationsAdapter::onCurrentAccountIdChanged,
Qt::UniqueConnection);
@ -198,7 +198,7 @@ ConversationsAdapter::onNewUnreadInteraction(const QString& accountId,
const interaction::Info& interaction)
{
if (!interaction.authorUri.isEmpty()
&& (!QApplication::focusWindow() || accountId != lrcInstance_->getCurrAccId()
&& (!QApplication::focusWindow() || accountId != lrcInstance_->getCurrentAccountId()
|| convUid != lrcInstance_->get_selectedConvUid())) {
auto& accountInfo = lrcInstance_->getAccountInfo(accountId);
auto from = accountInfo.contactModel->bestNameForContact(interaction.authorUri);
@ -248,7 +248,7 @@ void
ConversationsAdapter::onNewTrustRequest(const QString& accountId, const QString& peerUri)
{
#ifdef Q_OS_LINUX
if (!QApplication::focusWindow() || accountId != lrcInstance_->getCurrAccId()) {
if (!QApplication::focusWindow() || accountId != lrcInstance_->getCurrentAccountId()) {
auto& accInfo = lrcInstance_->getAccountInfo(accountId);
auto from = accInfo.contactModel->bestNameForContact(peerUri);
auto contactPhoto = Utils::contactPhoto(lrcInstance_, peerUri, QSize(50, 50), accountId);

View file

@ -115,7 +115,20 @@ LRCInstance::getAccountInfo(const QString& accountId)
const account::Info&
LRCInstance::getCurrentAccountInfo()
{
return getAccountInfo(getCurrAccId());
return getAccountInfo(getCurrentAccountId());
}
profile::Type
LRCInstance::getCurrentAccountType()
{
if (currentAccountType_ == profile::Type::INVALID) {
try {
currentAccountType_ = getCurrentAccountInfo().profileInfo.type;
} catch (...) {
qDebug() << "Cannot find current account info";
}
}
return currentAccountType_;
}
bool
@ -186,7 +199,8 @@ LRCInstance::getCallInfoForConversation(const conversation::Info& convInfo, bool
const conversation::Info&
LRCInstance::getConversationFromConvUid(const QString& convUid, const QString& accountId)
{
auto& accInfo = accountModel().getAccountInfo(!accountId.isEmpty() ? accountId : getCurrAccId());
auto& accInfo = accountModel().getAccountInfo(!accountId.isEmpty() ? accountId
: getCurrentAccountId());
auto& convModel = accInfo.conversationModel;
return convModel->getConversationForUid(convUid).value_or(invalid);
}
@ -194,7 +208,8 @@ LRCInstance::getConversationFromConvUid(const QString& convUid, const QString& a
const conversation::Info&
LRCInstance::getConversationFromPeerUri(const QString& peerUri, const QString& accountId)
{
auto& accInfo = accountModel().getAccountInfo(!accountId.isEmpty() ? accountId : getCurrAccId());
auto& accInfo = accountModel().getAccountInfo(!accountId.isEmpty() ? accountId
: getCurrentAccountId());
auto& convModel = accInfo.conversationModel;
return convModel->getConversationForPeerUri(peerUri).value_or(invalid);
}
@ -202,7 +217,8 @@ LRCInstance::getConversationFromPeerUri(const QString& peerUri, const QString& a
const conversation::Info&
LRCInstance::getConversationFromCallId(const QString& callId, const QString& accountId)
{
auto& accInfo = accountModel().getAccountInfo(!accountId.isEmpty() ? accountId : getCurrAccId());
auto& accInfo = accountModel().getAccountInfo(!accountId.isEmpty() ? accountId
: getCurrentAccountId());
auto& convModel = accInfo.conversationModel;
return convModel->getConversationForCallId(callId).value_or(invalid);
}
@ -241,35 +257,42 @@ LRCInstance::getCurrentContactModel()
}
const QString&
LRCInstance::getCurrAccId()
LRCInstance::getCurrentAccountId()
{
if (selectedAccountId_.isEmpty()) {
if (currentAccountId_.isEmpty()) {
auto accountList = accountModel().getAccountList();
if (accountList.size())
selectedAccountId_ = accountList.at(0);
currentAccountId_ = accountList.at(0);
}
return selectedAccountId_;
return currentAccountId_;
}
void
LRCInstance::setSelectedAccountId(const QString& accountId)
LRCInstance::setCurrentAccountId(const QString& accountId)
{
if (accountId == selectedAccountId_)
if (accountId == currentAccountId_)
return; // No need to select current selected account
selectedAccountId_ = accountId;
auto newAccountType = getAccountInfo(accountId).profileInfo.type;
bool accountTypeChanged = getCurrentAccountType() != newAccountType;
currentAccountId_ = accountId;
// Last selected account should be set as preferred.
accountModel().setTopAccount(accountId);
Q_EMIT currentAccountChanged();
if (accountTypeChanged) {
currentAccountType_ = newAccountType;
Q_EMIT currentAccountTypeChanged(newAccountType);
}
Q_EMIT currentAccountIdChanged(accountId);
}
int
LRCInstance::getCurrentAccountIndex()
{
for (int i = 0; i < accountModel().getAccountList().size(); i++) {
if (accountModel().getAccountList()[i] == getCurrAccId()) {
if (accountModel().getAccountList()[i] == getCurrentAccountId()) {
return i;
}
}
@ -295,19 +318,19 @@ LRCInstance::setCurrAccAvatar(const QPixmap& avatarPixmap)
bu.open(QIODevice::WriteOnly);
avatarPixmap.save(&bu, "PNG");
auto str = QString::fromLocal8Bit(ba.toBase64());
accountModel().setAvatar(getCurrAccId(), str);
accountModel().setAvatar(getCurrentAccountId(), str);
}
void
LRCInstance::setCurrAccAvatar(const QString& avatar)
{
accountModel().setAvatar(getCurrAccId(), avatar);
accountModel().setAvatar(getCurrentAccountId(), avatar);
}
void
LRCInstance::setCurrAccDisplayName(const QString& displayName)
{
auto accountId = getCurrAccId();
auto accountId = getCurrentAccountId();
accountModel().setAlias(accountId, displayName);
/*
* Force save to .yml.
@ -413,11 +436,11 @@ LRCInstance::selectConversation(const QString& convId, const QString& accountId)
{
// if the account is not currently selected, do that first, then
// proceed to select the conversation
if (!accountId.isEmpty() && accountId != getCurrAccId()) {
Utils::oneShotConnect(this, &LRCInstance::currentAccountChanged, [this, convId] {
if (!accountId.isEmpty() && accountId != getCurrentAccountId()) {
Utils::oneShotConnect(this, &LRCInstance::currentAccountIdChanged, [this, convId] {
set_selectedConvUid(convId);
});
setSelectedAccountId(accountId);
setCurrentAccountId(accountId);
return;
}
set_selectedConvUid(convId);

View file

@ -55,6 +55,10 @@ class LRCInstance : public QObject
{
Q_OBJECT
QML_PROPERTY(QString, selectedConvUid)
Q_PROPERTY(lrc::api::profile::Type currentAccountType READ getCurrentAccountType NOTIFY
currentAccountTypeChanged)
Q_PROPERTY(QString currentAccountId READ getCurrentAccountId WRITE setCurrentAccountId NOTIFY
currentAccountIdChanged)
public:
explicit LRCInstance(migrateCallback willMigrateCb = {},
@ -85,6 +89,7 @@ public:
const account::Info& getAccountInfo(const QString& accountId);
const account::Info& getCurrentAccountInfo();
profile::Type getCurrentAccountType();
QString getCallIdForConversationUid(const QString& convUid, const QString& accountId);
const call::Info* getCallInfo(const QString& callId, const QString& accountId);
const call::Info* getCallInfoForConversation(const conversation::Info& convInfo,
@ -99,8 +104,8 @@ public:
Q_INVOKABLE void selectConversation(const QString& convId, const QString& accountId = {});
Q_INVOKABLE void deselectConversation();
const QString& getCurrAccId();
void setSelectedAccountId(const QString& accountId = {});
const QString& getCurrentAccountId();
void setCurrentAccountId(const QString& accountId = {});
int getCurrentAccountIndex();
void setAvatarForAccount(const QPixmap& avatarPixmap, const QString& accountID);
void setCurrAccAvatar(const QPixmap& avatarPixmap);
@ -122,19 +127,22 @@ public:
Q_SIGNALS:
void accountListChanged();
void currentAccountChanged();
void restoreAppRequested();
void notificationClicked();
void quitEngineRequested();
void conversationUpdated(const QString& convId, const QString& accountId);
void draftSaved(const QString& convId);
void contactBanned(const QString& uri);
void currentAccountIdChanged(const QString& accountId);
void currentAccountTypeChanged(profile::Type type);
private:
std::unique_ptr<Lrc> lrc_;
std::unique_ptr<RenderManager> renderer_;
std::unique_ptr<UpdateManager> updateManager_;
QString selectedAccountId_ {};
QString currentAccountId_ {};
profile::Type currentAccountType_ = profile::Type::INVALID;
MapStringString contentDrafts_;
MapStringString lastConferences_;

View file

@ -57,7 +57,7 @@ Rectangle {
signal loaderSourceChangeRequested(int sourceToLoad)
property string currentAccountId: AccountAdapter.currentAccountId
property string currentAccountId: LRCInstance.currentAccountId
onCurrentAccountIdChanged: {
if (inSettingsView) {
settingsView.accountListChanged()
@ -115,7 +115,7 @@ Rectangle {
}
function currentAccountIsCalling() {
return UtilsAdapter.hasCall(AccountAdapter.currentAccountId)
return UtilsAdapter.hasCall(LRCInstance.currentAccountId)
}
// Only called onWidthChanged
@ -137,7 +137,7 @@ Rectangle {
return
if (checkCurrentCall && currentAccountIsCalling()) {
var callConv = UtilsAdapter.getCallConvForAccount(
AccountAdapter.currentAccountId)
LRCInstance.currentAccountId)
LRCInstance.selectConversation(callConv)
CallAdapter.updateCall(callConv, currentAccountId)
} else {
@ -187,13 +187,13 @@ Rectangle {
}
MessagesAdapter.setupChatView(convId)
callStackView.setLinkedWebview(communicationPageMessageWebView)
callStackView.responsibleAccountId = AccountAdapter.currentAccountId
callStackView.responsibleAccountId = LRCInstance.currentAccountId
callStackView.responsibleConvUid = convId
currentConvUID = convId
if (item.callState === Call.Status.IN_PROGRESS ||
item.callState === Call.Status.PAUSED) {
CallAdapter.updateCall(convId, AccountAdapter.currentAccountId)
CallAdapter.updateCall(convId, LRCInstance.currentAccountId)
if (item.isAudioOnly)
callStackView.showAudioCallPage()
else

View file

@ -38,16 +38,20 @@ Label {
Connections {
target: AccountAdapter
function onCurrentAccountIdChanged() {
root.update()
resetAccountListModel(AccountAdapter.currentAccountId)
}
function onAccountStatusChanged(accountId) {
resetAccountListModel(accountId)
}
}
Connections {
target: LRCInstance
function onCurrentAccountIdChanged() {
root.update()
resetAccountListModel(LRCInstance.currentAccountId)
}
}
function resetAccountListModel(accountId) {
AccountListModel.updateAvatarUid(accountId)
AccountListModel.reset()
@ -108,7 +112,7 @@ Label {
target: AccountListModel
function onModelReset() {
avatar.updateImage(AccountAdapter.currentAccountId,
avatar.updateImage(LRCInstance.currentAccountId,
AccountListModel.data(AccountListModel.index(0, 0),
AccountList.PictureUid))
avatar.presenceStatus = AccountListModel.data(AccountListModel.index(0, 0),
@ -133,7 +137,7 @@ Label {
Layout.preferredHeight: JamiTheme.accountListAvatarSize
Layout.alignment: Qt.AlignVCenter
imageId: AccountAdapter.currentAccountId
imageId: LRCInstance.currentAccountId
presenceStatus: AccountListModel.data(AccountListModel.index(0, 0),
AccountList.Status)
@ -208,7 +212,7 @@ Label {
height: visible ? preferredSize : 0
anchors.verticalCenter: parent.verticalCenter
visible: AccountAdapter.currentAccountType === Profile.Type.RING
visible: LRCInstance.currentAccountType === Profile.Type.RING
toolTipText: JamiStrings.displayQRCode
source: "qrc:/images/icons/share-24px.svg"

View file

@ -136,7 +136,7 @@ ListView {
"contactType": model.dataForRow(row, ConversationList.ContactType),
}
responsibleAccountId = AccountAdapter.currentAccountId
responsibleAccountId = LRCInstance.currentAccountId
responsibleConvUid = item.convId
contactType = item.contactType
@ -175,7 +175,7 @@ ListView {
context: Qt.ApplicationShortcut
enabled: root.visible
onActivated: MessagesAdapter.clearConversationHistory(
AccountAdapter.currentAccountId,
LRCInstance.currentAccountId,
UtilsAdapter.getCurrConvId())
}
@ -193,7 +193,7 @@ ListView {
context: Qt.ApplicationShortcut
enabled: root.visible
onActivated: MessagesAdapter.removeConversation(
AccountAdapter.currentAccountId,
LRCInstance.currentAccountId,
UtilsAdapter.getCurrConvId(),
false)
}

View file

@ -58,7 +58,7 @@ Rectangle {
contactImage.updateImage(avatar)
} else if (local) {
contactImage.mode = AvatarImage.Mode.FromAccount
contactImage.updateImage(AccountAdapter.currentAccountId)
contactImage.updateImage(LRCInstance.currentAccountId)
} else if (isContact) {
contactImage.mode = AvatarImage.Mode.FromContactUri
contactImage.updateImage(uri)

View file

@ -65,7 +65,7 @@ Popup {
pluginhandlerPickerListView.model = PluginAdapter.getMediaHandlerSelectableModel(callId)
} else {
// Reset the model on each show.
var accountId = AccountAdapter.currentAccountId
var accountId = LRCInstance.currentAccountId
var peerId = UtilsAdapter.getPeerUri(accountId, UtilsAdapter.getCurrConvId())
pluginhandlerPickerListView.model = PluginAdapter.getChatHandlerSelectableModel(accountId, peerId)
}
@ -79,7 +79,7 @@ Popup {
PluginModel.toggleCallMediaHandler(handlerId, callId, !isLoaded)
pluginhandlerPickerListView.model = PluginAdapter.getMediaHandlerSelectableModel(callId)
} else {
var accountId = AccountAdapter.currentAccountId
var accountId = LRCInstance.currentAccountId
var peerId = UtilsAdapter.getPeerUri(accountId, UtilsAdapter.getCurrConvId())
PluginModel.toggleChatHandler(handlerId, accountId, peerId, !isLoaded)
pluginhandlerPickerListView.model = PluginAdapter.getChatHandlerSelectableModel(accountId, peerId)
@ -138,7 +138,7 @@ Popup {
callStackViewWindow.responsibleConvUid)
return PluginAdapter.getMediaHandlerSelectableModel(callId)
} else {
var accountId = AccountAdapter.currentAccountId
var accountId = LRCInstance.currentAccountId
var peerId = UtilsAdapter.getPeerUri(accountId, UtilsAdapter.getCurrConvId())
return PluginAdapter.getChatHandlerSelectableModel(accountId, peerId)
}

View file

@ -38,16 +38,20 @@ Rectangle {
Connections {
target: AccountAdapter
function onCurrentAccountIdChanged() {
clearContactSearchBar()
}
function onSelectedContactAdded(convId) {
clearContactSearchBar()
LRCInstance.selectConversation(convId)
}
}
Connections {
target: LRCInstance
function onCurrentAccountIdChanged() {
clearContactSearchBar()
}
}
function clearContactSearchBar() {
contactSearchBar.clearText()
}

View file

@ -43,7 +43,7 @@ TabBar {
function selectTab(tabIndex) {
ConversationsAdapter.currentTypeFilter =
(tabIndex === SidePanelTabBar.Conversations) ?
AccountAdapter.currentAccountType :
LRCInstance.currentAccountType :
Profile.Type.PENDING
}

View file

@ -166,7 +166,7 @@ ItemDelegate {
onClicked: ListView.view.model.select(index)
onDoubleClicked: {
ListView.view.model.select(index)
if (AccountAdapter.currentAccountType === Profile.Type.SIP)
if (LRCInstance.currentAccountType === Profile.Type.SIP)
CallAdapter.placeAudioOnlyCall()
else
CallAdapter.placeCall()

View file

@ -79,7 +79,7 @@ Rectangle {
function handleParticipantsInfo(infos) {
if (infos.length === 0) {
bestName = UtilsAdapter.getBestName(AccountAdapter.currentAccountId,
bestName = UtilsAdapter.getBestName(LRCInstance.currentAccountId,
UtilsAdapter.getCurrConvId())
} else {
bestName = ""

View file

@ -91,7 +91,7 @@ Rectangle {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
visible: AccountAdapter.currentAccountType === Profile.Type.RING
visible: LRCInstance.currentAccountType === Profile.Type.RING
text: JamiStrings.shareInvite
color: JamiTheme.faddedFontColor
@ -106,7 +106,7 @@ Rectangle {
color: JamiTheme.secondaryBackgroundColor
visible: AccountAdapter.currentAccountType === Profile.Type.RING
visible: LRCInstance.currentAccountType === Profile.Type.RING
ColumnLayout {
id: jamiRegisteredNameRectColumnLayout
@ -128,7 +128,7 @@ Rectangle {
TextMetrics {
id: textMetricsjamiRegisteredNameText
font: jamiRegisteredNameText.font
text: UtilsAdapter.getBestId(AccountAdapter.currentAccountId)
text: UtilsAdapter.getBestId(LRCInstance.currentAccountId)
elideWidth: welcomePageColumnLayout.width
elide: Qt.ElideMiddle
}

View file

@ -49,9 +49,9 @@ ModalPopup {
fillMode: Image.PreserveAspectFit
source: {
if (AccountAdapter.currentAccountId &&
AccountAdapter.currentAccountType === Profile.Type.RING)
return "image://qrImage/account_" + AccountAdapter.currentAccountId
if (LRCInstance.currentAccountId &&
LRCInstance.currentAccountType === Profile.Type.RING)
return "image://qrImage/account_" + LRCInstance.currentAccountId
return ""
}
}

View file

@ -48,7 +48,7 @@ MessagesAdapter::MessagesAdapter(AppSettingsManager* settingsManager,
void
MessagesAdapter::safeInit()
{
connect(lrcInstance_, &LRCInstance::currentAccountChanged, [this]() {
connect(lrcInstance_, &LRCInstance::currentAccountIdChanged, [this]() {
currentConvUid_.clear();
connectConversationModel();
});
@ -73,7 +73,7 @@ MessagesAdapter::setupChatView(const QString& convUid)
QString contactURI = convInfo.participants.at(0);
auto selectedAccountId = lrcInstance_->getCurrAccId();
auto selectedAccountId = lrcInstance_->getCurrentAccountId();
auto& accountInfo = lrcInstance_->accountModel().getAccountInfo(selectedAccountId);
lrc::api::contact::Info contactInfo;
@ -131,7 +131,7 @@ MessagesAdapter::connectConversationModel()
[this](const QString& convUid,
uint64_t interactionId,
const lrc::api::interaction::Info& interaction) {
auto accountId = lrcInstance_->getCurrAccId();
auto accountId = lrcInstance_->getCurrentAccountId();
newInteraction(accountId, convUid, interactionId, interaction);
});
@ -180,7 +180,7 @@ void
MessagesAdapter::slotSendMessageContentSaved(const QString& content)
{
if (!LastConvUid_.isEmpty()) {
lrcInstance_->setContentDraft(LastConvUid_, lrcInstance_->getCurrAccId(), content);
lrcInstance_->setContentDraft(LastConvUid_, lrcInstance_->getCurrentAccountId(), content);
}
LastConvUid_ = lrcInstance_->get_selectedConvUid();
@ -189,7 +189,7 @@ MessagesAdapter::slotSendMessageContentSaved(const QString& content)
setInvitation(false);
clear();
auto restoredContent = lrcInstance_->getContentDraft(lrcInstance_->get_selectedConvUid(),
lrcInstance_->getCurrAccId());
lrcInstance_->getCurrentAccountId());
setSendMessageContent(restoredContent);
}
@ -197,7 +197,7 @@ void
MessagesAdapter::slotUpdateDraft(const QString& content)
{
if (!LastConvUid_.isEmpty()) {
lrcInstance_->setContentDraft(LastConvUid_, lrcInstance_->getCurrAccId(), content);
lrcInstance_->setContentDraft(LastConvUid_, lrcInstance_->getCurrentAccountId(), content);
}
}

View file

@ -52,7 +52,7 @@ ModeratorListModel::data(const QModelIndex& index, int role) const
{
try {
QStringList list = lrcInstance_->accountModel().getDefaultModerators(
lrcInstance_->getCurrAccId());
lrcInstance_->getCurrentAccountId());
if (!index.isValid() || list.size() <= index.row()) {
return QVariant();
}

View file

@ -257,7 +257,7 @@ SettingsAdapter::getCurrentAccount_Profile_Info_Type()
QString
SettingsAdapter::getAccountBestName()
{
return lrcInstance_->accountModel().bestNameForAccount(lrcInstance_->getCurrAccId());
return lrcInstance_->accountModel().bestNameForAccount(lrcInstance_->getCurrentAccountId());
}
lrc::api::account::ConfProperties_t
@ -265,7 +265,7 @@ SettingsAdapter::getAccountConfig()
{
lrc::api::account::ConfProperties_t res;
try {
res = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
res = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrentAccountId());
} catch (...) {
}
return res;
@ -564,7 +564,7 @@ SettingsAdapter::setAccountConfig_Username(QString input)
{
auto confProps = getAccountConfig();
confProps.username = input;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
@ -572,7 +572,7 @@ SettingsAdapter::setAccountConfig_Hostname(QString input)
{
auto confProps = getAccountConfig();
confProps.hostname = input;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
@ -580,7 +580,7 @@ SettingsAdapter::setAccountConfig_Password(QString input)
{
auto confProps = getAccountConfig();
confProps.password = input;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
@ -588,326 +588,366 @@ SettingsAdapter::setAccountConfig_RouteSet(QString input)
{
auto confProps = getAccountConfig();
confProps.routeset = input;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setAutoConnectOnLocalNetwork(bool state)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.peerDiscovery = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setCallsUntrusted(bool state)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.DHT.PublicInCalls = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setIsRendezVous(bool state)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.isRendezVous = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setAutoAnswerCalls(bool state)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.autoAnswer = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setEnableRingtone(bool state)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.Ringtone.ringtoneEnabled = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setEnableProxy(bool state)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.proxyEnabled = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setKeepAliveEnabled(bool state)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.keepAliveEnabled = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setUseUPnP(bool state)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.upnpEnabled = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setUseTURN(bool state)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TURN.enable = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setUseSTUN(bool state)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.STUN.enable = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setVideoState(bool state)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.Video.videoEnabled = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setUseSRTP(bool state)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.SRTP.enable = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setUseSDES(bool state)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.SRTP.keyExchange = state ? lrc::api::account::KeyExchangeProtocol::SDES
: lrc::api::account::KeyExchangeProtocol::NONE;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setUseRTPFallback(bool state)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.SRTP.rtpFallback = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setUseTLS(bool state)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TLS.enable = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setVerifyCertificatesServer(bool state)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TLS.verifyServer = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setVerifyCertificatesClient(bool state)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TLS.verifyClient = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setRequireCertificatesIncomingTLS(bool state)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TLS.requireClientCertificate = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setUseCustomAddressAndPort(bool state)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.publishedSameAsLocal = state;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setNameServer(QString text)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.RingNS.uri = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setProxyAddress(QString text)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.proxyServer = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setBootstrapAddress(QString text)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.hostname = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setTURNAddress(QString text)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TURN.server = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setTURNUsername(QString text)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TURN.username = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setTURNPassword(QString text)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TURN.password = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setTURNRealm(QString text)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TURN.realm = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::setSTUNAddress(QString text)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.STUN.server = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::lineEditVoiceMailDialCodeEditFinished(QString text)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.mailbox = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::outgoingTLSServerNameLineEditTextChanged(QString text)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TLS.serverName = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::lineEditSIPCertPasswordLineEditTextChanged(QString text)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TLS.password = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::lineEditSIPCustomAddressLineEditTextChanged(QString text)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.publishedAddress = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::customPortSIPSpinBoxValueChanged(int value)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.publishedPort = value;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::negotiationTimeoutSpinBoxValueChanged(int value)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TLS.negotiationTimeoutSec = value;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::registrationTimeoutSpinBoxValueChanged(int value)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.Registration.expire = value;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::networkInterfaceSpinBoxValueChanged(int value)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.localPort = value;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::audioRTPMinPortSpinBoxEditFinished(int value)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.Audio.audioPortMin = value;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::audioRTPMaxPortSpinBoxEditFinished(int value)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.Audio.audioPortMax = value;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::videoRTPMinPortSpinBoxEditFinished(int value)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.Video.videoPortMin = value;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::videoRTPMaxPortSpinBoxEditFinished(int value)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.Video.videoPortMax = value;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::tlsProtocolComboBoxIndexChanged(const int& index)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
if (static_cast<int>(confProps.TLS.method) != index) {
if (index == 0) {
@ -919,16 +959,18 @@ SettingsAdapter::tlsProtocolComboBoxIndexChanged(const int& index)
} else {
confProps.TLS.method = lrc::api::account::TlsMethod::TLSv1_2;
}
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(),
confProps);
}
}
void
SettingsAdapter::setDeviceName(QString text)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.deviceName = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
@ -988,33 +1030,37 @@ SettingsAdapter::increaseVideoCodecPriority(unsigned int id)
void
SettingsAdapter::set_RingtonePath(QString text)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.Ringtone.ringtonePath = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::set_FileCACert(QString text)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TLS.certificateListFile = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::set_FileUserCert(QString text)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TLS.certificateFile = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void
SettingsAdapter::set_FilePrivateKey(QString text)
{
auto confProps = lrcInstance_->accountModel().getAccountConfig(lrcInstance_->getCurrAccId());
auto confProps = lrcInstance_->accountModel().getAccountConfig(
lrcInstance_->getCurrentAccountId());
confProps.TLS.privateKeyFile = text;
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrAccId(), confProps);
lrcInstance_->accountModel().setAccountConfig(lrcInstance_->getCurrentAccountId(), confProps);
}
void

View file

@ -43,7 +43,7 @@ ColumnLayout {
checkBoxRdv.checked = SettingsAdapter.getAccountConfig_RendezVous()
checkBoxAutoAnswer.checked = SettingsAdapter.getAccountConfig_AutoAnswer()
checkBoxCustomRingtone.checked = SettingsAdapter.getAccountConfig_Ringtone_RingtoneEnabled()
checkboxAllModerators.checked = SettingsAdapter.isAllModeratorsEnabled(AccountAdapter.currentAccountId)
checkboxAllModerators.checked = SettingsAdapter.isAllModeratorsEnabled(LRCInstance.currentAccountId)
btnRingtone.setEnabled(SettingsAdapter.getAccountConfig_Ringtone_RingtoneEnabled())
btnRingtone.setText(UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_Ringtone_RingtonePath()))
@ -61,7 +61,7 @@ ColumnLayout {
function updateAndShowModeratorsSlot() {
toggleLocalModerators.checked = SettingsAdapter.isLocalModeratorsEnabled(
AccountAdapter.currentAccountId)
LRCInstance.currentAccountId)
moderatorListWidget.model.reset()
moderatorListWidget.visible = (moderatorListWidget.model.rowCount() > 0)
}
@ -170,7 +170,7 @@ ColumnLayout {
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: SettingsAdapter.enableLocalModerators(
AccountAdapter.currentAccountId, checked)
LRCInstance.currentAccountId, checked)
}
ElidedTextLabel {
@ -207,7 +207,7 @@ ColumnLayout {
onClicked: moderatorListWidget.currentIndex = index
onBtnContactClicked: {
SettingsAdapter.setDefaultModerator(
AccountAdapter.currentAccountId, contactID, false)
LRCInstance.currentAccountId, contactID, false)
updateAndShowModeratorsSlot()
}
}
@ -245,7 +245,7 @@ ColumnLayout {
fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: SettingsAdapter.setAllModeratorsEnabled(
AccountAdapter.currentAccountId, checked)
LRCInstance.currentAccountId, checked)
}
}
}

View file

@ -166,7 +166,7 @@ Rectangle {
return
} else {
if (exportPath.length > 0) {
var isSuccessful = AccountAdapter.model.exportToFile(AccountAdapter.currentAccountId,
var isSuccessful = AccountAdapter.model.exportToFile(LRCInstance.currentAccountId,
exportPath, "")
var title = isSuccessful ? qsTr("Success") : qsTr("Error")
var info = isSuccessful ? JamiStrings.backupSuccessful : JamiStrings.backupFailed
@ -195,7 +195,7 @@ Rectangle {
fontPointSize: JamiTheme.headerFontSize
onSwitchToggled: AccountAdapter.model.setAccountEnabled(
AccountAdapter.currentAccountId, checked)
LRCInstance.currentAccountId, checked)
}
AccountProfile {

View file

@ -60,7 +60,7 @@ BaseDialog {
interval: 200
onTriggered: {
AccountAdapter.model.exportOnRing(AccountAdapter.currentAccountId,
AccountAdapter.model.exportOnRing(LRCInstance.currentAccountId,
passwordEdit.text)
}
}

View file

@ -53,7 +53,7 @@ BaseDialog {
function slotStartNameRegistration() {
var password = passwordEdit.text
AccountAdapter.model.registerName(AccountAdapter.currentAccountId,
AccountAdapter.model.registerName(LRCInstance.currentAccountId,
password, registerdName)
}

View file

@ -46,7 +46,8 @@ int
SmartListModel::rowCount(const QModelIndex& parent) const
{
if (!parent.isValid() && lrcInstance_) {
auto& accInfo = lrcInstance_->accountModel().getAccountInfo(lrcInstance_->getCurrAccId());
auto& accInfo = lrcInstance_->accountModel().getAccountInfo(
lrcInstance_->getCurrentAccountId());
auto& convModel = accInfo.conversationModel;
if (listModelType_ == Type::TRANSFER) {
auto filterType = accInfo.profileInfo.type;
@ -77,7 +78,7 @@ SmartListModel::data(const QModelIndex& index, int role) const
case Type::TRANSFER: {
try {
auto& currentAccountInfo = lrcInstance_->accountModel().getAccountInfo(
lrcInstance_->getCurrAccId());
lrcInstance_->getCurrentAccountId());
auto& convModel = currentAccountInfo.conversationModel;
auto filterType = currentAccountInfo.profileInfo.type;
auto& item = convModel->getFilteredConversations(filterType).at(index.row());
@ -142,7 +143,8 @@ void
SmartListModel::setConferenceableFilter(const QString& filter)
{
beginResetModel();
auto& accountInfo = lrcInstance_->accountModel().getAccountInfo(lrcInstance_->getCurrAccId());
auto& accountInfo = lrcInstance_->accountModel().getAccountInfo(
lrcInstance_->getCurrentAccountId());
auto& convModel = accountInfo.conversationModel;
conferenceables_ = convModel->getConferenceableConversations(lrcInstance_->get_selectedConvUid(),
filter);

View file

@ -337,7 +337,7 @@ Utils::contactPhoto(LRCInstance* instance,
* Get first contact photo.
*/
auto& accountInfo = instance->accountModel().getAccountInfo(
accountId.isEmpty() ? instance->getCurrAccId() : accountId);
accountId.isEmpty() ? instance->getCurrentAccountId() : accountId);
auto contactInfo = accountInfo.contactModel->getContact(contactUri);
auto contactPhoto = contactInfo.profileInfo.avatar;
auto bestName = accountInfo.contactModel->bestNameForContact(contactUri);

View file

@ -218,7 +218,7 @@ UtilsAdapter::getCallId(const QString& accountId, const QString& convUid)
int
UtilsAdapter::getCallStatus(const QString& callId)
{
const auto callStatus = lrcInstance_->getCallInfo(callId, lrcInstance_->getCurrAccId());
const auto callStatus = lrcInstance_->getCallInfo(callId, lrcInstance_->getCurrentAccountId());
return static_cast<int>(callStatus->status);
}

View file

@ -316,7 +316,7 @@ Rectangle {
} else {
if (folderDir.length > 0) {
AccountAdapter.exportToFile(
AccountAdapter.currentAccountId,
LRCInstance.currentAccountId,
UtilsAdapter.getAbsPath(folderDir))
}
}