Reorder QML files to follow coding conventions
https://doc.qt.io/qt-5/qml-codingconventions.html#qml-object-declarations
This commit is contained in:
@@ -15,6 +15,7 @@ HGridLayout {
|
||||
return sum
|
||||
}
|
||||
|
||||
|
||||
flow:
|
||||
width >= summedImplicitWidth ?
|
||||
HGridLayout.LeftToRight :
|
||||
|
@@ -5,21 +5,6 @@ import QtQuick.Controls 2.12
|
||||
|
||||
Rectangle {
|
||||
id: avatar
|
||||
implicitWidth: implicitHeight
|
||||
implicitHeight:
|
||||
compact ?
|
||||
theme.controls.avatar.compactSize :
|
||||
theme.controls.avatar.size
|
||||
|
||||
radius: theme.controls.avatar.radius
|
||||
|
||||
color: avatarImage.visible ? "transparent" : utils.hsluv(
|
||||
name ? utils.hueFrom(name) : 0,
|
||||
name ? theme.controls.avatar.background.saturation : 0,
|
||||
theme.controls.avatar.background.lightness,
|
||||
theme.controls.avatar.background.opacity
|
||||
)
|
||||
|
||||
|
||||
property bool compact: false
|
||||
|
||||
@@ -37,6 +22,21 @@ Rectangle {
|
||||
readonly property alias circleRadius: avatarImage.circleRadius
|
||||
|
||||
|
||||
implicitWidth: implicitHeight
|
||||
implicitHeight:
|
||||
compact ?
|
||||
theme.controls.avatar.compactSize :
|
||||
theme.controls.avatar.size
|
||||
|
||||
radius: theme.controls.avatar.radius
|
||||
|
||||
color: avatarImage.visible ? "transparent" : utils.hsluv(
|
||||
name ? utils.hueFrom(name) : 0,
|
||||
name ? theme.controls.avatar.background.saturation : 0,
|
||||
theme.controls.avatar.background.lightness,
|
||||
theme.controls.avatar.background.opacity
|
||||
)
|
||||
|
||||
Behavior on color { HColorAnimation {} }
|
||||
|
||||
HLabel {
|
||||
@@ -73,13 +73,6 @@ Rectangle {
|
||||
|
||||
HToolTip {
|
||||
id: avatarToolTip
|
||||
visible: ! avatarImage.broken &&
|
||||
avatarImage.status !== Image.Error &&
|
||||
avatarImage.width < dimension * 0.75 &&
|
||||
(toolTipSourceOverride || toolTipMxc) &&
|
||||
hoverHandler.hovered
|
||||
delay: 1000
|
||||
backgroundColor: theme.controls.avatar.hoveredImage.background
|
||||
|
||||
readonly property int dimension: Math.min(
|
||||
mainUI.width / 1.25,
|
||||
@@ -88,6 +81,14 @@ Rectangle {
|
||||
background.border.width * 2,
|
||||
)
|
||||
|
||||
visible: ! avatarImage.broken &&
|
||||
avatarImage.status !== Image.Error &&
|
||||
avatarImage.width < dimension * 0.75 &&
|
||||
(toolTipSourceOverride || toolTipMxc) &&
|
||||
hoverHandler.hovered
|
||||
delay: 1000
|
||||
backgroundColor: theme.controls.avatar.hoveredImage.background
|
||||
|
||||
contentItem: HMxcImage {
|
||||
id: avatarToolTipImage
|
||||
fillMode: Image.PreserveAspectCrop
|
||||
|
@@ -6,7 +6,6 @@ import QtQuick 2.12
|
||||
HRectangleBottomBorder {
|
||||
id: line
|
||||
|
||||
|
||||
property bool show: false
|
||||
|
||||
|
||||
|
@@ -12,7 +12,6 @@ HFlickableColumnPage {
|
||||
radius: theme.controls.box.radius
|
||||
}
|
||||
|
||||
|
||||
HNumberAnimation on scale {
|
||||
running: true
|
||||
from: 0
|
||||
|
@@ -9,7 +9,6 @@ HCircleProgressBar {
|
||||
baseCircle.strokeWidth: 2
|
||||
progressCircle.strokeWidth: 2
|
||||
|
||||
|
||||
HNumberAnimation on rotation {
|
||||
from: 0
|
||||
to: 360
|
||||
|
@@ -6,6 +6,28 @@ import QtQuick.Layouts 1.12
|
||||
|
||||
Button {
|
||||
id: button
|
||||
|
||||
readonly property alias iconItem: contentItem.icon
|
||||
readonly property alias label: contentItem.label
|
||||
|
||||
property color backgroundColor: theme.controls.button.background
|
||||
property color focusLineColor:
|
||||
Qt.colorEqual(icon.color, theme.icons.colorize) ?
|
||||
theme.controls.button.focusedBorder :
|
||||
icon.color
|
||||
|
||||
property bool disableWhileLoading: true
|
||||
property bool loading: false
|
||||
property bool circle: false
|
||||
property bool padded: true
|
||||
property bool enableRadius: false
|
||||
|
||||
property HToolTip toolTip: HToolTip {
|
||||
id: toolTip
|
||||
visible: text && hovered
|
||||
}
|
||||
|
||||
|
||||
enabled: ! button.loading
|
||||
spacing: theme.spacing
|
||||
topPadding: padded ? spacing * (circle ? 1 : 0.5) : 0
|
||||
@@ -45,28 +67,6 @@ Button {
|
||||
Keys.onEnterPressed: Keys.onReturnPressed(event)
|
||||
activeFocusOnTab: true
|
||||
|
||||
|
||||
readonly property alias iconItem: contentItem.icon
|
||||
readonly property alias label: contentItem.label
|
||||
|
||||
property color backgroundColor: theme.controls.button.background
|
||||
property color focusLineColor:
|
||||
Qt.colorEqual(icon.color, theme.icons.colorize) ?
|
||||
theme.controls.button.focusedBorder :
|
||||
icon.color
|
||||
|
||||
property bool disableWhileLoading: true
|
||||
property bool loading: false
|
||||
property bool circle: false
|
||||
property bool padded: true
|
||||
property bool enableRadius: false
|
||||
|
||||
property HToolTip toolTip: HToolTip {
|
||||
id: toolTip
|
||||
visible: text && hovered
|
||||
}
|
||||
|
||||
|
||||
Binding on enabled {
|
||||
when: disableWhileLoading && button.loading
|
||||
value: false
|
||||
|
@@ -15,7 +15,6 @@ Rectangle {
|
||||
enabled ? 1 :
|
||||
theme.disabledElementsOpacity
|
||||
|
||||
|
||||
Behavior on opacity { HNumberAnimation {} }
|
||||
|
||||
Rectangle {
|
||||
|
@@ -6,10 +6,6 @@ import QtQuick.Layouts 1.12
|
||||
|
||||
HRowLayout {
|
||||
id: buttonContent
|
||||
spacing: button.spacing
|
||||
opacity: button.loading ? theme.loadingElementsOpacity :
|
||||
enabled ? 1 : theme.disabledElementsOpacity
|
||||
|
||||
|
||||
property var button
|
||||
property QtObject buttonTheme
|
||||
@@ -18,8 +14,11 @@ HRowLayout {
|
||||
readonly property alias label: label
|
||||
|
||||
|
||||
Behavior on opacity { HNumberAnimation {} }
|
||||
spacing: button.spacing
|
||||
opacity: button.loading ? theme.loadingElementsOpacity :
|
||||
enabled ? 1 : theme.disabledElementsOpacity
|
||||
|
||||
Behavior on opacity { HNumberAnimation {} }
|
||||
|
||||
Item {
|
||||
visible: button.icon.name || button.loading
|
||||
|
@@ -6,6 +6,15 @@ import QtQuick.Layouts 1.12
|
||||
|
||||
CheckBox {
|
||||
id: box
|
||||
|
||||
property alias mainText: mainText
|
||||
property alias subtitle: subtitleText
|
||||
property bool defaultChecked: false
|
||||
readonly property bool changed: checked !== defaultChecked
|
||||
|
||||
function reset() { checked = defaultChecked }
|
||||
|
||||
|
||||
checked: defaultChecked
|
||||
spacing: contentItem.visible ? theme.spacing : 0
|
||||
padding: 0
|
||||
@@ -83,15 +92,5 @@ CheckBox {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
property alias mainText: mainText
|
||||
property alias subtitle: subtitleText
|
||||
property bool defaultChecked: false
|
||||
readonly property bool changed: checked !== defaultChecked
|
||||
|
||||
|
||||
function reset() { checked = defaultChecked }
|
||||
|
||||
|
||||
Behavior on opacity { HNumberAnimation { factor: 2 } }
|
||||
}
|
||||
|
@@ -5,14 +5,6 @@ import QtQuick.Shapes 1.12
|
||||
|
||||
|
||||
Item {
|
||||
implicitWidth: 96 * (theme ? theme.uiScale : 1)
|
||||
implicitHeight: implicitWidth
|
||||
|
||||
layer.enabled: true
|
||||
layer.samples: 4
|
||||
layer.smooth: true
|
||||
|
||||
|
||||
property real progress: 0 // 0-1
|
||||
|
||||
readonly property alias baseCircle: baseCircle
|
||||
@@ -20,14 +12,22 @@ Item {
|
||||
readonly property alias label: label
|
||||
|
||||
|
||||
implicitWidth: 96 * (theme ? theme.uiScale : 1)
|
||||
implicitHeight: implicitWidth
|
||||
|
||||
layer.enabled: true
|
||||
layer.samples: 4
|
||||
layer.smooth: true
|
||||
|
||||
HLabel {
|
||||
id: label
|
||||
|
||||
property int progressNumber: Math.floor(progress * 100)
|
||||
|
||||
anchors.centerIn: parent
|
||||
text: progressNumber + "%"
|
||||
font.pixelSize: theme ? theme.fontSize.big : 22
|
||||
|
||||
property int progressNumber: Math.floor(progress * 100)
|
||||
|
||||
Behavior on progressNumber { HNumberAnimation { factor: 2 } }
|
||||
}
|
||||
|
||||
|
@@ -4,5 +4,7 @@ import QtQuick 2.12
|
||||
|
||||
ColorAnimation {
|
||||
property real factor: 1.0
|
||||
|
||||
|
||||
duration: theme.animationDuration * factor
|
||||
}
|
||||
|
@@ -5,15 +5,14 @@ import QtQuick 2.12
|
||||
HPage {
|
||||
id: page
|
||||
|
||||
|
||||
default property alias columnData: column.data
|
||||
|
||||
property alias column: column
|
||||
|
||||
|
||||
implicitWidth: theme.controls.box.defaultWidth
|
||||
contentHeight: column.childrenRect.height
|
||||
|
||||
|
||||
HColumnLayout {
|
||||
id: column
|
||||
anchors.fill: parent
|
||||
|
@@ -5,29 +5,6 @@ import QtQuick.Controls 2.12
|
||||
|
||||
Drawer {
|
||||
id: drawer
|
||||
implicitWidth: horizontal ? calculatedSize : parent.width
|
||||
implicitHeight: vertical ? calculatedSize : parent.height
|
||||
|
||||
// Prevents this: open a popup, make the window small enough for the
|
||||
// drawer to collapse, then make it big again → popup is now behind drawer
|
||||
z: -1
|
||||
|
||||
topPadding: 0
|
||||
bottomPadding: 0
|
||||
leftPadding: 0
|
||||
rightPadding: 0
|
||||
|
||||
// FIXME: https://bugreports.qt.io/browse/QTBUG-59141
|
||||
// dragMargin: parent.width / 2
|
||||
|
||||
interactive: collapse
|
||||
position: 1
|
||||
visible: ! collapse
|
||||
modal: false
|
||||
closePolicy: Popup.NoAutoClose
|
||||
|
||||
background: Rectangle { id: bg; color: theme.colors.strongBackground }
|
||||
|
||||
|
||||
property string saveName: ""
|
||||
property var saveId: "ALL"
|
||||
@@ -77,6 +54,29 @@ Drawer {
|
||||
readonly property bool vertical: ! horizontal
|
||||
|
||||
|
||||
implicitWidth: horizontal ? calculatedSize : parent.width
|
||||
implicitHeight: vertical ? calculatedSize : parent.height
|
||||
|
||||
// Prevents this: open a popup, make the window small enough for the
|
||||
// drawer to collapse, then make it big again → popup is now behind drawer
|
||||
z: -1
|
||||
|
||||
topPadding: 0
|
||||
bottomPadding: 0
|
||||
leftPadding: 0
|
||||
rightPadding: 0
|
||||
|
||||
// FIXME: https://bugreports.qt.io/browse/QTBUG-59141
|
||||
// dragMargin: parent.width / 2
|
||||
|
||||
interactive: collapse
|
||||
position: 1
|
||||
visible: ! collapse
|
||||
modal: false
|
||||
closePolicy: Popup.NoAutoClose
|
||||
|
||||
background: Rectangle { id: bg; color: theme.colors.strongBackground }
|
||||
|
||||
Behavior on width {
|
||||
enabled: horizontal && ! resizeMouseHandler.drag.active
|
||||
NumberAnimation { duration: 100 }
|
||||
@@ -97,6 +97,12 @@ Drawer {
|
||||
|
||||
MouseArea {
|
||||
id: resizeMouseHandler
|
||||
|
||||
function snapSize(num) {
|
||||
return num < snapAt + snapZone && num > snapAt - snapZone ?
|
||||
snapAt : num
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
enabled: ! drawer.collapse
|
||||
acceptedButtons: Qt.LeftButton
|
||||
@@ -124,11 +130,6 @@ Drawer {
|
||||
}
|
||||
|
||||
onReleased: window.saveState(drawer)
|
||||
|
||||
function snapSize(num) {
|
||||
return num < snapAt + snapZone && num > snapAt - snapZone ?
|
||||
snapAt : num
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -6,12 +6,9 @@ import "../ShortcutBundles"
|
||||
|
||||
HPage {
|
||||
id: page
|
||||
implicitWidth: theme.controls.box.defaultWidth
|
||||
contentHeight:
|
||||
flickable.contentHeight + flickable.topMargin + flickable.bottomMargin
|
||||
|
||||
|
||||
default property alias columnData: column.data
|
||||
|
||||
property alias column: column
|
||||
property alias flickable: flickable
|
||||
property alias flickShortcuts: flickShortcuts
|
||||
@@ -20,8 +17,11 @@ HPage {
|
||||
SwipeView ? SwipeView.isCurrentItem : true
|
||||
|
||||
|
||||
padding: 0
|
||||
implicitWidth: theme.controls.box.defaultWidth
|
||||
contentHeight:
|
||||
flickable.contentHeight + flickable.topMargin + flickable.bottomMargin
|
||||
|
||||
padding: 0
|
||||
|
||||
HFlickable {
|
||||
id: flickable
|
||||
|
@@ -5,58 +5,6 @@ import QtQuick.Controls 2.12
|
||||
|
||||
GridView {
|
||||
id: gridView
|
||||
currentIndex: -1
|
||||
keyNavigationWraps: true
|
||||
highlightMoveDuration: theme.animationDuration
|
||||
|
||||
// Keep highlighted delegate at the center
|
||||
highlightRangeMode: GridView.ApplyRange
|
||||
preferredHighlightBegin: height / 2 - currentItemHeight / 2
|
||||
preferredHighlightEnd: height / 2 + currentItemHeight / 2
|
||||
|
||||
maximumFlickVelocity: window.settings.kineticScrollingMaxSpeed
|
||||
|
||||
|
||||
highlight: Rectangle {
|
||||
color: theme.controls.gridView.highlight
|
||||
}
|
||||
|
||||
ScrollBar.vertical: HScrollBar {
|
||||
visible: gridView.interactive
|
||||
}
|
||||
|
||||
// property bool debug: false
|
||||
|
||||
// https://doc.qt.io/qt-5/qml-qtquick-viewtransition.html
|
||||
// #handling-interrupted-animations
|
||||
add: Transition {
|
||||
// ScriptAction { script: if (gridView.debug) print("add") }
|
||||
HNumberAnimation { property: "opacity"; from: 0; to: 1 }
|
||||
HNumberAnimation { property: "scale"; from: 0; to: 1 }
|
||||
}
|
||||
|
||||
move: Transition {
|
||||
// ScriptAction { script: if (gridView.debug) print("move") }
|
||||
HNumberAnimation { property: "opacity"; to: 1 }
|
||||
HNumberAnimation { property: "scale"; to: 1 }
|
||||
HNumberAnimation { properties: "x,y" }
|
||||
}
|
||||
|
||||
remove: Transition {
|
||||
// ScriptAction { script: if (gridView.debug) print("remove") }
|
||||
HNumberAnimation { property: "opacity"; to: 0 }
|
||||
HNumberAnimation { property: "scale"; to: 0 }
|
||||
}
|
||||
|
||||
displaced: Transition {
|
||||
// ScriptAction { script: if (gridView.debug) print("displaced") }
|
||||
HNumberAnimation { property: "opacity"; to: 1 }
|
||||
HNumberAnimation { property: "scale"; to: 1 }
|
||||
HNumberAnimation { properties: "x,y" }
|
||||
}
|
||||
|
||||
onSelectedCountChanged: if (! selectedCount) lastCheckedDelegateIndex = 0
|
||||
|
||||
|
||||
property alias cursorShape: mouseArea.cursorShape
|
||||
property int currentItemHeight: currentItem ? currentItem.height : 0
|
||||
@@ -117,6 +65,58 @@ GridView {
|
||||
}
|
||||
|
||||
|
||||
currentIndex: -1
|
||||
keyNavigationWraps: true
|
||||
highlightMoveDuration: theme.animationDuration
|
||||
|
||||
// Keep highlighted delegate at the center
|
||||
highlightRangeMode: GridView.ApplyRange
|
||||
preferredHighlightBegin: height / 2 - currentItemHeight / 2
|
||||
preferredHighlightEnd: height / 2 + currentItemHeight / 2
|
||||
|
||||
maximumFlickVelocity: window.settings.kineticScrollingMaxSpeed
|
||||
|
||||
|
||||
highlight: Rectangle {
|
||||
color: theme.controls.gridView.highlight
|
||||
}
|
||||
|
||||
ScrollBar.vertical: HScrollBar {
|
||||
visible: gridView.interactive
|
||||
}
|
||||
|
||||
// property bool debug: false
|
||||
|
||||
// https://doc.qt.io/qt-5/qml-qtquick-viewtransition.html
|
||||
// #handling-interrupted-animations
|
||||
add: Transition {
|
||||
// ScriptAction { script: if (gridView.debug) print("add") }
|
||||
HNumberAnimation { property: "opacity"; from: 0; to: 1 }
|
||||
HNumberAnimation { property: "scale"; from: 0; to: 1 }
|
||||
}
|
||||
|
||||
move: Transition {
|
||||
// ScriptAction { script: if (gridView.debug) print("move") }
|
||||
HNumberAnimation { property: "opacity"; to: 1 }
|
||||
HNumberAnimation { property: "scale"; to: 1 }
|
||||
HNumberAnimation { properties: "x,y" }
|
||||
}
|
||||
|
||||
remove: Transition {
|
||||
// ScriptAction { script: if (gridView.debug) print("remove") }
|
||||
HNumberAnimation { property: "opacity"; to: 0 }
|
||||
HNumberAnimation { property: "scale"; to: 0 }
|
||||
}
|
||||
|
||||
displaced: Transition {
|
||||
// ScriptAction { script: if (gridView.debug) print("displaced") }
|
||||
HNumberAnimation { property: "opacity"; to: 1 }
|
||||
HNumberAnimation { property: "scale"; to: 1 }
|
||||
HNumberAnimation { properties: "x,y" }
|
||||
}
|
||||
|
||||
onSelectedCountChanged: if (! selectedCount) lastCheckedDelegateIndex = 0
|
||||
|
||||
HKineticScrollingDisabler {
|
||||
id: mouseArea
|
||||
width: enabled ? parent.width : 0
|
||||
|
@@ -5,15 +5,6 @@ import QtGraphicalEffects 1.12
|
||||
|
||||
Image {
|
||||
id: icon
|
||||
cache: true
|
||||
asynchronous: true
|
||||
fillMode: Image.PreserveAspectFit
|
||||
visible: Boolean(svgName)
|
||||
|
||||
source: svgName ? `../../icons/${iconPack}/${svgName}.svg` : ""
|
||||
sourceSize.width: svgName ? dimension : 0
|
||||
sourceSize.height: svgName ? dimension : 0
|
||||
|
||||
|
||||
property string svgName: ""
|
||||
|
||||
@@ -27,6 +18,15 @@ Image {
|
||||
property string iconPack: theme ? theme.icons.preferredPack : "thin"
|
||||
|
||||
|
||||
cache: true
|
||||
asynchronous: true
|
||||
fillMode: Image.PreserveAspectFit
|
||||
visible: Boolean(svgName)
|
||||
source: svgName ? `../../icons/${iconPack}/${svgName}.svg` : ""
|
||||
|
||||
sourceSize.width: svgName ? dimension : 0
|
||||
sourceSize.height: svgName ? dimension : 0
|
||||
|
||||
layer.enabled: ! Qt.colorEqual(colorize, "transparent")
|
||||
layer.effect: ColorOverlay {
|
||||
color: icon.colorize
|
||||
|
@@ -5,16 +5,6 @@ import QtGraphicalEffects 1.12
|
||||
|
||||
Image {
|
||||
id: image
|
||||
autoTransform: true
|
||||
asynchronous: true
|
||||
fillMode: Image.PreserveAspectFit
|
||||
|
||||
cache: ! (animate && animated) &&
|
||||
(sourceSize.width + sourceSize.height) <= 512
|
||||
|
||||
layer.enabled: radius !== 0
|
||||
layer.effect: OpacityMask { maskSource: roundMask }
|
||||
|
||||
|
||||
property bool circle: radius === circleRadius
|
||||
property bool broken: false
|
||||
@@ -31,11 +21,24 @@ Image {
|
||||
Math.ceil(Math.max(image.width, image.height))
|
||||
|
||||
|
||||
autoTransform: true
|
||||
asynchronous: true
|
||||
fillMode: Image.PreserveAspectFit
|
||||
|
||||
cache: ! (animate && animated) &&
|
||||
(sourceSize.width + sourceSize.height) <= 512
|
||||
|
||||
layer.enabled: radius !== 0
|
||||
layer.effect: OpacityMask { maskSource: roundMask }
|
||||
|
||||
Component {
|
||||
id: animatedImageComponent
|
||||
|
||||
AnimatedImage {
|
||||
id: animatedImage
|
||||
|
||||
property bool userPaused: ! window.settings.media.autoPlayGIF
|
||||
|
||||
source: image.source
|
||||
autoTransform: image.autoTransform
|
||||
asynchronous: image.asynchronous
|
||||
@@ -46,6 +49,14 @@ Image {
|
||||
horizontalAlignment: image.horizontalAlignment
|
||||
verticalAlignment: image.verticalAlignment
|
||||
|
||||
// Online GIFs won't be able to loop if cache is set to false,
|
||||
// but caching GIFs is expansive.
|
||||
cache: ! Qt.resolvedUrl(source).startsWith("file://")
|
||||
paused: ! visible || window.hidden || userPaused
|
||||
|
||||
layer.enabled: image.radius !== 0
|
||||
layer.effect: OpacityMask { maskSource: roundMask }
|
||||
|
||||
// Hack to make the non-animated image behind this one
|
||||
// basically invisible
|
||||
Binding {
|
||||
@@ -64,16 +75,6 @@ Image {
|
||||
value: 1
|
||||
}
|
||||
|
||||
// Online GIFs won't be able to loop if cache is set to false,
|
||||
// but caching GIFs is expansive.
|
||||
cache: ! Qt.resolvedUrl(source).startsWith("file://")
|
||||
paused: ! visible || window.hidden || userPaused
|
||||
|
||||
layer.enabled: image.radius !== 0
|
||||
layer.effect: OpacityMask { maskSource: roundMask }
|
||||
|
||||
property bool userPaused: ! window.settings.media.autoPlayGIF
|
||||
|
||||
TapHandler {
|
||||
enabled: image.enabledAnimatedPausing
|
||||
onTapped: parent.userPaused = ! parent.userPaused
|
||||
|
@@ -4,27 +4,12 @@ import QtQuick 2.12
|
||||
|
||||
MouseArea {
|
||||
id: mouseArea
|
||||
enabled: ! window.settings.enableKineticScrolling
|
||||
propagateComposedEvents: true
|
||||
acceptedButtons: Qt.NoButton
|
||||
|
||||
|
||||
onWheel: {
|
||||
// Make components below the stack notice the wheel event
|
||||
wheel.accepted = false
|
||||
|
||||
const pos = getNewPosition(flickable, wheel)
|
||||
flickable.flick(0, 0)
|
||||
flickable.contentY = pos
|
||||
}
|
||||
|
||||
|
||||
property Flickable flickable: parent
|
||||
|
||||
// Used to get default flickDeceleration value
|
||||
readonly property Flickable dummy: Flickable {}
|
||||
|
||||
|
||||
function getNewPosition(flickable, wheel) {
|
||||
// wheel.pixelDelta will be available on high resolution trackpads.
|
||||
// Otherwise use wheel.angleDelta, which is available from mouses and
|
||||
@@ -53,6 +38,19 @@ MouseArea {
|
||||
}
|
||||
|
||||
|
||||
enabled: ! window.settings.enableKineticScrolling
|
||||
propagateComposedEvents: true
|
||||
acceptedButtons: Qt.NoButton
|
||||
|
||||
onWheel: {
|
||||
// Make components below the stack notice the wheel event
|
||||
wheel.accepted = false
|
||||
|
||||
const pos = getNewPosition(flickable, wheel)
|
||||
flickable.flick(0, 0)
|
||||
flickable.contentY = pos
|
||||
}
|
||||
|
||||
Binding {
|
||||
target: flickable
|
||||
property: "maximumFlickVelocity"
|
||||
|
@@ -4,9 +4,6 @@ import QtQuick 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
|
||||
HColumnLayout {
|
||||
spacing: theme.spacing / 2
|
||||
|
||||
|
||||
default property alias insideData: itemHolder.data
|
||||
|
||||
property bool loading: false
|
||||
@@ -17,6 +14,8 @@ HColumnLayout {
|
||||
readonly property alias toolTip: toolTip
|
||||
|
||||
|
||||
spacing: theme.spacing / 2
|
||||
|
||||
HRowLayout {
|
||||
spacing: theme.spacing
|
||||
|
||||
|
@@ -5,59 +5,6 @@ import QtQuick.Controls 2.12
|
||||
|
||||
ListView {
|
||||
id: listView
|
||||
currentIndex: -1
|
||||
keyNavigationWraps: true
|
||||
highlightMoveDuration: theme.animationDuration
|
||||
highlightResizeDuration: theme.animationDuration
|
||||
|
||||
// Keep highlighted delegate at the center
|
||||
highlightRangeMode: ListView.ApplyRange
|
||||
preferredHighlightBegin: height / 2 - currentItemHeight / 2
|
||||
preferredHighlightEnd: height / 2 + currentItemHeight / 2
|
||||
|
||||
maximumFlickVelocity: window.settings.kineticScrollingMaxSpeed
|
||||
|
||||
|
||||
highlight: Rectangle {
|
||||
color: theme.controls.listView.highlight
|
||||
}
|
||||
|
||||
ScrollBar.vertical: HScrollBar {
|
||||
visible: listView.interactive
|
||||
}
|
||||
|
||||
// property bool debug: false
|
||||
|
||||
// https://doc.qt.io/qt-5/qml-qtquick-viewtransition.html
|
||||
// #handling-interrupted-animations
|
||||
add: Transition {
|
||||
// ScriptAction { script: if (listView.debug) print("add") }
|
||||
HNumberAnimation { property: "opacity"; from: 0; to: 1 }
|
||||
HNumberAnimation { property: "scale"; from: 0; to: 1 }
|
||||
}
|
||||
|
||||
move: Transition {
|
||||
// ScriptAction { script: if (listView.debug) print("move") }
|
||||
HNumberAnimation { property: "opacity"; to: 1 }
|
||||
HNumberAnimation { property: "scale"; to: 1 }
|
||||
HNumberAnimation { properties: "x,y" }
|
||||
}
|
||||
|
||||
remove: Transition {
|
||||
// ScriptAction { script: if (listView.debug) print("remove") }
|
||||
HNumberAnimation { property: "opacity"; to: 0 }
|
||||
HNumberAnimation { property: "scale"; to: 0 }
|
||||
}
|
||||
|
||||
displaced: Transition {
|
||||
// ScriptAction { script: if (listView.debug) print("displaced") }
|
||||
HNumberAnimation { property: "opacity"; to: 1 }
|
||||
HNumberAnimation { property: "scale"; to: 1 }
|
||||
HNumberAnimation { properties: "x,y" }
|
||||
}
|
||||
|
||||
onSelectedCountChanged: if (! selectedCount) lastCheckedDelegateIndex = 0
|
||||
|
||||
|
||||
property alias cursorShape: cursorShapeArea.cursorShape
|
||||
property int currentItemHeight: currentItem ? currentItem.height : 0
|
||||
@@ -67,7 +14,6 @@ ListView {
|
||||
property int lastCheckedDelegateIndex: 0
|
||||
property int selectedCount: Object.keys(checked).length
|
||||
|
||||
|
||||
function check(...indices) {
|
||||
for (const i of indices) {
|
||||
const model = listView.model.get(i)
|
||||
@@ -131,6 +77,59 @@ ListView {
|
||||
}
|
||||
|
||||
|
||||
currentIndex: -1
|
||||
keyNavigationWraps: true
|
||||
highlightMoveDuration: theme.animationDuration
|
||||
highlightResizeDuration: theme.animationDuration
|
||||
|
||||
// Keep highlighted delegate at the center
|
||||
highlightRangeMode: ListView.ApplyRange
|
||||
preferredHighlightBegin: height / 2 - currentItemHeight / 2
|
||||
preferredHighlightEnd: height / 2 + currentItemHeight / 2
|
||||
|
||||
maximumFlickVelocity: window.settings.kineticScrollingMaxSpeed
|
||||
|
||||
|
||||
highlight: Rectangle {
|
||||
color: theme.controls.listView.highlight
|
||||
}
|
||||
|
||||
ScrollBar.vertical: HScrollBar {
|
||||
visible: listView.interactive
|
||||
}
|
||||
|
||||
// property bool debug: false
|
||||
|
||||
// https://doc.qt.io/qt-5/qml-qtquick-viewtransition.html
|
||||
// #handling-interrupted-animations
|
||||
add: Transition {
|
||||
// ScriptAction { script: if (listView.debug) print("add") }
|
||||
HNumberAnimation { property: "opacity"; from: 0; to: 1 }
|
||||
HNumberAnimation { property: "scale"; from: 0; to: 1 }
|
||||
}
|
||||
|
||||
move: Transition {
|
||||
// ScriptAction { script: if (listView.debug) print("move") }
|
||||
HNumberAnimation { property: "opacity"; to: 1 }
|
||||
HNumberAnimation { property: "scale"; to: 1 }
|
||||
HNumberAnimation { properties: "x,y" }
|
||||
}
|
||||
|
||||
remove: Transition {
|
||||
// ScriptAction { script: if (listView.debug) print("remove") }
|
||||
HNumberAnimation { property: "opacity"; to: 0 }
|
||||
HNumberAnimation { property: "scale"; to: 0 }
|
||||
}
|
||||
|
||||
displaced: Transition {
|
||||
// ScriptAction { script: if (listView.debug) print("displaced") }
|
||||
HNumberAnimation { property: "opacity"; to: 1 }
|
||||
HNumberAnimation { property: "scale"; to: 1 }
|
||||
HNumberAnimation { properties: "x,y" }
|
||||
}
|
||||
|
||||
onSelectedCountChanged: if (! selectedCount) lastCheckedDelegateIndex = 0
|
||||
|
||||
MouseArea {
|
||||
id: cursorShapeArea
|
||||
anchors.fill: parent
|
||||
|
@@ -6,6 +6,17 @@ import CppUtils 0.1
|
||||
|
||||
Menu {
|
||||
id: menu
|
||||
|
||||
property var previouslyFocused: null
|
||||
|
||||
// MenuItems that open popups (or other elements taking focus when opened)
|
||||
// should set this to null. It will be reset to previouslyFocus when
|
||||
// the Menu is closed and opened again.
|
||||
property Item focusOnClosed: previouslyFocused
|
||||
|
||||
readonly property string uuid: CppUtils.uuid()
|
||||
|
||||
|
||||
modal: true
|
||||
dim: false
|
||||
padding: theme.controls.menu.borderWidth
|
||||
@@ -48,24 +59,17 @@ Menu {
|
||||
previouslyFocused = window.activeFocusItem
|
||||
focusOnClosed = Qt.binding(() => previouslyFocused)
|
||||
}
|
||||
|
||||
onOpened: {
|
||||
window.visibleMenus[uuid] = this
|
||||
window.visibleMenusChanged()
|
||||
}
|
||||
|
||||
onClosed: {
|
||||
if (focusOnClosed) focusOnClosed.forceActiveFocus()
|
||||
delete window.visibleMenus[uuid]
|
||||
window.visibleMenusChanged()
|
||||
}
|
||||
|
||||
Component.onDestruction: closed()
|
||||
|
||||
|
||||
property var previouslyFocused: null
|
||||
|
||||
// MenuItems that open popups (or other elements taking focus when opened)
|
||||
// should set this to null. It will be reset to previouslyFocus when
|
||||
// the Menu is closed and opened again.
|
||||
property Item focusOnClosed: previouslyFocused
|
||||
|
||||
readonly property string uuid: CppUtils.uuid()
|
||||
}
|
||||
|
@@ -5,6 +5,11 @@ import QtQuick.Controls 2.12
|
||||
|
||||
MenuItem {
|
||||
id: menuItem
|
||||
|
||||
readonly property alias iconItem: contentItem.icon
|
||||
readonly property alias label: contentItem.label
|
||||
|
||||
|
||||
spacing: theme.spacing
|
||||
leftPadding: spacing
|
||||
rightPadding: leftPadding
|
||||
@@ -27,8 +32,4 @@ MenuItem {
|
||||
buttonTheme: theme.controls.menuItem
|
||||
label.horizontalAlignment: Label.AlignLeft
|
||||
}
|
||||
|
||||
|
||||
readonly property alias iconItem: contentItem.icon
|
||||
readonly property alias label: contentItem.label
|
||||
}
|
||||
|
@@ -4,6 +4,11 @@ import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
HMenuItem {
|
||||
property var popup // url or HPopup Component
|
||||
property bool autoDestruct: true
|
||||
property var properties: ({})
|
||||
|
||||
|
||||
onTriggered: {
|
||||
menu.focusOnClosed = null
|
||||
|
||||
@@ -16,9 +21,4 @@ HMenuItem {
|
||||
autoDestruct,
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
property var popup // url or HPopup Component
|
||||
property bool autoDestruct: true
|
||||
property var properties: ({})
|
||||
}
|
||||
|
@@ -5,15 +5,6 @@ import "../PythonBridge"
|
||||
|
||||
HImage {
|
||||
id: image
|
||||
inderterminateProgressBar: isMxc
|
||||
source: sourceOverride || (show ? cachedPath : "")
|
||||
|
||||
onWidthChanged: Qt.callLater(update)
|
||||
onHeightChanged: Qt.callLater(update)
|
||||
onVisibleChanged: Qt.callLater(update)
|
||||
onMxcChanged: Qt.callLater(update)
|
||||
Component.onDestruction: if (getFuture) getFuture.cancel()
|
||||
|
||||
|
||||
property string mxc
|
||||
property string title
|
||||
@@ -28,7 +19,6 @@ HImage {
|
||||
|
||||
readonly property bool isMxc: mxc.startsWith("mxc://")
|
||||
|
||||
|
||||
function update() {
|
||||
if (! py) return // component was destroyed
|
||||
|
||||
@@ -64,4 +54,14 @@ HImage {
|
||||
},
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
inderterminateProgressBar: isMxc
|
||||
source: sourceOverride || (show ? cachedPath : "")
|
||||
|
||||
onWidthChanged: Qt.callLater(update)
|
||||
onHeightChanged: Qt.callLater(update)
|
||||
onVisibleChanged: Qt.callLater(update)
|
||||
onMxcChanged: Qt.callLater(update)
|
||||
Component.onDestruction: if (getFuture) getFuture.cancel()
|
||||
}
|
||||
|
@@ -11,6 +11,7 @@ HRowLayout {
|
||||
property alias backgroundColor: noticeLabelBackground.color
|
||||
property alias radius: noticeLabelBackground.radius
|
||||
|
||||
|
||||
HLabel {
|
||||
id: noticeLabel
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
|
@@ -6,6 +6,7 @@ NumberAnimation {
|
||||
property real factor: 1.0
|
||||
property real overshoot: 1.0
|
||||
|
||||
|
||||
duration: theme.animationDuration * Math.max(overshoot / 1.7, 1.0) * factor
|
||||
easing.type: overshoot > 1 ? Easing.OutBack : Easing.Linear
|
||||
easing.overshoot: overshoot
|
||||
|
@@ -4,14 +4,6 @@ import QtQuick 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
|
||||
Page {
|
||||
padding: currentSpacing < theme.spacing ? 0 : currentSpacing
|
||||
background: null
|
||||
|
||||
Keys.onReturnPressed: keyboardAccept()
|
||||
Keys.onEnterPressed: keyboardAccept()
|
||||
Keys.onEscapePressed: keyboardCancel()
|
||||
|
||||
|
||||
property bool useVariableSpacing: true
|
||||
|
||||
property int currentSpacing:
|
||||
@@ -27,5 +19,12 @@ Page {
|
||||
signal keyboardCancel()
|
||||
|
||||
|
||||
padding: currentSpacing < theme.spacing ? 0 : currentSpacing
|
||||
background: null
|
||||
|
||||
Keys.onReturnPressed: keyboardAccept()
|
||||
Keys.onEnterPressed: keyboardAccept()
|
||||
Keys.onEscapePressed: keyboardCancel()
|
||||
|
||||
Behavior on padding { HNumberAnimation {} }
|
||||
}
|
||||
|
@@ -6,6 +6,19 @@ import CppUtils 0.1
|
||||
|
||||
Popup {
|
||||
id: popup
|
||||
|
||||
property var previouslyFocused: null
|
||||
property Item focusOnClosed: previouslyFocused
|
||||
|
||||
readonly property int maximumPreferredWidth:
|
||||
window.width - leftMargin - rightMargin - leftInset - rightInset
|
||||
|
||||
readonly property int maximumPreferredHeight:
|
||||
window.height - topMargin - bottomMargin - topInset - bottomInset
|
||||
|
||||
readonly property string uuid: CppUtils.uuid()
|
||||
|
||||
|
||||
modal: true
|
||||
focus: true
|
||||
padding: 0
|
||||
@@ -43,17 +56,6 @@ Popup {
|
||||
delete window.visiblePopups[uuid]
|
||||
window.visibleMenusChanged()
|
||||
}
|
||||
|
||||
Component.onDestruction: closed()
|
||||
|
||||
|
||||
property var previouslyFocused: null
|
||||
property Item focusOnClosed: previouslyFocused
|
||||
|
||||
readonly property int maximumPreferredWidth:
|
||||
window.width - leftMargin - rightMargin - leftInset - rightInset
|
||||
|
||||
readonly property int maximumPreferredHeight:
|
||||
window.height - topMargin - bottomMargin - topInset - bottomInset
|
||||
|
||||
readonly property string uuid: CppUtils.uuid()
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@ ProgressBar {
|
||||
property color backgroundColor: theme.controls.progressBar.background
|
||||
property color foregroundColor: theme.controls.progressBar.foreground
|
||||
|
||||
|
||||
background: Rectangle {
|
||||
implicitWidth: 200
|
||||
implicitHeight: theme.controls.progressBar.height
|
||||
|
@@ -7,6 +7,7 @@ Item {
|
||||
property alias borderHeight: clipArea.height
|
||||
property alias color: borderRectangle.color
|
||||
|
||||
|
||||
implicitWidth: rectangle.width
|
||||
implicitHeight: rectangle.height
|
||||
|
||||
|
@@ -7,7 +7,6 @@ import QtQuick 2.12
|
||||
Repeater {
|
||||
id: repeater
|
||||
|
||||
|
||||
readonly property var childrenImplicitWidth: {
|
||||
const widths = []
|
||||
|
||||
|
@@ -3,13 +3,13 @@
|
||||
import QtQuick 2.12
|
||||
|
||||
HAvatar {
|
||||
property string roomId
|
||||
property string displayName
|
||||
|
||||
|
||||
name: displayName[0] === "#" && displayName.length > 1 ?
|
||||
displayName.substring(1) :
|
||||
displayName
|
||||
|
||||
title: "room_" + roomId + ".avatar"
|
||||
|
||||
|
||||
property string roomId
|
||||
property string displayName
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@ import QtQuick.Controls 2.12
|
||||
|
||||
ScrollBar {
|
||||
id: scrollBar
|
||||
|
||||
minimumSize: (Math.min(height / 1.5, 48) * theme.uiScale) / height
|
||||
opacity: size < 1 && (active || hovered) ? 1 : 0
|
||||
padding: 0
|
||||
|
@@ -5,6 +5,19 @@ import QtQuick.Controls 2.12
|
||||
|
||||
TextEdit {
|
||||
id: label
|
||||
|
||||
property bool enableLinkActivation: true
|
||||
|
||||
function selectWordAt(position) {
|
||||
label.cursorPosition = positionAt(position.x, position.y)
|
||||
label.selectWord()
|
||||
}
|
||||
|
||||
function selectAllText() {
|
||||
label.selectAll()
|
||||
}
|
||||
|
||||
|
||||
font.family: theme.fontFamily.sans
|
||||
font.pixelSize: theme.fontSize.normal
|
||||
color: theme.colors.text
|
||||
@@ -18,20 +31,6 @@ TextEdit {
|
||||
selectByMouse: true
|
||||
onLinkActivated: if (enableLinkActivation) Qt.openUrlExternally(link)
|
||||
|
||||
|
||||
property bool enableLinkActivation: true
|
||||
|
||||
|
||||
function selectWordAt(position) {
|
||||
label.cursorPosition = positionAt(position.x, position.y)
|
||||
label.selectWord()
|
||||
}
|
||||
|
||||
function selectAllText() {
|
||||
label.selectAll()
|
||||
}
|
||||
|
||||
|
||||
MouseArea {
|
||||
anchors.fill: label
|
||||
acceptedButtons: Qt.NoButton
|
||||
|
@@ -3,10 +3,10 @@
|
||||
import QtQuick 2.12
|
||||
|
||||
Shortcut {
|
||||
enabled: ! window.anyPopupOrMenu && active
|
||||
context: Qt.ApplicationShortcut
|
||||
|
||||
|
||||
// TODO: use enabled + a Binding with restoreValue when switch to Qt 5.15
|
||||
property bool active: true
|
||||
|
||||
|
||||
enabled: ! window.anyPopupOrMenu && active
|
||||
context: Qt.ApplicationShortcut
|
||||
}
|
||||
|
@@ -5,10 +5,6 @@ import QtQuick.Controls 2.12
|
||||
|
||||
Slider {
|
||||
id: slider
|
||||
leftPadding: 0
|
||||
rightPadding: leftPadding
|
||||
topPadding: 0
|
||||
bottomPadding: topPadding
|
||||
|
||||
property bool enableRadius: true
|
||||
property bool fullHeight: false
|
||||
@@ -18,6 +14,12 @@ Slider {
|
||||
property alias toolTip: toolTip
|
||||
property alias mouseArea: mouseArea
|
||||
|
||||
|
||||
leftPadding: 0
|
||||
rightPadding: leftPadding
|
||||
topPadding: 0
|
||||
bottomPadding: topPadding
|
||||
|
||||
background: Rectangle {
|
||||
color: backgroundColor
|
||||
x: slider.leftPadding
|
||||
|
@@ -7,21 +7,6 @@ import "../ShortcutBundles"
|
||||
SwipeView {
|
||||
id: swipeView
|
||||
|
||||
Component.onCompleted: if (! changed) {
|
||||
setCurrentIndex(window.getState(this, "currentIndex", defaultIndex))
|
||||
saveEnabled = true
|
||||
}
|
||||
|
||||
onCurrentIndexChanged: {
|
||||
if (saveEnabled) window.saveState(this)
|
||||
|
||||
if (currentIndex < previousIndex) lastMove = HSwipeView.Move.ToPrevious
|
||||
if (currentIndex > previousIndex) lastMove = HSwipeView.Move.ToNext
|
||||
|
||||
previousIndex = currentIndex
|
||||
}
|
||||
|
||||
|
||||
enum Move { ToPrevious, ToNext }
|
||||
|
||||
property string saveName: ""
|
||||
@@ -52,6 +37,20 @@ SwipeView {
|
||||
}
|
||||
|
||||
|
||||
Component.onCompleted: if (! changed) {
|
||||
setCurrentIndex(window.getState(this, "currentIndex", defaultIndex))
|
||||
saveEnabled = true
|
||||
}
|
||||
|
||||
onCurrentIndexChanged: {
|
||||
if (saveEnabled) window.saveState(this)
|
||||
|
||||
if (currentIndex < previousIndex) lastMove = HSwipeView.Move.ToPrevious
|
||||
if (currentIndex > previousIndex) lastMove = HSwipeView.Move.ToNext
|
||||
|
||||
previousIndex = currentIndex
|
||||
}
|
||||
|
||||
TabShortcuts {
|
||||
container: swipeView
|
||||
}
|
||||
|
@@ -6,6 +6,7 @@ import "../ShortcutBundles"
|
||||
|
||||
TabBar {
|
||||
id: tabBar
|
||||
|
||||
spacing: 0
|
||||
position: TabBar.Header
|
||||
|
||||
@@ -18,7 +19,6 @@ TabBar {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TabShortcuts {
|
||||
container: tabBar
|
||||
}
|
||||
|
@@ -6,27 +6,6 @@ import QtQuick.Layouts 1.12
|
||||
|
||||
TabButton {
|
||||
id: button
|
||||
spacing: theme.spacing
|
||||
topPadding: spacing / 1.5
|
||||
bottomPadding: topPadding
|
||||
leftPadding: spacing
|
||||
rightPadding: leftPadding
|
||||
|
||||
icon.color: theme.icons.colorize
|
||||
|
||||
implicitWidth: Math.max(
|
||||
implicitBackgroundWidth + leftInset + rightInset,
|
||||
// FIXME: why is *2 needed to not get ellided text in AddAccount page?
|
||||
implicitContentWidth + leftPadding * 2 + rightPadding * 2,
|
||||
)
|
||||
implicitHeight: Math.max(
|
||||
implicitBackgroundHeight + topInset + bottomInset,
|
||||
implicitContentHeight + topPadding + bottomPadding,
|
||||
)
|
||||
|
||||
// Prevent button from gaining focus and being highlighted on click
|
||||
focusPolicy: Qt.TabFocus
|
||||
|
||||
|
||||
readonly property alias iconItem: contentItem.icon
|
||||
readonly property alias label: contentItem.label
|
||||
@@ -48,6 +27,27 @@ TabButton {
|
||||
}
|
||||
|
||||
|
||||
spacing: theme.spacing
|
||||
topPadding: spacing / 1.5
|
||||
bottomPadding: topPadding
|
||||
leftPadding: spacing
|
||||
rightPadding: leftPadding
|
||||
|
||||
icon.color: theme.icons.colorize
|
||||
|
||||
implicitWidth: Math.max(
|
||||
implicitBackgroundWidth + leftInset + rightInset,
|
||||
// FIXME: why is *2 needed to not get ellided text in AddAccount page?
|
||||
implicitContentWidth + leftPadding * 2 + rightPadding * 2,
|
||||
)
|
||||
implicitHeight: Math.max(
|
||||
implicitBackgroundHeight + topInset + bottomInset,
|
||||
implicitContentHeight + topPadding + bottomPadding,
|
||||
)
|
||||
|
||||
// Prevent button from gaining focus and being highlighted on click
|
||||
focusPolicy: Qt.TabFocus
|
||||
|
||||
background: HButtonBackground {
|
||||
button: button
|
||||
buttonTheme: theme.controls.tab
|
||||
|
@@ -6,7 +6,6 @@ import QtQuick.Controls 2.12
|
||||
TextArea {
|
||||
id: textArea
|
||||
|
||||
|
||||
property string saveName: ""
|
||||
property var saveId: "ALL"
|
||||
property var saveProperties: ["text"]
|
||||
@@ -27,7 +26,6 @@ TextArea {
|
||||
|
||||
property string previousDefaultText: "" // private
|
||||
|
||||
|
||||
function reset() { clear(); text = Qt.binding(() => defaultText || "") }
|
||||
function insertAtCursor(text) { insert(cursorPosition, text) }
|
||||
|
||||
|
@@ -7,7 +7,6 @@ HMenu {
|
||||
|
||||
property bool hadPersistentSelection: false // TODO: use a Qt 5.15 Binding
|
||||
|
||||
|
||||
function spawn(atMousePosition=true) {
|
||||
hadPersistentSelection = control.persistentSelection
|
||||
control.persistentSelection = true
|
||||
@@ -25,7 +24,6 @@ HMenu {
|
||||
Component.onDestruction:
|
||||
control.persistentSelection = hadPersistentSelection
|
||||
|
||||
|
||||
HMenuItem {
|
||||
icon.name: "undo"
|
||||
text: qsTr("Undo")
|
||||
|
@@ -5,6 +5,33 @@ import QtQuick.Controls 2.12
|
||||
|
||||
TextField {
|
||||
id: field
|
||||
|
||||
property string saveName: ""
|
||||
property var saveId: "ALL"
|
||||
property var saveProperties: ["text"]
|
||||
|
||||
property bool error: false
|
||||
|
||||
property alias radius: textFieldBackground.radius
|
||||
property bool bordered: true
|
||||
|
||||
property color backgroundColor: theme.controls.textField.background
|
||||
property color borderColor: theme.controls.textField.border
|
||||
property color errorBorder: theme.controls.textField.errorBorder
|
||||
|
||||
property color focusedBackgroundColor:
|
||||
theme.controls.textField.focusedBackground
|
||||
property color focusedBorderColor: theme.controls.textField.focusedBorder
|
||||
|
||||
property var disabledText: null
|
||||
property var defaultText: null
|
||||
readonly property bool changed: text !== (defaultText || "")
|
||||
|
||||
property string previousDefaultText: "" // private
|
||||
|
||||
function reset() { clear(); text = Qt.binding(() => defaultText || "")}
|
||||
|
||||
|
||||
text: defaultText || ""
|
||||
opacity: enabled ? 1 : theme.disabledElementsOpacity
|
||||
selectByMouse: true
|
||||
@@ -75,33 +102,6 @@ TextField {
|
||||
event.accepted = cursorPosition === length && ! selectedText
|
||||
|
||||
|
||||
property string saveName: ""
|
||||
property var saveId: "ALL"
|
||||
property var saveProperties: ["text"]
|
||||
|
||||
property bool error: false
|
||||
|
||||
property alias radius: textFieldBackground.radius
|
||||
property bool bordered: true
|
||||
|
||||
property color backgroundColor: theme.controls.textField.background
|
||||
property color borderColor: theme.controls.textField.border
|
||||
property color errorBorder: theme.controls.textField.errorBorder
|
||||
|
||||
property color focusedBackgroundColor:
|
||||
theme.controls.textField.focusedBackground
|
||||
property color focusedBorderColor: theme.controls.textField.focusedBorder
|
||||
|
||||
property var disabledText: null
|
||||
property var defaultText: null
|
||||
readonly property bool changed: text !== (defaultText || "")
|
||||
|
||||
property string previousDefaultText: "" // private
|
||||
|
||||
|
||||
function reset() { clear(); text = Qt.binding(() => defaultText || "")}
|
||||
|
||||
|
||||
Binding on color {
|
||||
value: "transparent"
|
||||
when: disabledText !== null && ! field.enabled
|
||||
|
@@ -4,9 +4,9 @@ import QtQuick 2.12
|
||||
import ".."
|
||||
|
||||
HRowLayout {
|
||||
property HTile tile
|
||||
|
||||
|
||||
spacing: tile.spacing
|
||||
opacity: tile.contentOpacity
|
||||
|
||||
|
||||
property HTile tile
|
||||
}
|
||||
|
@@ -5,26 +5,15 @@ import ".."
|
||||
|
||||
HButton {
|
||||
id: tile
|
||||
topPadding: padded ? spacing / (compact ? 4 : 2) : 0
|
||||
bottomPadding: topPadding
|
||||
|
||||
Keys.onEnterPressed: leftClicked()
|
||||
Keys.onReturnPressed: leftClicked()
|
||||
Keys.onSpacePressed: leftClicked()
|
||||
Keys.onMenuPressed: doRightClick(false)
|
||||
|
||||
property bool compact: window.settings.compactMode
|
||||
property real contentOpacity: 1
|
||||
property Component contextMenu: null
|
||||
|
||||
signal leftClicked()
|
||||
signal rightClicked()
|
||||
signal longPressed()
|
||||
|
||||
|
||||
property bool compact: window.settings.compactMode
|
||||
property real contentOpacity: 1
|
||||
|
||||
property Component contextMenu: null
|
||||
|
||||
|
||||
function openMenu(atCursor=true) {
|
||||
if (! contextMenu) return
|
||||
const menu = contextMenu.createObject(tile)
|
||||
@@ -38,6 +27,15 @@ HButton {
|
||||
}
|
||||
|
||||
|
||||
topPadding: padded ? spacing / (compact ? 4 : 2) : 0
|
||||
bottomPadding: topPadding
|
||||
|
||||
Keys.onEnterPressed: leftClicked()
|
||||
Keys.onReturnPressed: leftClicked()
|
||||
Keys.onSpacePressed: leftClicked()
|
||||
Keys.onMenuPressed: doRightClick(false)
|
||||
|
||||
|
||||
Behavior on topPadding { HNumberAnimation {} }
|
||||
Behavior on bottomPadding { HNumberAnimation {} }
|
||||
|
||||
|
@@ -7,6 +7,7 @@ import ".."
|
||||
HLabel {
|
||||
property HTile tile
|
||||
|
||||
|
||||
textFormat: Text.StyledText
|
||||
font.pixelSize: theme.fontSize.small
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
|
@@ -5,6 +5,9 @@ import QtQuick.Layouts 1.12
|
||||
import ".."
|
||||
|
||||
HLabel {
|
||||
property HTile tile
|
||||
|
||||
|
||||
font.pixelSize: theme.fontSize.small
|
||||
verticalAlignment: Qt.AlignVCenter
|
||||
color: theme.colors.halfDimText
|
||||
@@ -15,9 +18,5 @@ HLabel {
|
||||
text && tile.width >= 200 * theme.uiScale ?
|
||||
implicitWidth : 0
|
||||
|
||||
|
||||
property HTile tile
|
||||
|
||||
|
||||
Behavior on Layout.maximumWidth { HNumberAnimation {} }
|
||||
}
|
||||
|
@@ -6,6 +6,23 @@ import QtQuick.Layouts 1.12
|
||||
|
||||
ToolTip {
|
||||
id: toolTip
|
||||
|
||||
property bool instant: false
|
||||
|
||||
property alias label: label
|
||||
property alias backgroundColor: background.color
|
||||
|
||||
readonly property bool hideNow: ! window.hovered
|
||||
|
||||
|
||||
function instantShow() {
|
||||
if (visible) return
|
||||
instant = true
|
||||
open()
|
||||
instant = false
|
||||
}
|
||||
|
||||
|
||||
delay: instant ? 0 : theme.controls.toolTip.delay
|
||||
padding: background.border.width
|
||||
|
||||
@@ -43,23 +60,6 @@ ToolTip {
|
||||
|
||||
onHideNowChanged: if (visible && hideNow) toolTip.hide()
|
||||
|
||||
|
||||
property bool instant: false
|
||||
|
||||
property alias label: label
|
||||
property alias backgroundColor: background.color
|
||||
|
||||
readonly property bool hideNow: ! window.hovered
|
||||
|
||||
|
||||
function instantShow() {
|
||||
if (visible) return
|
||||
instant = true
|
||||
open()
|
||||
instant = false
|
||||
}
|
||||
|
||||
|
||||
TapHandler {
|
||||
onTapped: toolTip.hide()
|
||||
}
|
||||
|
@@ -3,10 +3,6 @@
|
||||
import QtQuick 2.12
|
||||
|
||||
HAvatar {
|
||||
name: displayName || userId.substring(1) // no leading @
|
||||
title: "user_" + userId + ".avatar"
|
||||
|
||||
|
||||
property string userId
|
||||
property string displayName
|
||||
property string presence: ""
|
||||
@@ -18,6 +14,9 @@ HAvatar {
|
||||
readonly property bool moderator: powerLevel >= 50 && ! admin
|
||||
|
||||
|
||||
name: displayName || userId.substring(1) // no leading @
|
||||
title: "user_" + userId + ".avatar"
|
||||
|
||||
HLoader {
|
||||
active: admin || moderator || invited
|
||||
anchors.top: parent.top
|
||||
@@ -53,6 +52,11 @@ HAvatar {
|
||||
}
|
||||
|
||||
HLoader {
|
||||
property int diameter:
|
||||
window.settings.compactMode ?
|
||||
theme.controls.presence.radius * 2 :
|
||||
theme.controls.presence.radius * 2.5
|
||||
|
||||
active: presence && presence !== "offline"
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.right: parent.right
|
||||
@@ -61,11 +65,6 @@ HAvatar {
|
||||
opacity: theme.controls.presence.opacity
|
||||
z: 300
|
||||
|
||||
property int diameter:
|
||||
window.settings.compactMode ?
|
||||
theme.controls.presence.radius * 2 :
|
||||
theme.controls.presence.radius * 2.5
|
||||
|
||||
sourceComponent: Rectangle {
|
||||
width: diameter
|
||||
height: diameter
|
||||
|
@@ -5,16 +5,16 @@ import QtAV 1.7
|
||||
|
||||
OSD {
|
||||
id: osd
|
||||
|
||||
property alias source: audioPlayer.source
|
||||
|
||||
|
||||
audioOnly: true
|
||||
media: audioPlayer
|
||||
|
||||
implicitWidth: osd.width
|
||||
implicitHeight: osd.height
|
||||
|
||||
|
||||
property alias source: audioPlayer.source
|
||||
|
||||
|
||||
MediaPlayer {
|
||||
id: audioPlayer
|
||||
autoLoad: window.settings.media.autoLoad
|
||||
|
@@ -7,20 +7,6 @@ import "../../Base"
|
||||
|
||||
HColumnLayout {
|
||||
id: osd
|
||||
visible: osdScaleTransform.yScale > 0
|
||||
|
||||
transform: Scale {
|
||||
id: osdScaleTransform
|
||||
yScale: audioOnly ||
|
||||
osdHover.hovered ||
|
||||
media.playbackState !== MediaPlayer.PlayingState ||
|
||||
osd.showup ?
|
||||
1 : 0
|
||||
origin.y: osd.height
|
||||
|
||||
Behavior on yScale { HNumberAnimation {} }
|
||||
}
|
||||
|
||||
|
||||
property QtObject media: parent // QtAV.Video or QtAV.MediaPlayer
|
||||
property bool audioOnly: false
|
||||
@@ -35,12 +21,6 @@ HColumnLayout {
|
||||
savedDuration ?
|
||||
Math.min(media.position, savedDuration) : media.position
|
||||
|
||||
|
||||
onShowupChanged: if (showup) osdHideTimer.restart()
|
||||
onDurationChanged: if (duration) savedDuration = duration
|
||||
onAspectRatioChanged: if (aspectRatio) savedAspectRatio = aspectRatio
|
||||
|
||||
|
||||
function togglePlay() {
|
||||
media.playbackState === MediaPlayer.PlayingState ?
|
||||
media.pause() : media.play()
|
||||
@@ -52,6 +32,24 @@ HColumnLayout {
|
||||
}
|
||||
|
||||
|
||||
visible: osdScaleTransform.yScale > 0
|
||||
|
||||
transform: Scale {
|
||||
id: osdScaleTransform
|
||||
yScale: audioOnly ||
|
||||
osdHover.hovered ||
|
||||
media.playbackState !== MediaPlayer.PlayingState ||
|
||||
osd.showup ?
|
||||
1 : 0
|
||||
origin.y: osd.height
|
||||
|
||||
Behavior on yScale { HNumberAnimation {} }
|
||||
}
|
||||
|
||||
onShowupChanged: if (showup) osdHideTimer.restart()
|
||||
onDurationChanged: if (duration) savedDuration = duration
|
||||
onAspectRatioChanged: if (aspectRatio) savedAspectRatio = aspectRatio
|
||||
|
||||
HoverHandler { id: osdHover }
|
||||
|
||||
Timer {
|
||||
@@ -77,6 +75,13 @@ HColumnLayout {
|
||||
|
||||
HToolTip {
|
||||
id: previewToolTip
|
||||
|
||||
readonly property int wantTimestamp:
|
||||
visible ?
|
||||
savedDuration *
|
||||
(timeSlider.mouseArea.mouseX / timeSlider.mouseArea.width) :
|
||||
-1
|
||||
|
||||
x: timeSlider.mouseArea.mouseX - width / 2
|
||||
visible: ! audioOnly &&
|
||||
|
||||
@@ -88,20 +93,6 @@ HColumnLayout {
|
||||
|
||||
! timeSlider.pressed && timeSlider.mouseArea.containsMouse
|
||||
|
||||
readonly property int wantTimestamp:
|
||||
visible ?
|
||||
savedDuration *
|
||||
(timeSlider.mouseArea.mouseX / timeSlider.mouseArea.width) :
|
||||
-1
|
||||
|
||||
Timer {
|
||||
interval: 300
|
||||
running: previewToolTip.visible
|
||||
repeat: true
|
||||
triggeredOnStart: true
|
||||
onTriggered: preview.timestamp = previewToolTip.wantTimestamp
|
||||
}
|
||||
|
||||
contentItem: VideoPreview {
|
||||
id: preview
|
||||
implicitHeight: Math.min(
|
||||
@@ -129,11 +120,19 @@ HColumnLayout {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binding on value {
|
||||
value: boundPosition
|
||||
when: ! timeSlider.pressed
|
||||
Binding on value {
|
||||
value: boundPosition
|
||||
when: ! timeSlider.pressed
|
||||
}
|
||||
|
||||
Timer {
|
||||
interval: 300
|
||||
running: previewToolTip.visible
|
||||
repeat: true
|
||||
triggeredOnStart: true
|
||||
onTriggered: preview.timestamp = previewToolTip.wantTimestamp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -3,7 +3,6 @@
|
||||
import QtQuick 2.12
|
||||
import "../../Base"
|
||||
|
||||
|
||||
HButton {
|
||||
backgroundColor: "transparent"
|
||||
iconItem.dimension: theme.mediaPlayer.controls.iconSize
|
||||
|
@@ -4,7 +4,6 @@ import QtQuick 2.12
|
||||
import QtQuick.Layouts 1.12
|
||||
import "../../Base"
|
||||
|
||||
|
||||
HLabel {
|
||||
Layout.leftMargin: theme.spacing / 2
|
||||
Layout.rightMargin: Layout.leftMargin
|
||||
|
@@ -6,9 +6,8 @@ import QtQuick.Layouts 1.12
|
||||
|
||||
HDrawer {
|
||||
id: pane
|
||||
defaultSize: buttonRepeater.count * buttonWidth
|
||||
minimumSize: buttonWidth
|
||||
|
||||
default property alias swipeViewData: swipeView.contentData
|
||||
|
||||
property color buttonsBackgroundColor
|
||||
|
||||
@@ -18,8 +17,9 @@ HDrawer {
|
||||
readonly property alias buttonRepeater: buttonRepeater
|
||||
readonly property alias swipeView: swipeView
|
||||
|
||||
default property alias swipeViewData: swipeView.contentData
|
||||
|
||||
defaultSize: buttonRepeater.count * buttonWidth
|
||||
minimumSize: buttonWidth
|
||||
|
||||
HColumnLayout {
|
||||
anchors.fill: parent
|
||||
|
Reference in New Issue
Block a user