Components moved to self project

This commit is contained in:
2023-04-12 18:56:14 +02:00
parent 4d02662034
commit e9fc872466
9 changed files with 29 additions and 201 deletions

View File

@@ -1,61 +0,0 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
Drawer {
property alias logo: logoImage.source
property alias appName: appNameLabel.text
property alias model: menuRepeater.model
property alias connected: connectionLabel.connected
signal actionSelected(var action)
width: parent.width * 0.66
height: parent.height
Column {
anchors.fill: parent
Row {
width: parent.width
height: 100
Image {
id: logoImage
anchors.top: parent.top
anchors.bottom: parent.bottom
anchors.margins: 10
}
Column {
anchors.verticalCenter: parent.verticalCenter
Label {
id: appNameLabel
font.pointSize: 20
}
Label {
id: connectionLabel
property bool connected: false
text: connected ? qsTr("Online") : qsTr("Offline")
color: connected ? "green" : "red"
}
}
}
Repeater {
id: menuRepeater
delegate: ItemDelegate {
width: parent.width
text: model.title
onClicked: actionSelected(model.action)
}
}
}
}

View File

@@ -1,84 +0,0 @@
import QtQuick 2.15
Item {
id: root
width: 40
height: 40
property double iconMarigns: 8
property double iconHeight: width - iconMarigns * 2
signal clicked()
signal back()
SystemPalette {
id: palette
}
MouseArea {
id: ma
anchors.fill: parent
}
Rectangle {
id: bar1
x: root.iconMarigns
y: root.iconMarigns + root.iconHeight / 6
width: root.iconHeight
height: root.iconHeight / 9
antialiasing: true
color: palette.button
}
Rectangle {
id: bar2
x: root.iconMarigns
y: root.iconMarigns + root.iconHeight / 2 - height / 2
width: root.iconHeight
height: root.iconHeight / 9
antialiasing: true
color: palette.button
}
Rectangle {
id: bar3
x: root.iconMarigns
y: root.iconMarigns + root.iconHeight / 2 + height * 2
width: root.iconHeight
height: root.iconHeight / 9
antialiasing: true
color: palette.button
}
property int animationDuration: 450
state: "menu"
states: [
State {
name: "menu"
PropertyChanges { target: ma; onClicked: root.clicked() }
},
State {
name: "back"
PropertyChanges { target: root; rotation: 180 }
PropertyChanges { target: bar1; rotation: 45; width: root.iconHeight / 3 * 2; x: root.iconMarigns + root.iconHeight / 2; y: root.iconMarigns + root.iconHeight / 4 }
PropertyChanges { target: bar2; width: root.iconHeight / 6 * 5 + 1; x: root.iconMarigns + root.iconHeight / 9 }
PropertyChanges { target: bar3; rotation: -45; width: root.iconHeight / 3 * 2; x: root.iconMarigns + root.iconHeight / 2; y: root.iconMarigns + root.iconHeight / 3 * 2 }
PropertyChanges { target: ma; onClicked: root.back() }
}
]
transitions: [
Transition {
RotationAnimation { target: root; direction: RotationAnimation.Clockwise; duration: animationDuration; easing.type: Easing.InOutQuad }
PropertyAnimation { target: bar1; properties: "rotation, width, x, y"; duration: animationDuration; easing.type: Easing.InOutQuad }
PropertyAnimation { target: bar2; properties: "rotation, width, x, y"; duration: animationDuration; easing.type: Easing.InOutQuad }
PropertyAnimation { target: bar3; properties: "rotation, width, x, y"; duration: animationDuration; easing.type: Easing.InOutQuad }
}
]
}

View File

@@ -1,24 +0,0 @@
import QtQuick 2.0
import QtQuick.Controls 2.2
ItemDelegate {
id: root
property string subtitle: ""
contentItem: Column {
Label {
id: titleLabel
width: parent.width
text: root.text
}
Label {
width: parent.width
font.pixelSize: titleLabel.font.pixelSize - 2
text: root.subtitle
opacity: 0.8
}
}
}

View File

@@ -1,5 +0,0 @@
module Components
MainMenu 1.0 MainMenu.qml
MenuBackButton 1.0 MenuBackButton.qml
SubtitledItemDelegate 1.0 SubtitledItemDelegate.qml

View File

@@ -1,7 +1,8 @@
import QtQuick 2.15
import QtQuick.Controls 2.15
import Components 1.0
import ru.ded.beerlog 1.0
import ru.ded.components 1.0
Page {
id: root

View File

@@ -5,7 +5,7 @@ import QtQuick.Layouts 1.15
import QtWebSockets
import ru.ded.beerlog 1.0
import Components 1.0
import ru.ded.components 1.0
ApplicationWindow {
width: 640
@@ -89,7 +89,10 @@ ApplicationWindow {
logo: "qrc:/logo.png"
appName: qsTr("BeerLog v0.1")
connected: beerService.connected
additional: Label {
text: beerService.connected ? qsTr("Online") : qsTr("Offline")
color: beerService.connected ? "green" : "red"
}
model: ListModel {
ListElement {

View File

@@ -1,14 +1,10 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>Components/MenuBackButton.qml</file>
<file>qtquickcontrols2.conf</file>
<file>logo.png</file>
<file>Components/MainMenu.qml</file>
<file>Views/OrdersView.qml</file>
<file>Views/SettingsView.qml</file>
<file>Components/SubtitledItemDelegate.qml</file>
<file>Components/qmldir</file>
<file>Views/ProductsView.qml</file>
</qresource>
</RCC>