1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-08-04 23:05:48 +02:00

qml interop: remove clientwrapper

The clientwrapper class masks granular object registration within
qml, and encourages code duplication between viewmodels(adapters)
and code lasagnafication and the misuse of declarative Qml.

Change-Id: I85fef214363e62e54fc0681282323ea4861000d6
Gitlab: #66
This commit is contained in:
Andreas Traczyk 2020-09-04 17:53:24 -04:00
parent 88816940fb
commit ae058405a5
44 changed files with 712 additions and 890 deletions

View file

@ -110,92 +110,93 @@ unix {
} }
# Input # Input
HEADERS += ./src/smartlistmodel.h \ HEADERS += \
./src/utils.h \ src/smartlistmodel.h \
./src/bannedlistmodel.h \ src/utils.h \
./src/version.h \ src/bannedlistmodel.h \
./src/accountlistmodel.h \ src/version.h \
./src/runguard.h \ src/accountlistmodel.h \
./src/lrcinstance.h \ src/runguard.h \
./src/globalsystemtray.h \ src/lrcinstance.h \
./src/appsettingsmanager.h \ src/globalsystemtray.h \
./src/webchathelpers.h \ src/appsettingsmanager.h \
./src/pixbufmanipulator.h \ src/webchathelpers.h \
./src/rendermanager.h \ src/pixbufmanipulator.h \
./src/connectivitymonitor.h \ src/rendermanager.h \
./src/jamiavatartheme.h \ src/connectivitymonitor.h \
./src/mainapplication.h \ src/jamiavatartheme.h \
./src/qrimageprovider.h \ src/mainapplication.h \
./src/messagesadapter.h \ src/qrimageprovider.h \
./src/accountadapter.h \ src/messagesadapter.h \
./src/tintedbuttonimageprovider.h \ src/accountadapter.h \
./src/calladapter.h \ src/tintedbuttonimageprovider.h \
./src/conversationsadapter.h \ src/calladapter.h \
./src/distantrenderer.h \ src/conversationsadapter.h \
./src/previewrenderer.h \ src/distantrenderer.h \
./src/qmladapterbase.h \ src/previewrenderer.h \
./src/avadapter.h \ src/qmladapterbase.h \
./src/contactadapter.h \ src/avadapter.h \
./src/pluginadapter.h \ src/contactadapter.h \
./src/settingsadapter.h \ src/pluginadapter.h \
./src/deviceitemlistmodel.h \ src/settingsadapter.h \
./src/pluginitemlistmodel.h \ src/deviceitemlistmodel.h \
./src/mediahandleritemlistmodel.h \ src/pluginitemlistmodel.h \
./src/preferenceitemlistmodel.h \ src/mediahandleritemlistmodel.h \
./src/audiocodeclistmodel.h \ src/preferenceitemlistmodel.h \
./src/videocodeclistmodel.h \ src/audiocodeclistmodel.h \
./src/accountstomigratelistmodel.h \ src/videocodeclistmodel.h \
./src/clientwrapper.h \ src/accountstomigratelistmodel.h \
./src/audioinputdevicemodel.h \ src/audioinputdevicemodel.h \
./src/videoinputdevicemodel.h \ src/videoinputdevicemodel.h \
./src/audiooutputdevicemodel.h \ src/audiooutputdevicemodel.h \
./src/pluginlistpreferencemodel.h \ src/pluginlistpreferencemodel.h \
./src/videoformatfpsmodel.h \ src/videoformatfpsmodel.h \
./src/videoformatresolutionmodel.h \ src/videoformatresolutionmodel.h \
./src/audiomanagerlistmodel.h \ src/audiomanagerlistmodel.h \
src/qmlregister.h \ src/qmlregister.h \
src/qtutils.h \ src/qtutils.h \
src/utilsadapter.h src/utilsadapter.h
SOURCES += ./src/bannedlistmodel.cpp \ SOURCES += \
./src/accountlistmodel.cpp \ src/bannedlistmodel.cpp \
./src/runguard.cpp \ src/accountlistmodel.cpp \
./src/webchathelpers.cpp \ src/runguard.cpp \
./src/main.cpp \ src/webchathelpers.cpp \
./src/globalsystemtray.cpp \ src/main.cpp \
./src/smartlistmodel.cpp \ src/globalsystemtray.cpp \
./src/utils.cpp \ src/smartlistmodel.cpp \
./src/pixbufmanipulator.cpp \ src/utils.cpp \
./src/rendermanager.cpp \ src/pixbufmanipulator.cpp \
./src/connectivitymonitor.cpp \ src/rendermanager.cpp \
./src/mainapplication.cpp \ src/connectivitymonitor.cpp \
./src/messagesadapter.cpp \ src/mainapplication.cpp \
./src/accountadapter.cpp \ src/messagesadapter.cpp \
./src/calladapter.cpp \ src/accountadapter.cpp \
./src/conversationsadapter.cpp \ src/calladapter.cpp \
./src/distantrenderer.cpp \ src/conversationsadapter.cpp \
./src/previewrenderer.cpp \ src/distantrenderer.cpp \
./src/avadapter.cpp \ src/previewrenderer.cpp \
./src/contactadapter.cpp \ src/avadapter.cpp \
./src/pluginadapter.cpp \ src/contactadapter.cpp \
./src/settingsadapter.cpp \ src/pluginadapter.cpp \
./src/deviceitemlistmodel.cpp \ src/settingsadapter.cpp \
./src/pluginitemlistmodel.cpp \ src/deviceitemlistmodel.cpp \
./src/mediahandleritemlistmodel.cpp \ src/pluginitemlistmodel.cpp \
./src/preferenceitemlistmodel.cpp \ src/mediahandleritemlistmodel.cpp \
./src/audiocodeclistmodel.cpp \ src/preferenceitemlistmodel.cpp \
./src/videocodeclistmodel.cpp \ src/audiocodeclistmodel.cpp \
./src/accountstomigratelistmodel.cpp \ src/videocodeclistmodel.cpp \
./src/clientwrapper.cpp \ src/accountstomigratelistmodel.cpp \
./src/audioinputdevicemodel.cpp \ src/audioinputdevicemodel.cpp \
./src/videoinputdevicemodel.cpp \ src/videoinputdevicemodel.cpp \
./src/audiooutputdevicemodel.cpp \ src/audiooutputdevicemodel.cpp \
./src/pluginlistpreferencemodel.cpp \ src/pluginlistpreferencemodel.cpp \
./src/videoformatfpsmodel.cpp \ src/videoformatfpsmodel.cpp \
./src/videoformatresolutionmodel.cpp \ src/videoformatresolutionmodel.cpp \
./src/audiomanagerlistmodel.cpp \ src/audiomanagerlistmodel.cpp \
src/qmlregister.cpp \ src/qmlregister.cpp \
src/utilsadapter.cpp src/utilsadapter.cpp
RESOURCES += ./resources.qrc \ RESOURCES += \
./qml.qrc resources.qrc \
qml.qrc

View file

