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
QTQUICK_COMPILER_SKIPPED_RESOURCES += ./ressources.qrc
QTQUICK_COMPILER_SKIPPED_RESOURCES += ./resources.qrc
# compiler options
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/lrcinstance.h \
./src/globalsystemtray.h \
./src/settingskey.h \
./src/appsettingsmanager.h \
./src/webchathelpers.h \
./src/pixbufmanipulator.h \
./src/rendermanager.h \
@@ -137,7 +137,7 @@ HEADERS += ./src/smartlistmodel.h \
./src/avadapter.h \
./src/contactadapter.h \
./src/mediahandleradapter.h \
./src/settingsadaptor.h \
./src/settingsadapter.h \
./src/deviceitemlistmodel.h \
./src/pluginitemlistmodel.h \
./src/mediahandleritemlistmodel.h \
@@ -153,7 +153,8 @@ HEADERS += ./src/smartlistmodel.h \
./src/mediahandlerlistpreferencemodel.h \
./src/videoformatfpsmodel.h \
./src/videoformatresolutionmodel.h \
./src/audiomanagerlistmodel.h
./src/audiomanagerlistmodel.h \
src/qmlregister.h
SOURCES += ./src/bannedlistmodel.cpp \
./src/accountlistmodel.cpp \
@@ -177,7 +178,7 @@ SOURCES += ./src/bannedlistmodel.cpp \
./src/avadapter.cpp \
./src/contactadapter.cpp \
./src/mediahandleradapter.cpp \
./src/settingsadaptor.cpp \
./src/settingsadapter.cpp \
./src/deviceitemlistmodel.cpp \
./src/pluginitemlistmodel.cpp \
./src/mediahandleritemlistmodel.cpp \
@@ -193,7 +194,8 @@ SOURCES += ./src/bannedlistmodel.cpp \
./src/mediahandlerlistpreferencemodel.cpp \
./src/videoformatfpsmodel.cpp \
./src/videoformatresolutionmodel.cpp \
./src/audiomanagerlistmodel.cpp
./src/audiomanagerlistmodel.cpp \
src/qmlregister.cpp
RESOURCES += ./ressources.qrc \
RESOURCES += ./resources.qrc \
./qml.qrc

View File

