mainview: support close to systray

- Introduces a C++/Qml common mechanic for accessing system settings
- Refactors a good chunk of application wide settings management code
- Refactors the onboarding and quit-suppression logic
- Makes a first stab at cleaning the Qml object registration
- Removes some 'ClientWrapper' use
- Fixes some file name spelling errors and inconsistencies

Gitlab: #51
Gitlab: #53
Change-Id: I3dd1085aca72a38827ec004e347bd91106be2bcb
This commit is contained in:
Andreas Traczyk
2020-09-01 14:31:31 -04:00
committed by Sébastien Blin
parent 4903973b23
commit 84dec083e2
31 changed files with 923 additions and 846 deletions

View File

@@ -6,7 +6,7 @@ win32-msvc {
CONFIG += suppress_vcproj_warnings c++17 qtquickcompiler CONFIG += suppress_vcproj_warnings c++17 qtquickcompiler
QTQUICK_COMPILER_SKIPPED_RESOURCES += ./ressources.qrc QTQUICK_COMPILER_SKIPPED_RESOURCES += ./resources.qrc
# compiler options # compiler options
QMAKE_CXXFLAGS += /wd"4068" /wd"4099" /wd"4189" /wd"4267" /wd"4577" /wd"4467" /wd"4715" /wd"4828" QMAKE_CXXFLAGS += /wd"4068" /wd"4099" /wd"4189" /wd"4267" /wd"4577" /wd"4467" /wd"4715" /wd"4828"
@@ -118,7 +118,7 @@ HEADERS += ./src/smartlistmodel.h \
./src/runguard.h \ ./src/runguard.h \
./src/lrcinstance.h \ ./src/lrcinstance.h \
./src/globalsystemtray.h \ ./src/globalsystemtray.h \
./src/settingskey.h \ ./src/appsettingsmanager.h \
./src/webchathelpers.h \ ./src/webchathelpers.h \
./src/pixbufmanipulator.h \ ./src/pixbufmanipulator.h \
./src/rendermanager.h \ ./src/rendermanager.h \
@@ -137,7 +137,7 @@ HEADERS += ./src/smartlistmodel.h \
./src/avadapter.h \ ./src/avadapter.h \
./src/contactadapter.h \ ./src/contactadapter.h \
./src/mediahandleradapter.h \ ./src/mediahandleradapter.h \
./src/settingsadaptor.h \ ./src/settingsadapter.h \
./src/deviceitemlistmodel.h \ ./src/deviceitemlistmodel.h \
./src/pluginitemlistmodel.h \ ./src/pluginitemlistmodel.h \
./src/mediahandleritemlistmodel.h \ ./src/mediahandleritemlistmodel.h \
@@ -153,7 +153,8 @@ HEADERS += ./src/smartlistmodel.h \
./src/mediahandlerlistpreferencemodel.h \ ./src/mediahandlerlistpreferencemodel.h \
./src/videoformatfpsmodel.h \ ./src/videoformatfpsmodel.h \
./src/videoformatresolutionmodel.h \ ./src/videoformatresolutionmodel.h \
./src/audiomanagerlistmodel.h ./src/audiomanagerlistmodel.h \
src/qmlregister.h
SOURCES += ./src/bannedlistmodel.cpp \ SOURCES += ./src/bannedlistmodel.cpp \
./src/accountlistmodel.cpp \ ./src/accountlistmodel.cpp \
@@ -177,7 +178,7 @@ SOURCES += ./src/bannedlistmodel.cpp \
./src/avadapter.cpp \ ./src/avadapter.cpp \
./src/contactadapter.cpp \ ./src/contactadapter.cpp \
./src/mediahandleradapter.cpp \ ./src/mediahandleradapter.cpp \
./src/settingsadaptor.cpp \ ./src/settingsadapter.cpp \
./src/deviceitemlistmodel.cpp \ ./src/deviceitemlistmodel.cpp \
./src/pluginitemlistmodel.cpp \ ./src/pluginitemlistmodel.cpp \
./src/mediahandleritemlistmodel.cpp \ ./src/mediahandleritemlistmodel.cpp \
@@ -193,7 +194,8 @@ SOURCES += ./src/bannedlistmodel.cpp \
./src/mediahandlerlistpreferencemodel.cpp \ ./src/mediahandlerlistpreferencemodel.cpp \
./src/videoformatfpsmodel.cpp \ ./src/videoformatfpsmodel.cpp \
./src/videoformatresolutionmodel.cpp \ ./src/videoformatresolutionmodel.cpp \
./src/audiomanagerlistmodel.cpp ./src/audiomanagerlistmodel.cpp \
src/qmlregister.cpp
RESOURCES += ./ressources.qrc \ RESOURCES += ./resources.qrc \
./qml.qrc ./qml.qrc

View File

@@ -5,13 +5,15 @@ import QtQuick.Layouts 1.14
import QtQuick.Controls.Universal 2.12 import QtQuick.Controls.Universal 2.12
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 net.jami.Enums 1.0
import "mainview" import "mainview"
import "wizardview" import "wizardview"
import "commoncomponents" import "commoncomponents"
ApplicationWindow { ApplicationWindow {
id: mainApplicationWindow id: root
AccountMigrationDialog{ AccountMigrationDialog{
id: accountMigrationDialog id: accountMigrationDialog
@@ -23,6 +25,21 @@ ApplicationWindow {
} }
} }
function close() {
// If we're in the onboarding wizard or 'MinimizeOnClose'
// is set, then we can quit
if (!SettingsAdapter.getAppValue(Settings.MinimizeOnClose) ||
!ClientWrapper.utilsAdaptor.getAccountListSize()) {
Qt.quit()
} else {
// hide to the systray
if (mainViewLoader.item)
mainViewLoader.item.hide()
else
wizardView.hide()
}
}
function slotNewAccountAdded() { function slotNewAccountAdded() {
if(mainViewLoader.newAddedAccountIndex !== -1) if(mainViewLoader.newAddedAccountIndex !== -1)
mainViewLoader.item.newAccountAdded(mainViewLoader.newAddedAccountIndex) mainViewLoader.item.newAccountAdded(mainViewLoader.newAddedAccountIndex)
@@ -60,7 +77,7 @@ ApplicationWindow {
target: mainViewLoader.item target: mainViewLoader.item
function onCloseApp() { function onCloseApp() {
Qt.quit() root.close()
} }
function onNoAccountIsAvailable() { function onNoAccountIsAvailable() {
@@ -98,14 +115,15 @@ ApplicationWindow {
onWizardViewIsClosed: parent.close() onWizardViewIsClosed: parent.close()
} }
// @disable-check M16
onClosing: { onClosing: {
if (mainViewLoader.source.toString() !== "qrc:/src/mainview/MainView.qml") { if (mainViewLoader.source.toString() !== "qrc:/src/mainview/MainView.qml") {
Qt.quit() root.close()
} }
} }
// @enable-check M16
} }
Component.onCompleted: { Component.onCompleted: {
if(!startAccountMigration()){ if(!startAccountMigration()){
startClientByMainview() startClientByMainview()
@@ -113,10 +131,9 @@ ApplicationWindow {
} }
overlay.modal: ColorOverlay { overlay.modal: ColorOverlay {
source: mainApplicationWindow.contentItem source: root.contentItem
color: "transparent" color: "transparent"
/* /*
* Color animation for overlay when pop up is shown. * Color animation for overlay when pop up is shown.
*/ */
@@ -128,6 +145,7 @@ ApplicationWindow {
Connections { Connections {
target: ClientWrapper.lrcInstance target: ClientWrapper.lrcInstance
onRestoreAppRequested: { onRestoreAppRequested: {
if (mainViewLoader.item) if (mainViewLoader.item)
mainViewLoader.item.show() mainViewLoader.item.show()

View File

@@ -82,12 +82,8 @@ 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) {
QSettings qSettings("jami.net", "Jami"); auto showBackup = isCreating &&
if (not qSettings.contains(SettingsKey::neverShowMeAgain)) { !AppSettingsManager::getValue(Settings::Key::NeverShowMeAgain).toBool();
qSettings.setValue(SettingsKey::neverShowMeAgain, false);
}
auto showBackup = isCreating && !settings.value(SettingsKey::neverShowMeAgain).toBool();
if (!registeredName.isEmpty()) { if (!registeredName.isEmpty()) {
Utils::oneShotConnect(&LRCInstance::accountModel(), Utils::oneShotConnect(&LRCInstance::accountModel(),
&lrc::api::NewAccountModel::nameRegistrationEnded, &lrc::api::NewAccountModel::nameRegistrationEnded,
@@ -313,13 +309,6 @@ AccountAdapter::setArchivePasswordAsync(const QString &accountID, const QString
}); });
} }
void
AccountAdapter::settingsNeverShowAgain(bool checked)
{
QSettings settings("jami.net", "Jami");
settings.setValue(SettingsKey::neverShowMeAgain, checked);
}
void void
AccountAdapter::passwordSetStatusMessageBox(bool success, QString title, QString infoToDisplay) AccountAdapter::passwordSetStatusMessageBox(bool success, QString title, QString infoToDisplay)
{ {

View File

@@ -57,7 +57,6 @@ public:
/* /*
* Setting related * Setting related
*/ */
Q_INVOKABLE void settingsNeverShowAgain(bool checked);
Q_INVOKABLE void passwordSetStatusMessageBox(bool success, QString title, QString infoToDisplay); Q_INVOKABLE void passwordSetStatusMessageBox(bool success, QString title, QString infoToDisplay);
/* /*
* conf property * conf property

136
src/appsettingsmanager.h Normal file
View File

@@ -0,0 +1,136 @@
/*!
* Copyright (C) 2020 by Savoir-faire Linux
* Author: Andreas Traczyk <andreas.traczyk@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 <https://www.gnu.org/licenses/>.
*
* \file appsettingsmanager.h
*/
#pragma once
#include "utils.h"
#include <QMetaEnum>
#include <QObject>
#include <QString>
#include <QStandardPaths>
const QString defaultDownloadPath =
QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
#define KEYS \
X(MinimizeOnClose, true) \
X(DownloadPath, defaultDownloadPath) \
X(EnableNotifications, true) \
X(AutoUpdate, true) \
X(NeverShowMeAgain, false)
/*
* A class to expose settings keys in both c++ and QML.
* Note: this using a non-constructable class instead of a
* namespace allows for QML enum auto-completion in QtCreator.
* This works well when there is only one enum class. Otherwise,
* to prevent element name collision when defining multiple enums,
* use a namespace with:
*
* Q_NAMESPACE
* Q_CLASSINFO("RegisterEnumClassesUnscoped", "false")
*/
class Settings : public QObject
{
Q_OBJECT
public:
enum class Key {
#define X(key, defaultValue) key,
KEYS
#undef X
COUNT__
};
Q_ENUM(Key)
static QString toString(Key key)
{
return QMetaEnum::fromType<Key>().valueToKey(
Utils::toUnderlyingValue(key));
}
static QVariant defaultValue(const Key key)
{
switch (key) {
#define X(key, defaultValue) \
case Key::key: return defaultValue;
KEYS
#undef X
default: return {};
}
}
private:
Settings() = delete;
};
Q_DECLARE_METATYPE(Settings::Key)
/*
* A singleton object to manage settings access.
*/
class AppSettingsManager : public QObject
{
Q_OBJECT
public:
virtual ~AppSettingsManager() = default;
static AppSettingsManager&
instance()
{
static AppSettingsManager *instance_ =
new AppSettingsManager(nullptr);
return *instance_;
}
static QVariant
getValue(const Settings::Key key)
{
auto settings = instance().settings_;
auto value = settings->value(Settings::toString(key),
Settings::defaultValue(key));
if (QString(value.typeName()) == "QString" &&
(value.toString() == "false" || value.toString() == "true"))
return value.toBool();
return value;
}
static void
setValue(const Settings::Key key, const QVariant& value)
{
instance().settings_->setValue(Settings::toString(key), value);
}
static void
initValues()
{
for (int i = 0;
i < Utils::toUnderlyingValue(Settings::Key::COUNT__);
++i) {
auto key = Utils::toEnum<Settings::Key>(i);
if (!instance().settings_->contains(Settings::toString(key)))
setValue(key, Settings::defaultValue(key));
}
}
private:
explicit AppSettingsManager(QObject *)
: settings_(new QSettings("jami.net", "Jami", this)) {}
QSettings *settings_;
};

View File

@@ -42,10 +42,10 @@ ClientWrapper::getUtilsAdapter()
return &(UtilsAdapter::instance()); return &(UtilsAdapter::instance());
} }
SettingsAdaptor * SettingsAdapter *
ClientWrapper::getSettingsAdaptor() ClientWrapper::getSettingsAdapter()
{ {
return &(SettingsAdaptor::instance()); return &(SettingsAdapter::instance());
} }
LRCInstance * LRCInstance *
@@ -93,11 +93,11 @@ ClientWrapper::getDataTransferModel()
lrc::api::ContactModel * lrc::api::ContactModel *
ClientWrapper::getContactModel() ClientWrapper::getContactModel()
{ {
return getSettingsAdaptor()->getCurrentAccountInfo().contactModel.get(); return getSettingsAdapter()->getCurrentAccountInfo().contactModel.get();
} }
lrc::api::NewDeviceModel * lrc::api::NewDeviceModel *
ClientWrapper::getDeviceModel() ClientWrapper::getDeviceModel()
{ {
return getSettingsAdaptor()->getCurrentAccountInfo().deviceModel.get(); return getSettingsAdapter()->getCurrentAccountInfo().deviceModel.get();
} }

View File

@@ -40,7 +40,7 @@
#include "pixbufmanipulator.h" #include "pixbufmanipulator.h"
#include "previewrenderer.h" #include "previewrenderer.h"
#include "qrimageprovider.h" #include "qrimageprovider.h"
#include "settingsadaptor.h" #include "settingsadapter.h"
#include "utils.h" #include "utils.h"
#include "version.h" #include "version.h"
#include "videocodeclistmodel.h" #include "videocodeclistmodel.h"
@@ -52,7 +52,7 @@ class ClientWrapper : public QObject
Q_OBJECT Q_OBJECT
Q_PROPERTY(UtilsAdapter *utilsAdaptor READ getUtilsAdapter NOTIFY utilsAdaptorChanged) Q_PROPERTY(UtilsAdapter *utilsAdaptor READ getUtilsAdapter NOTIFY utilsAdaptorChanged)
Q_PROPERTY(SettingsAdaptor *settingsAdaptor READ getSettingsAdaptor NOTIFY settingsAdaptorChanged) Q_PROPERTY(SettingsAdapter *SettingsAdapter READ getSettingsAdapter NOTIFY SettingsAdapterChanged)
Q_PROPERTY(NameDirectory *nameDirectory READ getNameDirectory NOTIFY nameDirectoryChanged) Q_PROPERTY(NameDirectory *nameDirectory READ getNameDirectory NOTIFY nameDirectoryChanged)
Q_PROPERTY(LRCInstance *lrcInstance READ getLRCInstance NOTIFY lrcInstanceChanged) Q_PROPERTY(LRCInstance *lrcInstance READ getLRCInstance NOTIFY lrcInstanceChanged)
Q_PROPERTY(AccountAdapter *accountAdaptor READ getAccountAdapter NOTIFY accountAdaptorChanged) Q_PROPERTY(AccountAdapter *accountAdaptor READ getAccountAdapter NOTIFY accountAdaptorChanged)
@@ -68,7 +68,7 @@ public:
NameDirectory *getNameDirectory(); NameDirectory *getNameDirectory();
UtilsAdapter *getUtilsAdapter(); UtilsAdapter *getUtilsAdapter();
SettingsAdaptor *getSettingsAdaptor(); SettingsAdapter *getSettingsAdapter();
LRCInstance *getLRCInstance(); LRCInstance *getLRCInstance();
AccountAdapter *getAccountAdapter(); AccountAdapter *getAccountAdapter();
@@ -83,7 +83,7 @@ public:
signals: signals:
void utilsAdaptorChanged(); void utilsAdaptorChanged();
void settingsAdaptorChanged(); void SettingsAdapterChanged();
void nameDirectoryChanged(); void nameDirectoryChanged();
void lrcInstanceChanged(); void lrcInstanceChanged();
void accountAdaptorChanged(); void accountAdaptorChanged();

View File

@@ -21,11 +21,12 @@ 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
Dialog { Dialog {
id: deleteAccountDialog id: deleteAccountDialog
property int profileType: ClientWrapper.settingsAdaptor.getCurrentAccount_Profile_Info_Type() property int profileType: SettingsAdapter.getCurrentAccount_Profile_Info_Type()
property bool isSIP: { property bool isSIP: {
switch (profileType) { switch (profileType) {
@@ -37,9 +38,9 @@ Dialog {
} }
onOpened: { onOpened: {
profileType = ClientWrapper.settingsAdaptor.getCurrentAccount_Profile_Info_Type() profileType = SettingsAdapter.getCurrentAccount_Profile_Info_Type()
labelBestId.text = ClientWrapper.settingsAdaptor.getAccountBestName() labelBestId.text = SettingsAdapter.getAccountBestName()
labelAccountHash.text = ClientWrapper.settingsAdaptor.getCurrentAccount_Profile_Info_Uri() labelAccountHash.text = SettingsAdapter.getCurrentAccount_Profile_Info_Uri()
} }
onVisibleChanged: { onVisibleChanged: {
@@ -91,7 +92,7 @@ Dialog {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap wrapMode: Text.Wrap
text: ClientWrapper.settingsAdaptor.getAccountBestName() text: SettingsAdapter.getAccountBestName()
} }
Label{ Label{
@@ -106,7 +107,7 @@ Dialog {
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap wrapMode: Text.Wrap
text: ClientWrapper.settingsAdaptor.getCurrentAccount_Profile_Info_Uri() text: SettingsAdapter.getCurrentAccount_Profile_Info_Uri()
} }
Item{ Item{

View File

@@ -31,7 +31,6 @@ public:
instance() instance()
{ {
static GlobalSystemTray *instance_ = new GlobalSystemTray(); static GlobalSystemTray *instance_ = new GlobalSystemTray();
return *instance_; return *instance_;
} }

View File

@@ -26,7 +26,7 @@
#include "accountlistmodel.h" #include "accountlistmodel.h"
#include "rendermanager.h" #include "rendermanager.h"
#include "settingskey.h" #include "appsettingsmanager.h"
#include "utils.h" #include "utils.h"
#include "api/account.h" #include "api/account.h"
@@ -271,8 +271,6 @@ public:
setSelectedAccountId(const QString &accountId = {}) setSelectedAccountId(const QString &accountId = {})
{ {
instance().selectedAccountId_ = accountId; instance().selectedAccountId_ = accountId;
QSettings settings("jami.net", "Jami");
settings.setValue(SettingsKey::selectedAccount, accountId);
// Last selected account should be set as preferred. // Last selected account should be set as preferred.
accountModel().setTopAccount(accountId); accountModel().setTopAccount(accountId);
@@ -304,7 +302,7 @@ public:
} }
}; };
static const int static int
getCurrentAccountIndex() getCurrentAccountIndex()
{ {
for (int i = 0; i < accountModel().getAccountList().size(); i++) { for (int i = 0; i < accountModel().getAccountList().size(); i++) {

View File

@@ -1,4 +1,4 @@
/* /*!
* Copyright (C) 2015-2020 by Savoir-faire Linux * Copyright (C) 2015-2020 by Savoir-faire Linux
* Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com> * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>
* Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> * Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
@@ -21,11 +21,28 @@
#include "mainapplication.h" #include "mainapplication.h"
#include "runguard.h" #include "runguard.h"
#include <clocale>
#include <QCryptographicHash> #include <QCryptographicHash>
#include <QtWebEngine>
#include <clocale> #include <clocale>
static char**
parseInputArgument(int& argc, char* argv[], char* argToParse)
{
/*
* Forcefully append argToParse.
*/
int oldArgc = argc;
argc = argc + 1 + 1;
char** newArgv = new char*[argc];
for (int i = 0; i < oldArgc; i++) {
newArgv[i] = argv[i];
}
newArgv[oldArgc] = argToParse;
newArgv[oldArgc + 1] = nullptr;
return newArgv;
}
int int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
@@ -33,13 +50,24 @@ main(int argc, char *argv[])
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
setenv("QT_QPA_PLATFORMTHEME", "gtk3", true); setenv("QT_QPA_PLATFORMTHEME", "gtk3", true);
#endif #endif
#ifdef Q_OS_WIN
QApplication::setApplicationName("Ring");
#else
QApplication::setApplicationName("Jami");
#endif
QApplication::setOrganizationDomain("jami.net");
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QApplication::setQuitOnLastWindowClosed(false);
QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
QApplication::setHighDpiScaleFactorRoundingPolicy(
Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor);
QtWebEngine::initialize();
MainApplication::applicationInitialization(); // Allow QtWebEngine to load local resources.
char ARG_DISABLE_WEB_SECURITY[] = "--disable-web-security"; char ARG_DISABLE_WEB_SECURITY[] = "--disable-web-security";
auto newArgv = MainApplication::parseInputArgument(argc, argv, ARG_DISABLE_WEB_SECURITY); auto newArgv = parseInputArgument(argc, argv, ARG_DISABLE_WEB_SECURITY);
MainApplication app(argc, newArgv);
MainApplication a(argc, newArgv);
/* /*
* Runguard to make sure that only one instance runs at a time. * Runguard to make sure that only one instance runs at a time.
@@ -50,22 +78,15 @@ main(int argc, char *argv[])
appData.addData(QApplication::organizationDomain().toUtf8()); appData.addData(QApplication::organizationDomain().toUtf8());
RunGuard guard(appData.result()); RunGuard guard(appData.result());
if (!guard.tryToRun()) { if (!guard.tryToRun()) {
/*
* No need to exitApp since app is not set up.
*/
return 0; return 0;
} }
if (!a.applicationSetup()) { app.init();
guard.release();
a.exitApp();
return 0;
}
/* /*
* Exec the application. * Exec the application.
*/ */
auto ret = a.exec(); auto ret = app.exec();
guard.release(); guard.release();
return ret; return ret;

View File

@@ -1,4 +1,4 @@
/** /*!
* Copyright (C) 2015-2020 by Savoir-faire Linux * Copyright (C) 2015-2020 by Savoir-faire Linux
* Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com> * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>
* Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> * Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
@@ -21,48 +21,18 @@
#include "mainapplication.h" #include "mainapplication.h"
#include "accountadapter.h" #include "appsettingsmanager.h"
#include "accountlistmodel.h"
#include "accountstomigratelistmodel.h"
#include "audiocodeclistmodel.h"
#include "audioinputdevicemodel.h"
#include "audiomanagerlistmodel.h"
#include "audiooutputdevicemodel.h"
#include "pluginlistpreferencemodel.h"
#include "mediahandlerlistpreferencemodel.h"
#include "avadapter.h"
#include "bannedlistmodel.h"
#include "calladapter.h"
#include "clientwrapper.h"
#include "contactadapter.h"
#include "mediahandleradapter.h"
#include "conversationsadapter.h"
#include "deviceitemlistmodel.h"
#include "pluginitemlistmodel.h"
#include "mediahandleritemlistmodel.h"
#include "preferenceitemlistmodel.h"
#include "distantrenderer.h"
#include "globalinstances.h" #include "globalinstances.h"
#include "globalsystemtray.h" #include "globalsystemtray.h"
#include "messagesadapter.h" #include "qmlregister.h"
#include "namedirectory.h"
#include "pixbufmanipulator.h"
#include "previewrenderer.h"
#include "qrimageprovider.h" #include "qrimageprovider.h"
#include "settingsadaptor.h" #include "pixbufmanipulator.h"
#include "tintedbuttonimageprovider.h" #include "tintedbuttonimageprovider.h"
#include "utils.h"
#include "version.h"
#include "videocodeclistmodel.h"
#include "videoformatfpsmodel.h"
#include "videoformatresolutionmodel.h"
#include "videoinputdevicemodel.h"
#include <QAction> #include <QAction>
#include <QFontDatabase> #include <QFontDatabase>
#include <QMenu> #include <QMenu>
#include <QQmlContext> #include <QQmlContext>
#include <QtWebEngine>
#include <locale.h> #include <locale.h>
@@ -74,44 +44,17 @@
#include <gnutls/gnutls.h> #include <gnutls/gnutls.h>
#endif #endif
MainApplication::MainApplication(int& argc, char** argv) static void
: QApplication(argc, argv) consoleDebug()
, engine_(new QQmlApplicationEngine())
{
QObject::connect(this, &QApplication::aboutToQuit, [this] { exitApp(); });
}
void
MainApplication::applicationInitialization()
{
/*
* Some attributes are needed to be set before the creation of the application.
*/
QApplication::setApplicationName("Ring");
QApplication::setOrganizationDomain("jami.net");
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling, true);
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QApplication::setQuitOnLastWindowClosed(false);
QCoreApplication::setAttribute(Qt::AA_UseOpenGLES);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QApplication::setHighDpiScaleFactorRoundingPolicy(
Qt::HighDpiScaleFactorRoundingPolicy::RoundPreferFloor);
/*
* Initialize QtWebEngine.
*/
QtWebEngine::initialize();
#endif
}
void
MainApplication::consoleDebug()
{ {
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
AllocConsole(); AllocConsole();
SetConsoleCP(CP_UTF8); SetConsoleCP(CP_UTF8);
freopen("CONOUT$", "w", stdout); FILE* fpstdout = stdout;
freopen("CONOUT$", "w", stderr); freopen_s(&fpstdout, "CONOUT$", "w", stdout);
FILE* fpstderr = stderr;
freopen_s(&fpstderr, "CONOUT$", "w", stderr);
COORD coordInfo; COORD coordInfo;
coordInfo.X = 130; coordInfo.X = 130;
@@ -122,8 +65,8 @@ MainApplication::consoleDebug()
#endif #endif
} }
void static void
MainApplication::vsConsoleDebug() vsConsoleDebug()
{ {
#ifdef _MSC_VER #ifdef _MSC_VER
/* /*
@@ -137,8 +80,16 @@ MainApplication::vsConsoleDebug()
#endif #endif
} }
void static QString
MainApplication::fileDebug(QFile* debugFile) getDebugFilePath()
{
QDir logPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation));
logPath.cdUp();
return QString(logPath.absolutePath() + "/jami/jami.log");
}
static void
fileDebug(QFile* debugFile)
{ {
QObject::connect(&LRCInstance::behaviorController(), QObject::connect(&LRCInstance::behaviorController(),
&lrc::api::BehaviorController::debugMessageReceived, &lrc::api::BehaviorController::debugMessageReceived,
@@ -151,41 +102,44 @@ MainApplication::fileDebug(QFile* debugFile)
}); });
} }
MainApplication::MainApplication(int& argc, char** argv)
: QApplication(argc, argv)
, engine_(new QQmlApplicationEngine())
{
QObject::connect(this, &QApplication::aboutToQuit, [this] { cleanup(); });
}
void void
MainApplication::exitApp() MainApplication::init()
{ {
GlobalSystemTray::instance().hide(); #ifdef Q_OS_LINUX
#ifdef Q_OS_WIN if (!getenv("QT_QPA_PLATFORMTHEME"))
FreeConsole(); setenv("QT_QPA_PLATFORMTHEME", "gtk3", true);
#endif #endif
}
char** for (auto string : QCoreApplication::arguments()) {
MainApplication::parseInputArgument(int& argc, char* argv[], char* argToParse) if (string == "-d" || string == "--debug") {
{ consoleDebug();
/* }
* Forcefully append argToParse.
*/
int oldArgc = argc;
argc = argc + 1 + 1;
char** newArgv = new char*[argc];
for (int i = 0; i < oldArgc; i++) {
newArgv[i] = argv[i];
} }
newArgv[oldArgc] = argToParse;
newArgv[oldArgc + 1] = nullptr;
return newArgv;
}
QString Utils::removeOldVersions();
MainApplication::getDebugFilePath() loadTranslations();
{ setApplicationFont();
QDir logPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation));
/* #if defined _MSC_VER && !COMPILE_ONLY
* Since logPath will be .../Ring, we use cdUp to remove it. gnutls_global_init();
*/ #endif
logPath.cdUp();
return QString(logPath.absolutePath() + "/jami/jami.log"); GlobalInstances::setPixmapManipulator(std::make_unique<PixbufManipulator>());
initLrc();
bool startMinimized {false};
parseArguments(startMinimized);
initSettings();
initSystray();
initQmlEngine();
} }
void void
@@ -244,7 +198,7 @@ MainApplication::initLrc()
this->processEvents(); this->processEvents();
} }
}, },
[this, &isMigrating] { [&isMigrating] {
while (!isMigrating) { while (!isMigrating) {
std::this_thread::sleep_for(std::chrono::milliseconds(10)); std::this_thread::sleep_for(std::chrono::milliseconds(10));
} }
@@ -255,9 +209,8 @@ MainApplication::initLrc()
} }
void void
MainApplication::processInputArgument(bool& startMinimized) MainApplication::parseArguments(bool& startMinimized)
{ {
debugFile_ = std::make_unique<QFile>(getDebugFilePath());
QString uri = ""; QString uri = "";
for (auto string : QCoreApplication::arguments()) { for (auto string : QCoreApplication::arguments()) {
@@ -267,6 +220,8 @@ MainApplication::processInputArgument(bool& startMinimized)
if (string == "-m" || string == "--minimized") { if (string == "-m" || string == "--minimized") {
startMinimized = true; startMinimized = true;
} }
#ifdef Q_OS_WINDOWS
debugFile_.reset(new QFile(getDebugFilePath()));
auto dbgFile = string == "-f" || string == "--file"; auto dbgFile = string == "-f" || string == "--file";
auto dbgConsole = string == "-c" || string == "--vsconsole"; auto dbgConsole = string == "-c" || string == "--vsconsole";
if (dbgFile || dbgConsole) { if (dbgFile || dbgConsole) {
@@ -275,12 +230,11 @@ MainApplication::processInputArgument(bool& startMinimized)
debugFile_->close(); debugFile_->close();
fileDebug(debugFile_.get()); fileDebug(debugFile_.get());
} }
#ifdef _MSC_VER
if (dbgConsole) { if (dbgConsole) {
vsConsoleDebug(); vsConsoleDebug();
} }
#endif
} }
#endif
} }
} }
} }
@@ -295,171 +249,27 @@ MainApplication::setApplicationFont()
} }
void void
MainApplication::qmlInitialization() MainApplication::initQmlEngine()
{ {
/* registerTypes();
* Register accountListModel type.
*/
QML_REGISTERTYPE(AccountListModel, 1, 0);
QML_REGISTERTYPE(DeviceItemListModel, 1, 0);
QML_REGISTERTYPE(PluginItemListModel, 1, 0);
QML_REGISTERTYPE(MediaHandlerItemListModel, 1, 0);
QML_REGISTERTYPE(PreferenceItemListModel, 1, 0);
QML_REGISTERTYPE(BannedListModel, 1, 0);
QML_REGISTERTYPE(VideoCodecListModel, 1, 0);
QML_REGISTERTYPE(AudioCodecListModel, 1, 0);
QML_REGISTERTYPE(AccountsToMigrateListModel, 1, 0);
QML_REGISTERTYPE(AudioInputDeviceModel, 1, 0);
QML_REGISTERTYPE(AudioOutputDeviceModel, 1, 0);
QML_REGISTERTYPE(AudioManagerListModel, 1, 0);
QML_REGISTERTYPE(VideoInputDeviceModel, 1, 0);
QML_REGISTERTYPE(VideoFormatResolutionModel, 1, 0);
QML_REGISTERTYPE(VideoFormatFpsModel, 1, 0);
QML_REGISTERTYPE(PluginListPreferenceModel, 1, 0);
QML_REGISTERTYPE(MediaHandlerListPreferenceModel, 1, 0);
/*
* Register QQuickItem type.
*/
QML_REGISTERTYPE(PreviewRenderer, 1, 0);
QML_REGISTERTYPE(VideoCallPreviewRenderer, 1, 0);
QML_REGISTERTYPE(DistantRenderer, 1, 0);
QML_REGISTERTYPE(PhotoboothPreviewRender, 1, 0)
/*
* Adapter - qmlRegisterSingletonType.
* Note: in future, if lrc is fully compatible with qml (C++ struct
* is readable in qml), the adapters can be optimized away.
*/
QML_REGISTERSINGLETONTYPE_URL(QStringLiteral("qrc:/src/constant/JamiTheme.qml"),
JamiTheme,
1,
0);
QML_REGISTERSINGLETONTYPE(CallAdapter, 1, 0);
QML_REGISTERSINGLETONTYPE(MessagesAdapter, 1, 0);
QML_REGISTERSINGLETONTYPE(ConversationsAdapter, 1, 0);
QML_REGISTERSINGLETONTYPE(AvAdapter, 1, 0);
QML_REGISTERSINGLETONTYPE(ContactAdapter, 1, 0);
QML_REGISTERSINGLETONTYPE(MediaHandlerAdapter, 1, 0);
QML_REGISTERSINGLETONTYPE(ClientWrapper, 1, 0);
// QML_REGISTERSINGLETONTYPE_WITH_INSTANCE(AccountAdapter, 1, 0);
// QML_REGISTERSINGLETONTYPE_WITH_INSTANCE(UtilsAdapter, 1, 0);
QML_REGISTERUNCREATABLE(AccountAdapter, 1, 0);
QML_REGISTERUNCREATABLE(UtilsAdapter, 1, 0);
QML_REGISTERUNCREATABLE(SettingsAdaptor, 1, 0);
QML_REGISTERUNCREATABLE(NameDirectory, 1, 0);
QML_REGISTERUNCREATABLE(LRCInstance, 1, 0);
/*
* Lrc models - qmlRegisterUncreatableType & Q_DECLARE_METATYPE.
* This to make lrc models recognizable 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(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);
/*
* Client models - qmlRegisterUncreatableType & Q_DECLARE_METATYPE.
* This to make client models recognizable in qml.
*/
QML_REGISTERUNCREATABLE(RenderManager, 1, 0);
/*
* Namespaces - qmlRegisterUncreatableMetaObject.
*/
QML_REGISTERNAMESPACE(lrc::api::staticMetaObject, "Lrc", 1, 0);
QML_REGISTERNAMESPACE(lrc::api::account::staticMetaObject, "Account", 1, 0);
QML_REGISTERNAMESPACE(lrc::api::call::staticMetaObject, "Call", 1, 0);
QML_REGISTERNAMESPACE(lrc::api::datatransfer::staticMetaObject, "Datatransfer", 1, 0);
QML_REGISTERNAMESPACE(lrc::api::interaction::staticMetaObject, "Interaction", 1, 0);
QML_REGISTERNAMESPACE(lrc::api::video::staticMetaObject, "Video", 1, 0);
QML_REGISTERNAMESPACE(lrc::api::profile::staticMetaObject, "Profile", 1, 0);
/*
* Add image provider.
*/
engine_->addImageProvider(QLatin1String("qrImage"), new QrImageProvider()); engine_->addImageProvider(QLatin1String("qrImage"), new QrImageProvider());
engine_->addImageProvider(QLatin1String("tintedPixmap"), new TintedButtonImageProvider()); engine_->addImageProvider(QLatin1String("tintedPixmap"), new TintedButtonImageProvider());
engine_->load(QUrl(QStringLiteral("qrc:/src/MainApplicationWindow.qml"))); engine_->load(QUrl(QStringLiteral("qrc:/src/MainApplicationWindow.qml")));
} }
MainApplication::~MainApplication() {} void
MainApplication::initSettings()
bool
MainApplication::applicationSetup()
{ {
#ifdef Q_OS_LINUX AppSettingsManager::instance().initValues();
if (!getenv("QT_QPA_PLATFORMTHEME")) auto downloadPath = AppSettingsManager::instance().getValue(Settings::Key::DownloadPath);
setenv("QT_QPA_PLATFORMTHEME", "gtk3", true); LRCInstance::dataTransferModel().downloadDirectory = downloadPath.toString() + "/";
#endif }
/* void
* Start debug console. MainApplication::initSystray()
*/ {
for (auto string : QCoreApplication::arguments()) {
if (string == "-d" || string == "--debug") {
consoleDebug();
}
}
/*
* Remove old version files.
*/
Utils::removeOldVersions();
/*
* Load translations.
*/
loadTranslations();
/*
* Set font.
*/
setApplicationFont();
#if defined _MSC_VER && !COMPILE_ONLY
gnutls_global_init();
#endif
/*
* Init pixmap manipulator.
*/
GlobalInstances::setPixmapManipulator(std::make_unique<PixbufManipulator>());
/*
* Init lrc and its possible migration ui.
*/
initLrc();
/*
* Process input argument.
*/
bool startMinimized {false};
processInputArgument(startMinimized);
/*
* Create jami.net settings in Registry if it is not presented.
*/
QSettings settings("jami.net", "Jami");
/*
* Initialize qml components.
*/
qmlInitialization();
/*
* Systray menu.
*/
GlobalSystemTray& sysIcon = GlobalSystemTray::instance(); GlobalSystemTray& sysIcon = GlobalSystemTray::instance();
sysIcon.setIcon(QIcon(":images/jami.png")); sysIcon.setIcon(QIcon(":images/jami.png"));
@@ -467,18 +277,27 @@ MainApplication::applicationSetup()
QAction* exitAction = new QAction(tr("Exit"), this); QAction* exitAction = new QAction(tr("Exit"), this);
connect(exitAction, &QAction::triggered, connect(exitAction, &QAction::triggered,
[this] { [this]{
QCoreApplication::exit(); engine_->quit();
cleanup();
});
connect(&sysIcon, &QSystemTrayIcon::activated,
[](QSystemTrayIcon::ActivationReason reason) {
if (reason != QSystemTrayIcon::ActivationReason::Context)
emit LRCInstance::instance().restoreAppRequested();
}); });
connect(&sysIcon, &QSystemTrayIcon::activated,
[this](QSystemTrayIcon::ActivationReason reason) {
emit LRCInstance::instance().restoreAppRequested();
});
systrayMenu->addAction(exitAction); systrayMenu->addAction(exitAction);
sysIcon.setContextMenu(systrayMenu); sysIcon.setContextMenu(systrayMenu);
sysIcon.show(); sysIcon.show();
}
return true;
void
MainApplication::cleanup()
{
GlobalSystemTray::instance().hide();
#ifdef Q_OS_WIN
FreeConsole();
#endif
QApplication::exit(0);
} }

View File

@@ -33,27 +33,22 @@ class MainApplication : public QApplication
public: public:
explicit MainApplication(int &argc, char **argv); explicit MainApplication(int &argc, char **argv);
~MainApplication(); ~MainApplication() = default;
bool applicationSetup(); void init();
void exitApp();
static void applicationInitialization();
static QString getDebugFilePath();
static char **parseInputArgument(int &argc, char *argv[], char *argToParse);
protected:
void consoleDebug();
void vsConsoleDebug();
void fileDebug(QFile *debugFile);
private: private:
void loadTranslations(); void loadTranslations();
void initLrc(); void initLrc();
void processInputArgument(bool &startMinimized); void parseArguments(bool &startMinimized);
void setApplicationFont(); void setApplicationFont();
void qmlInitialization(); void initQmlEngine();
void initSettings();
void initSystray();
void cleanup();
std::unique_ptr<QFile> debugFile_; private:
QScopedPointer<QFile> debugFile_;
QQmlApplicationEngine *engine_; QQmlApplicationEngine *engine_;
}; };

View File

@@ -80,7 +80,7 @@ Rectangle {
height = preferredHeight height = preferredHeight
if (isVideo) { if (isVideo) {
var device = ClientWrapper.avmodel.getDefaultDevice() var device = ClientWrapper.avmodel.getDefaultDevice()
var settings = ClientWrapper.settingsAdaptor.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]
if (aspectRatio) { if (aspectRatio) {

183
src/qmlregister.cpp Normal file
View File

@@ -0,0 +1,183 @@
/*!
* Copyright (C) 2020 by Savoir-faire Linux
* Author: Andreas Traczyk <andreas.traczyk@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 <https://www.gnu.org/licenses/>.
*/
#include "qmlregister.h"
#include "accountadapter.h"
#include "accountstomigratelistmodel.h"
#include "audiocodeclistmodel.h"
#include "audioinputdevicemodel.h"
#include "audiomanagerlistmodel.h"
#include "audiooutputdevicemodel.h"
#include "avadapter.h"
#include "bannedlistmodel.h"
#include "calladapter.h"
#include "clientwrapper.h"
#include "contactadapter.h"
#include "conversationsadapter.h"
#include "deviceitemlistmodel.h"
#include "distantrenderer.h"
#include "mediahandleradapter.h"
#include "mediahandleritemlistmodel.h"
#include "mediahandlerlistpreferencemodel.h"
#include "messagesadapter.h"
#include "namedirectory.h"
#include "preferenceitemlistmodel.h"
#include "pluginitemlistmodel.h"
#include "pluginlistpreferencemodel.h"
#include "previewrenderer.h"
#include "settingsadapter.h"
#include "utils.h"
#include "version.h"
#include "videocodeclistmodel.h"
#include "videoformatfpsmodel.h"
#include "videoformatresolutionmodel.h"
#include "videoinputdevicemodel.h"
#include <QMetaType>
#include <QQmlEngine>
#define QML_REGISTERSINGLETONTYPE(N, T, MAJ, MIN) \
qmlRegisterSingletonType<T>(N, MAJ, MIN, #T, \
[](QQmlEngine *e, QJSEngine *se) -> QObject * { \
Q_UNUSED(e); \
Q_UNUSED(se); \
T *obj = new T(); \
return obj; \
});
#define QML_REGISTERSINGLETONTYPE_WITH_INSTANCE(T, MAJ, MIN) \
qmlRegisterSingletonType<T>("net.jami.Models", \
MAJ, \
MIN, \
#T, \
[](QQmlEngine *e, QJSEngine *se) -> QObject * { \
Q_UNUSED(e); \
Q_UNUSED(se); \
return &(T::instance()); \
});
#define QML_REGISTERSINGLETONTYPE_URL(URL, T, MAJ, MIN) \
qmlRegisterSingletonType(QUrl(URL), "net.jami.Models", MAJ, MIN, #T);
#define QML_REGISTERTYPE(T, MAJ, MIN) qmlRegisterType<T>("net.jami.Models", MAJ, MIN, #T);
#define QML_REGISTERNAMESPACE(T, NAME, MAJ, MIN) \
qmlRegisterUncreatableMetaObject(T, "net.jami.Models", MAJ, MIN, NAME, "")
#define QML_REGISTERUNCREATABLE(N, T, MAJ, MIN) \
qmlRegisterUncreatableType<T>(N, \
MAJ, \
MIN, \
#T, \
"Don't try to add to a qml definition of " #T);
#define QML_REGISTERUNCREATABLE_IN_NAMESPACE(T, NAMESPACE, MAJ, MIN) \
qmlRegisterUncreatableType<NAMESPACE::T>("net.jami.Models", \
MAJ, \
MIN, \
#T, \
"Don't try to add to a qml definition of " #T);
/*!
* This function will expose custom types to the QML engine.
*/
void registerTypes()
{
/*
* Register QAbstractListModel type.
*/
QML_REGISTERTYPE(AccountListModel, 1, 0);
QML_REGISTERTYPE(DeviceItemListModel, 1, 0);
QML_REGISTERTYPE(PluginItemListModel, 1, 0);
QML_REGISTERTYPE(MediaHandlerItemListModel, 1, 0);
QML_REGISTERTYPE(PreferenceItemListModel, 1, 0);
QML_REGISTERTYPE(BannedListModel, 1, 0);
QML_REGISTERTYPE(VideoCodecListModel, 1, 0);
QML_REGISTERTYPE(AudioCodecListModel, 1, 0);
QML_REGISTERTYPE(AccountsToMigrateListModel, 1, 0);
QML_REGISTERTYPE(AudioInputDeviceModel, 1, 0);
QML_REGISTERTYPE(AudioOutputDeviceModel, 1, 0);
QML_REGISTERTYPE(AudioManagerListModel, 1, 0);
QML_REGISTERTYPE(VideoInputDeviceModel, 1, 0);
QML_REGISTERTYPE(VideoFormatResolutionModel, 1, 0);
QML_REGISTERTYPE(VideoFormatFpsModel, 1, 0);
QML_REGISTERTYPE(PluginListPreferenceModel, 1, 0);
QML_REGISTERTYPE(MediaHandlerListPreferenceModel, 1, 0);
/*
* Register QQuickItem type.
*/
QML_REGISTERTYPE(PreviewRenderer, 1, 0);
QML_REGISTERTYPE(VideoCallPreviewRenderer, 1, 0);
QML_REGISTERTYPE(DistantRenderer, 1, 0);
QML_REGISTERTYPE(PhotoboothPreviewRender, 1, 0)
/*
* Adaptors - qmlRegisterSingletonType.
*/
QML_REGISTERSINGLETONTYPE_URL(QStringLiteral("qrc:/src/constant/JamiTheme.qml"),
JamiTheme, 1, 0);
QML_REGISTERSINGLETONTYPE("net.jami.Models", CallAdapter, 1, 0);
QML_REGISTERSINGLETONTYPE("net.jami.Models", MessagesAdapter, 1, 0);
QML_REGISTERSINGLETONTYPE("net.jami.Models", ConversationsAdapter, 1, 0);
QML_REGISTERSINGLETONTYPE("net.jami.Models", AvAdapter, 1, 0);
QML_REGISTERSINGLETONTYPE("net.jami.Models", ContactAdapter, 1, 0);
QML_REGISTERSINGLETONTYPE("net.jami.Models", MediaHandlerAdapter, 1, 0);
QML_REGISTERSINGLETONTYPE("net.jami.Models", ClientWrapper, 1, 0);
QML_REGISTERSINGLETONTYPE("net.jami.Adapters", SettingsAdapter, 1, 0);
QML_REGISTERUNCREATABLE("net.jami.Enums", Settings, 1, 0);
/*
* Lrc models - qmlRegisterUncreatableType & Q_DECLARE_METATYPE.
* This to make lrc models recognizable 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(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.
*/
QML_REGISTERUNCREATABLE("net.jami.Models", RenderManager, 1, 0);
QML_REGISTERUNCREATABLE("net.jami.Models", AccountAdapter, 1, 0);
QML_REGISTERUNCREATABLE("net.jami.Models", UtilsAdapter, 1, 0);
QML_REGISTERUNCREATABLE("net.jami.Models", NameDirectory, 1, 0);
QML_REGISTERUNCREATABLE("net.jami.Models", LRCInstance, 1, 0);
/*
* qmlRegisterUncreatableMetaObject to expose namespaces in qml
*/
QML_REGISTERNAMESPACE(lrc::api::staticMetaObject, "Lrc", 1, 0);
QML_REGISTERNAMESPACE(lrc::api::account::staticMetaObject, "Account", 1, 0);
QML_REGISTERNAMESPACE(lrc::api::call::staticMetaObject, "Call", 1, 0);
QML_REGISTERNAMESPACE(lrc::api::datatransfer::staticMetaObject, "Datatransfer", 1, 0);
QML_REGISTERNAMESPACE(lrc::api::interaction::staticMetaObject, "Interaction", 1, 0);
QML_REGISTERNAMESPACE(lrc::api::video::staticMetaObject, "Video", 1, 0);
QML_REGISTERNAMESPACE(lrc::api::profile::staticMetaObject, "Profile", 1, 0);
}

21
src/qmlregister.h Normal file
View File

@@ -0,0 +1,21 @@
/*!
* Copyright (C) 2020 by Savoir-faire Linux
* Author: Andreas Traczyk <andreas.traczyk@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 <https://www.gnu.org/licenses/>.
*/
#pragma once
void registerTypes();

File diff suppressed because it is too large Load Diff

View File

@@ -27,30 +27,23 @@
#include "typedefs.h" #include "typedefs.h"
#include "utils.h" #include "utils.h"
class SettingsAdaptor : public QObject class SettingsAdapter : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
explicit SettingsAdaptor(QObject *parent = nullptr); explicit SettingsAdapter(QObject *parent = nullptr);
//Singleton //Singleton
static SettingsAdaptor &instance(); static SettingsAdapter &instance();
/* /*
* getters of directories * getters of directories
*/ */
Q_INVOKABLE QString getDir_Document(); Q_INVOKABLE QString getDir_Document();
Q_INVOKABLE QString getDir_Download(); Q_INVOKABLE QString getDir_Download();
/* Q_INVOKABLE QVariant getAppValue(const Settings::Key key);
* getters and setters of app settings options Q_INVOKABLE void setAppValue(const Settings::Key key, const QVariant& value);
*/
Q_INVOKABLE bool getSettingsValue_CloseOrMinimized();
Q_INVOKABLE bool getSettingsValue_EnableNotifications();
Q_INVOKABLE bool getSettingsValue_AutoUpdate();
Q_INVOKABLE void setClosedOrMin(bool state);
Q_INVOKABLE void setNotifications(bool state);
Q_INVOKABLE void setUpdateAutomatic(bool state);
Q_INVOKABLE void setRunOnStartUp(bool state); Q_INVOKABLE void setRunOnStartUp(bool state);
Q_INVOKABLE void setDownloadPath(QString dir); Q_INVOKABLE void setDownloadPath(QString dir);
@@ -237,5 +230,6 @@ public:
Q_INVOKABLE void set_FileCACert(QString text); Q_INVOKABLE void set_FileCACert(QString text);
Q_INVOKABLE void set_FileUserCert(QString text); Q_INVOKABLE void set_FileUserCert(QString text);
Q_INVOKABLE void set_FilePrivateKey(QString text); Q_INVOKABLE void set_FilePrivateKey(QString text);
}; };
Q_DECLARE_METATYPE(SettingsAdaptor *) Q_DECLARE_METATYPE(SettingsAdapter *)

View File

@@ -1,34 +0,0 @@
/*
* Copyright (C) 2015-2020 by Savoir-faire Linux
* Author: Edric Ladent Milaret <edric.ladent-milaret@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 <https://www.gnu.org/licenses/>.
*/
#pragma once
namespace SettingsKey {
constexpr static char closeOrMinimized[] = "closeOrMin";
constexpr static char downloadPath[] = "downloadPath";
constexpr static char enableNotifications[] = "enableNotifications";
constexpr static char geometry[] = "geometry";
constexpr static char selectedAccount[] = "selectedAccount";
constexpr static char mainSplitterState[] = "mainSplitterState";
constexpr static char smartListToWebviewSplitterState[] = "smartListToWebviewSplitterState";
constexpr static char windowState[] = "windowState";
constexpr static char autoUpdate[] = "autoUpdate";
constexpr static char neverShowMeAgain[] = "neverShowMeAgain";
constexpr static char hasRun[] = "hasRun";
} // namespace SettingsKey

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 "components" import "components"
@@ -44,7 +45,7 @@ Rectangle {
} }
function setSelected(sel, recovery = false){ function setSelected(sel, recovery = false){
profileType = ClientWrapper.settingsAdaptor.getCurrentAccount_Profile_Info_Type() profileType = SettingsAdapter.getCurrentAccount_Profile_Info_Type()
if(selectedMenu === sel && (!recovery)){return} if(selectedMenu === sel && (!recovery)){return}
switch(sel){ switch(sel){
@@ -135,7 +136,7 @@ Rectangle {
ClientWrapper.avmodel.setCurrentVideoCaptureDevice(device) ClientWrapper.avmodel.setCurrentVideoCaptureDevice(device)
} }
} }
property int profileType: ClientWrapper.settingsAdaptor.getCurrentAccount_Profile_Info_Type() property int profileType: SettingsAdapter.getCurrentAccount_Profile_Info_Type()
property int selectedMenu: SettingsView.Account property int selectedMenu: SettingsView.Account

View File

@@ -26,82 +26,83 @@ import QtQuick.Controls.Styles 1.4
import QtQuick.Dialogs 1.3 import QtQuick.Dialogs 1.3
import Qt.labs.platform 1.1 import Qt.labs.platform 1.1
import net.jami.Models 1.0 import net.jami.Models 1.0
import net.jami.Adapters 1.0
import "../../commoncomponents" import "../../commoncomponents"
ColumnLayout { ColumnLayout {
function updateAccountInfoDisplayedAdvanceSIP(){ function updateAccountInfoDisplayedAdvanceSIP(){
// Call Settings // Call Settings
checkBoxAutoAnswerSIP.checked = ClientWrapper.settingsAdaptor.getAccountConfig_AutoAnswer() checkBoxAutoAnswerSIP.checked = SettingsAdapter.getAccountConfig_AutoAnswer()
checkBoxCustomRingtoneSIP.checked = ClientWrapper.settingsAdaptor.getAccountConfig_Ringtone_RingtoneEnabled() checkBoxCustomRingtoneSIP.checked = SettingsAdapter.getAccountConfig_Ringtone_RingtoneEnabled()
// security // security
btnSIPCACert.enabled = ClientWrapper.settingsAdaptor.getAccountConfig_TLS_Enable() btnSIPCACert.enabled = SettingsAdapter.getAccountConfig_TLS_Enable()
btnSIPUserCert.enabled = ClientWrapper.settingsAdaptor.getAccountConfig_TLS_Enable() btnSIPUserCert.enabled = SettingsAdapter.getAccountConfig_TLS_Enable()
btnSIPPrivateKey.enabled = ClientWrapper.settingsAdaptor.getAccountConfig_TLS_Enable() btnSIPPrivateKey.enabled = SettingsAdapter.getAccountConfig_TLS_Enable()
lineEditSIPCertPassword.enabled = ClientWrapper.settingsAdaptor.getAccountConfig_TLS_Enable() lineEditSIPCertPassword.enabled = SettingsAdapter.getAccountConfig_TLS_Enable()
enableSDESToggle.enabled = ClientWrapper.settingsAdaptor.getAccountConfig_SRTP_Enabled() enableSDESToggle.enabled = SettingsAdapter.getAccountConfig_SRTP_Enabled()
fallbackRTPToggle.enabled = ClientWrapper.settingsAdaptor.getAccountConfig_SRTP_Enabled() fallbackRTPToggle.enabled = SettingsAdapter.getAccountConfig_SRTP_Enabled()
btnSIPCACert.text = ClientWrapper.utilsAdaptor.toFileInfoName(ClientWrapper.settingsAdaptor.getAccountConfig_TLS_CertificateListFile()) btnSIPCACert.text = ClientWrapper.utilsAdaptor.toFileInfoName(ClientWrapper.SettingsAdapter.getAccountConfig_TLS_CertificateListFile())
btnSIPUserCert.text = ClientWrapper.utilsAdaptor.toFileInfoName(ClientWrapper.settingsAdaptor.getAccountConfig_TLS_CertificateFile()) btnSIPUserCert.text = ClientWrapper.utilsAdaptor.toFileInfoName(ClientWrapper.SettingsAdapter.getAccountConfig_TLS_CertificateFile())
btnSIPPrivateKey.text = ClientWrapper.utilsAdaptor.toFileInfoName(ClientWrapper.settingsAdaptor.getAccountConfig_TLS_PrivateKeyFile()) btnSIPPrivateKey.text = ClientWrapper.utilsAdaptor.toFileInfoName(ClientWrapper.SettingsAdapter.getAccountConfig_TLS_PrivateKeyFile())
lineEditSIPCertPassword.text = ClientWrapper.settingsAdaptor.getAccountConfig_TLS_Password() lineEditSIPCertPassword.text = SettingsAdapter.getAccountConfig_TLS_Password()
encryptMediaStreamsToggle.checked = ClientWrapper.settingsAdaptor.getAccountConfig_SRTP_Enabled() encryptMediaStreamsToggle.checked = SettingsAdapter.getAccountConfig_SRTP_Enabled()
enableSDESToggle.checked = (ClientWrapper.settingsAdaptor.getAccountConfig_SRTP_KeyExchange() === Account.KeyExchangeProtocol.SDES) enableSDESToggle.checked = (ClientWrapper.SettingsAdapter.getAccountConfig_SRTP_KeyExchange() === Account.KeyExchangeProtocol.SDES)
fallbackRTPToggle.checked = ClientWrapper.settingsAdaptor.getAccountConfig_SRTP_RtpFallback() fallbackRTPToggle.checked = SettingsAdapter.getAccountConfig_SRTP_RtpFallback()
encryptNegotitationToggle.checked = ClientWrapper.settingsAdaptor.getAccountConfig_TLS_Enable() encryptNegotitationToggle.checked = SettingsAdapter.getAccountConfig_TLS_Enable()
verifyIncomingCertificatesServerToogle.checked = ClientWrapper.settingsAdaptor.getAccountConfig_TLS_VerifyServer() verifyIncomingCertificatesServerToogle.checked = SettingsAdapter.getAccountConfig_TLS_VerifyServer()
verifyIncomingCertificatesClientToogle.checked = ClientWrapper.settingsAdaptor.getAccountConfig_TLS_VerifyClient() verifyIncomingCertificatesClientToogle.checked = SettingsAdapter.getAccountConfig_TLS_VerifyClient()
requireCeritificateForTLSIncomingToggle.checked = ClientWrapper.settingsAdaptor.getAccountConfig_TLS_RequireClientCertificate() requireCeritificateForTLSIncomingToggle.checked = SettingsAdapter.getAccountConfig_TLS_RequireClientCertificate()
var method = ClientWrapper.settingsAdaptor.getAccountConfig_TLS_Method_inInt() var method = SettingsAdapter.getAccountConfig_TLS_Method_inInt()
tlsProtocolComboBox.currentIndex = method tlsProtocolComboBox.currentIndex = method
outgoingTLSServerNameLineEdit.text = ClientWrapper.settingsAdaptor.getAccountConfig_TLS_Servername() outgoingTLSServerNameLineEdit.text = SettingsAdapter.getAccountConfig_TLS_Servername()
negotiationTimeoutSpinBox.value = ClientWrapper.settingsAdaptor.getAccountConfig_TLS_NegotiationTimeoutSec() negotiationTimeoutSpinBox.value = SettingsAdapter.getAccountConfig_TLS_NegotiationTimeoutSec()
// Connectivity // Connectivity
checkBoxUPnPSIP.checked = ClientWrapper.settingsAdaptor.getAccountConfig_UpnpEnabled() checkBoxUPnPSIP.checked = SettingsAdapter.getAccountConfig_UpnpEnabled()
checkBoxTurnEnableSIP.checked = ClientWrapper.settingsAdaptor.getAccountConfig_TURN_Enabled() checkBoxTurnEnableSIP.checked = SettingsAdapter.getAccountConfig_TURN_Enabled()
lineEditTurnAddressSIP.text = ClientWrapper.settingsAdaptor.getAccountConfig_TURN_Server() lineEditTurnAddressSIP.text = SettingsAdapter.getAccountConfig_TURN_Server()
lineEditTurnUsernameSIP.text = ClientWrapper.settingsAdaptor.getAccountConfig_TURN_Username() lineEditTurnUsernameSIP.text = SettingsAdapter.getAccountConfig_TURN_Username()
lineEditTurnPsswdSIP.text = ClientWrapper.settingsAdaptor.getAccountConfig_TURN_Password() lineEditTurnPsswdSIP.text = SettingsAdapter.getAccountConfig_TURN_Password()
lineEditTurnRealmSIP.text = ClientWrapper.settingsAdaptor.getAccountConfig_TURN_Realm() lineEditTurnRealmSIP.text = SettingsAdapter.getAccountConfig_TURN_Realm()
lineEditTurnAddressSIP.enabled = ClientWrapper.settingsAdaptor.getAccountConfig_TURN_Enabled() lineEditTurnAddressSIP.enabled = SettingsAdapter.getAccountConfig_TURN_Enabled()
lineEditTurnUsernameSIP.enabled = ClientWrapper.settingsAdaptor.getAccountConfig_TURN_Enabled() lineEditTurnUsernameSIP.enabled = SettingsAdapter.getAccountConfig_TURN_Enabled()
lineEditTurnPsswdSIP.enabled = ClientWrapper.settingsAdaptor.getAccountConfig_TURN_Enabled() lineEditTurnPsswdSIP.enabled = SettingsAdapter.getAccountConfig_TURN_Enabled()
lineEditTurnRealmSIP.enabled = ClientWrapper.settingsAdaptor.getAccountConfig_TURN_Enabled() lineEditTurnRealmSIP.enabled = SettingsAdapter.getAccountConfig_TURN_Enabled()
checkBoxSTUNEnableSIP.checked = ClientWrapper.settingsAdaptor.getAccountConfig_STUN_Enabled() checkBoxSTUNEnableSIP.checked = SettingsAdapter.getAccountConfig_STUN_Enabled()
lineEditSTUNAddressSIP.text = ClientWrapper.settingsAdaptor.getAccountConfig_STUN_Server() lineEditSTUNAddressSIP.text = SettingsAdapter.getAccountConfig_STUN_Server()
lineEditSTUNAddressSIP.enabled = ClientWrapper.settingsAdaptor.getAccountConfig_STUN_Enabled() lineEditSTUNAddressSIP.enabled = SettingsAdapter.getAccountConfig_STUN_Enabled()
registrationExpireTimeoutSpinBox.value = ClientWrapper.settingsAdaptor.getAccountConfig_Registration_Expire() registrationExpireTimeoutSpinBox.value = SettingsAdapter.getAccountConfig_Registration_Expire()
networkInterfaceSpinBox.value = ClientWrapper.settingsAdaptor.getAccountConfig_Localport() networkInterfaceSpinBox.value = SettingsAdapter.getAccountConfig_Localport()
// published address // published address
checkBoxCustomAddressPort.checked = ClientWrapper.settingsAdaptor.getAccountConfig_PublishedSameAsLocal() checkBoxCustomAddressPort.checked = SettingsAdapter.getAccountConfig_PublishedSameAsLocal()
lineEditSIPCustomAddress.text = ClientWrapper.settingsAdaptor.getAccountConfig_PublishedAddress() lineEditSIPCustomAddress.text = SettingsAdapter.getAccountConfig_PublishedAddress()
customPortSIPSpinBox.value = ClientWrapper.settingsAdaptor.getAccountConfig_PublishedPort() customPortSIPSpinBox.value = SettingsAdapter.getAccountConfig_PublishedPort()
// codecs // codecs
videoCheckBoxSIP.checked = ClientWrapper.settingsAdaptor.getAccountConfig_Video_Enabled() videoCheckBoxSIP.checked = SettingsAdapter.getAccountConfig_Video_Enabled()
updateAudioCodecs() updateAudioCodecs()
updateVideoCodecs() updateVideoCodecs()
btnRingtoneSIP.enabled = ClientWrapper.settingsAdaptor.getAccountConfig_Ringtone_RingtoneEnabled() btnRingtoneSIP.enabled = SettingsAdapter.getAccountConfig_Ringtone_RingtoneEnabled()
btnRingtoneSIP.text = ClientWrapper.utilsAdaptor.toFileInfoName(ClientWrapper.settingsAdaptor.getAccountConfig_Ringtone_RingtonePath()) btnRingtoneSIP.text = ClientWrapper.utilsAdaptor.toFileInfoName(ClientWrapper.SettingsAdapter.getAccountConfig_Ringtone_RingtonePath())
lineEditSTUNAddressSIP.enabled = ClientWrapper.settingsAdaptor.getAccountConfig_STUN_Enabled() lineEditSTUNAddressSIP.enabled = SettingsAdapter.getAccountConfig_STUN_Enabled()
// SDP session negotiation ports // SDP session negotiation ports
audioRTPMinPortSpinBox.value = ClientWrapper.settingsAdaptor.getAccountConfig_Audio_AudioPortMin() audioRTPMinPortSpinBox.value = SettingsAdapter.getAccountConfig_Audio_AudioPortMin()
audioRTPMaxPortSpinBox.value = ClientWrapper.settingsAdaptor.getAccountConfig_Audio_AudioPortMax() audioRTPMaxPortSpinBox.value = SettingsAdapter.getAccountConfig_Audio_AudioPortMax()
videoRTPMinPortSpinBox.value = ClientWrapper.settingsAdaptor.getAccountConfig_Video_VideoPortMin() videoRTPMinPortSpinBox.value = SettingsAdapter.getAccountConfig_Video_VideoPortMin()
videoRTPMaxPortSpinBox.value = ClientWrapper.settingsAdaptor.getAccountConfig_Video_VideoPortMax() videoRTPMaxPortSpinBox.value = SettingsAdapter.getAccountConfig_Video_VideoPortMax()
// voicemail // voicemail
lineEditVoiceMailDialCode.text = ClientWrapper.settingsAdaptor.getAccountConfig_Mailbox() lineEditVoiceMailDialCode.text = SettingsAdapter.getAccountConfig_Mailbox()
} }
function updateAudioCodecs(){ function updateAudioCodecs(){
@@ -122,7 +123,7 @@ ColumnLayout {
var index = audioListWidgetSIP.currentIndex var index = audioListWidgetSIP.currentIndex
var codecId = audioCodecListModelSIP.data(audioCodecListModelSIP.index(index,0), AudioCodecListModel.AudioCodecID) var codecId = audioCodecListModelSIP.data(audioCodecListModelSIP.index(index,0), AudioCodecListModel.AudioCodecID)
ClientWrapper.settingsAdaptor.decreaseAudioCodecPriority(codecId) SettingsAdapter.decreaseAudioCodecPriority(codecId)
audioListWidgetSIP.currentIndex = index + 1 audioListWidgetSIP.currentIndex = index + 1
updateAudioCodecs() updateAudioCodecs()
} }
@@ -131,7 +132,7 @@ ColumnLayout {
var index = audioListWidgetSIP.currentIndex var index = audioListWidgetSIP.currentIndex
var codecId = audioCodecListModelSIP.data(audioCodecListModelSIP.index(index,0), AudioCodecListModel.AudioCodecID) var codecId = audioCodecListModelSIP.data(audioCodecListModelSIP.index(index,0), AudioCodecListModel.AudioCodecID)
ClientWrapper.settingsAdaptor.increaseAudioCodecPriority(codecId) SettingsAdapter.increaseAudioCodecPriority(codecId)
audioListWidgetSIP.currentIndex = index - 1 audioListWidgetSIP.currentIndex = index - 1
updateAudioCodecs() updateAudioCodecs()
} }
@@ -140,7 +141,7 @@ ColumnLayout {
var index = videoListWidgetSIP.currentIndex var index = videoListWidgetSIP.currentIndex
var codecId = videoCodecListModelSIP.data(videoCodecListModelSIP.index(index,0), VideoCodecListModel.VideoCodecID) var codecId = videoCodecListModelSIP.data(videoCodecListModelSIP.index(index,0), VideoCodecListModel.VideoCodecID)
ClientWrapper.settingsAdaptor.decreaseVideoCodecPriority(codecId) SettingsAdapter.decreaseVideoCodecPriority(codecId)
videoListWidgetSIP.currentIndex = index + 1 videoListWidgetSIP.currentIndex = index + 1
updateVideoCodecs() updateVideoCodecs()
} }
@@ -149,7 +150,7 @@ ColumnLayout {
var index = videoListWidgetSIP.currentIndex var index = videoListWidgetSIP.currentIndex
var codecId = videoCodecListModelSIP.data(videoCodecListModelSIP.index(index,0), VideoCodecListModel.VideoCodecID) var codecId = videoCodecListModelSIP.data(videoCodecListModelSIP.index(index,0), VideoCodecListModel.VideoCodecID)
ClientWrapper.settingsAdaptor.increaseVideoCodecPriority(codecId) SettingsAdapter.increaseVideoCodecPriority(codecId)
videoListWidgetSIP.currentIndex = index - 1 videoListWidgetSIP.currentIndex = index - 1
updateVideoCodecs() updateVideoCodecs()
} }
@@ -165,64 +166,64 @@ ColumnLayout {
// slots // slots
function audioRTPMinPortSpinBoxEditFinished(value){ function audioRTPMinPortSpinBoxEditFinished(value){
if (ClientWrapper.settingsAdaptor.getAccountConfig_Audio_AudioPortMax() < value) { if (ClientWrapper.SettingsAdapter.getAccountConfig_Audio_AudioPortMax() < value) {
audioRTPMinPortSpinBox.value = ClientWrapper.settingsAdaptor.getAccountConfig_Audio_AudioPortMin() audioRTPMinPortSpinBox.value = SettingsAdapter.getAccountConfig_Audio_AudioPortMin()
return return
} }
ClientWrapper.settingsAdaptor.audioRTPMinPortSpinBoxEditFinished(value) SettingsAdapter.audioRTPMinPortSpinBoxEditFinished(value)
} }
function audioRTPMaxPortSpinBoxEditFinished(value){ function audioRTPMaxPortSpinBoxEditFinished(value){
if (value < ClientWrapper.settingsAdaptor.getAccountConfig_Audio_AudioPortMin()) { if (value <SettingsAdapter.getAccountConfig_Audio_AudioPortMin()) {
audioRTPMaxPortSpinBox.value = ClientWrapper.settingsAdaptor.getAccountConfig_Audio_AudioPortMax() audioRTPMaxPortSpinBox.value = SettingsAdapter.getAccountConfig_Audio_AudioPortMax()
return return
} }
ClientWrapper.settingsAdaptor.audioRTPMaxPortSpinBoxEditFinished(value) SettingsAdapter.audioRTPMaxPortSpinBoxEditFinished(value)
} }
function videoRTPMinPortSpinBoxEditFinished(value){ function videoRTPMinPortSpinBoxEditFinished(value){
if (ClientWrapper.settingsAdaptor.getAccountConfig_Video_VideoPortMax() < value) { if (ClientWrapper.SettingsAdapter.getAccountConfig_Video_VideoPortMax() < value) {
videoRTPMinPortSpinBox.value = ClientWrapper.settingsAdaptor.getAccountConfig_Video_VideoPortMin() videoRTPMinPortSpinBox.value = SettingsAdapter.getAccountConfig_Video_VideoPortMin()
return return
} }
ClientWrapper.settingsAdaptor.videoRTPMinPortSpinBoxEditFinished(value) SettingsAdapter.videoRTPMinPortSpinBoxEditFinished(value)
} }
function videoRTPMaxPortSpinBoxEditFinished(value){ function videoRTPMaxPortSpinBoxEditFinished(value){
if (value < ClientWrapper.settingsAdaptor.getAccountConfig_Video_VideoPortMin()) { if (value <SettingsAdapter.getAccountConfig_Video_VideoPortMin()) {
videoRTPMinPortSpinBox.value = ClientWrapper.settingsAdaptor.getAccountConfig_Video_VideoPortMin() videoRTPMinPortSpinBox.value = SettingsAdapter.getAccountConfig_Video_VideoPortMin()
return return
} }
ClientWrapper.settingsAdaptor.videoRTPMaxPortSpinBoxEditFinished(value) SettingsAdapter.videoRTPMaxPortSpinBoxEditFinished(value)
} }
function changeRingtonePath(url){ function changeRingtonePath(url){
if(url.length !== 0) { if(url.length !== 0) {
ClientWrapper.settingsAdaptor.set_RingtonePath(url) SettingsAdapter.set_RingtonePath(url)
btnRingtoneSIP.text = ClientWrapper.utilsAdaptor.toFileInfoName(url) btnRingtoneSIP.text = ClientWrapper.utilsAdaptor.toFileInfoName(url)
} else if (ClientWrapper.settingsAdaptor.getAccountConfig_Ringtone_RingtonePath().length === 0){ } else if (ClientWrapper.SettingsAdapter.getAccountConfig_Ringtone_RingtonePath().length === 0){
btnRingtoneSIP.text = qsTr("Add a custom ringtone") btnRingtoneSIP.text = qsTr("Add a custom ringtone")
} }
} }
function changeFileCACert(url){ function changeFileCACert(url){
if(url.length !== 0) { if(url.length !== 0) {
ClientWrapper.settingsAdaptor.set_FileCACert(url) SettingsAdapter.set_FileCACert(url)
btnSIPCACert.text = ClientWrapper.utilsAdaptor.toFileInfoName(url) btnSIPCACert.text = ClientWrapper.utilsAdaptor.toFileInfoName(url)
} }
} }
function changeFileUserCert(url){ function changeFileUserCert(url){
if(url.length !== 0) { if(url.length !== 0) {
ClientWrapper.settingsAdaptor.set_FileUserCert(url) SettingsAdapter.set_FileUserCert(url)
btnSIPUserCert.text = ClientWrapper.utilsAdaptor.toFileInfoName(url) btnSIPUserCert.text = ClientWrapper.utilsAdaptor.toFileInfoName(url)
} }
} }
function changeFilePrivateKey(url){ function changeFilePrivateKey(url){
if(url.length !== 0) { if(url.length !== 0) {
ClientWrapper.settingsAdaptor.set_FilePrivateKey(url) SettingsAdapter.set_FilePrivateKey(url)
btnSIPPrivateKey.text = ClientWrapper.utilsAdaptor.toFileInfoName(url) btnSIPPrivateKey.text = ClientWrapper.utilsAdaptor.toFileInfoName(url)
} }
} }
@@ -230,7 +231,7 @@ ColumnLayout {
JamiFileDialog { JamiFileDialog {
id: ringtonePath_Dialog_SIP id: ringtonePath_Dialog_SIP
property string oldPath : ClientWrapper.settingsAdaptor.getAccountConfig_Ringtone_RingtonePath() property string oldPath : SettingsAdapter.getAccountConfig_Ringtone_RingtonePath()
property string openPath : oldPath === "" ? (ClientWrapper.utilsAdaptor.getCurrentPath() + "/ringtones/") : (ClientWrapper.utilsAdaptor.toFileAbsolutepath(oldPath)) property string openPath : oldPath === "" ? (ClientWrapper.utilsAdaptor.getCurrentPath() + "/ringtones/") : (ClientWrapper.utilsAdaptor.toFileAbsolutepath(oldPath))
mode: JamiFileDialog.OpenFile mode: JamiFileDialog.OpenFile
@@ -257,7 +258,7 @@ ColumnLayout {
JamiFileDialog { JamiFileDialog {
id: caCert_Dialog_SIP id: caCert_Dialog_SIP
property string oldPath : ClientWrapper.settingsAdaptor.getAccountConfig_TLS_CertificateListFile() property string oldPath : SettingsAdapter.getAccountConfig_TLS_CertificateListFile()
property string openPath : oldPath === "" ? (ClientWrapper.utilsAdaptor.getCurrentPath() + "/ringtones/") : (ClientWrapper.utilsAdaptor.toFileAbsolutepath(oldPath)) property string openPath : oldPath === "" ? (ClientWrapper.utilsAdaptor.getCurrentPath() + "/ringtones/") : (ClientWrapper.utilsAdaptor.toFileAbsolutepath(oldPath))
mode: JamiFileDialog.OpenFile mode: JamiFileDialog.OpenFile
@@ -283,7 +284,7 @@ ColumnLayout {
JamiFileDialog { JamiFileDialog {
id: userCert_Dialog_SIP id: userCert_Dialog_SIP
property string oldPath : ClientWrapper.settingsAdaptor.getAccountConfig_TLS_CertificateFile() property string oldPath : SettingsAdapter.getAccountConfig_TLS_CertificateFile()
property string openPath : oldPath === "" ? (ClientWrapper.utilsAdaptor.getCurrentPath() + "/ringtones/") : (ClientWrapper.utilsAdaptor.toFileAbsolutepath(oldPath)) property string openPath : oldPath === "" ? (ClientWrapper.utilsAdaptor.getCurrentPath() + "/ringtones/") : (ClientWrapper.utilsAdaptor.toFileAbsolutepath(oldPath))
mode: JamiFileDialog.OpenFile mode: JamiFileDialog.OpenFile
@@ -309,7 +310,7 @@ ColumnLayout {
JamiFileDialog { JamiFileDialog {
id: privateKey_Dialog_SIP id: privateKey_Dialog_SIP
property string oldPath : ClientWrapper.settingsAdaptor.getAccountConfig_TLS_PrivateKeyFile() property string oldPath : SettingsAdapter.getAccountConfig_TLS_PrivateKeyFile()
property string openPath : oldPath === "" ? (ClientWrapper.utilsAdaptor.getCurrentPath() + "/ringtones/") : (ClientWrapper.utilsAdaptor.toFileAbsolutepath(oldPath)) property string openPath : oldPath === "" ? (ClientWrapper.utilsAdaptor.getCurrentPath() + "/ringtones/") : (ClientWrapper.utilsAdaptor.toFileAbsolutepath(oldPath))
mode: JamiFileDialog.OpenFile mode: JamiFileDialog.OpenFile
@@ -368,7 +369,7 @@ ColumnLayout {
fontPointSize: JamiTheme.settingsFontSize fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: { onSwitchToggled: {
ClientWrapper.settingsAdaptor.setAutoAnswerCalls(checked) SettingsAdapter.setAutoAnswerCalls(checked)
} }
} }
@@ -386,7 +387,7 @@ ColumnLayout {
fontPointSize: JamiTheme.settingsFontSize fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: { onSwitchToggled: {
ClientWrapper.settingsAdaptor.setEnableRingtone(checked) SettingsAdapter.setEnableRingtone(checked)
btnRingtoneSIP.enabled = checked btnRingtoneSIP.enabled = checked
} }
} }
@@ -489,7 +490,7 @@ ColumnLayout {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
onEditingFinished: { onEditingFinished: {
ClientWrapper.settingsAdaptor.lineEditVoiceMailDialCodeEditFinished(text) SettingsAdapter.lineEditVoiceMailDialCodeEditFinished(text)
} }
} }
} }
@@ -523,7 +524,7 @@ ColumnLayout {
fontPointSize: JamiTheme.settingsFontSize fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: { onSwitchToggled: {
ClientWrapper.settingsAdaptor.setUseSRTP(checked) SettingsAdapter.setUseSRTP(checked)
enableSDESToggle.enabled = checked enableSDESToggle.enabled = checked
fallbackRTPToggle.enabled = checked fallbackRTPToggle.enabled = checked
} }
@@ -543,7 +544,7 @@ ColumnLayout {
fontPointSize: JamiTheme.settingsFontSize fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: { onSwitchToggled: {
ClientWrapper.settingsAdaptor.setUseSDES(checked) SettingsAdapter.setUseSDES(checked)
} }
} }
@@ -561,7 +562,7 @@ ColumnLayout {
fontPointSize: JamiTheme.settingsFontSize fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: { onSwitchToggled: {
ClientWrapper.settingsAdaptor.setUseRTPFallback(checked) SettingsAdapter.setUseRTPFallback(checked)
} }
} }
@@ -579,7 +580,7 @@ ColumnLayout {
fontPointSize: JamiTheme.settingsFontSize fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: { onSwitchToggled: {
ClientWrapper.settingsAdaptor.setUseTLS(checked) SettingsAdapter.setUseTLS(checked)
btnSIPCACert.enabled = checked btnSIPCACert.enabled = checked
btnSIPUserCert.enabled = checked btnSIPUserCert.enabled = checked
btnSIPPrivateKey.enabled = checked btnSIPPrivateKey.enabled = checked
@@ -730,7 +731,7 @@ ColumnLayout {
echoMode: TextInput.Password echoMode: TextInput.Password
onEditingFinished: { onEditingFinished: {
ClientWrapper.settingsAdaptor.lineEditSIPCertPasswordLineEditTextChanged(text) SettingsAdapter.lineEditSIPCertPasswordLineEditTextChanged(text)
} }
} }
} }
@@ -742,7 +743,7 @@ ColumnLayout {
fontPointSize: JamiTheme.settingsFontSize fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: { onSwitchToggled: {
ClientWrapper.settingsAdaptor.setVerifyCertificatesServer(checked) SettingsAdapter.setVerifyCertificatesServer(checked)
} }
} }
@@ -760,7 +761,7 @@ ColumnLayout {
fontPointSize: JamiTheme.settingsFontSize fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: { onSwitchToggled: {
ClientWrapper.settingsAdaptor.setVerifyCertificatesClient(checked) SettingsAdapter.setVerifyCertificatesClient(checked)
} }
} }
@@ -778,7 +779,7 @@ ColumnLayout {
fontPointSize: JamiTheme.settingsFontSize fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: { onSwitchToggled: {
ClientWrapper.settingsAdaptor.setRequireCertificatesIncomingTLS(checked) SettingsAdapter.setRequireCertificatesIncomingTLS(checked)
} }
} }
@@ -834,7 +835,7 @@ ColumnLayout {
onActivated: { onActivated: {
var indexOfOption = tlsProtocolComboBox.model.get(index).secondArg var indexOfOption = tlsProtocolComboBox.model.get(index).secondArg
ClientWrapper.settingsAdaptor.tlsProtocolComboBoxIndexChanged(parseInt(indexOfOption)) SettingsAdapter.tlsProtocolComboBoxIndexChanged(parseInt(indexOfOption))
} }
} }
@@ -863,7 +864,7 @@ ColumnLayout {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
onEditingFinished: { onEditingFinished: {
ClientWrapper.settingsAdaptor.outgoingTLSServerNameLineEditTextChanged(text) SettingsAdapter.outgoingTLSServerNameLineEditTextChanged(text)
} }
} }
@@ -899,7 +900,7 @@ ColumnLayout {
down.indicator.width: (width < 200) ? (width / 5) : 40 down.indicator.width: (width < 200) ? (width / 5) : 40
onValueModified: { onValueModified: {
ClientWrapper.settingsAdaptor.negotiationTimeoutSpinBoxValueChanged(value) SettingsAdapter.negotiationTimeoutSpinBoxValueChanged(value)
} }
} }
} }
@@ -968,7 +969,7 @@ ColumnLayout {
down.indicator.width: (width < 200) ? (width / 5) : 40 down.indicator.width: (width < 200) ? (width / 5) : 40
onValueModified: { onValueModified: {
ClientWrapper.settingsAdaptor.registrationTimeoutSpinBoxValueChanged(value) SettingsAdapter.registrationTimeoutSpinBoxValueChanged(value)
} }
} }
@@ -1007,7 +1008,7 @@ ColumnLayout {
down.indicator.width: (width < 200) ? (width / 5) : 40 down.indicator.width: (width < 200) ? (width / 5) : 40
onValueModified: { onValueModified: {
ClientWrapper.settingsAdaptor.networkInterfaceSpinBoxValueChanged(value) SettingsAdapter.networkInterfaceSpinBoxValueChanged(value)
} }
} }
@@ -1021,7 +1022,7 @@ ColumnLayout {
Layout.columnSpan: 2 Layout.columnSpan: 2
onSwitchToggled: { onSwitchToggled: {
ClientWrapper.settingsAdaptor.setUseUPnP(checked) SettingsAdapter.setUseUPnP(checked)
} }
} }
@@ -1035,7 +1036,7 @@ ColumnLayout {
Layout.columnSpan: 2 Layout.columnSpan: 2
onSwitchToggled: { onSwitchToggled: {
ClientWrapper.settingsAdaptor.setUseTURN(checked) SettingsAdapter.setUseTURN(checked)
lineEditTurnAddressSIP.enabled = checked lineEditTurnAddressSIP.enabled = checked
lineEditTurnUsernameSIP.enabled = checked lineEditTurnUsernameSIP.enabled = checked
lineEditTurnPsswdSIP.enabled = checked lineEditTurnPsswdSIP.enabled = checked
@@ -1069,7 +1070,7 @@ ColumnLayout {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
onEditingFinished: { onEditingFinished: {
ClientWrapper.settingsAdaptor.setTURNAddress(text) SettingsAdapter.setTURNAddress(text)
} }
} }
@@ -1099,7 +1100,7 @@ ColumnLayout {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
onEditingFinished: { onEditingFinished: {
ClientWrapper.settingsAdaptor.setTURNUsername(text) SettingsAdapter.setTURNUsername(text)
} }
} }
@@ -1130,7 +1131,7 @@ ColumnLayout {
echoMode: TextInput.Password echoMode: TextInput.Password
onEditingFinished: { onEditingFinished: {
ClientWrapper.settingsAdaptor.setTURNPassword(text) SettingsAdapter.setTURNPassword(text)
} }
} }
@@ -1160,7 +1161,7 @@ ColumnLayout {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
onEditingFinished: { onEditingFinished: {
ClientWrapper.settingsAdaptor.setTURNRealm(text) SettingsAdapter.setTURNRealm(text)
} }
} }
@@ -1174,7 +1175,7 @@ ColumnLayout {
Layout.columnSpan: 2 Layout.columnSpan: 2
onSwitchToggled: { onSwitchToggled: {
ClientWrapper.settingsAdaptor.setUseSTUN(checked) SettingsAdapter.setUseSTUN(checked)
lineEditSTUNAddressSIP.enabled = checked lineEditSTUNAddressSIP.enabled = checked
} }
} }
@@ -1205,7 +1206,7 @@ ColumnLayout {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
onEditingFinished: { onEditingFinished: {
ClientWrapper.settingsAdaptor.setSTUNAddress(text) SettingsAdapter.setSTUNAddress(text)
} }
} }
} }
@@ -1248,7 +1249,7 @@ ColumnLayout {
Layout.columnSpan: 2 Layout.columnSpan: 2
onSwitchToggled: { onSwitchToggled: {
ClientWrapper.settingsAdaptor.setUseCustomAddressAndPort(checked) SettingsAdapter.setUseCustomAddressAndPort(checked)
lineEditSIPCustomAddress.enabled = checked lineEditSIPCustomAddress.enabled = checked
customPortSIPSpinBox.enabled = checked customPortSIPSpinBox.enabled = checked
} }
@@ -1289,7 +1290,7 @@ ColumnLayout {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
onEditingFinished: { onEditingFinished: {
ClientWrapper.settingsAdaptor.lineEditSIPCustomAddressLineEditTextChanged(text) SettingsAdapter.lineEditSIPCustomAddressLineEditTextChanged(text)
} }
} }
@@ -1330,7 +1331,7 @@ ColumnLayout {
down.indicator.width: (width < 200) ? (width / 5) : 40 down.indicator.width: (width < 200) ? (width / 5) : 40
onValueModified: { onValueModified: {
ClientWrapper.settingsAdaptor.customPortSIPSpinBoxValueChanged(value) SettingsAdapter.customPortSIPSpinBoxValueChanged(value)
} }
} }
} }
@@ -1368,7 +1369,7 @@ ColumnLayout {
fontPointSize: JamiTheme.settingsFontSize fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: { onSwitchToggled: {
ClientWrapper.settingsAdaptor.setVideoState(checked) SettingsAdapter.setVideoState(checked)
} }
} }
@@ -1483,7 +1484,7 @@ ColumnLayout {
} }
onVideoCodecStateChange:{ onVideoCodecStateChange:{
ClientWrapper.settingsAdaptor.videoCodecsStateChange(idToSet , isToBeEnabled) SettingsAdapter.videoCodecsStateChange(idToSet , isToBeEnabled)
updateVideoCodecs() updateVideoCodecs()
} }
} }
@@ -1591,7 +1592,7 @@ ColumnLayout {
} }
onAudioCodecStateChange:{ onAudioCodecStateChange:{
ClientWrapper.settingsAdaptor.audioCodecsStateChange(idToSet , isToBeEnabled) SettingsAdapter.audioCodecsStateChange(idToSet , isToBeEnabled)
updateAudioCodecs() updateAudioCodecs()
} }
} }

