1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-07-23 08:55:26 +02:00
jami-client-qt/src/app/webengine/MediaPreviewBase.qml
Andreas Traczyk 9e4f5a19c6 misc: regenerate qml.qrc at configure time
Our qml.qrc is:
- commonly in conflict and prone to erroneous conflict resolution
- platform dependant (generation is used anyway for removing
  webengine dependant resources)
- a poorly maintained hodge-podge with resources in subdirectories
  that aren't grouped
- requires alteration when moving resources (if not done correctly,
  without tests, results in uncaught runtime failures)

This patch uses a python script at configure time to generate the
qml.qrc resource file, and removes it from versioning.

GitLab: #749
Change-Id: Ia2b81bb5b2c29d0bf6f5a5302e76795864e93e40
2022-11-15 09:51:19 -05:00

76 lines
2.6 KiB
QML

/*
* Copyright (C) 2021-2022 Savoir-faire Linux Inc.
* 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/>.
*/
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Qt5Compat.GraphicalEffects
import QtWebEngine
import net.jami.Models 1.1
import net.jami.Constants 1.1
import net.jami.Adapters 1.1
import "../commoncomponents"
WebEngineView {
id: wev
property bool isVideo
property string html
readonly property real minSize: 192
readonly property real maxSize: 256
readonly property real aspectRatio: 1 / .75
readonly property real adjustedWidth: Math.min(maxSize,
Math.max(minSize,
innerContent.width - senderMargin))
anchors.right: isOutgoing ? parent.right : undefined
width: isFullScreen ? parent.width : adjustedWidth
height: isVideo ?
isFullScreen ?
parent.height :
Math.ceil(adjustedWidth / aspectRatio) :
54
onContextMenuRequested: function(request) {
request.accepted = true
}
settings.fullScreenSupportEnabled: isVideo
settings.javascriptCanOpenWindows: false
Component.onCompleted: loadHtml(html, 'file://')
layer.enabled: !isFullScreen
layer.effect: OpacityMask {
maskSource: MessageBubble {
out: isOutgoing
type: seq
width: wev.width
height: wev.height
radius: msgRadius
}
}
onFullScreenRequested: function(request) {
if (request.toggleOn) {
layoutManager.pushFullScreenItem(
this,
localMediaCompLoader,
null,
function() { wev.fullScreenCancelled() })
} else if (!request.toggleOn) {
layoutManager.removeFullScreenItem(this)
}
request.accept()
}
}