Organize project files

Put QML components into folders, remove unused ones, split __init__.py
with engine.py.
This commit is contained in:
miruka
2019-03-26 05:52:43 -04:00
parent cccc43a9ae
commit 76b699ad64
28 changed files with 117 additions and 174 deletions

View File

@@ -0,0 +1,40 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.4
Item {
property bool invisible: false
property string username: "?"
property var imageSource: null
property int dimmension: 48
id: root
width: dimmension
height: invisible ? 1 : dimmension
Rectangle {
id: letterRectangle
anchors.fill: parent
visible: ! invisible && imageSource === null
color: Qt.hsla(Backend.hueFromString(username), 0.22, 0.5, 1)
HLabel {
anchors.centerIn: parent
text: username.charAt(0)
color: "white"
font.pixelSize: letterRectangle.height / 1.4
}
}
Image {
id: avatarImage
anchors.fill: parent
visible: ! invisible && imageSource !== null
Component.onCompleted: if (imageSource) {source = imageSource}
asynchronous: true
mipmap: true
fillMode: Image.PreserveAspectCrop
sourceSize.width: root.dimmension
}
}

View File

@@ -0,0 +1,12 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
Label {
property int bigSize: 24
property int normalSize: 16
property int smallSize: 12
font.family: "Roboto"
font.pixelSize: normalSize
textFormat: Text.PlainText
}

View File

@@ -0,0 +1,31 @@
import QtQuick 2.7
import QtQuick.Controls 2.2
import QtQuick.Layouts 1.4
ToolButton {
property string tooltip: ""
property string iconName: ""
id: "button"
display: ToolButton.IconOnly
icon.source: "../../icons/" + iconName + ".svg"
background: Rectangle { color: "transparent" }
onClicked: toolTip.hide()
ToolTip {
id: "toolTip"
text: tooltip
delay: Qt.styleHints.mousePressAndHoldInterval
visible: text ? toolTipZone.containsMouse : false
}
MouseArea {
id: "toolTipZone"
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.NoButton // Make button receive clicks normally
onEntered: button.background.color = "#656565"
onExited: button.background.color = "transparent"
}
}

View File

@@ -0,0 +1,16 @@
import QtQuick 2.7
import QtQuick.Controls 2.0
HLabel {
id: text
ToolTip {
delay: Qt.styleHints.mousePressAndHoldInterval
visible: text ? toolTipZone.containsMouse : false
text: user_id
}
MouseArea {
id: toolTipZone
anchors.fill: parent
hoverEnabled: true
}
}