Skip to content

Commit

Permalink
Merge pull request #669 from Nheko-Reborn/sticker-editor
Browse files Browse the repository at this point in the history
Sticker editor
  • Loading branch information
deepbluev7 authored Aug 6, 2021
2 parents 6d83b7c + cc22309 commit 11f9a9d
Show file tree
Hide file tree
Showing 19 changed files with 896 additions and 168 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ if(USE_BUNDLED_MTXCLIENT)
FetchContent_Declare(
MatrixClient
GIT_REPOSITORY https://github.com/Nheko-Reborn/mtxclient.git
GIT_TAG 316a4040785ee2eabac7ef5ce7b4acb71c48f6eb
GIT_TAG e5688a2c5987a614b5055595f991f18568127bd2
)
set(BUILD_LIB_EXAMPLES OFF CACHE INTERNAL "")
set(BUILD_LIB_TESTS OFF CACHE INTERNAL "")
Expand Down
2 changes: 1 addition & 1 deletion io.github.NhekoReborn.Nheko.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ modules:
buildsystem: cmake-ninja
name: mtxclient
sources:
- commit: 316a4040785ee2eabac7ef5ce7b4acb71c48f6eb
- commit: e5688a2c5987a614b5055595f991f18568127bd2
type: git
url: https://github.com/Nheko-Reborn/mtxclient.git
- config-opts:
Expand Down
6 changes: 4 additions & 2 deletions resources/qml/Avatar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ import im.nheko 1.0
Rectangle {
id: avatar

property alias url: img.source
property string url
property string userid
property string displayName
property alias textColor: label.color
property bool crop: true

signal clicked(var mouse)

Expand Down Expand Up @@ -44,12 +45,13 @@ Rectangle {

anchors.fill: parent
asynchronous: true
fillMode: Image.PreserveAspectCrop
fillMode: avatar.crop ? Image.PreserveAspectCrop : Image.PreserveAspectFit
mipmap: true
smooth: true
sourceSize.width: avatar.width
sourceSize.height: avatar.height
layer.enabled: true
source: avatar.url + ((avatar.crop || !avatar.url) ? "" : "?scale")

MouseArea {
id: mouseArea
Expand Down
4 changes: 2 additions & 2 deletions resources/qml/RoomSettings.qml
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ ApplicationWindow {

GridLayout {
columns: 2
rowSpacing: 10
rowSpacing: Nheko.paddingLarge

MatrixText {
text: qsTr("SETTINGS")
Expand All @@ -180,7 +180,7 @@ ApplicationWindow {
}

MatrixText {
text: "Room access"
text: qsTr("Room access")
Layout.fillWidth: true
}

Expand Down
6 changes: 3 additions & 3 deletions resources/qml/ScrollHelper.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ MouseArea {
// console.warn("Delta: ", wheel.pixelDelta.y);
// console.warn("Old position: ", flickable.contentY);
// console.warn("New position: ", newPos);
// breaks ListView's with headers...
//if (typeof (flickableItem.headerItem) !== "undefined" && flickableItem.headerItem)
// minYExtent += flickableItem.headerItem.height;

id: root

Expand Down Expand Up @@ -55,9 +58,6 @@ MouseArea {

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));
}
Expand Down
133 changes: 133 additions & 0 deletions resources/qml/components/AvatarListTile.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
// SPDX-FileCopyrightText: 2021 Nheko Contributors
//
// SPDX-License-Identifier: GPL-3.0-or-later

import ".."
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import im.nheko 1.0

Rectangle {
id: tile

property color background: Nheko.colors.window
property color importantText: Nheko.colors.text
property color unimportantText: Nheko.colors.buttonText
property color bubbleBackground: Nheko.colors.highlight
property color bubbleText: Nheko.colors.highlightedText
property int avatarSize: Math.ceil(fontMetrics.lineSpacing * 2.3)
required property string avatarUrl
required property string title
required property string subtitle
required property int index
required property int selectedIndex
property bool crop: true

color: background
height: avatarSize + 2 * Nheko.paddingMedium
width: ListView.view.width
state: "normal"
states: [
State {
name: "highlight"
when: hovered.hovered && !(index == selectedIndex)

PropertyChanges {
target: tile
background: Nheko.colors.dark
importantText: Nheko.colors.brightText
unimportantText: Nheko.colors.brightText
bubbleBackground: Nheko.colors.highlight
bubbleText: Nheko.colors.highlightedText
}

},
State {
name: "selected"
when: index == selectedIndex

PropertyChanges {
target: tile
background: Nheko.colors.highlight
importantText: Nheko.colors.highlightedText
unimportantText: Nheko.colors.highlightedText
bubbleBackground: Nheko.colors.highlightedText
bubbleText: Nheko.colors.highlight
}

}
]

HoverHandler {
id: hovered
}

RowLayout {
spacing: Nheko.paddingMedium
anchors.fill: parent
anchors.margins: Nheko.paddingMedium

Avatar {
id: avatar

enabled: false
Layout.alignment: Qt.AlignVCenter
height: avatarSize
width: avatarSize
url: tile.avatarUrl.replace("mxc://", "image://MxcImage/")
displayName: title
crop: tile.crop
}

ColumnLayout {
id: textContent

Layout.alignment: Qt.AlignLeft
Layout.fillWidth: true
Layout.minimumWidth: 100
width: parent.width - avatar.width
Layout.preferredWidth: parent.width - avatar.width
spacing: Nheko.paddingSmall

RowLayout {
Layout.fillWidth: true
spacing: 0

ElidedLabel {
Layout.alignment: Qt.AlignBottom
color: tile.importantText
elideWidth: textContent.width - Nheko.paddingMedium
fullText: title
textFormat: Text.PlainText
}

Item {
Layout.fillWidth: true
}

}

RowLayout {
Layout.fillWidth: true
spacing: 0

ElidedLabel {
color: tile.unimportantText
font.pixelSize: fontMetrics.font.pixelSize * 0.9
elideWidth: textContent.width - Nheko.paddingSmall
fullText: subtitle
textFormat: Text.PlainText
}

Item {
Layout.fillWidth: true
}

}

}

}

}
Loading

0 comments on commit 11f9a9d

Please sign in to comment.