Replace hardcoded shader effects by simple QML object on avatar. This fix OpenGLShader error on compability lost.

Clean address before searching contact while in call. This fix unfound contact (shown on loosing avatar in call list for example)
Fix CI to select Qt from MaintenanceTool and not homebrew or other libs.
macdeployqt from Homebrew is bugged on deploying webengine application : rpath stay in absolute and cannot be used for deployment
Fix Webview on Qt 5.15
This commit is contained in:
Julien Wadel 2021-11-26 18:58:22 +01:00
parent 3f41aa2194
commit 427fd742de
8 changed files with 119 additions and 136 deletions

View file

@ -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

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#include <QtGlobal>
#include <QDirIterator>
#include <QFontDatabase>
#include <QMessageBox>
#include <QQuickStyle>
#include <QtWebView>
#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(...){
}
}

View file

@ -20,7 +20,6 @@
#include "AppController.hpp"
#include <qloggingcategory.h>
#include <QtWebView>
#ifdef QT_QML_DEBUG
#include <QQmlDebuggingEnabler>
#endif
@ -30,7 +29,6 @@
int main (int argc, char *argv[]) {
AppController controller(argc, argv);
QtWebView::initialize();
#ifdef QT_QML_DEBUG
QQmlDebuggingEnabler enabler;
#endif

View file

@ -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{

View file

@ -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
}

View file

@ -167,6 +167,7 @@ public:
static bool isInstanciated(){return mInstance!=nullptr;}
Q_INVOKABLE bool isLastRemoteProvisioningGood();
Q_INVOKABLE QString getUserAgent()const;
public slots:
void initCoreManager();

View file

@ -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
}
}

View file

@ -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
}