Get rid of Neochat.Effect
This commit is contained in:
@@ -17,7 +17,6 @@ import NeoChat.Setting 1.0
|
||||
import NeoChat.Component 1.0
|
||||
import NeoChat.Dialog 1.0
|
||||
import NeoChat.Menu.Timeline 1.0
|
||||
import NeoChat.Effect 1.0
|
||||
|
||||
Control {
|
||||
id: root
|
||||
|
||||
@@ -17,7 +17,6 @@ import NeoChat.Setting 1.0
|
||||
import NeoChat.Component 1.0
|
||||
import NeoChat.Dialog 1.0
|
||||
import NeoChat.Menu.Timeline 1.0
|
||||
import NeoChat.Effect 1.0
|
||||
|
||||
RowLayout {
|
||||
property bool openOnFinished: false
|
||||
|
||||
@@ -15,7 +15,6 @@ import NeoChat.Setting 1.0
|
||||
import NeoChat.Component 1.0
|
||||
import NeoChat.Dialog 1.0
|
||||
import NeoChat.Menu.Timeline 1.0
|
||||
import NeoChat.Effect 1.0
|
||||
|
||||
Image {
|
||||
readonly property bool isAnimated: contentType === "image/gif"
|
||||
@@ -85,15 +84,23 @@ Image {
|
||||
}
|
||||
}
|
||||
|
||||
RippleEffect {
|
||||
anchors.fill: parent
|
||||
|
||||
MouseArea {
|
||||
id: messageMouseArea
|
||||
|
||||
onPrimaryClicked: fullScreenImage.createObject(parent, {"filename": eventId, "localPath": currentRoom.urlToDownload(eventId)}).showFullScreen()
|
||||
anchors.fill: parent
|
||||
|
||||
onSecondaryClicked: {
|
||||
var contextMenu = imageDelegateContextMenu.createObject(root, {'room': currentRoom});
|
||||
acceptedButtons: Qt.LeftButton | Qt.RightButton
|
||||
|
||||
onClicked: {
|
||||
if(mouse.button === Qt.LeftButton) {
|
||||
fullScreenImage.createObject(parent, {"filename": eventId, "localPath": currentRoom.urlToDownload(eventId)}).showFullScreen()
|
||||
} else {
|
||||
openContextMenu()
|
||||
}
|
||||
}
|
||||
|
||||
function openContextMenu() {
|
||||
var contextMenu = imageDelegateContextMenu.createObject(root, {'room': currentRoom, 'author': author});
|
||||
contextMenu.viewSource.connect(function() {
|
||||
messageSourceSheet.createObject(ApplicationWindow.overlay, {"sourceText": toolTip}).open()
|
||||
})
|
||||
|
||||
@@ -11,7 +11,6 @@ import org.kde.kirigami 2.13 as Kirigami
|
||||
|
||||
import NeoChat.Component 1.0
|
||||
import NeoChat.Dialog 1.0
|
||||
import NeoChat.Effect 1.0
|
||||
import NeoChat.Setting 1.0
|
||||
|
||||
RowLayout {
|
||||
|
||||
@@ -17,7 +17,6 @@ import org.kde.neochat 1.0
|
||||
import NeoChat.Component 1.0
|
||||
import NeoChat.Dialog 1.0
|
||||
import NeoChat.Menu.Timeline 1.0
|
||||
import NeoChat.Effect 1.0
|
||||
|
||||
Video {
|
||||
id: vid
|
||||
|
||||
@@ -9,7 +9,6 @@ import QtQuick.Layouts 1.12
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
|
||||
import NeoChat.Component 1.0
|
||||
import NeoChat.Effect 1.0
|
||||
import NeoChat.Setting 1.0
|
||||
|
||||
import org.kde.neochat 1.0
|
||||
|
||||
@@ -10,7 +10,6 @@ import QtQuick.Layouts 1.12
|
||||
import org.kde.kirigami 2.13 as Kirigami
|
||||
|
||||
import NeoChat.Component 1.0
|
||||
import NeoChat.Effect 1.0
|
||||
import NeoChat.Setting 1.0
|
||||
|
||||
Kirigami.OverlaySheet {
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2018 Black Hat <bhat@encom.eu.org>
|
||||
* SPDX-FileCopyrightText: 2020 Carl Schwan <carl@carlschwan.eu>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-only
|
||||
*/
|
||||
import QtQuick 2.12
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
Item {
|
||||
id: item
|
||||
|
||||
property alias source: mask.source
|
||||
|
||||
Rectangle {
|
||||
id: circleMask
|
||||
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
|
||||
smooth: true
|
||||
visible: false
|
||||
|
||||
radius: Math.max(width/2, height/2)
|
||||
}
|
||||
|
||||
OpacityMask {
|
||||
id: mask
|
||||
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
|
||||
maskSource: circleMask
|
||||
}
|
||||
}
|
||||
@@ -1,151 +0,0 @@
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2018 Black Hat <bhat@encom.eu.org>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-only
|
||||
*/
|
||||
import QtQuick 2.12
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
/*!
|
||||
An effect for standard Material Design elevation shadows
|
||||
*/
|
||||
Item {
|
||||
id: effect
|
||||
|
||||
property var source
|
||||
readonly property Item sourceItem: source.sourceItem
|
||||
|
||||
property int elevation: 0
|
||||
|
||||
// Shadow details follow Material Design (taken from Angular Material)
|
||||
readonly property var _shadows: [
|
||||
[{offset: 0, blur: 0, spread: 0},
|
||||
{offset: 0, blur: 0, spread: 0},
|
||||
{offset: 0, blur: 0, spread: 0}],
|
||||
|
||||
[{offset: 1, blur: 3, spread: 0},
|
||||
{offset: 1, blur: 1, spread: 0},
|
||||
{offset: 2, blur: 1, spread: -1}],
|
||||
|
||||
[{offset: 1, blur: 5, spread: 0},
|
||||
{offset: 2, blur: 2, spread: 0},
|
||||
{offset: 3, blur: 1, spread: -2}],
|
||||
|
||||
[{offset: 1, blur: 8, spread: 0},
|
||||
{offset: 3, blur: 4, spread: 0},
|
||||
{offset: 3, blur: 3, spread: -2}],
|
||||
|
||||
[{offset: 2, blur: 4, spread: -1},
|
||||
{offset: 4, blur: 5, spread: 0},
|
||||
{offset: 1, blur: 10, spread: 0}],
|
||||
|
||||
[{offset: 3, blur: 5, spread: -1},
|
||||
{offset: 5, blur: 8, spread: 0},
|
||||
{offset: 1, blur: 14, spread: 0}],
|
||||
|
||||
[{offset: 3, blur: 5, spread: -1},
|
||||
{offset: 6, blur: 10, spread: 0},
|
||||
{offset: 1, blur: 18, spread: 0}],
|
||||
|
||||
[{offset: 4, blur: 5, spread: -2},
|
||||
{offset: 7, blur: 10, spread: 1},
|
||||
{offset: 2, blur: 16, spread: 1}],
|
||||
|
||||
[{offset: 5, blur: 5, spread: -3},
|
||||
{offset: 8, blur: 10, spread: 1},
|
||||
{offset: 3, blur: 14, spread: 2}],
|
||||
|
||||
[{offset: 5, blur: 6, spread: -3},
|
||||
{offset: 9, blur: 12, spread: 1},
|
||||
{offset: 3, blur: 16, spread: 2}],
|
||||
|
||||
[{offset: 6, blur: 6, spread: -3},
|
||||
{offset: 10, blur: 14, spread: 1},
|
||||
{offset: 4, blur: 18, spread: 3}],
|
||||
|
||||
[{offset: 6, blur: 7, spread: -4},
|
||||
{offset: 11, blur: 15, spread: 1},
|
||||
{offset: 4, blur: 20, spread: 3}],
|
||||
|
||||
[{offset: 7, blur: 8, spread: -4},
|
||||
{offset: 12, blur: 17, spread: 2},
|
||||
{offset: 5, blur: 22, spread: 4}],
|
||||
|
||||
[{offset: 7, blur: 8, spread: -4},
|
||||
{offset: 13, blur: 19, spread: 2},
|
||||
{offset: 5, blur: 24, spread: 4}],
|
||||
|
||||
[{offset: 7, blur: 9, spread: -4},
|
||||
{offset: 14, blur: 21, spread: 2},
|
||||
{offset: 5, blur: 26, spread: 4}],
|
||||
|
||||
[{offset: 8, blur: 9, spread: -5},
|
||||
{offset: 15, blur: 22, spread: 2},
|
||||
{offset: 6, blur: 28, spread: 5}],
|
||||
|
||||
[{offset: 8, blur: 10, spread: -5},
|
||||
{offset: 16, blur: 24, spread: 2},
|
||||
{offset: 6, blur: 30, spread: 5}],
|
||||
|
||||
[{offset: 8, blur: 11, spread: -5},
|
||||
{offset: 17, blur: 26, spread: 2},
|
||||
{offset: 6, blur: 32, spread: 5}],
|
||||
|
||||
[{offset: 9, blur: 11, spread: -5},
|
||||
{offset: 18, blur: 28, spread: 2},
|
||||
{offset: 7, blur: 34, spread: 6}],
|
||||
|
||||
[{offset: 9, blur: 12, spread: -6},
|
||||
{offset: 19, blur: 29, spread: 2},
|
||||
{offset: 7, blur: 36, spread: 6}],
|
||||
|
||||
[{offset: 10, blur: 13, spread: -6},
|
||||
{offset: 20, blur: 31, spread: 3},
|
||||
{offset: 8, blur: 38, spread: 7}],
|
||||
|
||||
[{offset: 10, blur: 13, spread: -6},
|
||||
{offset: 21, blur: 33, spread: 3},
|
||||
{offset: 8, blur: 40, spread: 7}],
|
||||
|
||||
[{offset: 10, blur: 14, spread: -6},
|
||||
{offset: 22, blur: 35, spread: 3},
|
||||
{offset: 8, blur: 42, spread: 7}],
|
||||
|
||||
[{offset: 11, blur: 14, spread: -7},
|
||||
{offset: 23, blur: 36, spread: 3},
|
||||
{offset: 9, blur: 44, spread: 8}],
|
||||
|
||||
[{offset: 11, blur: 15, spread: -7},
|
||||
{offset: 24, blur: 38, spread: 3},
|
||||
{offset: 9, blur: 46, spread: 8}]
|
||||
]
|
||||
|
||||
readonly property var _shadowColors: [
|
||||
Qt.rgba(0,0,0, 0.2),
|
||||
Qt.rgba(0,0,0, 0.14),
|
||||
Qt.rgba(0,0,0, 0.12)
|
||||
]
|
||||
|
||||
Repeater {
|
||||
model: _shadows[elevation]
|
||||
|
||||
delegate: RectangularGlow {
|
||||
anchors {
|
||||
centerIn: parent
|
||||
verticalCenterOffset: modelData.offset
|
||||
}
|
||||
|
||||
width: parent.width + 2 * modelData.spread
|
||||
height: parent.height + 2 * modelData.spread
|
||||
glowRadius: modelData.blur/2
|
||||
spread: 0.05
|
||||
color: _shadowColors[index]
|
||||
cornerRadius: modelData.blur + (effect.sourceItem.radius ?? 0)
|
||||
}
|
||||
}
|
||||
|
||||
ShaderEffect {
|
||||
anchors.fill: parent
|
||||
property alias source: effect.source;
|
||||
}
|
||||
}
|
||||
@@ -1,244 +0,0 @@
|
||||
/**
|
||||
* SPDX-FileCopyrightText: 2018 Black Hat <bhat@encom.eu.org>
|
||||
*
|
||||
* SPDX-License-Identifier: GPL-3.0-only
|
||||
*/
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
import NeoChat.Component 1.0
|
||||
import NeoChat.Setting 1.0
|
||||
|
||||
AutoMouseArea {
|
||||
id: ripple
|
||||
|
||||
property color color: MSettings.darkTheme ? Qt.rgba(255, 255, 255, 0.16) : Qt.rgba(0, 0, 0, 0.08)
|
||||
property bool circular: false
|
||||
property bool centered: false
|
||||
property bool focused
|
||||
property color focusColor: "transparent"
|
||||
property int focusWidth: width - 32
|
||||
property Item control
|
||||
|
||||
clip: true
|
||||
|
||||
Connections {
|
||||
target: control
|
||||
|
||||
onPressedChanged: {
|
||||
if (!control.pressed)
|
||||
__private.removeLastCircle()
|
||||
}
|
||||
}
|
||||
|
||||
onPressed: {
|
||||
__private.createTapCircle(mouse.x, mouse.y)
|
||||
|
||||
if (control)
|
||||
mouse.accepted = false
|
||||
}
|
||||
|
||||
onReleased: __private.removeLastCircle()
|
||||
onCanceled: __private.removeLastCircle()
|
||||
|
||||
QtObject {
|
||||
id: __private
|
||||
|
||||
property int startRadius: 0
|
||||
property int endRadius
|
||||
property bool showFocus: true
|
||||
|
||||
property Item lastCircle
|
||||
|
||||
function createTapCircle(x, y) {
|
||||
endRadius = centered ? width/2 : radius(x, y) + 5
|
||||
showFocus = false
|
||||
|
||||
lastCircle = tapCircle.createObject(ripple, {
|
||||
"circleX": centered ? width/2 : x,
|
||||
"circleY": centered ? height/2 : y
|
||||
})
|
||||
}
|
||||
|
||||
function removeLastCircle() {
|
||||
if (lastCircle)
|
||||
lastCircle.removeCircle()
|
||||
}
|
||||
|
||||
function radius(x, y) {
|
||||
var dist1 = Math.max(dist(x, y, 0, 0), dist(x, y, width, height))
|
||||
var dist2 = Math.max(dist(x, y, width, 0), dist(x, y, 0, height))
|
||||
|
||||
return Math.max(dist1, dist2)
|
||||
}
|
||||
|
||||
function dist(x1, y1, x2, y2) {
|
||||
var distX = x2 - x1
|
||||
var distY = y2 - y1
|
||||
|
||||
return Math.sqrt(distX * distX + distY * distY)
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: focusBackground
|
||||
objectName: "focusBackground"
|
||||
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
|
||||
color: Qt.rgba(0,0,0,0.2)
|
||||
|
||||
opacity: __private.showFocus && focused ? 1 : 0
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation { duration: 500; easing.type: Easing.InOutQuad }
|
||||
}
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
id: focusCircle
|
||||
objectName: "focusRipple"
|
||||
|
||||
property bool focusedState
|
||||
|
||||
x: (parent.width - width)/2
|
||||
y: (parent.height - height)/2
|
||||
|
||||
width: focused
|
||||
? focusedState ? focusWidth
|
||||
: Math.min(parent.width - 8, focusWidth + 12)
|
||||
: parent.width/5
|
||||
height: width
|
||||
|
||||
radius: width/2
|
||||
|
||||
opacity: __private.showFocus && focused ? 1 : 0
|
||||
|
||||
color: focusColor.a === 0 ? Qt.rgba(1,1,1,0.4) : focusColor
|
||||
|
||||
Behavior on opacity {
|
||||
NumberAnimation { duration: 500; easing.type: Easing.InOutQuad }
|
||||
}
|
||||
|
||||
Behavior on width {
|
||||
NumberAnimation { duration: focusTimer.interval; }
|
||||
}
|
||||
|
||||
Timer {
|
||||
id: focusTimer
|
||||
running: focused
|
||||
repeat: true
|
||||
interval: 800
|
||||
|
||||
onTriggered: focusCircle.focusedState = !focusCircle.focusedState
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: tapCircle
|
||||
|
||||
Item {
|
||||
id: circleItem
|
||||
objectName: "tapRipple"
|
||||
|
||||
property bool done
|
||||
|
||||
property real circleX
|
||||
property real circleY
|
||||
|
||||
property bool closed
|
||||
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
|
||||
function removeCircle() {
|
||||
done = true
|
||||
|
||||
if (fillSizeAnimation.running) {
|
||||
fillOpacityAnimation.stop()
|
||||
closeAnimation.start()
|
||||
|
||||
circleItem.destroy(500);
|
||||
} else {
|
||||
__private.showFocus = true
|
||||
fadeAnimation.start();
|
||||
|
||||
circleItem.destroy(300);
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: circleParent
|
||||
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
|
||||
visible: !circular
|
||||
|
||||
Rectangle {
|
||||
id: circleRectangle
|
||||
|
||||
x: circleItem.circleX - radius
|
||||
y: circleItem.circleY - radius
|
||||
|
||||
width: radius * 2
|
||||
height: radius * 2
|
||||
|
||||
opacity: 0
|
||||
color: ripple.color
|
||||
|
||||
NumberAnimation {
|
||||
id: fillSizeAnimation
|
||||
running: true
|
||||
|
||||
target: circleRectangle; property: "radius"; duration: 500;
|
||||
from: __private.startRadius; to: __private.endRadius;
|
||||
easing.type: Easing.InOutQuad
|
||||
|
||||
onStopped: {
|
||||
if (done)
|
||||
__private.showFocus = true
|
||||
}
|
||||
}
|
||||
|
||||
NumberAnimation {
|
||||
id: fillOpacityAnimation
|
||||
running: true
|
||||
|
||||
target: circleRectangle; property: "opacity"; duration: 300;
|
||||
from: 0; to: 1; easing.type: Easing.InOutQuad
|
||||
}
|
||||
|
||||
NumberAnimation {
|
||||
id: fadeAnimation
|
||||
|
||||
target: circleRectangle; property: "opacity"; duration: 300;
|
||||
from: 1; to: 0; easing.type: Easing.InOutQuad
|
||||
}
|
||||
|
||||
SequentialAnimation {
|
||||
id: closeAnimation
|
||||
|
||||
NumberAnimation {
|
||||
target: circleRectangle; property: "opacity"; duration: 250;
|
||||
to: 1; easing.type: Easing.InOutQuad
|
||||
}
|
||||
|
||||
NumberAnimation {
|
||||
target: circleRectangle; property: "opacity"; duration: 250;
|
||||
from: 1; to: 0; easing.type: Easing.InOutQuad
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CircleMask {
|
||||
anchors.fill: parent
|
||||
source: circleParent
|
||||
visible: circular
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,3 +0,0 @@
|
||||
module NeoChat.Effect
|
||||
ElevationEffect 1.0 ElevationEffect.qml
|
||||
RippleEffect 1.0 RippleEffect.qml
|
||||
@@ -18,7 +18,6 @@ import org.kde.neochat 1.0
|
||||
import NeoChat.Component 1.0
|
||||
import NeoChat.Component.Timeline 1.0
|
||||
import NeoChat.Dialog 1.0
|
||||
import NeoChat.Effect 1.0
|
||||
import NeoChat.Menu.Timeline 1.0
|
||||
|
||||
Kirigami.ScrollablePage {
|
||||
|
||||
@@ -14,7 +14,6 @@ import org.kde.kitemmodels 1.0
|
||||
|
||||
import NeoChat.Component 1.0
|
||||
import NeoChat.Dialog 1.0
|
||||
import NeoChat.Effect 1.0
|
||||
import NeoChat.Setting 1.0
|
||||
|
||||
import org.kde.neochat 1.0
|
||||
|
||||
4
res.qrc
4
res.qrc
@@ -36,10 +36,6 @@
|
||||
<file>imports/NeoChat/Setting/Palette.qml</file>
|
||||
<file>imports/NeoChat/Panel/qmldir</file>
|
||||
<file>imports/NeoChat/Panel/RoomDrawer.qml</file>
|
||||
<file>imports/NeoChat/Effect/RippleEffect.qml</file>
|
||||
<file>imports/NeoChat/Effect/CircleMask.qml</file>
|
||||
<file>imports/NeoChat/Effect/ElevationEffect.qml</file>
|
||||
<file>imports/NeoChat/Effect/qmldir</file>
|
||||
<file>imports/NeoChat/Dialog/qmldir</file>
|
||||
<file>imports/NeoChat/Dialog/RoomSettingsDialog.qml</file>
|
||||
<file>imports/NeoChat/Dialog/UserDetailDialog.qml</file>
|
||||
|
||||
Reference in New Issue
Block a user