@@ -5,13 +5,15 @@ import QtQuick.Layouts 1.14
import QtQuick.Controls.Universal 2.12
import QtGraphicalEffects 1.14
import net.jami.Models 1.0
import net.jami.Adapters 1.0
import net.jami.Enums 1.0
import "mainview"
import "wizardview"
import "commoncomponents"
ApplicationWindow {
id: mainApplicationWindow
id: root
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() {
if(mainViewLoader.newAddedAccountIndex !== -1)
mainViewLoader.item.newAccountAdded(mainViewLoader.newAddedAccountIndex)
@@ -60,7 +77,7 @@ ApplicationWindow {
target: mainViewLoader.item
function onCloseApp() {
Qt.quit()
root.close()
}
function onNoAccountIsAvailable() {
@@ -98,14 +115,15 @@ ApplicationWindow {
onWizardViewIsClosed: parent.close()
}
// @disable-check M16
onClosing: {
if (mainViewLoader.source.toString() !== "qrc:/src/mainview/MainView.qml") {
Qt.quit()
root.close()
}
}
// @enable-check M16
}
Component.onCompleted: {
if(!startAccountMigration()){
startClientByMainview()
@@ -113,10 +131,9 @@ ApplicationWindow {
}
overlay.modal: ColorOverlay {
source: mainApplicationWindow.contentItem
source: root.contentItem
color: "transparent"
/*
* Color animation for overlay when pop up is shown.
*/
@@ -128,6 +145,7 @@ ApplicationWindow {
Connections {
target: ClientWrapper.lrcInstance
onRestoreAppRequested: {
if (mainViewLoader.item)
mainViewLoader.item.show()

View File

@@ -82,12 +82,8 @@ AccountAdapter::createJamiAccount(QString registeredName,
&LRCInstance::accountModel(),
&lrc::api::NewAccountModel::accountAdded,
[this, registeredName, settings, isCreating, photoBoothImgBase64](const QString &accountId) {
QSettings qSettings("jami.net", "Jami");
if (not qSettings.contains(SettingsKey::neverShowMeAgain)) {
qSettings.setValue(SettingsKey::neverShowMeAgain, false);
}
auto showBackup = isCreating && !settings.value(SettingsKey::neverShowMeAgain).toBool();
auto showBackup = isCreating &&
!AppSettingsManager::getValue(Settings::Key::NeverShowMeAgain).toBool();
if (!registeredName.isEmpty()) {
Utils::oneShotConnect(&LRCInstance::accountModel(),
&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
AccountAdapter::passwordSetStatusMessageBox(bool success, QString title, QString infoToDisplay)
{

View File

@@ -57,7 +57,6 @@ public:
/*
* Setting related
*/
Q_INVOKABLE void settingsNeverShowAgain(bool checked);
Q_INVOKABLE void passwordSetStatusMessageBox(bool success, QString title, QString infoToDisplay);
/*
* 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());
}
SettingsAdaptor *
ClientWrapper::getSettingsAdaptor()
SettingsAdapter *
ClientWrapper::getSettingsAdapter()
{
return &(SettingsAdaptor::instance());
return &(SettingsAdapter::instance());
}
LRCInstance *
@@ -93,11 +93,11 @@ ClientWrapper::getDataTransferModel()
lrc::api::ContactModel *
ClientWrapper::getContactModel()
{
return getSettingsAdaptor()->getCurrentAccountInfo().contactModel.get();
return getSettingsAdapter()->getCurrentAccountInfo().contactModel.get();
}
lrc::api::NewDeviceModel *
ClientWrapper::getDeviceModel()
{
return getSettingsAdaptor()->getCurrentAccountInfo().deviceModel.get();
return getSettingsAdapter()->getCurrentAccountInfo().deviceModel.get();
}

View File

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

View File

@@ -21,11 +21,12 @@ import QtQuick.Controls 2.14
import QtQuick.Layouts 1.14
import QtQuick.Controls.Styles 1.4
import net.jami.Models 1.0
import net.jami.Adapters 1.0
Dialog {
id: deleteAccountDialog
property int profileType: ClientWrapper.settingsAdaptor.getCurrentAccount_Profile_Info_Type()
property int profileType: SettingsAdapter.getCurrentAccount_Profile_Info_Type()
property bool isSIP: {
switch (profileType) {
@@ -37,9 +38,9 @@ Dialog {
}
onOpened: {
profileType = ClientWrapper.settingsAdaptor.getCurrentAccount_Profile_Info_Type()
labelBestId.text = ClientWrapper.settingsAdaptor.getAccountBestName()
labelAccountHash.text = ClientWrapper.settingsAdaptor.getCurrentAccount_Profile_Info_Uri()
profileType = SettingsAdapter.getCurrentAccount_Profile_Info_Type()
labelBestId.text = SettingsAdapter.getAccountBestName()
labelAccountHash.text = SettingsAdapter.getCurrentAccount_Profile_Info_Uri()
}
onVisibleChanged: {
@@ -91,7 +92,7 @@ Dialog {
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
text: ClientWrapper.settingsAdaptor.getAccountBestName()
text: SettingsAdapter.getAccountBestName()
}
Label{
@@ -106,7 +107,7 @@ Dialog {
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
wrapMode: Text.Wrap
text: ClientWrapper.settingsAdaptor.getCurrentAccount_Profile_Info_Uri()
text: SettingsAdapter.getCurrentAccount_Profile_Info_Uri()
}
Item{

View File

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

View File

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

View File

@@ -1,4 +1,4 @@
/*
/*!
* Copyright (C) 2015-2020 by Savoir-faire Linux
* Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>
* Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
@@ -21,11 +21,28 @@
#include "mainapplication.h"
#include "runguard.h"
#include <clocale>
#include <QCryptographicHash>
#include <QtWebEngine>
#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
main(int argc, char *argv[])
{
@@ -33,13 +50,24 @@ main(int argc, char *argv[])
#ifdef Q_OS_LINUX
setenv("QT_QPA_PLATFORMTHEME", "gtk3", true);
#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";
auto newArgv = MainApplication::parseInputArgument(argc, argv, ARG_DISABLE_WEB_SECURITY);
MainApplication a(argc, newArgv);
auto newArgv = parseInputArgument(argc, argv, ARG_DISABLE_WEB_SECURITY);
MainApplication app(argc, newArgv);
/*
* 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());
RunGuard guard(appData.result());
if (!guard.tryToRun()) {
/*
* No need to exitApp since app is not set up.
*/
return 0;
}
if (!a.applicationSetup()) {
guard.release();
a.exitApp();
return 0;
}
app.init();
/*
* Exec the application.
*/
auto ret = a.exec();
auto ret = app.exec();
guard.release();
return ret;

View File

@@ -1,4 +1,4 @@
/**
/*!
* Copyright (C) 2015-2020 by Savoir-faire Linux
* Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>
* Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
@@ -21,48 +21,18 @@
#include "mainapplication.h"
#include "accountadapter.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 "appsettingsmanager.h"
#include "globalinstances.h"
#include "globalsystemtray.h"
#include "messagesadapter.h"
#include "namedirectory.h"
#include "pixbufmanipulator.h"
#include "previewrenderer.h"
#include "qmlregister.h"
#include "qrimageprovider.h"
#include "settingsadaptor.h"
#include "pixbufmanipulator.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 <QFontDatabase>
#include <QMenu>
#include <QQmlContext>
#include <QtWebEngine>
#include <locale.h>
@@ -74,44 +44,17 @@
#include <gnutls/gnutls.h>
#endif
MainApplication::MainApplication(int& argc, char** argv)
: QApplication(argc, argv)
, 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()
static void
consoleDebug()
{
#ifdef Q_OS_WIN
AllocConsole();
SetConsoleCP(CP_UTF8);
freopen("CONOUT$", "w", stdout);
freopen("CONOUT$", "w", stderr);
FILE* fpstdout = stdout;
freopen_s(&fpstdout, "CONOUT$", "w", stdout);
FILE* fpstderr = stderr;
freopen_s(&fpstderr, "CONOUT$", "w", stderr);
COORD coordInfo;
coordInfo.X = 130;
@@ -122,8 +65,8 @@ MainApplication::consoleDebug()
#endif
}
void
MainApplication::vsConsoleDebug()
static void
vsConsoleDebug()
{
#ifdef _MSC_VER
/*
@@ -137,8 +80,16 @@ MainApplication::vsConsoleDebug()
#endif
}
void
MainApplication::fileDebug(QFile* debugFile)
static QString
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(),
&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
MainApplication::exitApp()
MainApplication::init()
{
GlobalSystemTray::instance().hide();
#ifdef Q_OS_WIN
FreeConsole();
#ifdef Q_OS_LINUX
if (!getenv("QT_QPA_PLATFORMTHEME"))
setenv("QT_QPA_PLATFORMTHEME", "gtk3", true);
#endif
}
char**
MainApplication::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];
for (auto string : QCoreApplication::arguments()) {
if (string == "-d" || string == "--debug") {
consoleDebug();
}
}
newArgv[oldArgc] = argToParse;
newArgv[oldArgc + 1] = nullptr;
return newArgv;
}
QString
MainApplication::getDebugFilePath()
{
QDir logPath(QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation));
/*
* Since logPath will be .../Ring, we use cdUp to remove it.
*/
logPath.cdUp();
return QString(logPath.absolutePath() + "/jami/jami.log");
Utils::removeOldVersions();
loadTranslations();
setApplicationFont();
#if defined _MSC_VER && !COMPILE_ONLY
gnutls_global_init();
#endif
GlobalInstances::setPixmapManipulator(std::make_unique<PixbufManipulator>());
initLrc();
bool startMinimized {false};
parseArguments(startMinimized);
initSettings();
initSystray();
initQmlEngine();
}
void
@@ -244,7 +198,7 @@ MainApplication::initLrc()
this->processEvents();
}
},
[this, &isMigrating] {
[&isMigrating] {
while (!isMigrating) {
std::this_thread::sleep_for(std::chrono::milliseconds(10));
}
@@ -255,9 +209,8 @@ MainApplication::initLrc()
}
void
MainApplication::processInputArgument(bool& startMinimized)
MainApplication::parseArguments(bool& startMinimized)
{
debugFile_ = std::make_unique<QFile>(getDebugFilePath());
QString uri = "";
for (auto string : QCoreApplication::arguments()) {
@@ -267,6 +220,8 @@ MainApplication::processInputArgument(bool& startMinimized)
if (string == "-m" || string == "--minimized") {
startMinimized = true;
}
#ifdef Q_OS_WINDOWS
debugFile_.reset(new QFile(getDebugFilePath()));
auto dbgFile = string == "-f" || string == "--file";
auto dbgConsole = string == "-c" || string == "--vsconsole";
if (dbgFile || dbgConsole) {
@@ -275,12 +230,11 @@ MainApplication::processInputArgument(bool& startMinimized)
debugFile_->close();
fileDebug(debugFile_.get());
}
#ifdef _MSC_VER
if (dbgConsole) {
vsConsoleDebug();
}
#endif
}
#endif
}
}
}
@@ -295,171 +249,27 @@ MainApplication::setApplicationFont()
}
void
MainApplication::qmlInitialization()
MainApplication::initQmlEngine()
{
/*
* 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)
registerTypes();
/*
* 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("tintedPixmap"), new TintedButtonImageProvider());
engine_->load(QUrl(QStringLiteral("qrc:/src/MainApplicationWindow.qml")));
}
MainApplication::~MainApplication() {}
bool
MainApplication::applicationSetup()
void
MainApplication::initSettings()
{
#ifdef Q_OS_LINUX
if (!getenv("QT_QPA_PLATFORMTHEME"))
setenv("QT_QPA_PLATFORMTHEME", "gtk3", true);
#endif
AppSettingsManager::instance().initValues();
auto downloadPath = AppSettingsManager::instance().getValue(Settings::Key::DownloadPath);
LRCInstance::dataTransferModel().downloadDirectory = downloadPath.toString() + "/";
}
/*
* Start debug console.
*/
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.
*/
void
MainApplication::initSystray()
{
GlobalSystemTray& sysIcon = GlobalSystemTray::instance();
sysIcon.setIcon(QIcon(":images/jami.png"));
@@ -467,18 +277,27 @@ MainApplication::applicationSetup()
QAction* exitAction = new QAction(tr("Exit"), this);
connect(exitAction, &QAction::triggered,
[this] {
QCoreApplication::exit();
[this]{
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);
sysIcon.setContextMenu(systrayMenu);
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:
explicit MainApplication(int &argc, char **argv);
~MainApplication();
~MainApplication() = default;
bool applicationSetup();
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);
void init();
private:
void loadTranslations();
void initLrc();
void processInputArgument(bool &startMinimized);
void parseArguments(bool &startMinimized);
void setApplicationFont();
void qmlInitialization();
void initQmlEngine();
void initSettings();
void initSystray();
void cleanup();
std::unique_ptr<QFile> debugFile_;
private:
QScopedPointer<QFile> debugFile_;
QQmlApplicationEngine *engine_;
};

View File

@@ -80,7 +80,7 @@ Rectangle {
height = preferredHeight
if (isVideo) {
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 aspectRatio = res[1] / res[0]
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 "utils.h"
class SettingsAdaptor : public QObject
class SettingsAdapter : public QObject
{
Q_OBJECT
public:
explicit SettingsAdaptor(QObject *parent = nullptr);
explicit SettingsAdapter(QObject *parent = nullptr);
//Singleton
static SettingsAdaptor &instance();
static SettingsAdapter &instance();
/*
* getters of directories
*/
Q_INVOKABLE QString getDir_Document();
Q_INVOKABLE QString getDir_Download();
/*
* getters and setters of app settings options
*/
Q_INVOKABLE bool getSettingsValue_CloseOrMinimized();
Q_INVOKABLE bool getSettingsValue_EnableNotifications();
Q_INVOKABLE bool getSettingsValue_AutoUpdate();
Q_INVOKABLE QVariant getAppValue(const Settings::Key key);
Q_INVOKABLE void setAppValue(const Settings::Key key, const QVariant& value);
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 setDownloadPath(QString dir);
@@ -237,5 +230,6 @@ public:
Q_INVOKABLE void set_FileCACert(QString text);
Q_INVOKABLE void set_FileUserCert(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 QtGraphicalEffects 1.14
import net.jami.Models 1.0
import net.jami.Adapters 1.0
import "components"
@@ -44,7 +45,7 @@ Rectangle {
}
function setSelected(sel, recovery = false){
profileType = ClientWrapper.settingsAdaptor.getCurrentAccount_Profile_Info_Type()
profileType = SettingsAdapter.getCurrentAccount_Profile_Info_Type()
if(selectedMenu === sel && (!recovery)){return}
switch(sel){
@@ -135,7 +136,7 @@ Rectangle {
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

View File

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

View File

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

View File

@@ -92,7 +92,7 @@ Rectangle {
function setFormatListForCurrentDevice(){
var device = ClientWrapper.avmodel.getCurrentVideoCaptureDevice()
if(ClientWrapper.settingsAdaptor.get_DeviceCapabilitiesSize(device) === 0){
if(ClientWrapper.SettingsAdapter.get_DeviceCapabilitiesSize(device) === 0){
return
}
@@ -208,7 +208,7 @@ Rectangle {
}
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)
} catch(error){console.warn(error.message)}
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -68,53 +68,6 @@ static constexpr bool isBeta = false;
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.
*/

View File

@@ -23,6 +23,7 @@ import QtQuick.Controls.Universal 2.12
import QtQuick.Layouts 1.3
import QtGraphicalEffects 1.14
import net.jami.Models 1.0
import net.jami.Adapters 1.0
import "../commoncomponents"
import "../constant"
@@ -330,7 +331,7 @@ Rectangle {
id: backupKeysPage
onNeverShowAgainBoxClicked: {
ClientWrapper.accountAdaptor.settingsNeverShowAgain(isChecked)
SettingsAdapter.setValue(Settings.NeverShowMeAgain, isChecked)
}
onExport_Btn_FileDialogAccepted: {
@@ -422,7 +423,7 @@ Rectangle {
}
onSaveProfile: {
ClientWrapper.settingsAdaptor.setCurrAccAvatar(profilePage.boothImgBase64)
SettingsAdapter.setCurrAccAvatar(profilePage.boothImgBase64)
ClientWrapper.accountAdaptor.setCurrAccDisplayName(profilePage.displayName)
leave()
}