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

@@ -56,10 +56,15 @@ else()
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES}) qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
endif() endif()
target_link_libraries(beerlog target_link_libraries(beerlog
PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Quick Qt${QT_VERSION_MAJOR}::WebSockets) PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Quick Qt${QT_VERSION_MAJOR}::WebSockets)
if (ANDROID)
set_property(TARGET beerlog APPEND PROPERTY QT_ANDROID_EXTRA_LIBS ${COMPONENTS_LIB})
endif()
target_link_libraries(beerlog PRIVATE ${COMPONENTS_LIB})
set_target_properties(beerlog PROPERTIES set_target_properties(beerlog PROPERTIES
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}

View File

@@ -1,19 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS> <!DOCTYPE TS>
<TS version="2.1" language="ru_RU"> <TS version="2.1" language="ru_RU">
<context>
<name>MainMenu</name>
<message>
<location filename="qml/Components/MainMenu.qml" line="44"/>
<source>Online</source>
<translation>В сети</translation>
</message>
<message>
<location filename="qml/Components/MainMenu.qml" line="44"/>
<source>Offline</source>
<translation>Не в сети</translation>
</message>
</context>
<context> <context>
<name>OrdersView</name> <name>OrdersView</name>
<message> <message>
@@ -43,7 +30,7 @@
<context> <context>
<name>SettingsView</name> <name>SettingsView</name>
<message> <message>
<location filename="qml/Views/SettingsView.qml" line="9"/> <location filename="qml/Views/SettingsView.qml" line="10"/>
<source>Settings</source> <source>Settings</source>
<translation>Настройки</translation> <translation>Настройки</translation>
</message> </message>
@@ -79,23 +66,33 @@
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="qml/main.qml" line="96"/> <location filename="qml/main.qml" line="93"/>
<source>Online</source>
<translation>В сети</translation>
</message>
<message>
<location filename="qml/main.qml" line="93"/>
<source>Offline</source>
<translation>Не в сети</translation>
</message>
<message>
<location filename="qml/main.qml" line="99"/>
<source>Orders</source> <source>Orders</source>
<translation>Заказы</translation> <translation>Заказы</translation>
</message> </message>
<message> <message>
<location filename="qml/main.qml" line="100"/> <location filename="qml/main.qml" line="103"/>
<source>Settings</source> <source>Settings</source>
<translation>Настройки</translation> <translation>Настройки</translation>
</message> </message>
<message> <message>
<location filename="qml/main.qml" line="104"/> <location filename="qml/main.qml" line="107"/>
<location filename="qml/main.qml" line="140"/> <location filename="qml/main.qml" line="143"/>
<source>Quit</source> <source>Quit</source>
<translation>Выход</translation> <translation>Выход</translation>
</message> </message>
<message> <message>
<location filename="qml/main.qml" line="144"/> <location filename="qml/main.qml" line="147"/>
<source>Realy quit the application?</source> <source>Realy quit the application?</source>
<translation>Действительно выйти из приложения?</translation> <translation>Действительно выйти из приложения?</translation>
</message> </message>

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 2.15
import QtQuick.Controls 2.15 import QtQuick.Controls 2.15
import Components 1.0
import ru.ded.beerlog 1.0 import ru.ded.beerlog 1.0
import ru.ded.components 1.0
Page { Page {
id: root id: root

View File

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

View File

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