diff --git a/.gitlab-ci-files/job-macosx-desktop.yml b/.gitlab-ci-files/job-macosx-desktop.yml index b5c05fad3..70a8f8741 100644 --- a/.gitlab-ci-files/job-macosx-desktop.yml +++ b/.gitlab-ci-files/job-macosx-desktop.yml @@ -5,8 +5,8 @@ .build_all_script: &build_all_script | ccache -s - export Qt5_DIR=/usr/local/opt/qt/lib/cmake/Qt5 - export PATH=$PATH:/usr/local/opt/qt/bin + export Qt5_DIR=~/Qt/5.15.2/clang_64/lib/cmake/Qt5 + export PATH=~/Qt/5.15.2/clang_64/bin:$PATH if [ -d "build" ]; then rm -rf build; fi; mkdir -p build/OUTPUT cd build diff --git a/linphone-app/src/app/AppController.cpp b/linphone-app/src/app/AppController.cpp index f1aa790be..b2bfaa4ef 100644 --- a/linphone-app/src/app/AppController.cpp +++ b/linphone-app/src/app/AppController.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2020 Belledonne Communications SARL. + * Copyright (c) 2010-2021 Belledonne Communications SARL. * * This file is part of linphone-desktop * (see https://www.linphone.org). @@ -18,10 +18,12 @@ * along with this program. If not, see . */ +#include #include #include #include #include +#include #include "config.h" #include "gitversion.h" @@ -35,73 +37,77 @@ using namespace std; AppController::AppController (int &argc, char *argv[]) { - DesktopTools::init(); - QT_REQUIRE_VERSION(argc, argv, Constants::ApplicationMinimalQtVersion) - Q_ASSERT(!mApp); - // Disable QML cache. Avoid malformed cache. - qputenv("QML_DISABLE_DISK_CACHE", "true"); - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - // Useful to share camera on Fullscreen (other context) - QApplication::setAttribute(Qt::AA_ShareOpenGLContexts); - - // Do not use APPLICATION_NAME here. - // The EXECUTABLE_NAME will be used in qt standard paths. It's our goal. - QCoreApplication::setApplicationName(EXECUTABLE_NAME); - QApplication::setOrganizationDomain(EXECUTABLE_NAME); - QCoreApplication::setApplicationVersion(LINPHONE_QT_GIT_VERSION); - - mApp = new App(argc, argv); - - // --------------------------------------------------------------------------- - // App creation. - // --------------------------------------------------------------------------- - - QQuickStyle::setStyle("Default"); - if (mApp->isSecondary()) { - #ifdef Q_OS_MACOS - mApp->processEvents(); - #endif // ifdef Q_OS_MACOS - - QString command = mApp->getCommandArgument(); - if( command.isEmpty()){ - command = "show"; - QStringList parametersList; - for(int i = 1 ; i < argc ; ++i){ - QString a = argv[i]; - if(a.startsWith("--"))// show is a command : remove <-->-style parameters - a.remove(0,2); - command += " "+a; - } - } - mApp->sendMessage(command.toLocal8Bit(), -1); - - return; - } - - // --------------------------------------------------------------------------- - // Fonts. - // --------------------------------------------------------------------------- - - QDirIterator it(":", QDirIterator::Subdirectories); - while (it.hasNext()) { - QFileInfo info(it.next()); - - if (info.suffix() == QLatin1String("ttf") || info.suffix() == QLatin1String("otf")) { - QString path = info.absoluteFilePath(); - if (path.startsWith(":/assets/fonts/")) - if(QFontDatabase::addApplicationFont(path)<0) - qWarning() << "Font cannot load : " << path; - } - } - qInfo() << "Available fonts : " << QFontDatabase().families(); - - mApp->setFont(QFont(Constants::DefaultFont)); + DesktopTools::init(); + QT_REQUIRE_VERSION(argc, argv, Constants::ApplicationMinimalQtVersion) + Q_ASSERT(!mApp); + // Disable QML cache. Avoid malformed cache. + qputenv("QML_DISABLE_DISK_CACHE", "true"); + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + // Useful to share camera on Fullscreen (other context) + QApplication::setAttribute(Qt::AA_ShareOpenGLContexts); + + // Do not use APPLICATION_NAME here. + // The EXECUTABLE_NAME will be used in qt standard paths. It's our goal. + QCoreApplication::setApplicationName(EXECUTABLE_NAME); + QApplication::setOrganizationDomain(EXECUTABLE_NAME); + QCoreApplication::setApplicationVersion(LINPHONE_QT_GIT_VERSION); +#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0) + mApp = new App(argc, argv); + QtWebView::initialize(); +#else + QtWebView::initialize(); + mApp = new App(argc, argv); +#endif + // --------------------------------------------------------------------------- + // App creation. + // --------------------------------------------------------------------------- + + QQuickStyle::setStyle("Default"); + if (mApp->isSecondary()) { +#ifdef Q_OS_MACOS + mApp->processEvents(); +#endif // ifdef Q_OS_MACOS + + QString command = mApp->getCommandArgument(); + if( command.isEmpty()){ + command = "show"; + QStringList parametersList; + for(int i = 1 ; i < argc ; ++i){ + QString a = argv[i]; + if(a.startsWith("--"))// show is a command : remove <-->-style parameters + a.remove(0,2); + command += " "+a; + } + } + mApp->sendMessage(command.toLocal8Bit(), -1); + + return; + } + + // --------------------------------------------------------------------------- + // Fonts. + // --------------------------------------------------------------------------- + + QDirIterator it(":", QDirIterator::Subdirectories); + while (it.hasNext()) { + QFileInfo info(it.next()); + + if (info.suffix() == QLatin1String("ttf") || info.suffix() == QLatin1String("otf")) { + QString path = info.absoluteFilePath(); + if (path.startsWith(":/assets/fonts/")) + if(QFontDatabase::addApplicationFont(path)<0) + qWarning() << "Font cannot load : " << path; + } + } + qInfo() << "Available fonts : " << QFontDatabase().families(); + + mApp->setFont(QFont(Constants::DefaultFont)); } AppController::~AppController () { - try{ - delete mApp; - } - catch(...){ - } + try{ + delete mApp; + } + catch(...){ + } } diff --git a/linphone-app/src/app/main.cpp b/linphone-app/src/app/main.cpp index c3385da91..7f59ea142 100644 --- a/linphone-app/src/app/main.cpp +++ b/linphone-app/src/app/main.cpp @@ -20,7 +20,6 @@ #include "AppController.hpp" #include -#include #ifdef QT_QML_DEBUG #include #endif @@ -30,7 +29,6 @@ int main (int argc, char *argv[]) { AppController controller(argc, argv); - QtWebView::initialize(); #ifdef QT_QML_DEBUG QQmlDebuggingEnabler enabler; #endif diff --git a/linphone-app/src/components/call/CallModel.cpp b/linphone-app/src/components/call/CallModel.cpp index 43329aa06..8726ecc17 100644 --- a/linphone-app/src/components/call/CallModel.cpp +++ b/linphone-app/src/components/call/CallModel.cpp @@ -111,8 +111,8 @@ QString CallModel::getFullLocalAddress () const { // ----------------------------------------------------------------------------- ContactModel *CallModel::getContactModel() const{ - auto contact = CoreManager::getInstance()->getContactsListModel()->findContactModelFromSipAddress(Utils::coreStringToAppString(mCall->getRemoteAddress()->asString())); - return contact; + QString cleanedAddress = Utils::cleanSipAddress(Utils::coreStringToAppString(mCall->getRemoteAddress()->asString())); + return CoreManager::getInstance()->getContactsListModel()->findContactModelFromSipAddress(cleanedAddress); } ChatRoomModel * CallModel::getChatRoomModel() const{ diff --git a/linphone-app/src/components/core/CoreManager.cpp b/linphone-app/src/components/core/CoreManager.cpp index b52805ebb..6ed32b569 100644 --- a/linphone-app/src/components/core/CoreManager.cpp +++ b/linphone-app/src/components/core/CoreManager.cpp @@ -405,3 +405,10 @@ void CoreManager::setLastRemoteProvisioningState(const linphone::ConfiguringStat bool CoreManager::isLastRemoteProvisioningGood(){ return mLastRemoteProvisioningState != linphone::ConfiguringState::Failed; } + +QString CoreManager::getUserAgent()const { + if(mCore) + return Utils::coreStringToAppString(mCore->getUserAgent()); + else + return EXECUTABLE_NAME " Desktop";// Just in case +} diff --git a/linphone-app/src/components/core/CoreManager.hpp b/linphone-app/src/components/core/CoreManager.hpp index 220ca2603..27a9a1676 100644 --- a/linphone-app/src/components/core/CoreManager.hpp +++ b/linphone-app/src/components/core/CoreManager.hpp @@ -167,6 +167,7 @@ public: static bool isInstanciated(){return mInstance!=nullptr;} Q_INVOKABLE bool isLastRemoteProvisioningGood(); + Q_INVOKABLE QString getUserAgent()const; public slots: void initCoreManager(); diff --git a/linphone-app/ui/modules/Common/Image/RoundedImage.qml b/linphone-app/ui/modules/Common/Image/RoundedImage.qml index 61a193778..998e9956f 100644 --- a/linphone-app/ui/modules/Common/Image/RoundedImage.qml +++ b/linphone-app/ui/modules/Common/Image/RoundedImage.qml @@ -1,70 +1,41 @@ import QtQuick 2.7 +import QtGraphicalEffects 1.0 import Linphone 1.0 // ============================================================================= Item { - id: item - - property alias source: image.source - property color backgroundColor: '#00000000' - property color foregroundColor: '#00000000' - readonly property alias status: image.status - - Item { - id: imageContainer - - anchors.fill: parent - layer.enabled: true - visible: false - - Image { - id: image - mipmap: SettingsModel.mipmapEnabled - anchors.fill: parent - fillMode: Image.PreserveAspectCrop - sourceSize.width: parent.width - sourceSize.height: parent.height - } - } - - Rectangle { - anchors.fill: parent - - layer { - effect: ShaderEffect { - property color backgroundColor: item.backgroundColor - property color foregroundColor: item.foregroundColor - property var image: imageContainer - - // See: https://www.opengl.org/sdk/docs/man/html/mix.xhtml - fragmentShader: ' - #ifdef GL_ES - precision lowp float; - #endif - uniform sampler2D image; - uniform sampler2D mask; - uniform vec4 backgroundColor; - uniform vec4 foregroundColor; - - uniform float qt_Opacity; - varying vec2 qt_TexCoord0; - - void main () { - vec4 tex = texture2D(image, qt_TexCoord0); - vec4 interpolation = mix(backgroundColor, vec4(tex.rgb, 1.0), tex.a); - interpolation = mix(interpolation, vec4(foregroundColor.rgb, 1.0), foregroundColor.a); - - gl_FragColor = interpolation * texture2D(mask, qt_TexCoord0) * qt_Opacity; - } - ' - } - - enabled: true - samplerName: 'mask' - } - - radius: width / 2 - } + id: item + + property alias source: image.source + property color backgroundColor: '#00000000' + property color foregroundColor: '#00000000' + readonly property alias status: image.status + + Rectangle { + id: backgroundArea + anchors.fill: parent + color: item.backgroundColor + radius: width/2 + } + Image { + id: image + mipmap: SettingsModel.mipmapEnabled + anchors.fill: parent + fillMode: Image.PreserveAspectCrop + sourceSize.width: parent.width + sourceSize.height: parent.height + layer.enabled: true + layer.effect: OpacityMask { + maskSource: backgroundArea + } + } + Rectangle { + id: foregroundArea + anchors.fill: parent + visible: color != 'transparent' + color: item.foregroundColor + radius: width/2 + } } diff --git a/linphone-app/ui/views/App/Main/Assistant/CreateAppSipAccount.qml b/linphone-app/ui/views/App/Main/Assistant/CreateAppSipAccount.qml index 986fc5b54..131db64ab 100644 --- a/linphone-app/ui/views/App/Main/Assistant/CreateAppSipAccount.qml +++ b/linphone-app/ui/views/App/Main/Assistant/CreateAppSipAccount.qml @@ -38,7 +38,7 @@ AssistantAbstractView { id:webview property bool isLogingOut : true state: 'hidden' - Component.onCompleted: {if(webview.httpUserAgent != undefined) webview.httpUserAgent = Linphone.App.getUserAgent() // only available on Qt 5.15 (QtWebView 1.15) + Component.onCompleted: {if(webview.httpUserAgent != undefined) webview.httpUserAgent = Linphone.CoreManager.getUserAgent() // only available on Qt 5.15 (QtWebView 1.15) isLogingOut = true webview.url = view.defaultLogoutUrl }