@ -143,7 +143,7 @@ ApplicationWindow {
} }
Connections { Connections {
target: ClientWrapper.lrcInstance target: LRCInstance
function onRestoreAppRequested() { function onRestoreAppRequested() {
if (mainViewLoader.item) if (mainViewLoader.item)

View file

@ -32,17 +32,28 @@ AccountAdapter::AccountAdapter(QObject *parent)
: QmlAdapterBase(parent) : QmlAdapterBase(parent)
{} {}
AccountAdapter &
AccountAdapter::instance()
{
static auto instance = new AccountAdapter;
return *instance;
}
void void
AccountAdapter::safeInit() AccountAdapter::safeInit()
{ {
setSelectedAccount(LRCInstance::getCurrAccId()); setSelectedAccountId(LRCInstance::getCurrAccId());
}
lrc::api::NewAccountModel*
AccountAdapter::getModel()
{
return &(LRCInstance::accountModel());
}
lrc::api::ContactModel*
AccountAdapter::getContactModel()
{
return LRCInstance::getCurrentAccountInfo().contactModel.get();
}
lrc::api::NewDeviceModel*
AccountAdapter::getDeviceModel()
{
return LRCInstance::getCurrentAccountInfo().deviceModel.get();
} }
void void
@ -50,7 +61,7 @@ AccountAdapter::accountChanged(int index)
{ {
auto accountList = LRCInstance::accountModel().getAccountList(); auto accountList = LRCInstance::accountModel().getAccountList();
if (accountList.size() > index) if (accountList.size() > index)
setSelectedAccount(accountList.at(index)); setSelectedAccountId(accountList.at(index));
} }
void void
@ -80,8 +91,9 @@ AccountAdapter::createJamiAccount(QString registeredName,
&LRCInstance::accountModel(), &LRCInstance::accountModel(),
&lrc::api::NewAccountModel::accountAdded, &lrc::api::NewAccountModel::accountAdded,
[this, registeredName, settings, isCreating, photoBoothImgBase64](const QString& accountId) { [this, registeredName, settings, isCreating, photoBoothImgBase64](const QString& accountId) {
auto showBackup = isCreating && auto showBackup = isCreating
!AppSettingsManager::getValue(Settings::Key::NeverShowMeAgain).toBool(); && !AppSettingsManager::getValue(Settings::Key::NeverShowMeAgain)
.toBool();
if (!registeredName.isEmpty()) { if (!registeredName.isEmpty()) {
Utils::oneShotConnect(&LRCInstance::accountModel(), Utils::oneShotConnect(&LRCInstance::accountModel(),
&lrc::api::NewAccountModel::nameRegistrationEnded, &lrc::api::NewAccountModel::nameRegistrationEnded,
@ -214,9 +226,9 @@ AccountAdapter::deleteCurrentAccount()
} }
bool bool
AccountAdapter::savePassword(const QString accountId, AccountAdapter::savePassword(const QString& accountId,
const QString oldPassword, const QString& oldPassword,
const QString newPassword) const QString& newPassword)
{ {
return LRCInstance::accountModel().changeAccountPassword(accountId, oldPassword, newPassword); return LRCInstance::accountModel().changeAccountPassword(accountId, oldPassword, newPassword);
} }
@ -260,21 +272,15 @@ AccountAdapter::isPreviewing()
} }
void void
AccountAdapter::setCurrAccDisplayName(QString text) AccountAdapter::setCurrAccDisplayName(const QString& text)
{ {
LRCInstance::setCurrAccDisplayName(text); LRCInstance::setCurrAccDisplayName(text);
} }
void void
AccountAdapter::setSelectedAccountId(QString accountId) AccountAdapter::setSelectedConvId(const QString& convId)
{ {
LRCInstance::setSelectedAccountId(accountId); LRCInstance::setSelectedConvId(convId);
}
void
AccountAdapter::setSelectedConvId(QString accountId)
{
LRCInstance::setSelectedConvId(accountId);
} }
bool bool
@ -320,12 +326,18 @@ AccountAdapter::passwordSetStatusMessageBox(bool success, QString title, QString
} }
void void
AccountAdapter::setSelectedAccount(const QString &accountId) AccountAdapter::setSelectedAccountId(const QString& accountId)
{ {
LRCInstance::setSelectedAccountId(accountId); LRCInstance::setSelectedAccountId(accountId);
setProperty("currentAccountId", accountId);
auto accountType = LRCInstance::getAccountInfo(accountId).profileInfo.type;
setProperty("currentAccountType", lrc::api::profile::to_string(accountType));
connectAccount(accountId); connectAccount(accountId);
emit accountSignalsReconnect(accountId);
emit contactModelChanged();
emit deviceModelChanged();
backToWelcomePage(); backToWelcomePage();
} }

View file

@ -31,6 +31,30 @@ class AccountAdapter final : public QmlAdapterBase
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(lrc::api::NewAccountModel* model READ getModel NOTIFY modelChanged)
Q_PROPERTY(lrc::api::ContactModel* contactModel READ getContactModel NOTIFY contactModelChanged)
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();
lrc::api::ContactModel* getContactModel();
lrc::api::NewDeviceModel* getDeviceModel();
signals:
void modelChanged();
void contactModelChanged();
void deviceModelChanged();
void currentAccountIdChanged();
void currentAccountTypeChanged();
void accountListSizeChanged();
public: public:
explicit AccountAdapter(QObject* parent = 0); explicit AccountAdapter(QObject* parent = 0);
~AccountAdapter() = default; ~AccountAdapter() = default;
@ -38,10 +62,6 @@ public:
protected: protected:
void safeInit() override; void safeInit() override;
public:
//Singleton
static AccountAdapter &instance();
/* /*
* Change to account corresponding to combox box index. * Change to account corresponding to combox box index.
*/ */
@ -75,34 +95,37 @@ public:
/* /*
* lrc instances functions wrappers * lrc instances functions wrappers
*/ */
Q_INVOKABLE bool savePassword(QString accountId, QString oldPassword, QString newPassword); Q_INVOKABLE bool savePassword(const QString& accountId,
const QString& oldPassword,
const QString& newPassword);
Q_INVOKABLE void startAudioMeter(bool async); Q_INVOKABLE void startAudioMeter(bool async);
Q_INVOKABLE void stopAudioMeter(bool async); Q_INVOKABLE void stopAudioMeter(bool async);
Q_INVOKABLE void startPreviewing(bool force = false, bool async = true); Q_INVOKABLE void startPreviewing(bool force = false, bool async = true);
Q_INVOKABLE void stopPreviewing(bool async = true); Q_INVOKABLE void stopPreviewing(bool async = true);
Q_INVOKABLE bool hasVideoCall(); Q_INVOKABLE bool hasVideoCall();
Q_INVOKABLE bool isPreviewing(); Q_INVOKABLE bool isPreviewing();
Q_INVOKABLE void setCurrAccDisplayName(QString text); Q_INVOKABLE void setCurrAccDisplayName(const QString& text);
Q_INVOKABLE void setSelectedAccountId(QString accountId = {}); Q_INVOKABLE void setSelectedAccountId(const QString& accountId = {});
Q_INVOKABLE void setSelectedConvId(QString accountId = {}); Q_INVOKABLE void setSelectedConvId(const QString& convId = {});
signals: signals:
/* /*
* Trigger other components to reconnect account related signals. * Trigger other components to reconnect account related signals.
*/ */
void accountSignalsReconnect(const QString &accountId);
void accountStatusChanged(); void accountStatusChanged();
void updateConversationForAddedContact(); void updateConversationForAddedContact();
/* /*
* send report failure to QML to make it show the right UI state . * send report failure to QML to make it show the right UI state .
*/ */
void reportFailure(); void reportFailure();
void accountAdded(bool showBackUp, int index);
void navigateToWelcomePageRequested(); void navigateToWelcomePageRequested();
void accountAdded(bool showBackUp, int index);
private: private:
void setSelectedAccount(const QString &accountId); QString currentAccountId_;
lrc::api::profile::Type currentAccountType_;
int accountListSize_;
void backToWelcomePage(); void backToWelcomePage();
void deselectConversation(); void deselectConversation();

View file

@ -1,4 +1,4 @@
/* /*!
* Copyright (C) 2020 by Savoir-faire Linux * Copyright (C) 2020 by Savoir-faire Linux
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com> * Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
* *

View file

@ -1,97 +0,0 @@
/*
* Copyright (C) 2019-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/>.
*/
#include "clientwrapper.h"
ClientWrapper::ClientWrapper(QObject *parent)
: QObject(parent)
{
connect(getAccountAdapter(), &AccountAdapter::accountSignalsReconnect, [this]() {
emit accountModelChanged();
emit avmodelChanged();
emit dataTransferModelChanged();
emit contactModelChanged();
emit deviceModelChanged();
});
}
NameDirectory *
ClientWrapper::getNameDirectory()
{
return &(NameDirectory::instance());
}
SettingsAdapter *
ClientWrapper::getSettingsAdapter()
{
return &(SettingsAdapter::instance());
}
LRCInstance *
ClientWrapper::getLRCInstance()
{
return &(LRCInstance::instance());
}
AccountAdapter *
ClientWrapper::getAccountAdapter()
{
return &(AccountAdapter::instance());
}
RenderManager *
ClientWrapper::getRenderManager()
{
return LRCInstance::renderer();
}
lrc::api::NewAccountModel *
ClientWrapper::getAccountModel()
{
return &(LRCInstance::accountModel());
}
lrc::api::AVModel *
ClientWrapper::getAvModel()
{
return &(LRCInstance::avModel());
}
lrc::api::PluginModel *
ClientWrapper::getPluginModel()
{
return &(LRCInstance::pluginModel());
}
lrc::api::DataTransferModel *
ClientWrapper::getDataTransferModel()
{
return &(LRCInstance::dataTransferModel());
}
lrc::api::ContactModel *
ClientWrapper::getContactModel()
{
return getSettingsAdapter()->getCurrentAccountInfo().contactModel.get();
}
lrc::api::NewDeviceModel *
ClientWrapper::getDeviceModel()
{
return getSettingsAdapter()->getCurrentAccountInfo().deviceModel.get();
}

View file

@ -1,93 +0,0 @@
/*
* Copyright (C) 2019-2020 by Savoir-faire Linux
* Author: Yang Wang <yang.wang@savoirfairelinux.com>
* Author: Aline Gondim Santos <aline.gondimsantos@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 "accountadapter.h"
#include "accountlistmodel.h"
#include "audiocodeclistmodel.h"
#include "avadapter.h"
#include "bannedlistmodel.h"
#include "calladapter.h"
#include "contactadapter.h"
#include "pluginadapter.h"
#include "conversationsadapter.h"
#include "deviceitemlistmodel.h"
#include "pluginitemlistmodel.h"
#include "mediahandleritemlistmodel.h"
#include "preferenceitemlistmodel.h"
#include "distantrenderer.h"
#include "globalinstances.h"
#include "globalsystemtray.h"
#include "messagesadapter.h"
#include "namedirectory.h"
#include "pixbufmanipulator.h"
#include "previewrenderer.h"
#include "qrimageprovider.h"
#include "settingsadapter.h"
#include "version.h"
#include "videocodeclistmodel.h"
#include <QObject>
class ClientWrapper : public QObject
{
Q_OBJECT
Q_PROPERTY(SettingsAdapter *SettingsAdapter READ getSettingsAdapter NOTIFY SettingsAdapterChanged)
Q_PROPERTY(NameDirectory *nameDirectory READ getNameDirectory NOTIFY nameDirectoryChanged)
Q_PROPERTY(LRCInstance *lrcInstance READ getLRCInstance NOTIFY lrcInstanceChanged)
Q_PROPERTY(AccountAdapter *accountAdaptor READ getAccountAdapter NOTIFY accountAdaptorChanged)
Q_PROPERTY(RenderManager *renderManager READ getRenderManager NOTIFY renderManagerChanged)
Q_PROPERTY(lrc::api::NewAccountModel *accountModel READ getAccountModel NOTIFY accountModelChanged)
Q_PROPERTY(lrc::api::AVModel *avmodel READ getAvModel NOTIFY avmodelChanged)
Q_PROPERTY(lrc::api::DataTransferModel *dataTransferModel READ getDataTransferModel NOTIFY dataTransferModelChanged)
Q_PROPERTY(lrc::api::ContactModel *contactModel READ getContactModel NOTIFY contactModelChanged)
Q_PROPERTY(lrc::api::NewDeviceModel *deviceModel READ getDeviceModel NOTIFY deviceModelChanged)
Q_PROPERTY(lrc::api::PluginModel *pluginModel READ getPluginModel)
public:
explicit ClientWrapper(QObject *parent = nullptr);
NameDirectory *getNameDirectory();
SettingsAdapter *getSettingsAdapter();
LRCInstance *getLRCInstance();
AccountAdapter *getAccountAdapter();
RenderManager *getRenderManager();
lrc::api::NewAccountModel *getAccountModel();
lrc::api::AVModel *getAvModel();
lrc::api::DataTransferModel *getDataTransferModel();
lrc::api::ContactModel *getContactModel();
lrc::api::NewDeviceModel *getDeviceModel();
lrc::api::PluginModel *getPluginModel();
signals:
void SettingsAdapterChanged();
void nameDirectoryChanged();
void lrcInstanceChanged();
void accountAdaptorChanged();
void renderManagerChanged();
void accountModelChanged();
void avmodelChanged();
void dataTransferModelChanged();
void contactModelChanged();
void deviceModelChanged();
};
Q_DECLARE_METATYPE(ClientWrapper *)

View file

@ -23,6 +23,7 @@ import QtQuick.Controls.Universal 2.12
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.14 import QtGraphicalEffects 1.14
import net.jami.Models 1.0 import net.jami.Models 1.0
import net.jami.Adapters 1.0
import "../constant" import "../constant"
import "../wizardview/components" import "../wizardview/components"
@ -123,7 +124,7 @@ Window{
} }
function refuseMigrationAndDeleteAccount(){ function refuseMigrationAndDeleteAccount(){
ClientWrapper.accountModel.removeAccount(accountID) AccountAdapter.model.removeAccount(accountID)
acceptMigration() acceptMigration()
} }
@ -147,7 +148,7 @@ Window{
Connections{ Connections{
id: connectionMigrationEnded id: connectionMigrationEnded
enabled: false enabled: false
target: ClientWrapper.accountModel target: AccountAdapter.model
function onMigrationEnded(accountIdIn, ok){ function onMigrationEnded(accountIdIn, ok){
nonOperationClosing = true nonOperationClosing = true
@ -169,7 +170,7 @@ Window{
stackedWidget.currentIndex = 1 stackedWidget.currentIndex = 1
connectionMigrationEnded.enabled = true connectionMigrationEnded.enabled = true
ClientWrapper.accountAdaptor.setArchivePasswordAsync(accountID,password) AccountAdapter.setArchivePasswordAsync(accountID,password)
} }
function slotDeleteButtonClicked(){ function slotDeleteButtonClicked(){

View file

@ -160,7 +160,7 @@ Dialog {
font.kerning: true font.kerning: true
onClicked: { onClicked: {
ClientWrapper.accountAdaptor.deleteCurrentAccount() AccountAdapter.deleteCurrentAccount()
accept() accept()
} }
} }

View file

@ -21,6 +21,7 @@ import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14 import QtQuick.Layouts 1.14
import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Styles 1.4
import net.jami.Models 1.0 import net.jami.Models 1.0
import net.jami.Adapters 1.0
import "../constant" import "../constant"
@ -113,7 +114,7 @@ Dialog {
function exportAccountQML() { function exportAccountQML() {
var success = false var success = false
if (path.length > 0) { if (path.length > 0) {
success = ClientWrapper.accountAdaptor.exportToFile( success = AccountAdapter.exportToFile(
UtilsAdapter.getCurrAccId(), UtilsAdapter.getCurrAccId(),
path, path,
currentPasswordEdit.text) currentPasswordEdit.text)
@ -129,13 +130,13 @@ Dialog {
function savePasswordQML() { function savePasswordQML() {
var success = false var success = false
success = ClientWrapper.accountAdaptor.savePassword( success = AccountAdapter.savePassword(
UtilsAdapter.getCurrAccId(), UtilsAdapter.getCurrAccId(),
currentPasswordEdit.text, currentPasswordEdit.text,
passwordEdit.text) passwordEdit.text)
if (success) { if (success) {
ClientWrapper.accountAdaptor.setArchiveHasPassword(passwordEdit.text.length !== 0) AccountAdapter.setArchiveHasPassword(passwordEdit.text.length !== 0)
haveDone(successCode, root.purpose) haveDone(successCode, passwordDialog.purpose)
} else { } else {
currentPasswordEdit.borderColorMode = InfoLineEdit.ERROR currentPasswordEdit.borderColorMode = InfoLineEdit.ERROR
btnChangePasswordConfirm.enabled = false btnChangePasswordConfirm.enabled = false

View file

@ -5,6 +5,7 @@ import QtQuick.Controls.Styles 1.4
import Qt.labs.platform 1.1 import Qt.labs.platform 1.1
import QtGraphicalEffects 1.0 import QtGraphicalEffects 1.0
import net.jami.Models 1.0 import net.jami.Models 1.0
import net.jami.Adapters 1.0
ColumnLayout { ColumnLayout {
property bool takePhotoState: false property bool takePhotoState: false
@ -21,14 +22,14 @@ ColumnLayout {
function startBooth(force = false){ function startBooth(force = false){
hasAvatar = false hasAvatar = false
ClientWrapper.accountAdaptor.startPreviewing(force) AccountAdapter.startPreviewing(force)
takePhotoState = true takePhotoState = true
} }
function stopBooth(){ function stopBooth(){
try{ try{
if(!ClientWrapper.accountAdaptor.hasVideoCall()) { if(!AccountAdapter.hasVideoCall()) {
ClientWrapper.accountAdaptor.stopPreviewing() AccountAdapter.stopPreviewing()
} }
} catch(erro){console.log("Exception: " + erro.message)} } catch(erro){console.log("Exception: " + erro.message)}

View file

@ -26,6 +26,7 @@ import QtQuick.Controls.Styles 1.4
import Qt.labs.platform 1.1 import Qt.labs.platform 1.1
import QtQuick.Dialogs 1.3 import QtQuick.Dialogs 1.3
import net.jami.Models 1.0 import net.jami.Models 1.0
import net.jami.Adapters 1.0
import "../commoncomponents" import "../commoncomponents"
@ -162,9 +163,7 @@ ItemDelegate {
icon.width: 24 icon.width: 24
toolTipText: qsTr("Press to choose an image file") toolTipText: qsTr("Press to choose an image file")
text: { text: UtilsAdapter.fileName(preferenceCurrentValue)
return ClientWrapper.utilsAdaptor.fileName(preferenceCurrentValue)
}
fontPointSize: JamiTheme.buttonFontSize fontPointSize: JamiTheme.buttonFontSize
onClicked: { onClicked: {

View file

@ -36,7 +36,7 @@ MaterialLineEdit {
Connections { Connections {
id: registeredNameFoundConnection id: registeredNameFoundConnection
target: ClientWrapper.nameDirectory target: NameDirectory
function onRegisteredNameFound(status, address, name) { function onRegisteredNameFound(status, address, name) {
if (text === name) { if (text === name) {
@ -66,7 +66,7 @@ MaterialLineEdit {
onTriggered: { onTriggered: {
if (text.length !== 0 && readOnly === false) { if (text.length !== 0 && readOnly === false) {
nameRegistrationState = UsernameLineEdit.NameRegistrationState.SEARCHING nameRegistrationState = UsernameLineEdit.NameRegistrationState.SEARCHING
ClientWrapper.nameDirectory.lookupName("", text) NameDirectory.lookupName("", text)
} else { } else {
nameRegistrationState = UsernameLineEdit.NameRegistrationState.BLANK nameRegistrationState = UsernameLineEdit.NameRegistrationState.BLANK
} }

View file

@ -42,10 +42,10 @@ ConversationsAdapter::safeInit()
emit showChatView(accountId, convInfo.uid); emit showChatView(accountId, convInfo.uid);
}); });
connect(&LRCInstance::instance(), &LRCInstance::currentAccountChanged, connect(&LRCInstance::instance(),
[this]() { &LRCInstance::currentAccountChanged,
accountChangedSetUp(LRCInstance::getCurrAccId()); this,
}); &ConversationsAdapter::onCurrentAccountIdChanged);
connectConversationModel(); connectConversationModel();
} }
@ -79,7 +79,6 @@ ConversationsAdapter::selectConversation(const QString &convUid)
const auto& conversation = convModel->getConversationForUID(convUid); const auto& conversation = convModel->getConversationForUID(convUid);
if (selectConversation(conversation, false)) { if (selectConversation(conversation, false)) {
// If it is calling, show callview (can use showChatView signal, since it will be determined on qml). // If it is calling, show callview (can use showChatView signal, since it will be determined on qml).
if (!conversation.uid.isEmpty() if (!conversation.uid.isEmpty()
&& LRCInstance::getCurrentCallModel()->hasCall(conversation.callId)) { && LRCInstance::getCurrentCallModel()->hasCall(conversation.callId)) {
@ -125,8 +124,9 @@ ConversationsAdapter::deselectConversation()
} }
void void
ConversationsAdapter::accountChangedSetUp(const QString &accountId) ConversationsAdapter::onCurrentAccountIdChanged()
{ {
auto accountId = LRCInstance::getCurrAccId();
// Should be called when current account is changed. // Should be called when current account is changed.
conversationSmartListModel_->setAccount(accountId); conversationSmartListModel_->setAccount(accountId);
@ -183,21 +183,20 @@ ConversationsAdapter::refill()
conversationSmartListModel_->fillConversationsList(); conversationSmartListModel_->fillConversationsList();
} }
bool bool
ConversationsAdapter::connectConversationModel(bool updateFilter) ConversationsAdapter::connectConversationModel(bool updateFilter)
{ {
// Signal connections // Signal connections
auto currentConversationModel = LRCInstance::getCurrentConversationModel(); auto currentConversationModel = LRCInstance::getCurrentConversationModel();
modelSortedConnection_ = QObject::connect(currentConversationModel, modelSortedConnection_ = QObject::connect(
&lrc::api::ConversationModel::modelSorted, currentConversationModel, &lrc::api::ConversationModel::modelSorted, [this]() {
[this]() {
conversationSmartListModel_->fillConversationsList(); conversationSmartListModel_->fillConversationsList();
updateConversationsFilterWidget(); updateConversationsFilterWidget();
emit updateListViewRequested(); emit updateListViewRequested();
auto* convModel = LRCInstance::getCurrentConversationModel(); auto* convModel = LRCInstance::getCurrentConversationModel();
const auto conversation = convModel->getConversationForUID(LRCInstance::getCurrentConvUid()); const auto conversation = convModel->getConversationForUID(
LRCInstance::getCurrentConvUid());
if (conversation.uid.isEmpty() || conversation.participants.isEmpty()) { if (conversation.uid.isEmpty() || conversation.participants.isEmpty()) {
return; return;
@ -214,12 +213,14 @@ ConversationsAdapter::connectConversationModel(bool updateFilter)
modelUpdatedConnection_ = QObject::connect(currentConversationModel, modelUpdatedConnection_ = QObject::connect(currentConversationModel,
&lrc::api::ConversationModel::conversationUpdated, &lrc::api::ConversationModel::conversationUpdated,
[this](const QString& convUid) { [this](const QString& convUid) {
conversationSmartListModel_->updateConversation(convUid); conversationSmartListModel_->updateConversation(
convUid);
updateConversationsFilterWidget(); updateConversationsFilterWidget();
emit updateListViewRequested(); emit updateListViewRequested();
}); });
filterChangedConnection_ = QObject::connect(currentConversationModel, filterChangedConnection_
= QObject::connect(currentConversationModel,
&lrc::api::ConversationModel::filterChanged, &lrc::api::ConversationModel::filterChanged,
[this]() { [this]() {
conversationSmartListModel_->fillConversationsList(); conversationSmartListModel_->fillConversationsList();
@ -228,7 +229,8 @@ ConversationsAdapter::connectConversationModel(bool updateFilter)
emit updateListViewRequested(); emit updateListViewRequested();
}); });
newConversationConnection_ = QObject::connect(currentConversationModel, newConversationConnection_
= QObject::connect(currentConversationModel,
&lrc::api::ConversationModel::newConversation, &lrc::api::ConversationModel::newConversation,
[this](const QString& convUid) { [this](const QString& convUid) {
conversationSmartListModel_->fillConversationsList(); conversationSmartListModel_->fillConversationsList();
@ -236,39 +238,42 @@ ConversationsAdapter::connectConversationModel(bool updateFilter)
updateConversationForNewContact(convUid); updateConversationForNewContact(convUid);
}); });
conversationRemovedConnection_ = QObject::connect(currentConversationModel, conversationRemovedConnection_
= QObject::connect(currentConversationModel,
&lrc::api::ConversationModel::conversationRemoved, &lrc::api::ConversationModel::conversationRemoved,
[this]() { [this]() {
conversationSmartListModel_->fillConversationsList(); conversationSmartListModel_->fillConversationsList();
backToWelcomePage(); backToWelcomePage();
}); });
conversationClearedConnection = QObject::connect(currentConversationModel, conversationClearedConnection
= QObject::connect(currentConversationModel,
&lrc::api::ConversationModel::conversationCleared, &lrc::api::ConversationModel::conversationCleared,
[this](const QString& convUid) { [this](const QString& convUid) {
// If currently selected, switch to welcome screen (deselecting current smartlist item ). // If currently selected, switch to welcome screen (deselecting
// current smartlist item ).
if (convUid != LRCInstance::getCurrentConvUid()) { if (convUid != LRCInstance::getCurrentConvUid()) {
return; return;
} }
backToWelcomePage(); backToWelcomePage();
}); });
searchStatusChangedConnection_ = QObject::connect(currentConversationModel, searchStatusChangedConnection_
= QObject::connect(currentConversationModel,
&lrc::api::ConversationModel::searchStatusChanged, &lrc::api::ConversationModel::searchStatusChanged,
[this](const QString &status) { [this](const QString& status) { emit showSearchStatus(status); });
emit showSearchStatus(status);
});
searchResultUpdatedConnection_ = QObject::connect(currentConversationModel, searchResultUpdatedConnection_
= QObject::connect(currentConversationModel,
&lrc::api::ConversationModel::searchResultUpdated, &lrc::api::ConversationModel::searchResultUpdated,
[this]() { [this]() {
conversationSmartListModel_->fillConversationsList(); conversationSmartListModel_->fillConversationsList();
conversationSmartListModel_->setAccount(LRCInstance::getCurrAccId()); conversationSmartListModel_->setAccount(LRCInstance::getCurrAccId());
emit updateListViewRequested(); emit updateListViewRequested();
}); });
if (updateFilter) currentConversationModel->setFilter(""); if (updateFilter)
currentConversationModel->setFilter("");
return true; return true;
} }
@ -296,7 +301,8 @@ ConversationsAdapter::updateConversationForNewContact(const QString &convUid)
const auto conversation = convModel->getConversationForUID(convUid); const auto conversation = convModel->getConversationForUID(convUid);
if (!conversation.uid.isEmpty() && !conversation.participants.isEmpty()) { if (!conversation.uid.isEmpty() && !conversation.participants.isEmpty()) {
try { try {
const auto contact = convModel->owner.contactModel->getContact(conversation.participants[0]); const auto contact = convModel->owner.contactModel->getContact(
conversation.participants[0]);
if (!contact.profileInfo.uri.isEmpty() && contact.profileInfo.uri == selectedUid) { if (!contact.profileInfo.uri.isEmpty() && contact.profileInfo.uri == selectedUid) {
LRCInstance::setSelectedConvId(convUid); LRCInstance::setSelectedConvId(convUid);
convModel->selectConversation(convUid); convModel->selectConversation(convUid);

View file

@ -44,7 +44,6 @@ public:
Q_INVOKABLE void selectConversation(const QString& uid); Q_INVOKABLE void selectConversation(const QString& uid);
Q_INVOKABLE void deselectConversation(); Q_INVOKABLE void deselectConversation();
Q_INVOKABLE void refill(); Q_INVOKABLE void refill();
Q_INVOKABLE void accountChangedSetUp(const QString &accountId);
Q_INVOKABLE void updateConversationsFilterWidget(); Q_INVOKABLE void updateConversationsFilterWidget();
Q_INVOKABLE void setConversationFilter(const QString& type); Q_INVOKABLE void setConversationFilter(const QString& type);
@ -58,6 +57,9 @@ signals:
void updateListViewRequested(); void updateListViewRequested();
void navigateToWelcomePageRequested(); void navigateToWelcomePageRequested();
private slots:
void onCurrentAccountIdChanged();
private: private:
void setConversationFilter(lrc::api::profile::Type filter); void setConversationFilter(lrc::api::profile::Type filter);
void backToWelcomePage(); void backToWelcomePage();

View file

@ -1,4 +1,4 @@
/* /*!
* Copyright (C) 2019-2020 by Savoir-faire Linux * Copyright (C) 2019-2020 by Savoir-faire Linux
* Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> * Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
* Author: Isa Nanic <isa.nanic@savoirfairelinux.com> * Author: Isa Nanic <isa.nanic@savoirfairelinux.com>
@ -65,79 +65,74 @@ class LRCInstance : public QObject
Q_OBJECT Q_OBJECT
public: public:
static LRCInstance & static LRCInstance& instance(migrateCallback willMigrate = {}, migrateCallback didMigrate = {})
instance(migrateCallback willMigrate = {}, migrateCallback didMigrate = {})
{ {
static LRCInstance instance_(willMigrate, didMigrate); static LRCInstance instance_(willMigrate, didMigrate);
return instance_; return instance_;
}; }
static void
init(migrateCallback willMigrate = {}, migrateCallback didMigrate = {}) static void init(migrateCallback willMigrate = {}, migrateCallback didMigrate = {})
{ {
instance(willMigrate, didMigrate); instance(willMigrate, didMigrate);
}; }
static Lrc &
getAPI() static Lrc& getAPI() {
{
return *(instance().lrc_); return *(instance().lrc_);
}; }
static RenderManager *
renderer() static RenderManager* renderer() {
{
return instance().renderer_.get(); return instance().renderer_.get();
} }
static void
connectivityChanged() static void connectivityChanged() {
{
instance().lrc_->connectivityChanged(); instance().lrc_->connectivityChanged();
}; }
static NewAccountModel &
accountModel() static NewAccountModel& accountModel() {
{
return instance().lrc_->getAccountModel(); return instance().lrc_->getAccountModel();
}; }
static BehaviorController &
behaviorController() static BehaviorController& behaviorController()
{ {
return instance().lrc_->getBehaviorController(); return instance().lrc_->getBehaviorController();
}; }
static DataTransferModel &
dataTransferModel() static DataTransferModel& dataTransferModel()
{ {
return instance().lrc_->getDataTransferModel(); return instance().lrc_->getDataTransferModel();
}; }
static AVModel &
avModel() static AVModel& avModel()
{ {
return instance().lrc_->getAVModel(); return instance().lrc_->getAVModel();
}; }
static PluginModel &
pluginModel() static PluginModel& pluginModel()
{ {
return instance().lrc_->getPluginModel(); return instance().lrc_->getPluginModel();
}; }
static bool
isConnected() static bool isConnected()
{ {
return instance().lrc_->isConnected(); return instance().lrc_->isConnected();
}; }
static VectorString
getActiveCalls() static VectorString getActiveCalls()
{ {
return instance().lrc_->activeCalls(); return instance().lrc_->activeCalls();
}; }
static const account::Info &
getAccountInfo(const QString &accountId) static const account::Info& getAccountInfo(const QString& accountId)
{ {
return accountModel().getAccountInfo(accountId); return accountModel().getAccountInfo(accountId);
}; }
static const account::Info &
getCurrentAccountInfo() static const account::Info& getCurrentAccountInfo()
{ {
return getAccountInfo(getCurrAccId()); return getAccountInfo(getCurrAccId());
}; }
static bool
hasVideoCall() static bool hasVideoCall()
{ {
auto activeCalls = instance().lrc_->activeCalls(); auto activeCalls = instance().lrc_->activeCalls();
auto accountList = accountModel().getAccountList(); auto accountList = accountModel().getAccountList();
@ -152,9 +147,9 @@ public:
} }
} }
return result; return result;
}; }
static QString
getCallIdForConversationUid(const QString &convUid, const QString &accountId) static QString getCallIdForConversationUid(const QString& convUid, const QString& accountId)
{ {
auto& accInfo = LRCInstance::getAccountInfo(accountId); auto& accInfo = LRCInstance::getAccountInfo(accountId);
auto convInfo = accInfo.conversationModel->getConversationForUID(convUid); auto convInfo = accInfo.conversationModel->getConversationForUID(convUid);
@ -163,8 +158,8 @@ public:
} }
return convInfo.confId.isEmpty() ? convInfo.callId : convInfo.confId; return convInfo.confId.isEmpty() ? convInfo.callId : convInfo.confId;
} }
static const call::Info *
getCallInfo(const QString &callId, const QString &accountId) static const call::Info* getCallInfo(const QString& callId, const QString& accountId)
{ {
try { try {
auto& accInfo = LRCInstance::accountModel().getAccountInfo(accountId); auto& accInfo = LRCInstance::accountModel().getAccountInfo(accountId);
@ -176,8 +171,9 @@ public:
return nullptr; return nullptr;
} }
} }
static const call::Info *
getCallInfoForConversation(const conversation::Info &convInfo, bool forceCallOnly = {}) static const call::Info* getCallInfoForConversation(const conversation::Info& convInfo,
bool forceCallOnly = {})
{ {
try { try {
auto accountId = convInfo.accountId; auto accountId = convInfo.accountId;
@ -193,8 +189,10 @@ public:
return nullptr; return nullptr;
} }
} }
static const conversation::Info &
getConversation(const QString &accountId, getConvPredicate pred = {}, bool filtered = false) static const conversation::Info& getConversation(const QString& accountId,
getConvPredicate pred = {},
bool filtered = false)
{ {
using namespace lrc::api; using namespace lrc::api;
static conversation::Info invalid = {}; static conversation::Info invalid = {};
@ -223,18 +221,20 @@ public:
} }
return invalid; return invalid;
} }
static const conversation::Info &
getConversationFromCallId(const QString &callId, static const conversation::Info& getConversationFromCallId(const QString& callId,
const QString& accountId = {}, const QString& accountId = {},
bool filtered = false) bool filtered = false)
{ {
return getConversation( return getConversation(
!accountId.isEmpty() ? accountId : getCurrAccId(), !accountId.isEmpty() ? accountId : getCurrAccId(),
[&](const conversation::Info &conv) -> bool { return callId == conv.callId or callId == conv.confId; }, [&](const conversation::Info& conv) -> bool {
return callId == conv.callId or callId == conv.confId;
},
filtered); filtered);
} }
static const conversation::Info &
getConversationFromPeerUri(const QString &peerUri, static const conversation::Info& getConversationFromPeerUri(const QString& peerUri,
const QString& accountId = {}, const QString& accountId = {},
bool filtered = false) bool filtered = false)
{ {
@ -244,20 +244,17 @@ public:
filtered); filtered);
} }
static ConversationModel * static ConversationModel* getCurrentConversationModel()
getCurrentConversationModel()
{ {
return getCurrentAccountInfo().conversationModel.get(); return getCurrentAccountInfo().conversationModel.get();
}; }
static NewCallModel * static NewCallModel* getCurrentCallModel()
getCurrentCallModel()
{ {
return getCurrentAccountInfo().callModel.get(); return getCurrentAccountInfo().callModel.get();
}; }
static const QString & static const QString& getCurrAccId()
getCurrAccId()
{ {
if (instance().selectedAccountId_.isEmpty()) { if (instance().selectedAccountId_.isEmpty()) {
auto accountList = accountModel().getAccountList(); auto accountList = accountModel().getAccountList();
@ -265,35 +262,32 @@ public:
instance().selectedAccountId_ = accountList.at(0); instance().selectedAccountId_ = accountList.at(0);
} }
return instance().selectedAccountId_; return instance().selectedAccountId_;
}; }
static void static void setSelectedAccountId(const QString& accountId = {})
setSelectedAccountId(const QString &accountId = {})
{ {
if (accountId == instance().selectedAccountId_) if (accountId == instance().selectedAccountId_)
return; // No need to select current selected account return; // No need to select current selected account
instance().selectedAccountId_ = accountId; instance().selectedAccountId_ = accountId;
// Last selected account should be set as preferred. // Last selected account should be set as preferred.
accountModel().setTopAccount(accountId); accountModel().setTopAccount(accountId);
emit instance().currentAccountChanged(); emit instance().currentAccountChanged();
}; }
static const QString & static const QString& getCurrentConvUid()
getCurrentConvUid()
{ {
return instance().selectedConvUid_; return instance().selectedConvUid_;
}; }
static void static void setSelectedConvId(const QString& convUid = {})
setSelectedConvId(const QString &convUid = {})
{ {
instance().selectedConvUid_ = convUid; instance().selectedConvUid_ = convUid;
}; }
static void static void reset(bool newInstance = false)
reset(bool newInstance = false)
{ {
if (newInstance) { if (newInstance) {
instance().renderer_.reset(new RenderManager(avModel())); instance().renderer_.reset(new RenderManager(avModel()));
@ -302,10 +296,9 @@ public:
instance().renderer_.reset(); instance().renderer_.reset();
instance().lrc_.reset(); instance().lrc_.reset();
} }
}; }
static int static int getCurrentAccountIndex()
getCurrentAccountIndex()
{ {
for (int i = 0; i < accountModel().getAccountList().size(); i++) { for (int i = 0; i < accountModel().getAccountList().size(); i++) {
if (accountModel().getAccountList()[i] == getCurrAccId()) { if (accountModel().getAccountList()[i] == getCurrAccId()) {
@ -313,20 +306,18 @@ public:
} }
} }
return -1; return -1;
}; }
static const QPixmap static const QPixmap getCurrAccPixmap()
getCurrAccPixmap()
{ {
return instance() return instance()
.accountListModel_ .accountListModel_
.data(instance().accountListModel_.index(getCurrentAccountIndex()), .data(instance().accountListModel_.index(getCurrentAccountIndex()),
AccountListModel::Role::Picture) AccountListModel::Role::Picture)
.value<QPixmap>(); .value<QPixmap>();
}; }
static void static void setAvatarForAccount(const QPixmap& avatarPixmap, const QString& accountID)
setAvatarForAccount(const QPixmap &avatarPixmap, const QString &accountID)
{ {
QByteArray ba; QByteArray ba;
QBuffer bu(&ba); QBuffer bu(&ba);
@ -334,10 +325,9 @@ public:
avatarPixmap.save(&bu, "PNG"); avatarPixmap.save(&bu, "PNG");
auto str = QString::fromLocal8Bit(ba.toBase64()); auto str = QString::fromLocal8Bit(ba.toBase64());
accountModel().setAvatar(accountID, str); accountModel().setAvatar(accountID, str);
}; }
static void static void setCurrAccAvatar(const QPixmap& avatarPixmap)
setCurrAccAvatar(const QPixmap &avatarPixmap)
{ {
QByteArray ba; QByteArray ba;
QBuffer bu(&ba); QBuffer bu(&ba);
@ -345,16 +335,14 @@ public:
avatarPixmap.save(&bu, "PNG"); avatarPixmap.save(&bu, "PNG");
auto str = QString::fromLocal8Bit(ba.toBase64()); auto str = QString::fromLocal8Bit(ba.toBase64());
accountModel().setAvatar(getCurrAccId(), str); accountModel().setAvatar(getCurrAccId(), str);
}; }
static void static void setCurrAccAvatar(const QString& avatar)
setCurrAccAvatar(const QString &avatar)
{ {
accountModel().setAvatar(getCurrAccId(), avatar); accountModel().setAvatar(getCurrAccId(), avatar);
}; }
static void static void setCurrAccDisplayName(const QString& displayName)
setCurrAccDisplayName(const QString &displayName)
{ {
auto accountId = LRCInstance::getCurrAccId(); auto accountId = LRCInstance::getCurrAccId();
accountModel().setAlias(accountId, displayName); accountModel().setAlias(accountId, displayName);
@ -363,22 +351,19 @@ public:
*/ */
auto confProps = LRCInstance::accountModel().getAccountConfig(accountId); auto confProps = LRCInstance::accountModel().getAccountConfig(accountId);
LRCInstance::accountModel().setAccountConfig(accountId, confProps); LRCInstance::accountModel().setAccountConfig(accountId, confProps);
}; }
static const account::ConfProperties_t & static const account::ConfProperties_t& getCurrAccConfig()
getCurrAccConfig()
{ {
return instance().getCurrentAccountInfo().confProperties; return instance().getCurrentAccountInfo().confProperties;
} }
static void static void subscribeToDebugReceived()
subscribeToDebugReceived()
{ {
instance().lrc_->subscribeToDebugReceived(); instance().lrc_->subscribeToDebugReceived();
} }
static void static void startAudioMeter(bool async)
startAudioMeter(bool async)
{ {
auto f = [] { auto f = [] {
if (!LRCInstance::getActiveCalls().size()) { if (!LRCInstance::getActiveCalls().size()) {
@ -393,8 +378,7 @@ public:
} }
} }
static void static void stopAudioMeter(bool async)
stopAudioMeter(bool async)
{ {
auto f = [] { auto f = [] {
if (!LRCInstance::getActiveCalls().size()) { if (!LRCInstance::getActiveCalls().size()) {
@ -409,28 +393,26 @@ public:
} }
} }
static QString static QString getContentDraft(const QString& convUid, const QString& accountId)
getContentDraft(const QString &convUid, const QString &accountId)
{ {
auto draftKey = accountId + "_" + convUid; auto draftKey = accountId + "_" + convUid;
return instance().contentDrafts_[draftKey]; return instance().contentDrafts_[draftKey];
} }
static void static void setContentDraft(const QString& convUid,
setContentDraft(const QString &convUid, const QString &accountId, const QString &content) const QString& accountId,
const QString& content)
{ {
auto draftKey = accountId + "_" + convUid; auto draftKey = accountId + "_" + convUid;
instance().contentDrafts_[draftKey] = content; instance().contentDrafts_[draftKey] = content;
} }
static void static void pushLastConferencee(const QString& confId, const QString& callId)
pushLastConferencee(const QString &confId, const QString &callId)
{ {
instance().lastConferencees_[confId] = callId; instance().lastConferencees_[confId] = callId;
} }
static QString static QString popLastConferencee(const QString& confId)
popLastConferencee(const QString &confId)
{ {
QString callId = {}; QString callId = {};
auto iter = instance().lastConferencees_.find(confId); auto iter = instance().lastConferencees_.find(confId);

View file

@ -288,7 +288,7 @@ Window {
currentIndex: 0 currentIndex: 0
Connections { Connections {
target: ClientWrapper.accountAdaptor target: AccountAdapter
function onUpdateConversationForAddedContact() { function onUpdateConversationForAddedContact() {
mainViewWindowSidePanel.needToUpdateConversationForAddedContact() mainViewWindowSidePanel.needToUpdateConversationForAddedContact()
@ -310,7 +310,7 @@ Window {
if (needToShowCallStack if (needToShowCallStack
&& callStackView.responsibleAccountId === UtilsAdapter.getCurrAccId()){ && callStackView.responsibleAccountId === UtilsAdapter.getCurrAccId()){
if (!ClientWrapper.accountAdaptor.hasVideoCall()) { if (!AccountAdapter.hasVideoCall()) {
pushCommunicationMessageWebView() pushCommunicationMessageWebView()
needToShowCallStack = false needToShowCallStack = false
} else if (needToShowCallStack) { } else if (needToShowCallStack) {
@ -329,7 +329,7 @@ Window {
} }
Component.onCompleted: { Component.onCompleted: {
ClientWrapper.accountAdaptor.setQmlObject(this) AccountAdapter.setQmlObject(this)
} }
} }
@ -485,15 +485,11 @@ Window {
// If the item argument is specified, all items down to (but not including) item will be popped. // If the item argument is specified, all items down to (but not including) item will be popped.
if (!inSettingsView) { if (!inSettingsView) {
mainViewStack.pop(welcomePage) mainViewStack.pop(welcomePage)
welcomePage.updateWelcomePage()
qrDialog.updateQrDialog()
} }
} }
onConversationSmartListViewNeedToShowWelcomePage: { onConversationSmartListViewNeedToShowWelcomePage: {
mainViewStack.pop(welcomePage) mainViewStack.pop(welcomePage)
welcomePage.updateWelcomePage()
qrDialog.updateQrDialog()
} }
onNeedToUpdateConversationForAddedContact: { onNeedToUpdateConversationForAddedContact: {

View file

@ -20,6 +20,7 @@ import QtQuick 2.14
import QtQuick.Controls 2.14 import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14 import QtQuick.Layouts 1.14
import net.jami.Models 1.0 import net.jami.Models 1.0
import net.jami.Adapters 1.0
import "../../commoncomponents" import "../../commoncomponents"
@ -50,7 +51,7 @@ ComboBox {
} }
Connections { Connections {
target: ClientWrapper.accountAdaptor target: AccountAdapter
function onNavigateToWelcomePageRequested() { function onNavigateToWelcomePageRequested() {
needToBackToWelcomePage() needToBackToWelcomePage()

View file

@ -22,6 +22,7 @@ import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14 import QtQuick.Layouts 1.14
import QtQuick.Controls.Universal 2.12 import QtQuick.Controls.Universal 2.12
import net.jami.Models 1.0 import net.jami.Models 1.0
import net.jami.Adapters 1.0
import "../js/incomingcallpagecreation.js" as IncomingCallPageCreation import "../js/incomingcallpagecreation.js" as IncomingCallPageCreation
import "../js/videocallfullscreenwindowcontainercreation.js" as VideoCallFullScreenWindowContainerCreation import "../js/videocallfullscreenwindowcontainercreation.js" as VideoCallFullScreenWindowContainerCreation

View file

@ -26,7 +26,7 @@ import "../../commoncomponents"
Popup { Popup {
id: root id: root
function toggleMediaHandlerSlot(mediaHandlerId, isLoaded) { function toggleMediaHandlerSlot(mediaHandlerId, isLoaded) {
ClientWrapper.pluginModel.toggleCallMediaHandler(mediaHandlerId, !isLoaded) PluginModel.toggleCallMediaHandler(mediaHandlerId, !isLoaded)
mediahandlerPickerListView.model = PluginAdapter.getMediaHandlerSelectableModel() mediahandlerPickerListView.model = PluginAdapter.getMediaHandlerSelectableModel()
} }
@ -102,7 +102,7 @@ Popup {
delegate: MediaHandlerItemDelegate { delegate: MediaHandlerItemDelegate {
id: mediaHandlerItemDelegate id: mediaHandlerItemDelegate
visible: ClientWrapper.pluginModel.getPluginsEnabled() visible: PluginModel.getPluginsEnabled()
width: mediahandlerPickerListView.width width: mediahandlerPickerListView.width
height: 50 height: 50
@ -231,7 +231,7 @@ Popup {
onClicked: mediahandlerPreferencePickerListView.currentIndex = index onClicked: mediahandlerPreferencePickerListView.currentIndex = index
onBtnPreferenceClicked: { onBtnPreferenceClicked: {
ClientWrapper.pluginModel.setPluginPreference(pluginId, preferenceKey, preferenceNewValue) PluginModel.setPluginPreference(pluginId, preferenceKey, preferenceNewValue)
mediahandlerPreferencePickerListView.model = PluginAdapter.getPluginPreferencesModel(pluginId, mediahandlerPreferencePickerListView.mediaHandlerName) mediahandlerPreferencePickerListView.model = PluginAdapter.getPluginPreferencesModel(pluginId, mediahandlerPreferencePickerListView.mediaHandlerName)
} }
} }

View file

@ -21,9 +21,10 @@ import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14 import QtQuick.Layouts 1.14
import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Styles 1.4
import QtQuick.Dialogs 1.3 import QtQuick.Dialogs 1.3
import net.jami.Models 1.0
import QtGraphicalEffects 1.15 import QtGraphicalEffects 1.15
import QtQuick.Shapes 1.15 import QtQuick.Shapes 1.15
import net.jami.Models 1.0
import net.jami.Adapters 1.0
import "../../commoncomponents" import "../../commoncomponents"
@ -71,7 +72,7 @@ Rectangle {
updateState(RecordBox.States.INIT) updateState(RecordBox.States.INIT)
if (isVideo){ if (isVideo){
ClientWrapper.accountAdaptor.startPreviewing(false) AccountAdapter.startPreviewing(false)
previewAvailable = true previewAvailable = true
} }
} }
@ -79,7 +80,7 @@ Rectangle {
function scaleHeight(){ function scaleHeight(){
height = preferredHeight height = preferredHeight
if (isVideo) { if (isVideo) {
var device = ClientWrapper.avmodel.getDefaultDevice() var device = AVModel.getDefaultDevice()
var settings = SettingsAdapter.get_Video_Settings_Size(device) var settings = SettingsAdapter.get_Video_Settings_Size(device)
var res = settings.split("x") var res = settings.split("x")
var aspectRatio = res[1] / res[0] var aspectRatio = res[1] / res[0]
@ -104,8 +105,8 @@ Rectangle {
} }
function closeRecorder() { function closeRecorder() {
if (isVideo && ClientWrapper.accountAdaptor.isPreviewing()) { if (isVideo && AccountAdapter.isPreviewing()) {
ClientWrapper.accountAdaptor.stopPreviewing() AccountAdapter.stopPreviewing()
} }
stopRecording() stopRecording()
visible = false visible = false
@ -129,7 +130,7 @@ Rectangle {
function startRecording() { function startRecording() {
timer.start() timer.start()
pathRecorder = ClientWrapper.avmodel.startLocalRecorder(!isVideo) pathRecorder = AVModel.startLocalRecorder(!isVideo)
if (pathRecorder == "") { if (pathRecorder == "") {
timer.stop() timer.stop()
} }
@ -137,7 +138,7 @@ Rectangle {
function stopRecording() { function stopRecording() {
if (pathRecorder !== "") { if (pathRecorder !== "") {
ClientWrapper.avmodel.stopLocalRecorder(pathRecorder) AVModel.stopLocalRecorder(pathRecorder)
} }
} }
@ -160,11 +161,6 @@ Rectangle {
time.text = min + ":" + sec; time.text = min + ":" + sec;
} }
Connections{
target: ClientWrapper.renderManager
}
Shape { Shape {
id: backgroundShape id: backgroundShape
width: recBox.width width: recBox.width

View file

@ -75,7 +75,7 @@ Rectangle {
} }
function refreshAccountComboBox(index) { function refreshAccountComboBox(index) {
ClientWrapper.accountAdaptor.accountChanged(index) AccountAdapter.accountChanged(index)
accountComboBox.update() accountComboBox.update()
accountChangedUIReset() accountChangedUIReset()

View file

@ -246,7 +246,9 @@ Rectangle {
Connections { Connections {
target: CallAdapter target: CallAdapter
onPreviewVisibilityNeedToChange: previewRenderer.visible = visible function onPreviewVisibilityNeedToChange(visible) {
previewRenderer.visible = visible
}
} }
width: videoCallPageMainRect.width / 4 width: videoCallPageMainRect.width / 4

View file

@ -1,4 +1,3 @@
/* /*
* Copyright (C) 2020 by Savoir-faire Linux * Copyright (C) 2020 by Savoir-faire Linux
* Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com> * Author: Mingrui Zhang <mingrui.zhang@savoirfairelinux.com>
@ -16,23 +15,21 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import QtQuick 2.14 import QtQuick 2.14
import QtQuick.Controls 2.14 import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14 import QtQuick.Layouts 1.14
import net.jami.Models 1.0 import net.jami.Models 1.0
import net.jami.Adapters 1.0
import "../../commoncomponents" import "../../commoncomponents"
Rectangle { Rectangle {
id: welcomeRect id: welcomeRect
property int buttonPreferredSize: 30
anchors.fill: parent anchors.fill: parent
function updateWelcomePage(){ property int buttonPreferredSize: 30
jamiShareWithFriendText.visible = accountListModel.data(accountListModel.index(0, 0), 260) === 1
jamiRegisteredNameRect.visible = accountListModel.data(accountListModel.index(0, 0), 260) === 1
textMetricsjamiRegisteredNameText.text = accountListModel.data(accountListModel.index(0, 0), 258)
}
Rectangle { Rectangle {
id: welcomeRectComponentsGroup id: welcomeRectComponentsGroup
@ -89,9 +86,7 @@ Rectangle {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
visible: accountListModel.data(accountListModel.index( visible: AccountAdapter.currentAccountType === Profile.Type.RING
0, 0),
260) === 1
text: qsTr("This is your ID.\nCopy and share it with your friends") text: qsTr("This is your ID.\nCopy and share it with your friends")
color: JamiTheme.faddedFontColor color: JamiTheme.faddedFontColor
@ -99,13 +94,14 @@ Rectangle {
Rectangle { Rectangle {
id: jamiRegisteredNameRect id: jamiRegisteredNameRect
Layout.alignment: Qt.AlignCenter Layout.alignment: Qt.AlignCenter
Layout.preferredWidth: welcomeRectComponentsGroup.width Layout.preferredWidth: welcomeRectComponentsGroup.width
Layout.preferredHeight: 65 Layout.preferredHeight: 65
Layout.bottomMargin: 5 Layout.bottomMargin: 5
visible: accountListModel.data(accountListModel.index(
0, 0), visible: AccountAdapter.currentAccountType === Profile.Type.RING
260) === 1
ColumnLayout { ColumnLayout {
id: jamiRegisteredNameRectColumnLayout id: jamiRegisteredNameRectColumnLayout
spacing: 0 spacing: 0
@ -121,9 +117,7 @@ Rectangle {
TextMetrics { TextMetrics {
id: textMetricsjamiRegisteredNameText id: textMetricsjamiRegisteredNameText
font: jamiRegisteredNameText.font font: jamiRegisteredNameText.font
text: accountListModel.data( text: UtilsAdapter.getBestId(AccountAdapter.currentAccountId)
accountListModel.index(
currentAccountIndex, 0), 258)
elideWidth: welcomeRectComponentsGroup.width elideWidth: welcomeRectComponentsGroup.width
elide: Qt.ElideMiddle elide: Qt.ElideMiddle
} }
@ -171,8 +165,4 @@ Rectangle {
bBorderwidth: 0 bBorderwidth: 0
borderColor: JamiTheme.tabbarBorderColor borderColor: JamiTheme.tabbarBorderColor
} }
Component.onCompleted: {
updateWelcomePage()
}
} }

View file

@ -25,12 +25,6 @@ import net.jami.Adapters 1.0
Dialog { Dialog {
id: userQrImageDialog id: userQrImageDialog
property string accountIdStr: UtilsAdapter.getCurrAccId()
function updateQrDialog() {
accountIdStr = UtilsAdapter.getCurrAccId()
}
// When dialog is opened, trigger mainViewWindow overlay which is defined in overlay.model. // When dialog is opened, trigger mainViewWindow overlay which is defined in overlay.model.
// (model : true is necessary) // (model : true is necessary)
modal: true modal: true
@ -43,14 +37,12 @@ Dialog {
anchors.centerIn: parent anchors.centerIn: parent
width: 250 width: 256
height: 250 height: 256
smooth: false
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
source: "image://qrImage/account_" + accountIdStr source: "image://qrImage/account_" + AccountAdapter.currentAccountId
sourceSize.width: 260
sourceSize.height: 260
mipmap: true
} }
background: Rectangle { background: Rectangle {

View file

@ -27,7 +27,6 @@
#include "avadapter.h" #include "avadapter.h"
#include "bannedlistmodel.h" #include "bannedlistmodel.h"
#include "calladapter.h" #include "calladapter.h"
#include "clientwrapper.h"
#include "contactadapter.h" #include "contactadapter.h"
#include "conversationsadapter.h" #include "conversationsadapter.h"
#include "deviceitemlistmodel.h" #include "deviceitemlistmodel.h"
@ -51,127 +50,109 @@
#include <QMetaType> #include <QMetaType>
#include <QQmlEngine> #include <QQmlEngine>
// clang-format off
#define QML_REGISTERSINGLETONTYPE(N, T, MAJ, MIN) \ #define QML_REGISTERSINGLETONTYPE(N, T, MAJ, MIN) \
qmlRegisterSingletonType<T>(N, MAJ, MIN, #T, \ qmlRegisterSingletonType<T>(N, MAJ, MIN, #T, \
[](QQmlEngine* e, QJSEngine* se) -> QObject* { \ [](QQmlEngine* e, QJSEngine* se) -> QObject* { \
Q_UNUSED(e); \ Q_UNUSED(e); Q_UNUSED(se); \
Q_UNUSED(se); \ T* obj = new T(); return obj; \
T *obj = new T(); \
return obj; \
}); });
#define QML_REGISTERSINGLETONTYPE_WITH_INSTANCE(T, MAJ, MIN) \ #define QML_REGISTERSINGLETONTYPE_WITH_INSTANCE(T, MAJ, MIN) \
qmlRegisterSingletonType<T>("net.jami.Models", \ qmlRegisterSingletonType<T>("net.jami.Models", MAJ, MIN, #T, \
MAJ, \
MIN, \
#T, \
[](QQmlEngine* e, QJSEngine* se) -> QObject* { \ [](QQmlEngine* e, QJSEngine* se) -> QObject* { \
Q_UNUSED(e); \ Q_UNUSED(e); Q_UNUSED(se); \
Q_UNUSED(se); \
return &(T::instance()); \ return &(T::instance()); \
}); });
#define QML_REGISTERSINGLETONTYPE_URL(URL, T, MAJ, MIN) \ #define QML_REGISTERSINGLETONTYPE_CUSTOM(N, T, MAJ, MIN, P) \
qmlRegisterSingletonType(QUrl(URL), "net.jami.Models", MAJ, MIN, #T); qmlRegisterSingletonType<T>(N, MAJ, MIN, #T, \
[](QQmlEngine* e, QJSEngine* se) -> QObject* { \
Q_UNUSED(e); Q_UNUSED(se); \
return P; \
});
#define QML_REGISTERTYPE(T, MAJ, MIN) qmlRegisterType<T>("net.jami.Models", MAJ, MIN, #T); #define QML_REGISTERSINGLETONTYPE_URL(URL, T, MAJ, MIN) \
qmlRegisterSingletonType(QUrl(QStringLiteral(URL)), "net.jami.Models", MAJ, MIN, #T);
#define QML_REGISTERTYPE(N, T, MAJ, MIN) qmlRegisterType<T>(N, MAJ, MIN, #T);
#define QML_REGISTERNAMESPACE(T, NAME, MAJ, MIN) \ #define QML_REGISTERNAMESPACE(T, NAME, MAJ, MIN) \
qmlRegisterUncreatableMetaObject(T, "net.jami.Models", MAJ, MIN, NAME, "") qmlRegisterUncreatableMetaObject(T, "net.jami.Models", MAJ, MIN, NAME, "")
#define QML_REGISTERUNCREATABLE(N, T, MAJ, MIN) \ #define QML_REGISTERUNCREATABLE(N, T, MAJ, MIN) \
qmlRegisterUncreatableType<T>(N, \ qmlRegisterUncreatableType<T>(N, MAJ, MIN, #T, "Don't try to add to a qml definition of " #T);
MAJ, \
MIN, \
#T, \
"Don't try to add to a qml definition of " #T);
#define QML_REGISTERUNCREATABLE_IN_NAMESPACE(T, NAMESPACE, MAJ, MIN) \ #define QML_REGISTERUNCREATABLE_IN_NAMESPACE(T, NAMESPACE, MAJ, MIN) \
qmlRegisterUncreatableType<NAMESPACE::T>("net.jami.Models", \ qmlRegisterUncreatableType<NAMESPACE::T>("net.jami.Models", \
MAJ, \ MAJ, MIN, #T, \
MIN, \
#T, \
"Don't try to add to a qml definition of " #T); "Don't try to add to a qml definition of " #T);
/*! /*!
* This function will expose custom types to the QML engine. * This function will expose custom types to the QML engine.
*/ */
void registerTypes() void
registerTypes()
{ {
/* /*
* Register QAbstractListModel type. * QAbstractListModels
*/ */
QML_REGISTERTYPE(AccountListModel, 1, 0); QML_REGISTERTYPE("net.jami.Models", AccountListModel, 1, 0);
QML_REGISTERTYPE(DeviceItemListModel, 1, 0); QML_REGISTERTYPE("net.jami.Models", DeviceItemListModel, 1, 0);
QML_REGISTERTYPE(PluginItemListModel, 1, 0); QML_REGISTERTYPE("net.jami.Models", PluginItemListModel, 1, 0);
QML_REGISTERTYPE(MediaHandlerItemListModel, 1, 0); QML_REGISTERTYPE("net.jami.Models", MediaHandlerItemListModel, 1, 0);
QML_REGISTERTYPE(PreferenceItemListModel, 1, 0); QML_REGISTERTYPE("net.jami.Models", PreferenceItemListModel, 1, 0);
QML_REGISTERTYPE(BannedListModel, 1, 0); QML_REGISTERTYPE("net.jami.Models", BannedListModel, 1, 0);
QML_REGISTERTYPE(VideoCodecListModel, 1, 0); QML_REGISTERTYPE("net.jami.Models", VideoCodecListModel, 1, 0);
QML_REGISTERTYPE(AudioCodecListModel, 1, 0); QML_REGISTERTYPE("net.jami.Models", AudioCodecListModel, 1, 0);
QML_REGISTERTYPE(AccountsToMigrateListModel, 1, 0); QML_REGISTERTYPE("net.jami.Models", AccountsToMigrateListModel, 1, 0);
QML_REGISTERTYPE(AudioInputDeviceModel, 1, 0); QML_REGISTERTYPE("net.jami.Models", AudioInputDeviceModel, 1, 0);
QML_REGISTERTYPE(AudioOutputDeviceModel, 1, 0); QML_REGISTERTYPE("net.jami.Models", AudioOutputDeviceModel, 1, 0);
QML_REGISTERTYPE(AudioManagerListModel, 1, 0); QML_REGISTERTYPE("net.jami.Models", AudioManagerListModel, 1, 0);
QML_REGISTERTYPE(VideoInputDeviceModel, 1, 0); QML_REGISTERTYPE("net.jami.Models", VideoInputDeviceModel, 1, 0);
QML_REGISTERTYPE(VideoFormatResolutionModel, 1, 0); QML_REGISTERTYPE("net.jami.Models", VideoFormatResolutionModel, 1, 0);
QML_REGISTERTYPE(VideoFormatFpsModel, 1, 0); QML_REGISTERTYPE("net.jami.Models", VideoFormatFpsModel, 1, 0);
QML_REGISTERTYPE(PluginListPreferenceModel, 1, 0); QML_REGISTERTYPE("net.jami.Models", PluginListPreferenceModel, 1, 0);
/* /*
* Register QQuickItem type. * QQuickItems
*/ */
QML_REGISTERTYPE(PreviewRenderer, 1, 0); QML_REGISTERTYPE("net.jami.Models", PreviewRenderer, 1, 0);
QML_REGISTERTYPE(VideoCallPreviewRenderer, 1, 0); QML_REGISTERTYPE("net.jami.Models", VideoCallPreviewRenderer, 1, 0);
QML_REGISTERTYPE(DistantRenderer, 1, 0); QML_REGISTERTYPE("net.jami.Models", DistantRenderer, 1, 0);
QML_REGISTERTYPE(PhotoboothPreviewRender, 1, 0) QML_REGISTERTYPE("net.jami.Models", PhotoboothPreviewRender, 1, 0)
/* /*
* Adaptors and qml singleton components - qmlRegisterSingletonType. * Adaptors
*/ */
QML_REGISTERSINGLETONTYPE_URL(QStringLiteral("qrc:/src/constant/JamiTheme.qml"),
JamiTheme, 1, 0);
QML_REGISTERSINGLETONTYPE_URL(QStringLiteral("qrc:/src/constant/JamiQmlUtils.qml"),
JamiQmlUtils, 1, 0);
QML_REGISTERSINGLETONTYPE("net.jami.Models", AccountAdapter, 1, 0);
QML_REGISTERSINGLETONTYPE("net.jami.Models", CallAdapter, 1, 0); QML_REGISTERSINGLETONTYPE("net.jami.Models", CallAdapter, 1, 0);
QML_REGISTERSINGLETONTYPE("net.jami.Models", MessagesAdapter, 1, 0); QML_REGISTERSINGLETONTYPE("net.jami.Models", MessagesAdapter, 1, 0);
QML_REGISTERSINGLETONTYPE("net.jami.Models", ConversationsAdapter, 1, 0); QML_REGISTERSINGLETONTYPE("net.jami.Models", ConversationsAdapter, 1, 0);
QML_REGISTERSINGLETONTYPE("net.jami.Models", AvAdapter, 1, 0); QML_REGISTERSINGLETONTYPE("net.jami.Models", AvAdapter, 1, 0);
QML_REGISTERSINGLETONTYPE("net.jami.Models", ContactAdapter, 1, 0); QML_REGISTERSINGLETONTYPE("net.jami.Models", ContactAdapter, 1, 0);
QML_REGISTERSINGLETONTYPE("net.jami.Models", PluginAdapter, 1, 0); QML_REGISTERSINGLETONTYPE("net.jami.Models", PluginAdapter, 1, 0);
QML_REGISTERSINGLETONTYPE("net.jami.Models", ClientWrapper, 1, 0); QML_REGISTERSINGLETONTYPE("net.jami.Adapters", AccountAdapter, 1, 0);
QML_REGISTERSINGLETONTYPE("net.jami.Adapters", UtilsAdapter, 1, 0); QML_REGISTERSINGLETONTYPE("net.jami.Adapters", UtilsAdapter, 1, 0);
QML_REGISTERSINGLETONTYPE("net.jami.Adapters", SettingsAdapter, 1, 0); QML_REGISTERSINGLETONTYPE("net.jami.Adapters", SettingsAdapter, 1, 0);
QML_REGISTERUNCREATABLE("net.jami.Enums", Settings, 1, 0); QML_REGISTERSINGLETONTYPE_CUSTOM("net.jami.Models", AVModel, 1, 0, &LRCInstance::avModel())
QML_REGISTERSINGLETONTYPE_CUSTOM("net.jami.Models", PluginModel, 1, 0, &LRCInstance::pluginModel())
QML_REGISTERSINGLETONTYPE_CUSTOM("net.jami.Models", RenderManager, 1, 0, LRCInstance::renderer())
/* /*
* Lrc models - qmlRegisterUncreatableType & Q_DECLARE_METATYPE. * Qml singleton components
* This to make lrc models recognizable in qml.
*/ */
QML_REGISTERUNCREATABLE_IN_NAMESPACE(NewAccountModel, lrc::api, 1, 0); QML_REGISTERSINGLETONTYPE_URL("qrc:/src/constant/JamiTheme.qml", JamiTheme, 1, 0);
QML_REGISTERUNCREATABLE_IN_NAMESPACE(BehaviorController, lrc::api, 1, 0); QML_REGISTERSINGLETONTYPE_URL("qrc:/src/constant/JamiQmlUtils.qml", JamiQmlUtils, 1, 0);
QML_REGISTERUNCREATABLE_IN_NAMESPACE(DataTransferModel, lrc::api, 1, 0);
QML_REGISTERUNCREATABLE_IN_NAMESPACE(AVModel, lrc::api, 1, 0);
QML_REGISTERUNCREATABLE_IN_NAMESPACE(ContactModel, lrc::api, 1, 0);
QML_REGISTERUNCREATABLE_IN_NAMESPACE(ConversationModel, lrc::api, 1, 0);
QML_REGISTERUNCREATABLE_IN_NAMESPACE(NewCallModel, lrc::api, 1, 0);
QML_REGISTERUNCREATABLE_IN_NAMESPACE(PluginModel, lrc::api, 1, 0);
QML_REGISTERUNCREATABLE_IN_NAMESPACE(NewDeviceModel, lrc::api, 1, 0);
QML_REGISTERUNCREATABLE_IN_NAMESPACE(NewCodecModel, lrc::api, 1, 0);
QML_REGISTERUNCREATABLE_IN_NAMESPACE(PeerDiscoveryModel, lrc::api, 1, 0);
/* /*
* qmlRegisterUncreatableType & Q_DECLARE_METATYPE to expose models in qml. * C++ singletons
*/ */
QML_REGISTERUNCREATABLE("net.jami.Models", RenderManager, 1, 0); QML_REGISTERSINGLETONTYPE_WITH_INSTANCE(LRCInstance, 1, 0);
QML_REGISTERUNCREATABLE("net.jami.Models", NameDirectory, 1, 0); QML_REGISTERSINGLETONTYPE_WITH_INSTANCE(NameDirectory, 1, 0);
QML_REGISTERUNCREATABLE("net.jami.Models", LRCInstance, 1, 0);
/* /*
* qmlRegisterUncreatableMetaObject to expose namespaces in qml * lrc namespaces, models, and singletons
*/ */
QML_REGISTERNAMESPACE(lrc::api::staticMetaObject, "Lrc", 1, 0); QML_REGISTERNAMESPACE(lrc::api::staticMetaObject, "Lrc", 1, 0);
QML_REGISTERNAMESPACE(lrc::api::account::staticMetaObject, "Account", 1, 0); QML_REGISTERNAMESPACE(lrc::api::account::staticMetaObject, "Account", 1, 0);
@ -180,4 +161,23 @@ void registerTypes()
QML_REGISTERNAMESPACE(lrc::api::interaction::staticMetaObject, "Interaction", 1, 0); QML_REGISTERNAMESPACE(lrc::api::interaction::staticMetaObject, "Interaction", 1, 0);
QML_REGISTERNAMESPACE(lrc::api::video::staticMetaObject, "Video", 1, 0); QML_REGISTERNAMESPACE(lrc::api::video::staticMetaObject, "Video", 1, 0);
QML_REGISTERNAMESPACE(lrc::api::profile::staticMetaObject, "Profile", 1, 0); QML_REGISTERNAMESPACE(lrc::api::profile::staticMetaObject, "Profile", 1, 0);
/*
* same as QML_REGISTERUNCREATABLE but omit the namespace in Qml
*/
QML_REGISTERUNCREATABLE_IN_NAMESPACE(NewAccountModel, lrc::api, 1, 0);
QML_REGISTERUNCREATABLE_IN_NAMESPACE(BehaviorController, lrc::api, 1, 0);
QML_REGISTERUNCREATABLE_IN_NAMESPACE(DataTransferModel, lrc::api, 1, 0);
QML_REGISTERUNCREATABLE_IN_NAMESPACE(ContactModel, lrc::api, 1, 0);
QML_REGISTERUNCREATABLE_IN_NAMESPACE(ConversationModel, lrc::api, 1, 0);
QML_REGISTERUNCREATABLE_IN_NAMESPACE(NewCallModel, lrc::api, 1, 0);
QML_REGISTERUNCREATABLE_IN_NAMESPACE(NewDeviceModel, lrc::api, 1, 0);
QML_REGISTERUNCREATABLE_IN_NAMESPACE(NewCodecModel, lrc::api, 1, 0);
QML_REGISTERUNCREATABLE_IN_NAMESPACE(PeerDiscoveryModel, lrc::api, 1, 0);
/*
* Enums
*/
QML_REGISTERUNCREATABLE("net.jami.Enums", Settings, 1, 0);
} }
// clang-format on

View file

@ -43,10 +43,9 @@ public:
* Cannot use getCurrentAccId to replace account index, * Cannot use getCurrentAccId to replace account index,
* since we need to keep each image id unique. * since we need to keep each image id unique.
*/ */
QPair<QrType, QString> QPair<QrType, QString> getIndexFromID(const QString& id)
getIndexFromID(const QString &id)
{ {
auto list = id.split('_', QString::SkipEmptyParts); auto list = id.split('_', Qt::SkipEmptyParts);
if (list.size() < 2) if (list.size() < 2)
return QPair(QrType::Account, ""); return QPair(QrType::Account, "");
if (list.contains("account") && list.size() > 1) { if (list.contains("account") && list.size() > 1) {
@ -65,8 +64,7 @@ public:
return QPair(QrType::Account, ""); return QPair(QrType::Account, "");
} }
QImage QImage requestImage(const QString& id, QSize* size, const QSize& requestedSize) override
requestImage(const QString &id, QSize *size, const QSize &requestedSize) override
{ {
Q_UNUSED(size); Q_UNUSED(size);

View file

@ -46,7 +46,8 @@ class FrameWrapper final : public QObject
Q_OBJECT; Q_OBJECT;
public: public:
FrameWrapper(AVModel &avModel, const QString &id = video::PREVIEW_RENDERER_ID); FrameWrapper(AVModel &avModel,
const QString &id = video::PREVIEW_RENDERER_ID);
~FrameWrapper(); ~FrameWrapper();
/* /*

View file

@ -30,7 +30,6 @@ import "components"
Rectangle { Rectangle {
id: root id: root
enum SettingsMenu{ enum SettingsMenu{
Account, Account,
General, General,
@ -101,7 +100,7 @@ Rectangle {
Connections { Connections {
id: accountListChangedConnection id: accountListChangedConnection
target: ClientWrapper.lrcInstance target: LRCInstance
function onAccountListChanged(){ function onAccountListChanged(){
slotAccountListChanged() slotAccountListChanged()
@ -124,14 +123,13 @@ Rectangle {
} }
function slotAccountListChanged(){ function slotAccountListChanged(){
var accountList = ClientWrapper.accountModel.getAccountList() var accountList = AccountAdapter.model.getAccountList()
if(accountList.length === 0) if(accountList.length === 0)
return return
currentAccountSettingsScrollWidget.disconnectAccountConnections() currentAccountSettingsScrollWidget.disconnectAccountConnections()
var device = ClientWrapper.avmodel.getDefaultDevice() var device = AVModel.getDefaultDevice()
if(device.length === 0){ if(device.length === 0){
ClientWrapper.avmodel.setCurrentVideoCaptureDevice(device) AVModel.setCurrentVideoCaptureDevice(device)
} }
} }
property int profileType: SettingsAdapter.getCurrentAccount_Profile_Info_Type() property int profileType: SettingsAdapter.getCurrentAccount_Profile_Info_Type()

View file

@ -48,13 +48,13 @@ ColumnLayout {
enableSDESToggle.enabled = SettingsAdapter.getAccountConfig_SRTP_Enabled() enableSDESToggle.enabled = SettingsAdapter.getAccountConfig_SRTP_Enabled()
fallbackRTPToggle.enabled = SettingsAdapter.getAccountConfig_SRTP_Enabled() fallbackRTPToggle.enabled = SettingsAdapter.getAccountConfig_SRTP_Enabled()
btnSIPCACert.text = UtilsAdapter.toFileInfoName(ClientWrapper.SettingsAdapter.getAccountConfig_TLS_CertificateListFile()) btnSIPCACert.text = UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_TLS_CertificateListFile())
btnSIPUserCert.text = UtilsAdapter.toFileInfoName(ClientWrapper.SettingsAdapter.getAccountConfig_TLS_CertificateFile()) btnSIPUserCert.text = UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_TLS_CertificateFile())
btnSIPPrivateKey.text = UtilsAdapter.toFileInfoName(ClientWrapper.SettingsAdapter.getAccountConfig_TLS_PrivateKeyFile()) btnSIPPrivateKey.text = UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_TLS_PrivateKeyFile())
lineEditSIPCertPassword.text = SettingsAdapter.getAccountConfig_TLS_Password() lineEditSIPCertPassword.text = SettingsAdapter.getAccountConfig_TLS_Password()
encryptMediaStreamsToggle.checked = SettingsAdapter.getAccountConfig_SRTP_Enabled() encryptMediaStreamsToggle.checked = SettingsAdapter.getAccountConfig_SRTP_Enabled()
enableSDESToggle.checked = (ClientWrapper.SettingsAdapter.getAccountConfig_SRTP_KeyExchange() === Account.KeyExchangeProtocol.SDES) enableSDESToggle.checked = (SettingsAdapter.getAccountConfig_SRTP_KeyExchange() === Account.KeyExchangeProtocol.SDES)
fallbackRTPToggle.checked = SettingsAdapter.getAccountConfig_SRTP_RtpFallback() fallbackRTPToggle.checked = SettingsAdapter.getAccountConfig_SRTP_RtpFallback()
encryptNegotitationToggle.checked = SettingsAdapter.getAccountConfig_TLS_Enable() encryptNegotitationToggle.checked = SettingsAdapter.getAccountConfig_TLS_Enable()
verifyIncomingCertificatesServerToogle.checked = SettingsAdapter.getAccountConfig_TLS_VerifyServer() verifyIncomingCertificatesServerToogle.checked = SettingsAdapter.getAccountConfig_TLS_VerifyServer()
@ -96,7 +96,7 @@ ColumnLayout {
updateAudioCodecs() updateAudioCodecs()
updateVideoCodecs() updateVideoCodecs()
btnRingtoneSIP.enabled = SettingsAdapter.getAccountConfig_Ringtone_RingtoneEnabled() btnRingtoneSIP.enabled = SettingsAdapter.getAccountConfig_Ringtone_RingtoneEnabled()
btnRingtoneSIP.text = UtilsAdapter.toFileInfoName(ClientWrapper.SettingsAdapter.getAccountConfig_Ringtone_RingtonePath()) btnRingtoneSIP.text = UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_Ringtone_RingtonePath())
lineEditSTUNAddressSIP.enabled = SettingsAdapter.getAccountConfig_STUN_Enabled() lineEditSTUNAddressSIP.enabled = SettingsAdapter.getAccountConfig_STUN_Enabled()
// SDP session negotiation ports // SDP session negotiation ports
@ -161,7 +161,7 @@ ColumnLayout {
// slots // slots
function audioRTPMinPortSpinBoxEditFinished(value){ function audioRTPMinPortSpinBoxEditFinished(value){
if (ClientWrapper.SettingsAdapter.getAccountConfig_Audio_AudioPortMax() < value) { if (SettingsAdapter.getAccountConfig_Audio_AudioPortMax() < value) {
audioRTPMinPortSpinBox.value = SettingsAdapter.getAccountConfig_Audio_AudioPortMin() audioRTPMinPortSpinBox.value = SettingsAdapter.getAccountConfig_Audio_AudioPortMin()
return return
} }
@ -177,7 +177,7 @@ ColumnLayout {
} }
function videoRTPMinPortSpinBoxEditFinished(value){ function videoRTPMinPortSpinBoxEditFinished(value){
if (ClientWrapper.SettingsAdapter.getAccountConfig_Video_VideoPortMax() < value) { if (SettingsAdapter.getAccountConfig_Video_VideoPortMax() < value) {
videoRTPMinPortSpinBox.value = SettingsAdapter.getAccountConfig_Video_VideoPortMin() videoRTPMinPortSpinBox.value = SettingsAdapter.getAccountConfig_Video_VideoPortMin()
return return
} }
@ -197,7 +197,7 @@ ColumnLayout {
if(url.length !== 0) { if(url.length !== 0) {
SettingsAdapter.set_RingtonePath(url) SettingsAdapter.set_RingtonePath(url)
btnRingtoneSIP.text = UtilsAdapter.toFileInfoName(url) btnRingtoneSIP.text = UtilsAdapter.toFileInfoName(url)
} else if (ClientWrapper.SettingsAdapter.getAccountConfig_Ringtone_RingtonePath().length === 0){ } else if (SettingsAdapter.getAccountConfig_Ringtone_RingtonePath().length === 0){
btnRingtoneSIP.text = qsTr("Add a custom ringtone") btnRingtoneSIP.text = qsTr("Add a custom ringtone")
} }
} }

View file

@ -52,9 +52,9 @@ ColumnLayout {
lineEditBootstrap.text = SettingsAdapter.getAccountConfig_Hostname() lineEditBootstrap.text = SettingsAdapter.getAccountConfig_Hostname()
// Security // Security
btnCACert.text = UtilsAdapter.toFileInfoName(ClientWrapper.SettingsAdapter.getAccountConfig_TLS_CertificateListFile()) btnCACert.text = UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_TLS_CertificateListFile())
btnUserCert.text = UtilsAdapter.toFileInfoName(ClientWrapper.SettingsAdapter.getAccountConfig_TLS_CertificateFile()) btnUserCert.text = UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_TLS_CertificateFile())
btnPrivateKey.text = UtilsAdapter.toFileInfoName(ClientWrapper.SettingsAdapter.getAccountConfig_TLS_PrivateKeyFile()) btnPrivateKey.text = UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_TLS_PrivateKeyFile())
// Connectivity // Connectivity
checkBoxUPnP.checked = SettingsAdapter.getAccountConfig_UpnpEnabled() checkBoxUPnP.checked = SettingsAdapter.getAccountConfig_UpnpEnabled()
@ -70,7 +70,7 @@ ColumnLayout {
updateAudioCodecs(); updateAudioCodecs();
updateVideoCodecs(); updateVideoCodecs();
btnRingtone.enabled = SettingsAdapter.getAccountConfig_Ringtone_RingtoneEnabled() btnRingtone.enabled = SettingsAdapter.getAccountConfig_Ringtone_RingtoneEnabled()
btnRingtone.text = UtilsAdapter.toFileInfoName(ClientWrapper.SettingsAdapter.getAccountConfig_Ringtone_RingtonePath()) btnRingtone.text = UtilsAdapter.toFileInfoName(SettingsAdapter.getAccountConfig_Ringtone_RingtonePath())
lineEditProxy.enabled = SettingsAdapter.getAccountConfig_ProxyEnabled() lineEditProxy.enabled = SettingsAdapter.getAccountConfig_ProxyEnabled()
lineEditSTUNAddress.enabled = SettingsAdapter.getAccountConfig_STUN_Enabled() lineEditSTUNAddress.enabled = SettingsAdapter.getAccountConfig_STUN_Enabled()
} }
@ -129,7 +129,7 @@ ColumnLayout {
if(url.length !== 0) { if(url.length !== 0) {
SettingsAdapter.set_RingtonePath(url) SettingsAdapter.set_RingtonePath(url)
btnRingtone.text = UtilsAdapter.toFileInfoName(url) btnRingtone.text = UtilsAdapter.toFileInfoName(url)
} else if (ClientWrapper.SettingsAdapter.getAccountConfig_Ringtone_RingtonePath().length === 0){ } else if (SettingsAdapter.getAccountConfig_Ringtone_RingtonePath().length === 0){
btnRingtone.text = qsTr("Add a custom ringtone") btnRingtone.text = qsTr("Add a custom ringtone")
} }
} }
@ -214,7 +214,7 @@ ColumnLayout {
id: privateKey_Dialog id: privateKey_Dialog
property string oldPath : { property string oldPath : {
return ClientWrapper.SettingsAdapter.getAccountConfig_TLS_PrivateKeyFile() return SettingsAdapter.getAccountConfig_TLS_PrivateKeyFile()
} }
property string openPath : oldPath === "" ? (UtilsAdapter.getCurrentPath() + "/ringtones/") : (UtilsAdapter.toFileAbsolutepath(oldPath)) property string openPath : oldPath === "" ? (UtilsAdapter.getCurrentPath() + "/ringtones/") : (UtilsAdapter.toFileAbsolutepath(oldPath))

View file

@ -24,6 +24,8 @@ import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.14 import QtGraphicalEffects 1.14
import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Styles 1.4
import net.jami.Models 1.0 import net.jami.Models 1.0
import net.jami.Adapters 1.0
import "../../commoncomponents" import "../../commoncomponents"
Rectangle { Rectangle {
@ -37,7 +39,7 @@ Rectangle {
signal backArrowClicked signal backArrowClicked
Connections{ Connections{
target: ClientWrapper.avmodel target: AVModel
enabled: root.visible enabled: root.visible
function onAudioMeter(id, level){ function onAudioMeter(id, level){
@ -46,7 +48,7 @@ Rectangle {
} }
Connections{ Connections{
target: ClientWrapper.renderManager target: RenderManager
enabled: root.visible enabled: root.visible
function onVideoDeviceListChanged(){ function onVideoDeviceListChanged(){
@ -75,7 +77,7 @@ Rectangle {
} }
populateVideoSettings() populateVideoSettings()
var encodeAccel = ClientWrapper.avmodel.getHardwareAcceleration() var encodeAccel = AVModel.getHardwareAcceleration()
hardwareAccelControl.checked = encodeAccel hardwareAccelControl.checked = encodeAccel
} }
@ -99,8 +101,8 @@ Rectangle {
} }
function setFormatListForCurrentDevice(){ function setFormatListForCurrentDevice(){
var device = ClientWrapper.avmodel.getCurrentVideoCaptureDevice() var device = AVModel.getCurrentVideoCaptureDevice()
if(ClientWrapper.SettingsAdapter.get_DeviceCapabilitiesSize(device) === 0){ if(SettingsAdapter.get_DeviceCapabilitiesSize(device) === 0){
return return
} }
@ -112,22 +114,22 @@ Rectangle {
} }
function startPreviewing(force = false, async = true){ function startPreviewing(force = false, async = true){
ClientWrapper.accountAdaptor.startPreviewing(force, async) AccountAdapter.startPreviewing(force, async)
previewAvailable = true previewAvailable = true
} }
function stopPreviewing(async = true){ function stopPreviewing(async = true){
ClientWrapper.accountAdaptor.stopPreviewing(async) AccountAdapter.stopPreviewing(async)
} }
function startAudioMeter(async = true){ function startAudioMeter(async = true){
audioInputMeter.start() audioInputMeter.start()
ClientWrapper.accountAdaptor.startAudioMeter(async) AccountAdapter.startAudioMeter(async)
} }
function stopAudioMeter(async = true){ function stopAudioMeter(async = true){
audioInputMeter.stop() audioInputMeter.stop()
ClientWrapper.accountAdaptor.stopAudioMeter(async) AccountAdapter.stopAudioMeter(async)
} }
// slots for av page // slots for av page
@ -138,7 +140,7 @@ Rectangle {
} }
function slotSetHardwareAccel(state){ function slotSetHardwareAccel(state){
ClientWrapper.avmodel.setHardwareAcceleration(state) AVModel.setHardwareAcceleration(state)
startPreviewing(true) startPreviewing(true)
} }
@ -146,7 +148,7 @@ Rectangle {
stopAudioMeter(false) stopAudioMeter(false)
var selectedAudioManager = audioManagerComboBox.model.data(audioManagerComboBox.model.index( var selectedAudioManager = audioManagerComboBox.model.data(audioManagerComboBox.model.index(
index, 0), AudioManagerListModel.AudioManagerID) index, 0), AudioManagerListModel.AudioManagerID)
ClientWrapper.avmodel.setAudioManager(selectedAudioManager) AVModel.setAudioManager(selectedAudioManager)
startAudioMeter(false) startAudioMeter(false)
} }
@ -154,7 +156,7 @@ Rectangle {
stopAudioMeter(false) stopAudioMeter(false)
var selectedRingtoneDeviceName = audioOutputDeviceModel.data(audioOutputDeviceModel.index( var selectedRingtoneDeviceName = audioOutputDeviceModel.data(audioOutputDeviceModel.index(
index, 0), AudioOutputDeviceModel.Device_ID) index, 0), AudioOutputDeviceModel.Device_ID)
ClientWrapper.avmodel.setRingtoneDevice(selectedRingtoneDeviceName) AVModel.setRingtoneDevice(selectedRingtoneDeviceName)
startAudioMeter(false) startAudioMeter(false)
} }
@ -162,7 +164,7 @@ Rectangle {
stopAudioMeter(false) stopAudioMeter(false)
var selectedOutputDeviceName = audioOutputDeviceModel.data(audioOutputDeviceModel.index( var selectedOutputDeviceName = audioOutputDeviceModel.data(audioOutputDeviceModel.index(
index, 0), AudioOutputDeviceModel.Device_ID) index, 0), AudioOutputDeviceModel.Device_ID)
ClientWrapper.avmodel.setOutputDevice(selectedOutputDeviceName) AVModel.setOutputDevice(selectedOutputDeviceName)
startAudioMeter(false) startAudioMeter(false)
} }
@ -171,7 +173,7 @@ Rectangle {
var selectedInputDeviceName = audioInputComboBox.model.data(audioInputComboBox.model.index( var selectedInputDeviceName = audioInputComboBox.model.data(audioInputComboBox.model.index(
index, 0), AudioInputDeviceModel.Device_ID) index, 0), AudioInputDeviceModel.Device_ID)
ClientWrapper.avmodel.setInputDevice(selectedInputDeviceName) AVModel.setInputDevice(selectedInputDeviceName)
startAudioMeter(false) startAudioMeter(false)
} }
@ -190,8 +192,8 @@ Rectangle {
return return
} }
ClientWrapper.avmodel.setCurrentVideoCaptureDevice(deviceId) AVModel.setCurrentVideoCaptureDevice(deviceId)
ClientWrapper.avmodel.setDefaultDevice(deviceId) AVModel.setDefaultDevice(deviceId)
setFormatListForCurrentDevice() setFormatListForCurrentDevice()
startPreviewing(true) startPreviewing(true)
} catch(err){console.warn(err.message)} } catch(err){console.warn(err.message)}
@ -216,7 +218,7 @@ Rectangle {
} }
try{ try{
SettingsAdapter.set_Video_Settings_Rate_And_Resolution(ClientWrapper.avmodel.getCurrentVideoCaptureDevice(),rate,resolution) SettingsAdapter.set_Video_Settings_Rate_And_Resolution(AVModel.getCurrentVideoCaptureDevice(),rate,resolution)
updatePreviewRatio(resolution) updatePreviewRatio(resolution)
} catch(error){console.warn(error.message)} } catch(error){console.warn(error.message)}
} }

View file

@ -48,12 +48,12 @@ Rectangle {
accountEnableCheckBox.checked = SettingsAdapter.get_CurrentAccountInfo_Enabled() accountEnableCheckBox.checked = SettingsAdapter.get_CurrentAccountInfo_Enabled()
displayNameLineEdit.text = SettingsAdapter.getCurrentAccount_Profile_Info_Alias() displayNameLineEdit.text = SettingsAdapter.getCurrentAccount_Profile_Info_Alias()
var showLocalAccountConfig = (ClientWrapper.SettingsAdapter.getAccountConfig_Manageruri() === "") var showLocalAccountConfig = (SettingsAdapter.getAccountConfig_Manageruri() === "")
passwdPushButton.visible = showLocalAccountConfig passwdPushButton.visible = showLocalAccountConfig
btnExportAccount.visible = showLocalAccountConfig btnExportAccount.visible = showLocalAccountConfig
linkDevPushButton.visible = showLocalAccountConfig linkDevPushButton.visible = showLocalAccountConfig
registeredIdNeedsSet = (ClientWrapper.SettingsAdapter.get_CurrentAccountInfo_RegisteredName() === "") registeredIdNeedsSet = (SettingsAdapter.get_CurrentAccountInfo_RegisteredName() === "")
if(!registeredIdNeedsSet){ if(!registeredIdNeedsSet){
currentRegisteredID.text = SettingsAdapter.get_CurrentAccountInfo_RegisteredName() currentRegisteredID.text = SettingsAdapter.get_CurrentAccountInfo_RegisteredName()
@ -111,8 +111,8 @@ Rectangle {
Connections { Connections {
id: accountConnections_ContactModel id: accountConnections_ContactModel
target: ClientWrapper.contactModel target: AccountAdapter.contactModel
enabled: root.visible enabled: accountViewRect.visible
function onModelUpdated(uri, needsSorted) { function onModelUpdated(uri, needsSorted) {
updateAndShowBannedContactsSlot() updateAndShowBannedContactsSlot()
@ -129,8 +129,8 @@ Rectangle {
Connections { Connections {
id: accountConnections_DeviceModel id: accountConnections_DeviceModel
target: ClientWrapper.deviceModel target: AccountAdapter.deviceModel
enabled: root.visible enabled: accountViewRect.visible
function onDeviceAdded(id) { function onDeviceAdded(id) {
updateAndShowDevicesSlot() updateAndShowDevicesSlot()
@ -146,7 +146,7 @@ Rectangle {
} }
function setAccEnableSlot(state) { function setAccEnableSlot(state) {
ClientWrapper.accountModel.setAccountEnabled(UtilsAdapter.getCurrAccId(), state) AccountAdapter.model.setAccountEnabled(UtilsAdapter.getCurrAccId(), state)
} }
// JamiFileDialog for exporting account // JamiFileDialog for exporting account
@ -164,12 +164,12 @@ Rectangle {
onAccepted: { onAccepted: {
// is there password? If so, go to password dialog, else, go to following directly // is there password? If so, go to password dialog, else, go to following directly
var exportPath = UtilsAdapter.getAbsPath(file.toString()) var exportPath = UtilsAdapter.getAbsPath(file.toString())
if (ClientWrapper.accountAdaptor.hasPassword()) { if (AccountAdapter.hasPassword()) {
passwordDialog.openDialog(PasswordDialog.ExportAccount,exportPath) passwordDialog.openDialog(PasswordDialog.ExportAccount,exportPath)
return return
} else { } else {
if (exportPath.length > 0) { if (exportPath.length > 0) {
var isSuccessful = ClientWrapper.accountModel.exportToFile(UtilsAdapter.getCurrAccId(), exportPath,"") var isSuccessful = AccountAdapter.model.exportToFile(UtilsAdapter.getCurrAccId(), exportPath,"")
var title = isSuccessful ? qsTr("Success") : qsTr("Error") var title = isSuccessful ? qsTr("Success") : qsTr("Error")
var iconMode = isSuccessful ? StandardIcon.Information : StandardIcon.Critical var iconMode = isSuccessful ? StandardIcon.Information : StandardIcon.Critical
var info = isSuccessful ? qsTr("Export Successful") : qsTr("Export Failed") var info = isSuccessful ? qsTr("Export Successful") : qsTr("Export Failed")
@ -212,7 +212,7 @@ Rectangle {
} }
function passwordClicked() { function passwordClicked() {
if (ClientWrapper.accountAdaptor.hasPassword()){ if (AccountAdapter.hasPassword()){
passwordDialog.openDialog(PasswordDialog.ChangePassword) passwordDialog.openDialog(PasswordDialog.ChangePassword)
} else { } else {
passwordDialog.openDialog(PasswordDialog.SetPassword) passwordDialog.openDialog(PasswordDialog.SetPassword)
@ -229,7 +229,7 @@ Rectangle {
anchors.centerIn: parent.Center anchors.centerIn: parent.Center
onAccepted: { onAccepted: {
ClientWrapper.accountAdaptor.setSelectedConvId() AccountAdapter.setSelectedConvId()
if(UtilsAdapter.getAccountListSize() > 0){ if(UtilsAdapter.getAccountListSize() > 0){
navigateToMainView() navigateToMainView()
@ -289,8 +289,8 @@ Rectangle {
} }
function removeDeviceSlot(index){ function removeDeviceSlot(index){
var idOfDevice = settingsListView.model.data(settingsListView.model.index(index,0), DeviceItemListModel.DeviceID) var idOfDevice = deviceItemListModel.data(deviceItemListModel.index(index,0), DeviceItemListModel.DeviceID)
if(ClientWrapper.accountAdaptor.hasPassword()){ if(AccountAdapter.hasPassword()){
revokeDevicePasswordDialog.openRevokeDeviceDialog(idOfDevice) revokeDevicePasswordDialog.openRevokeDeviceDialog(idOfDevice)
} else { } else {
revokeDeviceMessageBox.idOfDev = idOfDevice revokeDeviceMessageBox.idOfDev = idOfDevice
@ -299,7 +299,7 @@ Rectangle {
} }
function revokeDeviceWithIDAndPassword(idDevice, password){ function revokeDeviceWithIDAndPassword(idDevice, password){
ClientWrapper.deviceModel.revokeDevice(idDevice, password) AccountAdapter.deviceModel.revokeDevice(idDevice, password)
updateAndShowDevicesSlot() updateAndShowDevicesSlot()
} }
@ -313,7 +313,7 @@ Rectangle {
} }
function updateAndShowDevicesSlot() { function updateAndShowDevicesSlot() {
if(ClientWrapper.SettingsAdapter.getAccountConfig_Manageruri() === ""){ if(SettingsAdapter.getAccountConfig_Manageruri() === ""){
linkDevPushButton.visible = true linkDevPushButton.visible = true
} }
@ -450,7 +450,7 @@ Rectangle {
padding: 8 padding: 8
onEditingFinished: { onEditingFinished: {
ClientWrapper.accountAdaptor.setCurrAccDisplayName( AccountAdapter.setCurrAccDisplayName(
displayNameLineEdit.text) displayNameLineEdit.text)
} }
} }
@ -525,7 +525,7 @@ Rectangle {
elide: Text.ElideRight elide: Text.ElideRight
elideWidth: root.width - idLabel.width -JamiTheme.preferredMarginSize*4 elideWidth: root.width - idLabel.width -JamiTheme.preferredMarginSize*4
text: ClientWrapper.SettingsAdapter.getCurrentAccount_Profile_Info_Uri() text: SettingsAdapter.getCurrentAccount_Profile_Info_Uri()
} }
} }
} }
@ -556,7 +556,7 @@ Rectangle {
qsTr("Type here to register a username") : "" qsTr("Type here to register a username") : ""
text: { text: {
if (!registeredIdNeedsSet) if (!registeredIdNeedsSet)
return ClientWrapper.SettingsAdapter.get_CurrentAccountInfo_RegisteredName() return SettingsAdapter.get_CurrentAccountInfo_RegisteredName()
else else
return "" return ""
} }
@ -615,10 +615,10 @@ Rectangle {
pressedColor: JamiTheme.buttonTintedBlackPressed pressedColor: JamiTheme.buttonTintedBlackPressed
outlined: true outlined: true
toolTipText: ClientWrapper.accountAdaptor.hasPassword() ? toolTipText: AccountAdapter.hasPassword() ?
qsTr("Change the current password") : qsTr("Change the current password") :
qsTr("Currently no password, press this button to set a password") qsTr("Currently no password, press this button to set a password")
text: ClientWrapper.accountAdaptor.hasPassword() ? qsTr("Change Password") : text: AccountAdapter.hasPassword() ? qsTr("Change Password") :
qsTr("Set Password") qsTr("Set Password")
source: "qrc:/images/icons/round-edit-24px.svg" source: "qrc:/images/icons/round-edit-24px.svg"

View file

@ -23,6 +23,7 @@ import QtQuick.Controls.Universal 2.12
import QtQuick.Layouts 1.3 import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.14 import QtGraphicalEffects 1.14
import net.jami.Models 1.0 import net.jami.Models 1.0
import net.jami.Adapters 1.0
import "../../commoncomponents" import "../../commoncomponents"
@ -67,7 +68,7 @@ Rectangle {
// slots // slots
function setAccEnableSlot(state) { function setAccEnableSlot(state) {
ClientWrapper.accountModel.setAccountEnabled(UtilsAdapter.getCurrAccId(), state) AccountAdapter.model.setAccountEnabled(UtilsAdapter.getCurrAccId(), state)
} }
function delAccountSlot() { function delAccountSlot() {
@ -80,7 +81,7 @@ Rectangle {
anchors.centerIn: parent.Center anchors.centerIn: parent.Center
onAccepted: { onAccepted: {
ClientWrapper.accountAdaptor.setSelectedConvId() AccountAdapter.setSelectedConvId()
if(UtilsAdapter.getAccountListSize() > 0){ if(UtilsAdapter.getAccountListSize() > 0){
navigateToMainView() navigateToMainView()
@ -212,7 +213,7 @@ Rectangle {
padding: 8 padding: 8
onEditingFinished: { onEditingFinished: {
ClientWrapper.accountAdaptor.setCurrAccDisplayName( AccountAdapter.setCurrAccDisplayName(
displaySIPNameLineEdit.text) displaySIPNameLineEdit.text)
} }
} }

View file

@ -37,12 +37,12 @@ Rectangle {
applicationOnStartUpCheckBox.checked = UtilsAdapter.checkStartupLink() applicationOnStartUpCheckBox.checked = UtilsAdapter.checkStartupLink()
notificationCheckBox.checked = SettingsAdapter.getAppValue(Settings.EnableNotifications) notificationCheckBox.checked = SettingsAdapter.getAppValue(Settings.EnableNotifications)
alwaysRecordingCheckBox.checked = ClientWrapper.avmodel.getAlwaysRecord() alwaysRecordingCheckBox.checked = AVModel.getAlwaysRecord()
recordPreviewCheckBox.checked = ClientWrapper.avmodel.getRecordPreview() recordPreviewCheckBox.checked = AVModel.getRecordPreview()
recordQualityValueLabel.text = UtilsAdapter.getRecordQualityString(ClientWrapper.avmodel.getRecordQuality() / 100) recordQualityValueLabel.text = UtilsAdapter.getRecordQualityString(AVModel.getRecordQuality() / 100)
recordQualitySlider.value = ClientWrapper.avmodel.getRecordQuality() / 100 recordQualitySlider.value = AVModel.getRecordQuality() / 100
ClientWrapper.avmodel.setRecordPath(ClientWrapper.SettingsAdapter.getDir_Document()) AVModel.setRecordPath(SettingsAdapter.getDir_Document())
autoUpdateCheckBox.checked = SettingsAdapter.getAppValue(Settings.Key.AutoUpdate) autoUpdateCheckBox.checked = SettingsAdapter.getAppValue(Settings.Key.AutoUpdate)
} }
@ -64,11 +64,11 @@ Rectangle {
} }
function slotAlwaysRecordingClicked(state){ function slotAlwaysRecordingClicked(state){
ClientWrapper.avmodel.setAlwaysRecord(state) AVModel.setAlwaysRecord(state)
} }
function slotRecordPreviewClicked(state){ function slotRecordPreviewClicked(state){
ClientWrapper.avmodel.setRecordPreview(state) AVModel.setRecordPreview(state)
} }
function slotRecordQualitySliderValueChanged(value){ function slotRecordQualitySliderValueChanged(value){
@ -88,7 +88,7 @@ Rectangle {
function slotRecordQualitySliderSliderReleased(){ function slotRecordQualitySliderSliderReleased(){
var value = recordQualitySlider.value var value = recordQualitySlider.value
ClientWrapper.avmodel.setRecordQuality(value * 100) AVModel.setRecordQuality(value * 100)
} }
function openDownloadFolderSlot(){ function openDownloadFolderSlot(){
@ -146,8 +146,8 @@ Rectangle {
onRecordPathChanged: { onRecordPathChanged: {
if(recordPath === "") return if(recordPath === "") return
if(ClientWrapper.avmodel){ if(AVModel){
ClientWrapper.avmodel.setRecordPath(recordPath) AVModel.setRecordPath(recordPath)
} }
} }

View file

@ -21,6 +21,7 @@ import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14 import QtQuick.Layouts 1.14
import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Styles 1.4
import net.jami.Models 1.0 import net.jami.Models 1.0
import net.jami.Adapters 1.0
import "../../commoncomponents" import "../../commoncomponents"
@ -31,7 +32,7 @@ Dialog {
infoLabel.text = qsTr("This pin and the account password should be entered in your device within 10 minutes.") infoLabel.text = qsTr("This pin and the account password should be entered in your device within 10 minutes.")
passwordEdit.clear() passwordEdit.clear()
root.open() root.open()
if(ClientWrapper.accountAdaptor.hasPassword()) { if(AccountAdapter.hasPassword()) {
stackedWidget.currentIndex = 0 stackedWidget.currentIndex = 0
} else { } else {
setGeneratingPage() setGeneratingPage()
@ -39,7 +40,7 @@ Dialog {
} }
function setGeneratingPage() { function setGeneratingPage() {
if(passwordEdit.length === 0 && ClientWrapper.accountAdaptor.hasPassword()){ if(passwordEdit.length === 0 && AccountAdapter.hasPassword()){
setExportPage(NameDirectory.ExportOnRingStatus.WRONG_PASSWORD, "") setExportPage(NameDirectory.ExportOnRingStatus.WRONG_PASSWORD, "")
return return
} }
@ -51,7 +52,7 @@ Dialog {
} }
function slotExportOnRing(){ function slotExportOnRing(){
ClientWrapper.accountModel.exportOnRing(UtilsAdapter.getCurrAccId(),passwordEdit.text) AccountAdapter.model.exportOnRing(UtilsAdapter.getCurrAccId(),passwordEdit.text)
} }
Timer{ Timer{
@ -112,7 +113,7 @@ Dialog {
property int exportTimeout : 20000 property int exportTimeout : 20000
Connections { Connections {
target: ClientWrapper.nameDirectory target: NameDirectory
function onExportOnRingEnded(status, pin) { function onExportOnRingEnded(status, pin) {
setExportPage(status, pin) setExportPage(status, pin)

View file

@ -21,6 +21,7 @@ import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14 import QtQuick.Layouts 1.14
import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Styles 1.4
import net.jami.Models 1.0 import net.jami.Models 1.0
import net.jami.Adapters 1.0
import "../../commoncomponents" import "../../commoncomponents"
@ -33,7 +34,7 @@ Dialog {
registerdName = registerNameIn registerdName = registerNameIn
lblRegistrationError.text = qsTr("Something went wrong") lblRegistrationError.text = qsTr("Something went wrong")
passwordEdit.clear() passwordEdit.clear()
if(ClientWrapper.accountAdaptor.hasPassword()){ if(AccountAdapter.hasPassword()){
stackedWidget.currentIndex = 0 stackedWidget.currentIndex = 0
} else { } else {
startRegistration() startRegistration()
@ -49,7 +50,7 @@ Dialog {
function slotStartNameRegistration(){ function slotStartNameRegistration(){
var password = passwordEdit.text var password = passwordEdit.text
ClientWrapper.accountModel.registerName(UtilsAdapter.getCurrAccId(), password, registerdName) AccountAdapter.model.registerName(UtilsAdapter.getCurrAccId(), password, registerdName)
} }
function startSpinner(){ function startSpinner(){
@ -70,7 +71,7 @@ Dialog {
} }
Connections{ Connections{
target: ClientWrapper.nameDirectory target: NameDirectory
function onNameRegistrationEnded(status, name){ function onNameRegistrationEnded(status, name){
if(status === NameDirectory.RegisterNameStatus.SUCCESS){ if(status === NameDirectory.RegisterNameStatus.SUCCESS){

View file

@ -49,11 +49,11 @@ Rectangle {
function resetPlugin(){ function resetPlugin(){
if (isLoaded){ if (isLoaded){
ClientWrapper.pluginModel.unloadPlugin(pluginId) PluginModel.unloadPlugin(pluginId)
ClientWrapper.pluginModel.resetPluginPreferencesValues(pluginId) PluginModel.resetPluginPreferencesValues(pluginId)
ClientWrapper.pluginModel.loadPlugin(pluginId) PluginModel.loadPlugin(pluginId)
} else { } else {
ClientWrapper.pluginModel.resetPluginPreferencesValues(pluginId) PluginModel.resetPluginPreferencesValues(pluginId)
} }
pluginPreferenceView.model = PluginAdapter.getPluginPreferencesModel(pluginId) pluginPreferenceView.model = PluginAdapter.getPluginPreferencesModel(pluginId)
} }
@ -63,18 +63,18 @@ Rectangle {
} }
function uninstallPlugin(){ function uninstallPlugin(){
ClientWrapper.pluginModel.uninstallPlugin(pluginId) PluginModel.uninstallPlugin(pluginId)
} }
function setPreference(pluginId, preferenceKey, preferenceNewValue) function setPreference(pluginId, preferenceKey, preferenceNewValue)
{ {
if (isLoaded){ if (isLoaded){
ClientWrapper.pluginModel.unloadPlugin(pluginId) PluginModel.unloadPlugin(pluginId)
ClientWrapper.pluginModel.setPluginPreference(pluginId, preferenceKey, preferenceNewValue) PluginModel.setPluginPreference(pluginId, preferenceKey, preferenceNewValue)
ClientWrapper.pluginModel.loadPlugin(pluginId) PluginModel.loadPlugin(pluginId)
} }
else { else {
ClientWrapper.pluginModel.setPluginPreference(pluginId, preferenceKey, preferenceNewValue) PluginModel.setPluginPreference(pluginId, preferenceKey, preferenceNewValue)
} }
} }

View file

@ -40,9 +40,9 @@ Rectangle {
function loadPluginSlot(pluginId, isLoaded){ function loadPluginSlot(pluginId, isLoaded){
var loaded = false var loaded = false
if (isLoaded) if (isLoaded)
ClientWrapper.pluginModel.unloadPlugin(pluginId) PluginModel.unloadPlugin(pluginId)
else else
loaded = ClientWrapper.pluginModel.loadPlugin(pluginId) loaded = PluginModel.loadPlugin(pluginId)
if(pluginListPreferencesView.pluginId === pluginId) if(pluginListPreferencesView.pluginId === pluginId)
pluginListPreferencesView.isLoaded = loaded pluginListPreferencesView.isLoaded = loaded
} }
@ -78,7 +78,7 @@ Rectangle {
onAccepted: { onAccepted: {
var url = UtilsAdapter.getAbsPath(file.toString()) var url = UtilsAdapter.getAbsPath(file.toString())
ClientWrapper.pluginModel.installPlugin(url, true) PluginModel.installPlugin(url, true)
} }
} }

View file

@ -31,12 +31,12 @@ Rectangle {
function populatePluginSettings(){ function populatePluginSettings(){
// settings // settings
enabledplugin.checked = ClientWrapper.pluginModel.getPluginsEnabled() enabledplugin.checked = PluginModel.getPluginsEnabled()
pluginListSettingsView.visible = enabledplugin.checked pluginListSettingsView.visible = enabledplugin.checked
} }
function slotSetPluginEnabled(state){ function slotSetPluginEnabled(state){
ClientWrapper.pluginModel.setPluginsEnabled(state) PluginModel.setPluginsEnabled(state)
} }
signal backArrowClicked signal backArrowClicked
@ -110,7 +110,7 @@ Rectangle {
pluginListSettingsView.visible = checked pluginListSettingsView.visible = checked
if (!pluginListSettingsView.visible) { if (!pluginListSettingsView.visible) {
ClientWrapper.pluginModel.toggleCallMediaHandler("", true) PluginModel.toggleCallMediaHandler("", true)
pluginListSettingsView.hidePreferences() pluginListSettingsView.hidePreferences()
} }
} }

View file

@ -118,6 +118,15 @@ UtilsAdapter::getBestName(const QString &accountId, const QString &uid)
return Utils::bestNameForConversation(convModel->getConversationForUID(uid), *convModel); return Utils::bestNameForConversation(convModel->getConversationForUID(uid), *convModel);
} }
QString
UtilsAdapter::getBestId(const QString& accountId)
{
if (accountId.isEmpty())
return {};
auto& accountInfo = LRCInstance::getAccountInfo(accountId);
return Utils::bestIdForAccount(accountInfo);
}
const QString const QString
UtilsAdapter::getBestId(const QString& accountId, const QString& uid) UtilsAdapter::getBestId(const QString& accountId, const QString& uid)
{ {
@ -249,7 +258,6 @@ UtilsAdapter::getCallStatusStr(int statusInt)
return lrc::api::call::to_string(status); return lrc::api::call::to_string(status);
} }
// returns true if name is valid registered name // returns true if name is valid registered name
bool bool
UtilsAdapter::validateRegNameForm(const QString& regName) UtilsAdapter::validateRegNameForm(const QString& regName)

View file

@ -39,26 +39,22 @@ public:
Q_INVOKABLE const QString getVersionStr(); Q_INVOKABLE const QString getVersionStr();
Q_INVOKABLE void setText(QString text); Q_INVOKABLE void setText(QString text);
Q_INVOKABLE const QString qStringFromFile(const QString& filename); Q_INVOKABLE const QString qStringFromFile(const QString& filename);
Q_INVOKABLE const QString getStyleSheet(const QString &name, Q_INVOKABLE const QString getStyleSheet(const QString& name, const QString& source);
const QString &source);
Q_INVOKABLE const QString getCachePath(); Q_INVOKABLE const QString getCachePath();
Q_INVOKABLE bool createStartupLink(); Q_INVOKABLE bool createStartupLink();
Q_INVOKABLE QString GetRingtonePath(); Q_INVOKABLE QString GetRingtonePath();
Q_INVOKABLE bool checkStartupLink(); Q_INVOKABLE bool checkStartupLink();
Q_INVOKABLE const QString getContactImageString(const QString &accountId, Q_INVOKABLE const QString getContactImageString(const QString& accountId, const QString& uid);
const QString &uid);
Q_INVOKABLE void removeConversation(const QString& accountId, Q_INVOKABLE void removeConversation(const QString& accountId,
const QString& uid, const QString& uid,
bool banContact = false); bool banContact = false);
Q_INVOKABLE void clearConversationHistory(const QString &accountId, Q_INVOKABLE void clearConversationHistory(const QString& accountId, const QString& uid);
const QString &uid);
Q_INVOKABLE void setConversationFilter(const QString& filter); Q_INVOKABLE void setConversationFilter(const QString& filter);
Q_INVOKABLE int getTotalUnreadMessages(); Q_INVOKABLE int getTotalUnreadMessages();
Q_INVOKABLE int getTotalPendingRequest(); Q_INVOKABLE int getTotalPendingRequest();
Q_INVOKABLE const QString getBestName(const QString &accountId, Q_INVOKABLE const QString getBestName(const QString& accountId, const QString& uid);
const QString &uid); Q_INVOKABLE QString getBestId(const QString& accountId);
Q_INVOKABLE const QString getBestId(const QString &accountId, Q_INVOKABLE const QString getBestId(const QString& accountId, const QString& uid);
const QString &uid);
Q_INVOKABLE const QString getCurrAccId(); Q_INVOKABLE const QString getCurrAccId();
Q_INVOKABLE const QString getCurrConvId(); Q_INVOKABLE const QString getCurrConvId();
Q_INVOKABLE void makePermanentCurrentConv(); Q_INVOKABLE void makePermanentCurrentConv();

View file

@ -76,11 +76,11 @@ Rectangle {
} }
Connections{ Connections{
target: ClientWrapper.accountAdaptor target: AccountAdapter
function onAccountAdded(showBackUp, index) { function onAccountAdded(showBackUp, index) {
addedAccountIndex = index addedAccountIndex = index
ClientWrapper.accountAdaptor.accountChanged(index) AccountAdapter.accountChanged(index)
if (showProfile) { if (showProfile) {
changePageQML(WizardView.WizardViewPageIndex.PROFILEPAGE) changePageQML(WizardView.WizardViewPageIndex.PROFILEPAGE)
profilePage.readyToSaveDetails() profilePage.readyToSaveDetails()
@ -150,7 +150,7 @@ Rectangle {
var info = success ? qsTr("Export Successful") : qsTr( var info = success ? qsTr("Export Successful") : qsTr(
"Export Failed") "Export Failed")
ClientWrapper.accountAdaptor.passwordSetStatusMessageBox(success, AccountAdapter.passwordSetStatusMessageBox(success,
title, info) title, info)
if (success) { if (success) {
console.log("Account Export Succeed") console.log("Account Export Succeed")
@ -190,7 +190,7 @@ Rectangle {
onCreateAccount: { onCreateAccount: {
inputParaObject = {} inputParaObject = {}
inputParaObject["password"] = text_passwordEditAlias inputParaObject["password"] = text_passwordEditAlias
ClientWrapper.accountAdaptor.createJamiAccount( AccountAdapter.createJamiAccount(
createAccountPage.text_usernameEditAlias, createAccountPage.text_usernameEditAlias,
inputParaObject, inputParaObject,
createAccountPage.boothImgBase64, createAccountPage.boothImgBase64,
@ -220,7 +220,7 @@ Rectangle {
inputParaObject["proxy"] = createSIPAccountPage.text_sipProxyEditAlias inputParaObject["proxy"] = createSIPAccountPage.text_sipProxyEditAlias
createSIPAccountPage.clearAllTextFields() createSIPAccountPage.clearAllTextFields()
ClientWrapper.accountAdaptor.createSIPAccount(inputParaObject, "") AccountAdapter.createSIPAccount(inputParaObject, "")
showBackUp = false showBackUp = false
showBottom = false showBottom = false
changePageQML(WizardView.WizardViewPageIndex.PROFILEPAGE) changePageQML(WizardView.WizardViewPageIndex.PROFILEPAGE)
@ -242,7 +242,7 @@ Rectangle {
showBackUp = false showBackUp = false
showBottom = false showBottom = false
showProfile = true showProfile = true
ClientWrapper.accountAdaptor.createJamiAccount( AccountAdapter.createJamiAccount(
"", inputParaObject, "", false) "", inputParaObject, "", false)
} }
} }
@ -257,13 +257,13 @@ Rectangle {
onExport_Btn_FileDialogAccepted: { onExport_Btn_FileDialogAccepted: {
if (accepted) { if (accepted) {
// is there password? If so, go to password dialog, else, go to following directly // is there password? If so, go to password dialog, else, go to following directly
if (ClientWrapper.accountAdaptor.hasPassword()) { if (AccountAdapter.hasPassword()) {
passwordDialog.path = UtilsAdapter.getAbsPath(folderDir) passwordDialog.path = UtilsAdapter.getAbsPath(folderDir)
passwordDialog.open() passwordDialog.open()
return return
} else { } else {
if (folderDir.length > 0) { if (folderDir.length > 0) {
ClientWrapper.accountAdaptor.exportToFile( AccountAdapter.exportToFile(
UtilsAdapter.getCurrAccId(), UtilsAdapter.getCurrAccId(),
UtilsAdapter.getAbsPath(folderDir)) UtilsAdapter.getAbsPath(folderDir))
} }
@ -295,7 +295,7 @@ Rectangle {
showProfile = true showProfile = true
showBackUp = false showBackUp = false
showBottom = false showBottom = false
ClientWrapper.accountAdaptor.createJamiAccount( AccountAdapter.createJamiAccount(
"", inputParaObject, "", false) "", inputParaObject, "", false)
} }
} }
@ -311,7 +311,7 @@ Rectangle {
= connectToAccountManagerPage.text_passwordManagerEditAlias = connectToAccountManagerPage.text_passwordManagerEditAlias
inputParaObject["manager"] inputParaObject["manager"]
= connectToAccountManagerPage.text_accountManagerEditAlias = connectToAccountManagerPage.text_accountManagerEditAlias
ClientWrapper.accountAdaptor.createJAMSAccount(inputParaObject) AccountAdapter.createJAMSAccount(inputParaObject)
} }
onLeavePage: { onLeavePage: {
@ -333,7 +333,7 @@ Rectangle {
onSaveProfile: { onSaveProfile: {
SettingsAdapter.setCurrAccAvatar(profilePage.boothImgBase64) SettingsAdapter.setCurrAccAvatar(profilePage.boothImgBase64)
ClientWrapper.accountAdaptor.setCurrAccDisplayName(profilePage.displayName) AccountAdapter.setCurrAccDisplayName(profilePage.displayName)
leave() leave()
} }

View file

@ -210,7 +210,7 @@ Rectangle {
anchors.margins: 20 anchors.margins: 20
Connections { Connections {
target: ClientWrapper.lrcInstance target: LRCInstance
function onAccountListChanged() { function onAccountListChanged() {
backButton.visible = UtilsAdapter.getAccountListSize() backButton.visible = UtilsAdapter.getAccountListSize()