View File

@@ -26,48 +26,49 @@ import QtQuick.Controls.Styles 1.4
import QtQuick.Dialogs 1.3 import QtQuick.Dialogs 1.3
import Qt.labs.platform 1.1 import Qt.labs.platform 1.1
import net.jami.Models 1.0 import net.jami.Models 1.0
import net.jami.Adapters 1.0
import "../../commoncomponents" import "../../commoncomponents"
ColumnLayout { ColumnLayout {
function updateAccountInfoDisplayedAdvance() { function updateAccountInfoDisplayedAdvance() {
//Call Settings //Call Settings
checkAutoConnectOnLocalNetwork.checked = ClientWrapper.settingsAdaptor.getAccountConfig_PeerDiscovery() checkAutoConnectOnLocalNetwork.checked = SettingsAdapter.getAccountConfig_PeerDiscovery()
checkBoxUntrusted.checked = ClientWrapper.settingsAdaptor.getAccountConfig_DHT_PublicInCalls() checkBoxUntrusted.checked = SettingsAdapter.getAccountConfig_DHT_PublicInCalls()
checkBoxRdv.checked = ClientWrapper.settingsAdaptor.getAccountConfig_RendezVous() checkBoxRdv.checked = SettingsAdapter.getAccountConfig_RendezVous()
checkBoxAutoAnswer.checked = ClientWrapper.settingsAdaptor.getAccountConfig_AutoAnswer() checkBoxAutoAnswer.checked = SettingsAdapter.getAccountConfig_AutoAnswer()
checkBoxCustomRingtone.checked = ClientWrapper.settingsAdaptor.getAccountConfig_Ringtone_RingtoneEnabled() checkBoxCustomRingtone.checked = SettingsAdapter.getAccountConfig_Ringtone_RingtoneEnabled()
// Name Server // Name Server
lineEditNameServer.text = ClientWrapper.settingsAdaptor.getAccountConfig_RingNS_Uri() lineEditNameServer.text = SettingsAdapter.getAccountConfig_RingNS_Uri()
//OpenDHT Config //OpenDHT Config
checkBoxEnableProxy.checked = ClientWrapper.settingsAdaptor.getAccountConfig_ProxyEnabled() checkBoxEnableProxy.checked = SettingsAdapter.getAccountConfig_ProxyEnabled()
lineEditProxy.text = ClientWrapper.settingsAdaptor.getAccountConfig_ProxyServer() lineEditProxy.text = SettingsAdapter.getAccountConfig_ProxyServer()
lineEditBootstrap.text = ClientWrapper.settingsAdaptor.getAccountConfig_Hostname() lineEditBootstrap.text = SettingsAdapter.getAccountConfig_Hostname()
// Security // Security
btnCACert.text = ClientWrapper.utilsAdaptor.toFileInfoName(ClientWrapper.settingsAdaptor.getAccountConfig_TLS_CertificateListFile()) btnCACert.text = ClientWrapper.utilsAdaptor.toFileInfoName(ClientWrapper.SettingsAdapter.getAccountConfig_TLS_CertificateListFile())
btnUserCert.text = ClientWrapper.utilsAdaptor.toFileInfoName(ClientWrapper.settingsAdaptor.getAccountConfig_TLS_CertificateFile()) btnUserCert.text = ClientWrapper.utilsAdaptor.toFileInfoName(ClientWrapper.SettingsAdapter.getAccountConfig_TLS_CertificateFile())
btnPrivateKey.text = ClientWrapper.utilsAdaptor.toFileInfoName(ClientWrapper.settingsAdaptor.getAccountConfig_TLS_PrivateKeyFile()) btnPrivateKey.text = ClientWrapper.utilsAdaptor.toFileInfoName(ClientWrapper.SettingsAdapter.getAccountConfig_TLS_PrivateKeyFile())
// Connectivity // Connectivity
checkBoxUPnP.checked = ClientWrapper.settingsAdaptor.getAccountConfig_UpnpEnabled() checkBoxUPnP.checked = SettingsAdapter.getAccountConfig_UpnpEnabled()
checkBoxTurnEnable.checked = ClientWrapper.settingsAdaptor.getAccountConfig_TURN_Enabled() checkBoxTurnEnable.checked = SettingsAdapter.getAccountConfig_TURN_Enabled()
lineEditTurnAddress.text = ClientWrapper.settingsAdaptor.getAccountConfig_TURN_Server() lineEditTurnAddress.text = SettingsAdapter.getAccountConfig_TURN_Server()
lineEditTurnUsername.text = ClientWrapper.settingsAdaptor.getAccountConfig_TURN_Username() lineEditTurnUsername.text = SettingsAdapter.getAccountConfig_TURN_Username()
lineEditTurnPassword.text = ClientWrapper.settingsAdaptor.getAccountConfig_TURN_Password() lineEditTurnPassword.text = SettingsAdapter.getAccountConfig_TURN_Password()
checkBoxSTUNEnable.checked = ClientWrapper.settingsAdaptor.getAccountConfig_STUN_Enabled() checkBoxSTUNEnable.checked = SettingsAdapter.getAccountConfig_STUN_Enabled()
lineEditSTUNAddress.text = ClientWrapper.settingsAdaptor.getAccountConfig_STUN_Server() lineEditSTUNAddress.text = SettingsAdapter.getAccountConfig_STUN_Server()
// codecs // codecs
videoCheckBox.checked = ClientWrapper.settingsAdaptor.getAccountConfig_Video_Enabled() videoCheckBox.checked = SettingsAdapter.getAccountConfig_Video_Enabled()
// update audio and video codec, make sure this change does not trigger item change events // update audio and video codec, make sure this change does not trigger item change events
updateAudioCodecs(); updateAudioCodecs();
updateVideoCodecs(); updateVideoCodecs();
btnRingtone.enabled = ClientWrapper.settingsAdaptor.getAccountConfig_Ringtone_RingtoneEnabled() btnRingtone.enabled = SettingsAdapter.getAccountConfig_Ringtone_RingtoneEnabled()
btnRingtone.text = ClientWrapper.utilsAdaptor.toFileInfoName(ClientWrapper.settingsAdaptor.getAccountConfig_Ringtone_RingtonePath()) btnRingtone.text = ClientWrapper.utilsAdaptor.toFileInfoName(ClientWrapper.SettingsAdapter.getAccountConfig_Ringtone_RingtonePath())
lineEditProxy.enabled = ClientWrapper.settingsAdaptor.getAccountConfig_ProxyEnabled() lineEditProxy.enabled = SettingsAdapter.getAccountConfig_ProxyEnabled()
lineEditSTUNAddress.enabled = ClientWrapper.settingsAdaptor.getAccountConfig_STUN_Enabled() lineEditSTUNAddress.enabled = SettingsAdapter.getAccountConfig_STUN_Enabled()
} }
function updateAudioCodecs(){ function updateAudioCodecs(){
@@ -88,7 +89,7 @@ ColumnLayout {
var index = audioListWidget.currentIndex var index = audioListWidget.currentIndex
var codecId = audioCodecListModel.data(audioCodecListModel.index(index,0), AudioCodecListModel.AudioCodecID) var codecId = audioCodecListModel.data(audioCodecListModel.index(index,0), AudioCodecListModel.AudioCodecID)
ClientWrapper.settingsAdaptor.decreaseAudioCodecPriority(codecId) SettingsAdapter.decreaseAudioCodecPriority(codecId)
audioListWidget.currentIndex = index + 1 audioListWidget.currentIndex = index + 1
updateAudioCodecs() updateAudioCodecs()
} }
@@ -97,7 +98,7 @@ ColumnLayout {
var index = audioListWidget.currentIndex var index = audioListWidget.currentIndex
var codecId = audioCodecListModel.data(audioCodecListModel.index(index,0), AudioCodecListModel.AudioCodecID) var codecId = audioCodecListModel.data(audioCodecListModel.index(index,0), AudioCodecListModel.AudioCodecID)
ClientWrapper.settingsAdaptor.increaseAudioCodecPriority(codecId) SettingsAdapter.increaseAudioCodecPriority(codecId)
audioListWidget.currentIndex = index - 1 audioListWidget.currentIndex = index - 1
updateAudioCodecs() updateAudioCodecs()
} }
@@ -106,7 +107,7 @@ ColumnLayout {
var index = videoListWidget.currentIndex var index = videoListWidget.currentIndex
var codecId = videoCodecListModel.data(videoCodecListModel.index(index,0), VideoCodecListModel.VideoCodecID) var codecId = videoCodecListModel.data(videoCodecListModel.index(index,0), VideoCodecListModel.VideoCodecID)
ClientWrapper.settingsAdaptor.decreaseVideoCodecPriority(codecId) SettingsAdapter.decreaseVideoCodecPriority(codecId)
videoListWidget.currentIndex = index + 1 videoListWidget.currentIndex = index + 1
updateVideoCodecs() updateVideoCodecs()
} }
@@ -115,7 +116,7 @@ ColumnLayout {
var index = videoListWidget.currentIndex var index = videoListWidget.currentIndex
var codecId = videoCodecListModel.data(videoCodecListModel.index(index,0), VideoCodecListModel.VideoCodecID) var codecId = videoCodecListModel.data(videoCodecListModel.index(index,0), VideoCodecListModel.VideoCodecID)
ClientWrapper.settingsAdaptor.increaseVideoCodecPriority(codecId) SettingsAdapter.increaseVideoCodecPriority(codecId)
videoListWidget.currentIndex = index - 1 videoListWidget.currentIndex = index - 1
updateVideoCodecs() updateVideoCodecs()
} }
@@ -130,30 +131,30 @@ ColumnLayout {
function changeRingtonePath(url){ function changeRingtonePath(url){
if(url.length !== 0) { if(url.length !== 0) {
ClientWrapper.settingsAdaptor.set_RingtonePath(url) SettingsAdapter.set_RingtonePath(url)
btnRingtone.text = ClientWrapper.utilsAdaptor.toFileInfoName(url) btnRingtone.text = ClientWrapper.utilsAdaptor.toFileInfoName(url)
} else if (ClientWrapper.settingsAdaptor.getAccountConfig_Ringtone_RingtonePath().length === 0){ } else if (ClientWrapper.SettingsAdapter.getAccountConfig_Ringtone_RingtonePath().length === 0){
btnRingtone.text = qsTr("Add a custom ringtone") btnRingtone.text = qsTr("Add a custom ringtone")
} }
} }
function changeFileCACert(url){ function changeFileCACert(url){
if(url.length !== 0) { if(url.length !== 0) {
ClientWrapper.settingsAdaptor.set_FileCACert(url) SettingsAdapter.set_FileCACert(url)
btnCACert.text = ClientWrapper.utilsAdaptor.toFileInfoName(url) btnCACert.text = ClientWrapper.utilsAdaptor.toFileInfoName(url)
} }
} }
function changeFileUserCert(url){ function changeFileUserCert(url){
if(url.length !== 0) { if(url.length !== 0) {
ClientWrapper.settingsAdaptor.set_FileUserCert(url) SettingsAdapter.set_FileUserCert(url)
btnUserCert.text = ClientWrapper.utilsAdaptor.toFileInfoName(url) btnUserCert.text = ClientWrapper.utilsAdaptor.toFileInfoName(url)
} }
} }
function changeFilePrivateKey(url){ function changeFilePrivateKey(url){
if(url.length !== 0) { if(url.length !== 0) {
ClientWrapper.settingsAdaptor.set_FilePrivateKey(url) SettingsAdapter.set_FilePrivateKey(url)
btnPrivateKey.text = ClientWrapper.utilsAdaptor.toFileInfoName(url) btnPrivateKey.text = ClientWrapper.utilsAdaptor.toFileInfoName(url)
} }
} }
@@ -161,7 +162,7 @@ ColumnLayout {
JamiFileDialog { JamiFileDialog {
id: ringtonePath_Dialog id: ringtonePath_Dialog
property string oldPath : ClientWrapper.settingsAdaptor.getAccountConfig_Ringtone_RingtonePath() property string oldPath : SettingsAdapter.getAccountConfig_Ringtone_RingtonePath()
property string openPath : oldPath === "" ? (ClientWrapper.utilsAdaptor.getCurrentPath() + "/ringtones/") : (ClientWrapper.utilsAdaptor.toFileAbsolutepath(oldPath)) property string openPath : oldPath === "" ? (ClientWrapper.utilsAdaptor.getCurrentPath() + "/ringtones/") : (ClientWrapper.utilsAdaptor.toFileAbsolutepath(oldPath))
mode: JamiFileDialog.OpenFile mode: JamiFileDialog.OpenFile
@@ -188,7 +189,7 @@ ColumnLayout {
JamiFileDialog { JamiFileDialog {
id: caCert_Dialog id: caCert_Dialog
property string oldPath : ClientWrapper.settingsAdaptor.getAccountConfig_TLS_CertificateListFile() property string oldPath : SettingsAdapter.getAccountConfig_TLS_CertificateListFile()
property string openPath : oldPath === "" ? (ClientWrapper.utilsAdaptor.getCurrentPath() + "/ringtones/") : (ClientWrapper.utilsAdaptor.toFileAbsolutepath(oldPath)) property string openPath : oldPath === "" ? (ClientWrapper.utilsAdaptor.getCurrentPath() + "/ringtones/") : (ClientWrapper.utilsAdaptor.toFileAbsolutepath(oldPath))
mode: JamiFileDialog.OpenFile mode: JamiFileDialog.OpenFile
@@ -214,7 +215,7 @@ ColumnLayout {
JamiFileDialog { JamiFileDialog {
id: userCert_Dialog id: userCert_Dialog
property string oldPath : ClientWrapper.settingsAdaptor.getAccountConfig_TLS_CertificateFile() property string oldPath : SettingsAdapter.getAccountConfig_TLS_CertificateFile()
property string openPath : oldPath === "" ? (ClientWrapper.utilsAdaptor.getCurrentPath() + "/ringtones/") : (ClientWrapper.utilsAdaptor.toFileAbsolutepath(oldPath)) property string openPath : oldPath === "" ? (ClientWrapper.utilsAdaptor.getCurrentPath() + "/ringtones/") : (ClientWrapper.utilsAdaptor.toFileAbsolutepath(oldPath))
mode: JamiFileDialog.OpenFile mode: JamiFileDialog.OpenFile
@@ -241,7 +242,7 @@ ColumnLayout {
id: privateKey_Dialog id: privateKey_Dialog
property string oldPath : { property string oldPath : {
return ClientWrapper.settingsAdaptor.getAccountConfig_TLS_PrivateKeyFile() return ClientWrapper.SettingsAdapter.getAccountConfig_TLS_PrivateKeyFile()
} }
property string openPath : oldPath === "" ? (ClientWrapper.utilsAdaptor.getCurrentPath() + "/ringtones/") : (ClientWrapper.utilsAdaptor.toFileAbsolutepath(oldPath)) property string openPath : oldPath === "" ? (ClientWrapper.utilsAdaptor.getCurrentPath() + "/ringtones/") : (ClientWrapper.utilsAdaptor.toFileAbsolutepath(oldPath))
@@ -298,7 +299,7 @@ ColumnLayout {
fontPointSize: JamiTheme.settingsFontSize fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: { onSwitchToggled: {
ClientWrapper.settingsAdaptor.setCallsUntrusted(checked) SettingsAdapter.setCallsUntrusted(checked)
} }
} }
@@ -318,7 +319,7 @@ ColumnLayout {
fontPointSize: JamiTheme.settingsFontSize fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: { onSwitchToggled: {
ClientWrapper.settingsAdaptor.setAutoAnswerCalls(checked) SettingsAdapter.setAutoAnswerCalls(checked)
} }
} }
@@ -336,7 +337,7 @@ ColumnLayout {
fontPointSize: JamiTheme.settingsFontSize fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: { onSwitchToggled: {
ClientWrapper.settingsAdaptor.setEnableRingtone(checked) SettingsAdapter.setEnableRingtone(checked)
btnRingtone.enabled = checked btnRingtone.enabled = checked
} }
} }
@@ -390,7 +391,7 @@ ColumnLayout {
fontPointSize: 10 fontPointSize: 10
onSwitchToggled: { onSwitchToggled: {
ClientWrapper.settingsAdaptor.setIsRendezVous(checked) SettingsAdapter.setIsRendezVous(checked)
} }
} }
} }
@@ -445,7 +446,7 @@ ColumnLayout {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
onEditingFinished: { onEditingFinished: {
ClientWrapper.settingsAdaptor.setNameServer(text) SettingsAdapter.setNameServer(text)
} }
} }
} }
@@ -478,7 +479,7 @@ ColumnLayout {
fontPointSize: JamiTheme.settingsFontSize fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: { onSwitchToggled: {
ClientWrapper.settingsAdaptor.setEnableProxy(checked) SettingsAdapter.setEnableProxy(checked)
lineEditProxy.enabled = checked lineEditProxy.enabled = checked
} }
} }
@@ -511,7 +512,7 @@ ColumnLayout {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
onEditingFinished: { onEditingFinished: {
ClientWrapper.settingsAdaptor.setProxyAddress(text) SettingsAdapter.setProxyAddress(text)
} }
} }
} }
@@ -549,7 +550,7 @@ ColumnLayout {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
onEditingFinished: { onEditingFinished: {
ClientWrapper.settingsAdaptor.setBootstrapAddress(text) SettingsAdapter.setBootstrapAddress(text)
} }
} }
} }
@@ -743,7 +744,7 @@ ColumnLayout {
fontPointSize: JamiTheme.settingsFontSize fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: { onSwitchToggled: {
ClientWrapper.settingsAdaptor.setAutoConnectOnLocalNetwork(checked) SettingsAdapter.setAutoConnectOnLocalNetwork(checked)
} }
} }
@@ -763,7 +764,7 @@ ColumnLayout {
fontPointSize: JamiTheme.settingsFontSize fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: { onSwitchToggled: {
ClientWrapper.settingsAdaptor.setUseUPnP(checked) SettingsAdapter.setUseUPnP(checked)
} }
} }
@@ -776,7 +777,7 @@ ColumnLayout {
fontPointSize: JamiTheme.settingsFontSize fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: { onSwitchToggled: {
ClientWrapper.settingsAdaptor.setUseTURN(checked) SettingsAdapter.setUseTURN(checked)
} }
} }
@@ -808,7 +809,7 @@ ColumnLayout {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
onEditingFinished: { onEditingFinished: {
ClientWrapper.settingsAdaptor.setTURNAddress(text) SettingsAdapter.setTURNAddress(text)
} }
} }
} }
@@ -842,7 +843,7 @@ ColumnLayout {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
onEditingFinished: { onEditingFinished: {
ClientWrapper.settingsAdaptor.setTURNUsername(text) SettingsAdapter.setTURNUsername(text)
} }
} }
} }
@@ -877,7 +878,7 @@ ColumnLayout {
echoMode: TextInput.Password echoMode: TextInput.Password
onEditingFinished: { onEditingFinished: {
ClientWrapper.settingsAdaptor.setTURNPassword(text) SettingsAdapter.setTURNPassword(text)
} }
} }
} }
@@ -892,7 +893,7 @@ ColumnLayout {
fontPointSize: JamiTheme.settingsFontSize fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: { onSwitchToggled: {
ClientWrapper.settingsAdaptor.setUseSTUN(checked) SettingsAdapter.setUseSTUN(checked)
lineEditSTUNAddress.enabled = checked lineEditSTUNAddress.enabled = checked
} }
} }
@@ -930,7 +931,7 @@ ColumnLayout {
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
onEditingFinished: { onEditingFinished: {
ClientWrapper.settingsAdaptor.setSTUNAddress(text) SettingsAdapter.setSTUNAddress(text)
} }
} }
} }
@@ -966,7 +967,7 @@ ColumnLayout {
fontPointSize: JamiTheme.settingsFontSize fontPointSize: JamiTheme.settingsFontSize
onSwitchToggled: { onSwitchToggled: {
ClientWrapper.settingsAdaptor.setVideoState(checked) SettingsAdapter.setVideoState(checked)
} }
} }
@@ -1068,7 +1069,7 @@ ColumnLayout {
} }
onVideoCodecStateChange:{ onVideoCodecStateChange:{
ClientWrapper.settingsAdaptor.videoCodecsStateChange(idToSet , isToBeEnabled) SettingsAdapter.videoCodecsStateChange(idToSet , isToBeEnabled)
updateVideoCodecs() updateVideoCodecs()
} }
} }
@@ -1171,7 +1172,7 @@ ColumnLayout {
} }
onAudioCodecStateChange:{ onAudioCodecStateChange:{
ClientWrapper.settingsAdaptor.audioCodecsStateChange(idToSet , isToBeEnabled) SettingsAdapter.audioCodecsStateChange(idToSet , isToBeEnabled)
updateAudioCodecs() updateAudioCodecs()
} }
} }

