mirror of
https://git.jami.net/savoirfairelinux/jami-client-qt.git
synced 2025-07-18 22:45:25 +02:00
misc: fix build without webengine
Change-Id: I2511cd89e1ce7f60424f69ab6576d7fb992dd58c GitLab: #881
This commit is contained in:
parent
9e4f5a19c6
commit
9b2dbb64ea
6 changed files with 99 additions and 53 deletions
|
@ -20,7 +20,6 @@ import QtQuick.Controls
|
|||
import QtQuick.Layouts
|
||||
import Qt.labs.platform
|
||||
import Qt5Compat.GraphicalEffects
|
||||
import QtWebEngine
|
||||
|
||||
import net.jami.Models 1.1
|
||||
import net.jami.Adapters 1.1
|
||||
|
|
|
@ -19,7 +19,6 @@ import QtQuick.Controls
|
|||
import QtQuick.Layouts
|
||||
import Qt.labs.platform
|
||||
import Qt5Compat.GraphicalEffects
|
||||
import QtWebEngine
|
||||
|
||||
import net.jami.Models 1.1
|
||||
import net.jami.Adapters 1.1
|
||||
|
|
|
@ -19,7 +19,6 @@ import QtQuick.Controls
|
|||
import QtQuick.Layouts
|
||||
import Qt.labs.platform
|
||||
import Qt5Compat.GraphicalEffects
|
||||
import QtWebEngine
|
||||
|
||||
import net.jami.Models 1.1
|
||||
import net.jami.Adapters 1.1
|
||||
|
@ -92,59 +91,17 @@ Component {
|
|||
}
|
||||
Component {
|
||||
id: avMediaComp
|
||||
|
||||
Loader {
|
||||
property real msgRadius: 20
|
||||
|
||||
Rectangle {
|
||||
id: videoAudioRect
|
||||
color: JamiTheme.secondaryBackgroundColor
|
||||
anchors.fill: parent
|
||||
|
||||
WebEngineView {
|
||||
id: wev
|
||||
|
||||
property bool isVideo: mediaInfo.isVideo
|
||||
property string html: mediaInfo.html
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.verticalCenter: videoAudioRect.verticalCenter
|
||||
backgroundColor: JamiTheme.secondaryBackgroundColor
|
||||
anchors.topMargin: isVideo? 0 : wev.implicitHeight / 2
|
||||
settings.fullScreenSupportEnabled: isVideo
|
||||
settings.javascriptCanOpenWindows: false
|
||||
Component.onCompleted: loadHtml(html, 'file://')
|
||||
onFullScreenRequested: function(request) {
|
||||
if (request.toggleOn) {
|
||||
layoutManager.pushFullScreenItem(
|
||||
this,
|
||||
videoAudioRect,
|
||||
null,
|
||||
function() { wev.fullScreenCancelled() })
|
||||
} else if (!request.toggleOn) {
|
||||
layoutManager.removeFullScreenItem(this)
|
||||
}
|
||||
request.accept()
|
||||
}
|
||||
}
|
||||
|
||||
layer.enabled: true
|
||||
layer.effect: OpacityMask {
|
||||
maskSource: Item {
|
||||
width: videoAudioRect.width
|
||||
height: videoAudioRect.height
|
||||
Rectangle {
|
||||
anchors.centerIn: parent
|
||||
width: videoAudioRect.width
|
||||
height: videoAudioRect.height
|
||||
radius: JamiTheme.swarmDetailsPageDocumentsMediaRadius
|
||||
}
|
||||
}
|
||||
}
|
||||
Component.onCompleted: {
|
||||
var qml = WITH_WEBENGINE ?
|
||||
"qrc:/webengine/VideoPreview.qml" :
|
||||
"qrc:/nowebengine/VideoPreview.qml"
|
||||
setSource( qml, { isVideo: mediaInfo.isVideo, html:mediaInfo.html } )
|
||||
}
|
||||
|
||||
property real msgRadius: 20
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: imageMediaComp
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import QtQuick.Controls
|
|||
import QtQuick.Layouts
|
||||
import Qt.labs.platform
|
||||
import Qt5Compat.GraphicalEffects
|
||||
import QtWebEngine
|
||||
|
||||
import net.jami.Models 1.1
|
||||
import net.jami.Adapters 1.1
|
||||
|
|
24
src/app/nowebengine/VideoPreview.qml
Normal file
24
src/app/nowebengine/VideoPreview.qml
Normal file
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* Copyright (C) 2022 Savoir-faire Linux Inc.
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import QtQuick.Layouts
|
||||
|
||||
Rectangle {
|
||||
property var mediaInfo: undefined
|
||||
}
|
68
src/app/webengine/VideoPreview.qml
Normal file
68
src/app/webengine/VideoPreview.qml
Normal file
|
@ -0,0 +1,68 @@
|
|||
/*
|
||||
* Copyright (C) 2022 Savoir-faire Linux Inc.
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
import QtQuick
|
||||
import QtWebEngine
|
||||
import Qt5Compat.GraphicalEffects
|
||||
|
||||
import net.jami.Constants 1.1
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
color: JamiTheme.secondaryBackgroundColor
|
||||
anchors.fill: parent
|
||||
property bool isVideo: false
|
||||
property string html: ""
|
||||
|
||||
WebEngineView {
|
||||
id: wev
|
||||
|
||||
anchors.fill: parent
|
||||
anchors.verticalCenter: root.verticalCenter
|
||||
backgroundColor: JamiTheme.secondaryBackgroundColor
|
||||
anchors.topMargin: root.isVideo? 0 : wev.implicitHeight / 2
|
||||
settings.fullScreenSupportEnabled: root.isVideo
|
||||
settings.javascriptCanOpenWindows: false
|
||||
Component.onCompleted: loadHtml(root.html, 'file://')
|
||||
onFullScreenRequested: function(request) {
|
||||
if (request.toggleOn) {
|
||||
layoutManager.pushFullScreenItem(
|
||||
this,
|
||||
root,
|
||||
null,
|
||||
function() { wev.fullScreenCancelled() })
|
||||
} else if (!request.toggleOn) {
|
||||
layoutManager.removeFullScreenItem(this)
|
||||
}
|
||||
request.accept()
|
||||
}
|
||||
}
|
||||
|
||||
layer.enabled: true
|
||||
layer.effect: OpacityMask {
|
||||
maskSource: Item {
|
||||
width: root.width
|
||||
height: root.height
|
||||
Rectangle {
|
||||
anchors.centerIn: parent
|
||||
width: root.width
|
||||
height: root.height
|
||||
radius: JamiTheme.swarmDetailsPageDocumentsMediaRadius
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue