diff --git a/imports/NeoChat/Component/AutoListView.qml b/imports/NeoChat/Component/AutoListView.qml deleted file mode 100644 index 5ab153edb..000000000 --- a/imports/NeoChat/Component/AutoListView.qml +++ /dev/null @@ -1,16 +0,0 @@ -/** - * SPDX-FileCopyrightText: 2018-2019 Black Hat - * - * SPDX-License-Identifier: GPL-3.0-only - */ -import QtQuick 2.12 - -ListView { - pixelAligned: true - - ScrollHelper { - anchors.fill: parent - - flickable: parent - } -} diff --git a/imports/NeoChat/Component/AutoRectangle.qml b/imports/NeoChat/Component/AutoRectangle.qml deleted file mode 100644 index 9b0821049..000000000 --- a/imports/NeoChat/Component/AutoRectangle.qml +++ /dev/null @@ -1,156 +0,0 @@ -/** - * SPDX-FileCopyrightText: 2019 Black Hat - * - * SPDX-License-Identifier: GPL-3.0-only - */ -import QtQuick 2.12 - -Rectangle { - property alias topLeftRadius: topLeftRect.radius - property alias topRightRadius: topRightRect.radius - property alias bottomLeftRadius: bottomLeftRect.radius - property alias bottomRightRadius: bottomRightRect.radius - - property alias topLeftVisible: topLeftRect.visible - property alias topRightVisible: topRightRect.visible - property alias bottomLeftVisible: bottomLeftRect.visible - property alias bottomRightVisible: bottomRightRect.visible - - antialiasing: true - - Rectangle { - anchors.top: parent.top - anchors.left: parent.left - - width: parent.width / 2 - height: parent.height / 2 - - id: topLeftRect - - antialiasing: true - - color: parent.color - - Rectangle { - anchors.bottom: parent.bottom - anchors.left: parent.left - - width: parent.width / 2 - height: parent.height / 2 - - color: parent.color - } - - Rectangle { - anchors.top: parent.top - anchors.right: parent.right - - width: parent.width / 2 - height: parent.height / 2 - - color: parent.color - } - } - - Rectangle { - anchors.top: parent.top - anchors.right: parent.right - - width: parent.width / 2 - height: parent.height / 2 - - id: topRightRect - - antialiasing: true - - color: parent.color - - Rectangle { - anchors.bottom: parent.bottom - anchors.right: parent.right - - width: parent.width / 2 - height: parent.height / 2 - - color: parent.color - } - - Rectangle { - anchors.top: parent.top - anchors.left: parent.left - - width: parent.width / 2 - height: parent.height / 2 - - color: parent.color - } - } - - Rectangle { - anchors.bottom: parent.bottom - anchors.left: parent.left - - width: parent.width / 2 - height: parent.height / 2 - - id: bottomLeftRect - - antialiasing: true - - color: parent.color - - Rectangle { - anchors.bottom: parent.bottom - anchors.right: parent.right - - width: parent.width / 2 - height: parent.height / 2 - - color: parent.color - } - - Rectangle { - anchors.top: parent.top - anchors.left: parent.left - - width: parent.width / 2 - height: parent.height / 2 - - color: parent.color - } - } - - Rectangle { - anchors.bottom: parent.bottom - anchors.right: parent.right - - width: parent.width / 2 - height: parent.height / 2 - - id: bottomRightRect - - antialiasing: true - - color: parent.color - - Rectangle { - anchors.bottom: parent.bottom - anchors.left: parent.left - - width: parent.width / 2 - height: parent.height / 2 - - color: parent.color - } - - Rectangle { - anchors.top: parent.top - anchors.right: parent.right - - width: parent.width / 2 - height: parent.height / 2 - - color: parent.color - } - } -} diff --git a/imports/NeoChat/Component/AutoTextField.qml b/imports/NeoChat/Component/AutoTextField.qml deleted file mode 100644 index d6be67a1e..000000000 --- a/imports/NeoChat/Component/AutoTextField.qml +++ /dev/null @@ -1,67 +0,0 @@ -/** - * SPDX-FileCopyrightText: 2018-2020 Black Hat - * - * SPDX-License-Identifier: GPL-3.0-only - */ -import QtQuick 2.12 -import QtQuick.Controls 2.12 - -import QtQuick.Controls.Material 2.3 - -TextField { - id: textField - - selectByMouse: true - - topPadding: 8 - bottomPadding: 8 - - background: Item { - Label { - id: floatingPlaceholder - - anchors.top: parent.top - anchors.left: parent.left - anchors.topMargin: textField.topPadding - anchors.leftMargin: textField.leftPadding - transformOrigin: Item.TopLeft - visible: false - color: Material.accent - - states: [ - State { - name: "shown" - when: textField.text.length != 0 || textField.activeFocus - PropertyChanges { target: floatingPlaceholder; scale: 0.8 } - PropertyChanges { target: floatingPlaceholder; anchors.topMargin: -floatingPlaceholder.height * 0.4 } - } - ] - - transitions: [ - Transition { - to: "shown" - SequentialAnimation { - PropertyAction { target: floatingPlaceholder; property: "text"; value: textField.placeholderText } - PropertyAction { target: floatingPlaceholder; property: "visible"; value: true } - PropertyAction { target: textField; property: "placeholderTextColor"; value: "transparent" } - ParallelAnimation { - NumberAnimation { target: floatingPlaceholder; property: "scale"; duration: 250; easing.type: Easing.InOutQuad } - NumberAnimation { target: floatingPlaceholder; property: "anchors.topMargin"; duration: 250; easing.type: Easing.InOutQuad } - } - } - }, - Transition { - from: "shown" - SequentialAnimation { - ParallelAnimation { - NumberAnimation { target: floatingPlaceholder; property: "scale"; duration: 250; easing.type: Easing.InOutQuad } - NumberAnimation { target: floatingPlaceholder; property: "anchors.topMargin"; duration: 250; easing.type: Easing.InOutQuad } - } - PropertyAction { target: textField; property: "placeholderTextColor"; value: "grey" } - PropertyAction { target: floatingPlaceholder; property: "visible"; value: false } - } - } - ] - } - } -} diff --git a/imports/NeoChat/Component/ScrollHelper.qml b/imports/NeoChat/Component/ScrollHelper.qml deleted file mode 100644 index 61c4a457b..000000000 --- a/imports/NeoChat/Component/ScrollHelper.qml +++ /dev/null @@ -1,93 +0,0 @@ -/** - * SPDX-FileCopyrightText: 2016 Michael Bohlender - * SPDX-FileCopyrightText: 2017 Christian Mollekopf - * - * SPDX-License-Identifier: GPL-2.0-or-later - */ - -import QtQuick 2.12 -import QtQuick.Controls 2.12 - -/* -* The MouseArea + interactive: false + maximumFlickVelocity are required -* to fix scrolling for desktop systems where we don't want flicking behaviour. -* -* See also: -* ScrollView.qml in qtquickcontrols -* qquickwheelarea.cpp in qtquickcontrols -*/ -MouseArea { - id: root - propagateComposedEvents: true - - property Flickable flickable - property alias enabled: root.enabled - - //Place the mouse area under the flickable - z: -1 - onFlickableChanged: { - if (enabled) { - flickable.interactive = false - flickable.maximumFlickVelocity = 100000 - flickable.boundsBehavior = Flickable.StopAtBounds - root.parent = flickable - } - } - - function calculateNewPosition(flickableItem, wheel) { - //Nothing to scroll - if (flickableItem.contentHeight < flickableItem.height) { - return flickableItem.contentY; - } - //Ignore 0 events (happens at least with Christians trackpad) - if (wheel.pixelDelta.y == 0 && wheel.angleDelta.y == 0) { - return flickableItem.contentY; - } - //pixelDelta seems to be the same as angleDelta/8 - var pixelDelta = 0 - //The pixelDelta is a smaller number if both are provided, so pixelDelta can be 0 while angleDelta is still something. So we check the angleDelta - if (wheel.angleDelta.y) { - var wheelScrollLines = 3 //Default value of QApplication wheelScrollLines property - var pixelPerLine = 20 //Default value in Qt, originally comes from QTextEdit - var ticks = (wheel.angleDelta.y / 8) / 15.0 //Divide by 8 gives us pixels typically come in 15pixel steps. - pixelDelta = ticks * pixelPerLine * wheelScrollLines - } else { - pixelDelta = wheel.pixelDelta.y - } - - if (!pixelDelta) { - return flickableItem.contentY; - } - - var minYExtent = flickableItem.originY + flickableItem.topMargin; - var maxYExtent = (flickableItem.contentHeight + flickableItem.bottomMargin + flickableItem.originY) - flickableItem.height; - - if (typeof(flickableItem.headerItem) !== "undefined" && flickableItem.headerItem) { - minYExtent += flickableItem.headerItem.height - } - - //Avoid overscrolling - return Math.max(minYExtent, Math.min(maxYExtent, flickableItem.contentY - pixelDelta)); - } - - onWheel: { - var newPos = calculateNewPosition(flickable, wheel); - // console.warn("Delta: ", wheel.pixelDelta.y); - // console.warn("Old position: ", flickable.contentY); - // console.warn("New position: ", newPos); - - // Show the scrollbars - flickable.flick(0, 0); - flickable.contentY = newPos; - cancelFlickStateTimer.start() - } - - - Timer { - id: cancelFlickStateTimer - //How long the scrollbar will remain visible - interval: 500 - // Hide the scrollbars - onTriggered: flickable.cancelFlick(); - } -} diff --git a/imports/NeoChat/Component/qmldir b/imports/NeoChat/Component/qmldir index d5f50d0a8..f3ad2e3cd 100644 --- a/imports/NeoChat/Component/qmldir +++ b/imports/NeoChat/Component/qmldir @@ -1,10 +1,5 @@ module NeoChat.Component AutoMouseArea 1.0 AutoMouseArea.qml -MaterialIcon 1.0 MaterialIcon.qml -SideNavButton 1.0 SideNavButton.qml -ScrollHelper 1.0 ScrollHelper.qml AutoListView 1.0 AutoListView.qml -AutoTextField 1.0 AutoTextField.qml FullScreenImage 1.0 FullScreenImage.qml -AutoRectangle 1.0 AutoRectangle.qml ChatTextInput 1.0 ChatTextInput.qml diff --git a/res.qrc b/res.qrc index 384b3b6aa..8680b7963 100644 --- a/res.qrc +++ b/res.qrc @@ -16,10 +16,6 @@ imports/NeoChat/Component/qmldir imports/NeoChat/Component/ChatTextInput.qml imports/NeoChat/Component/AutoMouseArea.qml - imports/NeoChat/Component/ScrollHelper.qml - imports/NeoChat/Component/AutoListView.qml - imports/NeoChat/Component/AutoTextField.qml - imports/NeoChat/Component/AutoRectangle.qml imports/NeoChat/Component/FullScreenImage.qml imports/NeoChat/Component/Emoji/EmojiPicker.qml imports/NeoChat/Component/Emoji/qmldir