View File

@@ -92,7 +92,7 @@ Rectangle {
function setFormatListForCurrentDevice(){ function setFormatListForCurrentDevice(){
var device = ClientWrapper.avmodel.getCurrentVideoCaptureDevice() var device = ClientWrapper.avmodel.getCurrentVideoCaptureDevice()
if(ClientWrapper.settingsAdaptor.get_DeviceCapabilitiesSize(device) === 0){ if(ClientWrapper.SettingsAdapter.get_DeviceCapabilitiesSize(device) === 0){
return return
} }
@@ -208,7 +208,7 @@ Rectangle {
} }
try{ try{
ClientWrapper.settingsAdaptor.set_Video_Settings_Rate_And_Resolution(ClientWrapper.avmodel.getCurrentVideoCaptureDevice(),rate,resolution) SettingsAdapter.set_Video_Settings_Rate_And_Resolution(ClientWrapper.avmodel.getCurrentVideoCaptureDevice(),rate,resolution)
updatePreviewRatio(resolution) updatePreviewRatio(resolution)
} catch(error){console.warn(error.message)} } catch(error){console.warn(error.message)}
} }

View File

@@ -26,6 +26,7 @@ import QtQuick.Controls.Styles 1.4
import QtQuick.Dialogs 1.3 import QtQuick.Dialogs 1.3
import Qt.labs.platform 1.1 import Qt.labs.platform 1.1
import net.jami.Models 1.0 import net.jami.Models 1.0
import net.jami.Adapters 1.0
import "../../commoncomponents" import "../../commoncomponents"
@@ -59,23 +60,23 @@ Rectangle {
function updateAccountInfoDisplayed() { function updateAccountInfoDisplayed() {
setAvatar() setAvatar()
accountEnableCheckBox.checked = ClientWrapper.settingsAdaptor.get_CurrentAccountInfo_Enabled() accountEnableCheckBox.checked = SettingsAdapter.get_CurrentAccountInfo_Enabled()
displayNameLineEdit.text = ClientWrapper.settingsAdaptor.getCurrentAccount_Profile_Info_Alias() displayNameLineEdit.text = SettingsAdapter.getCurrentAccount_Profile_Info_Alias()
var showLocalAccountConfig = (ClientWrapper.settingsAdaptor.getAccountConfig_Manageruri() === "") var showLocalAccountConfig = (ClientWrapper.SettingsAdapter.getAccountConfig_Manageruri() === "")
passwdPushButton.visible = showLocalAccountConfig passwdPushButton.visible = showLocalAccountConfig
btnExportAccount.visible = showLocalAccountConfig btnExportAccount.visible = showLocalAccountConfig
linkDevPushButton.visible = showLocalAccountConfig linkDevPushButton.visible = showLocalAccountConfig
registeredIdNeedsSet = (ClientWrapper.settingsAdaptor.get_CurrentAccountInfo_RegisteredName() === "") registeredIdNeedsSet = (ClientWrapper.SettingsAdapter.get_CurrentAccountInfo_RegisteredName() === "")
if(!registeredIdNeedsSet){ if(!registeredIdNeedsSet){
currentRegisteredID.text = ClientWrapper.settingsAdaptor.get_CurrentAccountInfo_RegisteredName() currentRegisteredID.text = SettingsAdapter.get_CurrentAccountInfo_RegisteredName()
} else { } else {
currentRegisteredID.text = "" currentRegisteredID.text = ""
} }
currentRingIDText.text = ClientWrapper.settingsAdaptor.getCurrentAccount_Profile_Info_Uri() currentRingIDText.text = SettingsAdapter.getCurrentAccount_Profile_Info_Uri()
// update device list view // update device list view
updateAndShowDevicesSlot() updateAndShowDevicesSlot()
@@ -104,9 +105,9 @@ Rectangle {
function setAvatar() { function setAvatar() {
currentAccountAvatar.setAvatarPixmap( currentAccountAvatar.setAvatarPixmap(
ClientWrapper.settingsAdaptor.getAvatarImage_Base64( SettingsAdapter.getAvatarImage_Base64(
currentAccountAvatar.boothWidth), currentAccountAvatar.boothWidth),
ClientWrapper.settingsAdaptor.getIsDefaultAvatar()) SettingsAdapter.getIsDefaultAvatar())
} }
function stopBooth() { function stopBooth() {
@@ -120,7 +121,7 @@ Rectangle {
} }
function unban(index) { function unban(index) {
ClientWrapper.settingsAdaptor.unbanContact(index) SettingsAdapter.unbanContact(index)
updateAndShowBannedContactsSlot() updateAndShowBannedContactsSlot()
} }
@@ -160,7 +161,7 @@ Rectangle {
// slots // slots
function verifyRegisteredNameSlot() { function verifyRegisteredNameSlot() {
if (ClientWrapper.settingsAdaptor.get_CurrentAccountInfo_RegisteredName() !== "") { if (ClientWrapper.SettingsAdapter.get_CurrentAccountInfo_RegisteredName() !== "") {
regNameUi = CurrentAccountSettingsScrollPage.BLANK regNameUi = CurrentAccountSettingsScrollPage.BLANK
} else { } else {
registeredName = ClientWrapper.utilsAdaptor.stringSimplifier( registeredName = ClientWrapper.utilsAdaptor.stringSimplifier(
@@ -410,7 +411,7 @@ Rectangle {
} }
function updateAndShowDevicesSlot() { function updateAndShowDevicesSlot() {
if(ClientWrapper.settingsAdaptor.getAccountConfig_Manageruri() === ""){ if(ClientWrapper.SettingsAdapter.getAccountConfig_Manageruri() === ""){
linkDevPushButton.visible = true linkDevPushButton.visible = true
} }
@@ -560,11 +561,11 @@ Rectangle {
Layout.minimumHeight: boothWidth+50 Layout.minimumHeight: boothWidth+50
onImageAcquired: { onImageAcquired: {
ClientWrapper.settingsAdaptor.setCurrAccAvatar(imgBase64) SettingsAdapter.setCurrAccAvatar(imgBase64)
} }
onImageCleared: { onImageCleared: {
ClientWrapper.settingsAdaptor.clearCurrentAvatar() SettingsAdapter.clearCurrentAvatar()
setAvatar() setAvatar()
} }
} }
@@ -673,7 +674,7 @@ Rectangle {
elideWidth: accountViewRect.width - idLabel.width -JamiTheme.preferredMarginSize*4 elideWidth: accountViewRect.width - idLabel.width -JamiTheme.preferredMarginSize*4
text: { refreshVariable text: { refreshVariable
return ClientWrapper.settingsAdaptor.getCurrentAccount_Profile_Info_Uri() return ClientWrapper.SettingsAdapter.getCurrentAccount_Profile_Info_Uri()
} }
} }
} }
@@ -716,7 +717,7 @@ Rectangle {
text: { text: {
refreshVariable refreshVariable
if (!registeredIdNeedsSet){ if (!registeredIdNeedsSet){
return ClientWrapper.settingsAdaptor.get_CurrentAccountInfo_RegisteredName() return ClientWrapper.SettingsAdapter.get_CurrentAccountInfo_RegisteredName()
} else { } else {
return "" return ""
} }
@@ -775,7 +776,8 @@ Rectangle {
MaterialButton { MaterialButton {
id: passwdPushButton id: passwdPushButton
visible: ClientWrapper.settingsAdaptor.getAccountConfig_Manageruri() === ""
visible: SettingsAdapter.getAccountConfig_Manageruri() === ""
color: JamiTheme.buttonTintedBlack color: JamiTheme.buttonTintedBlack
hoveredColor: JamiTheme.buttonTintedBlackHovered hoveredColor: JamiTheme.buttonTintedBlackHovered
@@ -805,7 +807,8 @@ Rectangle {
MaterialButton { MaterialButton {
id: btnExportAccount id: btnExportAccount
visible: ClientWrapper.settingsAdaptor.getAccountConfig_Manageruri() === ""
visible: SettingsAdapter.getAccountConfig_Manageruri() === ""
color: JamiTheme.buttonTintedBlack color: JamiTheme.buttonTintedBlack
hoveredColor: JamiTheme.buttonTintedBlackHovered hoveredColor: JamiTheme.buttonTintedBlackHovered
@@ -913,7 +916,7 @@ Rectangle {
MaterialButton { MaterialButton {
id: linkDevPushButton id: linkDevPushButton
visible: ClientWrapper.settingsAdaptor.getAccountConfig_Manageruri() === "" visible: SettingsAdapter.getAccountConfig_Manageruri() === ""
Layout.minimumHeight: JamiTheme.preferredFieldHeight Layout.minimumHeight: JamiTheme.preferredFieldHeight
Layout.preferredHeight: JamiTheme.preferredFieldHeight Layout.preferredHeight: JamiTheme.preferredFieldHeight

View File

@@ -35,13 +35,13 @@ Rectangle {
property int preferredColumnWidth : sipAccountViewRect.width / 2 - 50 property int preferredColumnWidth : sipAccountViewRect.width / 2 - 50
function updateAccountInfoDisplayed() { function updateAccountInfoDisplayed() {
displaySIPNameLineEdit.text = ClientWrapper.settingsAdaptor.getCurrentAccount_Profile_Info_Alias() displaySIPNameLineEdit.text = SettingsAdapter.getCurrentAccount_Profile_Info_Alias()
usernameSIP.text = ClientWrapper.settingsAdaptor.getAccountConfig_Username() usernameSIP.text = SettingsAdapter.getAccountConfig_Username()
hostnameSIP.text = ClientWrapper.settingsAdaptor.getAccountConfig_Hostname() hostnameSIP.text = SettingsAdapter.getAccountConfig_Hostname()
passSIPlineEdit.text = ClientWrapper.settingsAdaptor.getAccountConfig_Password() passSIPlineEdit.text = SettingsAdapter.getAccountConfig_Password()
proxySIP.text = ClientWrapper.settingsAdaptor.getAccountConfig_ProxyServer() proxySIP.text = SettingsAdapter.getAccountConfig_ProxyServer()
accountSIPEnableCheckBox.checked = ClientWrapper.settingsAdaptor.get_CurrentAccountInfo_Enabled() accountSIPEnableCheckBox.checked = SettingsAdapter.get_CurrentAccountInfo_Enabled()
setAvatar() setAvatar()
@@ -56,9 +56,9 @@ Rectangle {
function setAvatar() { function setAvatar() {
currentSIPAccountAvatar.setAvatarPixmap( currentSIPAccountAvatar.setAvatarPixmap(
ClientWrapper.settingsAdaptor.getAvatarImage_Base64( SettingsAdapter.getAvatarImage_Base64(
currentSIPAccountAvatar.boothWidth), currentSIPAccountAvatar.boothWidth),
ClientWrapper.settingsAdaptor.getIsDefaultAvatar()) SettingsAdapter.getIsDefaultAvatar())
} }
function stopBooth() { function stopBooth() {
@@ -220,11 +220,11 @@ Rectangle {
Layout.minimumHeight: boothWidth+50 Layout.minimumHeight: boothWidth+50
onImageAcquired: { onImageAcquired: {
ClientWrapper.settingsAdaptor.setCurrAccAvatar(imgBase64) SettingsAdapter.setCurrAccAvatar(imgBase64)
} }
onImageCleared: { onImageCleared: {
ClientWrapper.settingsAdaptor.clearCurrentAvatar() SettingsAdapter.clearCurrentAvatar()
setAvatar() setAvatar()
} }
} }
@@ -313,7 +313,7 @@ Rectangle {
padding: 8 padding: 8
onEditingFinished: { onEditingFinished: {
ClientWrapper.settingsAdaptor.setAccountConfig_Username( SettingsAdapter.setAccountConfig_Username(
usernameSIP.text) usernameSIP.text)
} }
} }
@@ -348,7 +348,7 @@ Rectangle {
padding: 8 padding: 8
onEditingFinished: { onEditingFinished: {
ClientWrapper.settingsAdaptor.setAccountConfig_Hostname( SettingsAdapter.setAccountConfig_Hostname(
hostnameSIP.text) hostnameSIP.text)
} }
} }
@@ -383,7 +383,7 @@ Rectangle {
padding: 8 padding: 8
onEditingFinished: { onEditingFinished: {
ClientWrapper.settingsAdaptor.setAccountConfig_ProxyServer( SettingsAdapter.setAccountConfig_ProxyServer(
proxySIP.text) proxySIP.text)
} }
} }
@@ -419,7 +419,7 @@ Rectangle {
padding: 8 padding: 8
onEditingFinished: { onEditingFinished: {
ClientWrapper.settingsAdaptor.setAccountConfig_Password( SettingsAdapter.setAccountConfig_Password(
passSIPlineEdit.text) passSIPlineEdit.text)
} }
} }

View File

@@ -57,7 +57,7 @@ ItemDelegate {
function toggleEditable() { function toggleEditable() {
editable = !editable editable = !editable
if (editable) { if (editable) {
ClientWrapper.settingsAdaptor.setDeviceName(elidedTextDeviceName.text) SettingsAdapter.setDeviceName(elidedTextDeviceName.text)
} }
} }

View File

@@ -24,6 +24,8 @@ import QtQuick.Layouts 1.3
import Qt.labs.platform 1.1 import Qt.labs.platform 1.1
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 net.jami.Enums 1.0
import "../../commoncomponents" import "../../commoncomponents"
Rectangle { Rectangle {
@@ -31,34 +33,34 @@ Rectangle {
function populateGeneralSettings(){ function populateGeneralSettings(){
// settings // settings
closeOrMinCheckBox.checked = ClientWrapper.settingsAdaptor.getSettingsValue_CloseOrMinimized() closeOrMinCheckBox.checked = SettingsAdapter.getAppValue(Settings.MinimizeOnClose)
applicationOnStartUpCheckBox.checked = ClientWrapper.utilsAdaptor.checkStartupLink() applicationOnStartUpCheckBox.checked = ClientWrapper.utilsAdaptor.checkStartupLink()
notificationCheckBox.checked = ClientWrapper.settingsAdaptor.getSettingsValue_EnableNotifications() notificationCheckBox.checked = SettingsAdapter.getAppValue(Settings.EnableNotifications)
alwaysRecordingCheckBox.checked = ClientWrapper.avmodel.getAlwaysRecord() alwaysRecordingCheckBox.checked = ClientWrapper.avmodel.getAlwaysRecord()
recordPreviewCheckBox.checked = ClientWrapper.avmodel.getRecordPreview() recordPreviewCheckBox.checked = ClientWrapper.avmodel.getRecordPreview()
recordQualityValueLabel.text = ClientWrapper.utilsAdaptor.getRecordQualityString(ClientWrapper.avmodel.getRecordQuality() / 100) recordQualityValueLabel.text = ClientWrapper.utilsAdaptor.getRecordQualityString(ClientWrapper.avmodel.getRecordQuality() / 100)
recordQualitySlider.value = ClientWrapper.avmodel.getRecordQuality() / 100 recordQualitySlider.value = ClientWrapper.avmodel.getRecordQuality() / 100
ClientWrapper.avmodel.setRecordPath(ClientWrapper.settingsAdaptor.getDir_Document()) ClientWrapper.avmodel.setRecordPath(ClientWrapper.SettingsAdapter.getDir_Document())
autoUpdateCheckBox.checked = ClientWrapper.settingsAdaptor.getSettingsValue_AutoUpdate() autoUpdateCheckBox.checked = SettingsAdapter.getAppValue(Settings.Key.AutoUpdate)
} }
function slotSetNotifications(state){ function setEnableNotifications(state) {
ClientWrapper.settingsAdaptor.setNotifications(state) SettingsAdapter.setAppValue(Settings.Key.EnableNotifications, state)
} }
function slotSetClosedOrMin(state){ function setMinimizeOnClose(state) {
ClientWrapper.settingsAdaptor.setClosedOrMin(state) SettingsAdapter.setAppValue(Settings.Key.MinimizeOnClose, state)
} }
function slotSetRunOnStartUp(state){ function slotSetRunOnStartUp(state){
ClientWrapper.settingsAdaptor.setRunOnStartUp(state) SettingsAdapter.setRunOnStartUp(state)
} }
function slotSetUpdateAutomatic(state){ function setAutoUpdate(state) {
ClientWrapper.settingsAdaptor.setUpdateAutomatic(state) SettingsAdapter.setAppValue(Settings.Key.AutoUpdate, state)
} }
function slotAlwaysRecordingClicked(state){ function slotAlwaysRecordingClicked(state){
@@ -142,10 +144,10 @@ Rectangle {
function installBetaSlot(){} function installBetaSlot(){}
// settings // settings
property string downloadPath: ClientWrapper.settingsAdaptor.getDir_Download() property string downloadPath: SettingsAdapter.getDir_Download()
// recording // recording
property string recordPath: ClientWrapper.settingsAdaptor.getDir_Document() property string recordPath: SettingsAdapter.getDir_Document()
property int preferredColumnWidth : generalSettingsScrollView.width / 2 - 50 property int preferredColumnWidth : generalSettingsScrollView.width / 2 - 50
property int preferredSettingsWidth : generalSettingsScrollView.width - 100 property int preferredSettingsWidth : generalSettingsScrollView.width - 100
@@ -154,7 +156,7 @@ Rectangle {
onDownloadPathChanged: { onDownloadPathChanged: {
if(downloadPath === "") return if(downloadPath === "") return
ClientWrapper.settingsAdaptor.setDownloadPath(downloadPath) SettingsAdapter.setDownloadPath(downloadPath)
} }
onRecordPathChanged: { onRecordPathChanged: {
@@ -276,7 +278,7 @@ Rectangle {
tooltipText: qsTr("toggle enable notifications") tooltipText: qsTr("toggle enable notifications")
onSwitchToggled: { onSwitchToggled: {
slotSetNotifications(checked) setEnableNotifications(checked)
} }
} }
@@ -297,7 +299,7 @@ Rectangle {
tooltipText: qsTr("toggle keep minimized on close") tooltipText: qsTr("toggle keep minimized on close")
onSwitchToggled: { onSwitchToggled: {
slotSetClosedOrMin(checked) setMinimizeOnClose(checked)
} }
} }
@@ -575,7 +577,7 @@ Rectangle {
tooltipText: qsTr("toggle automatic updates") tooltipText: qsTr("toggle automatic updates")
onSwitchToggled: { onSwitchToggled: {
slotSetUpdateAutomatic(checked) setAutoUpdate(checked)
} }
} }

View File

@@ -176,14 +176,19 @@ Utils::removeOldVersions()
*/ */
QSettings(hkcuSoftwareKey + "jami.net\\Ring", QSettings::NativeFormat).remove(""); QSettings(hkcuSoftwareKey + "jami.net\\Ring", QSettings::NativeFormat).remove("");
QSettings(hkcuSoftwareKey + "ring.cx", QSettings::NativeFormat).remove(""); QSettings(hkcuSoftwareKey + "ring.cx", QSettings::NativeFormat).remove("");
/* /*
* 2. Unset Ring as a startup application. * 2. Unset Ring as a startup application.
*/ */
if (Utils::CheckStartupLink(TEXT("Ring"))) { if (Utils::CheckStartupLink(TEXT("Ring"))) {
qDebug() << "Found startup link for Ring. Removing it and killing Ring.exe."; qDebug() << "Found startup link for Ring. Removing it and killing Ring.exe.";
Utils::DeleteStartupLink(TEXT("Ring")); Utils::DeleteStartupLink(TEXT("Ring"));
QProcess::execute("taskkill /im Ring.exe /f"); QProcess process;
process.start("taskkill", QStringList()
<< "/im" << "Ring.exe" << "/f");
process.waitForFinished();
} }
/* /*
* 3. Remove registry entries for winsparkle(both Jami-x64 and Ring-x64). * 3. Remove registry entries for winsparkle(both Jami-x64 and Ring-x64).
*/ */
@@ -306,12 +311,13 @@ Utils::showSystemNotification(QWidget *widget,
long delay, long delay,
const QString &triggeredAccountId) const QString &triggeredAccountId)
{ {
QSettings settings("jami.net", "Jami"); if (!AppSettingsManager::getValue(Settings::Key::EnableNotifications).toBool()) {
if (settings.value(SettingsKey::enableNotifications).toBool()) { qWarning() << "Notifications are disabled";
GlobalSystemTray::instance().setTriggeredAccountId(triggeredAccountId); return;
GlobalSystemTray::instance().showMessage(message, "", QIcon(":images/jami.png"));
QApplication::alert(widget, delay);
} }
GlobalSystemTray::instance().setTriggeredAccountId(triggeredAccountId);
GlobalSystemTray::instance().showMessage(message, "", QIcon(":images/jami.png"));
QApplication::alert(widget, delay);
} }
void void
@@ -321,12 +327,13 @@ Utils::showSystemNotification(QWidget *widget,
long delay, long delay,
const QString &triggeredAccountId) const QString &triggeredAccountId)
{ {
QSettings settings("jami.net", "Jami"); if (!AppSettingsManager::getValue(Settings::Key::EnableNotifications).toBool()) {
if (settings.value(SettingsKey::enableNotifications).toBool()) { qWarning() << "Notifications are disabled";
GlobalSystemTray::instance().setTriggeredAccountId(triggeredAccountId); return;
GlobalSystemTray::instance().showMessage(sender, message, QIcon(":images/jami.png"));
QApplication::alert(widget, delay);
} }
GlobalSystemTray::instance().setTriggeredAccountId(triggeredAccountId);
GlobalSystemTray::instance().showMessage(sender, message, QIcon(":images/jami.png"));
QApplication::alert(widget, delay);
} }
QSize QSize
@@ -1103,4 +1110,4 @@ UtilsAdapter::checkShowPluginsButton()
{ {
return LRCInstance::pluginModel().getPluginsEnabled() return LRCInstance::pluginModel().getPluginsEnabled()
&& (LRCInstance::pluginModel().listLoadedPlugins().size() > 0); && (LRCInstance::pluginModel().listLoadedPlugins().size() > 0);
} }

View File

@@ -68,53 +68,6 @@ static constexpr bool isBeta = false;
namespace Utils { namespace Utils {
/*
* Qml type register.
*/
#define QML_REGISTERSINGLETONTYPE(T, MAJ, MIN) \
qmlRegisterSingletonType<T>("net.jami.Models", \
MAJ, \
MIN, \
#T, \
[](QQmlEngine *e, QJSEngine *se) -> QObject * { \
Q_UNUSED(e); \
Q_UNUSED(se); \
T *obj = new T(); \
return obj; \
});
#define QML_REGISTERSINGLETONTYPE_WITH_INSTANCE(T, MAJ, MIN) \
qmlRegisterSingletonType<T>("net.jami.Models", \
MAJ, \
MIN, \
#T, \
[](QQmlEngine *e, QJSEngine *se) -> QObject * { \
Q_UNUSED(e); \
Q_UNUSED(se); \
return &(T::instance()); \
});
#define QML_REGISTERSINGLETONTYPE_URL(URL, T, MAJ, MIN) \
qmlRegisterSingletonType(QUrl(URL), "net.jami.Models", MAJ, MIN, #T);
#define QML_REGISTERTYPE(T, MAJ, MIN) qmlRegisterType<T>("net.jami.Models", MAJ, MIN, #T);
#define QML_REGISTERNAMESPACE(T, NAME, MAJ, MIN) \
qmlRegisterUncreatableMetaObject(T, "net.jami.Models", MAJ, MIN, NAME, "")
#define QML_REGISTERUNCREATABLE(T, MAJ, MIN) \
qmlRegisterUncreatableType<T>("net.jami.Models", \
MAJ, \
MIN, \
#T, \
"Don't try to add to a qml definition of " #T);
#define QML_REGISTERUNCREATABLE_IN_NAMESPACE(T, NAMESPACE, MAJ, MIN) \
qmlRegisterUncreatableType<NAMESPACE::T>("net.jami.Models", \
MAJ, \
MIN, \
#T, \
"Don't try to add to a qml definition of " #T);
/* /*
* System. * System.
*/ */

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"
import "../constant" import "../constant"
@@ -330,7 +331,7 @@ Rectangle {
id: backupKeysPage id: backupKeysPage
onNeverShowAgainBoxClicked: { onNeverShowAgainBoxClicked: {
ClientWrapper.accountAdaptor.settingsNeverShowAgain(isChecked) SettingsAdapter.setValue(Settings.NeverShowMeAgain, isChecked)
} }
onExport_Btn_FileDialogAccepted: { onExport_Btn_FileDialogAccepted: {
@@ -422,7 +423,7 @@ Rectangle {
} }
onSaveProfile: { onSaveProfile: {
ClientWrapper.settingsAdaptor.setCurrAccAvatar(profilePage.boothImgBase64) SettingsAdapter.setCurrAccAvatar(profilePage.boothImgBase64)
ClientWrapper.accountAdaptor.setCurrAccDisplayName(profilePage.displayName) ClientWrapper.accountAdaptor.setCurrAccDisplayName(profilePage.displayName)
leave() leave()
} }