Initial commit
This commit is contained in:
74
.gitignore
vendored
Normal file
74
.gitignore
vendored
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
# This file is used to ignore files which are generated
|
||||||
|
# ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
*~
|
||||||
|
*.autosave
|
||||||
|
*.a
|
||||||
|
*.core
|
||||||
|
*.moc
|
||||||
|
*.o
|
||||||
|
*.obj
|
||||||
|
*.orig
|
||||||
|
*.rej
|
||||||
|
*.so
|
||||||
|
*.so.*
|
||||||
|
*_pch.h.cpp
|
||||||
|
*_resource.rc
|
||||||
|
*.qm
|
||||||
|
.#*
|
||||||
|
*.*#
|
||||||
|
core
|
||||||
|
!core/
|
||||||
|
tags
|
||||||
|
.DS_Store
|
||||||
|
.directory
|
||||||
|
*.debug
|
||||||
|
Makefile*
|
||||||
|
*.prl
|
||||||
|
*.app
|
||||||
|
moc_*.cpp
|
||||||
|
ui_*.h
|
||||||
|
qrc_*.cpp
|
||||||
|
Thumbs.db
|
||||||
|
*.res
|
||||||
|
*.rc
|
||||||
|
/.qmake.cache
|
||||||
|
/.qmake.stash
|
||||||
|
|
||||||
|
# qtcreator generated files
|
||||||
|
*.pro.user*
|
||||||
|
CMakeLists.txt.user*
|
||||||
|
|
||||||
|
# xemacs temporary files
|
||||||
|
*.flc
|
||||||
|
|
||||||
|
# Vim temporary files
|
||||||
|
.*.swp
|
||||||
|
|
||||||
|
# Visual Studio generated files
|
||||||
|
*.ib_pdb_index
|
||||||
|
*.idb
|
||||||
|
*.ilk
|
||||||
|
*.pdb
|
||||||
|
*.sln
|
||||||
|
*.suo
|
||||||
|
*.vcproj
|
||||||
|
*vcproj.*.*.user
|
||||||
|
*.ncb
|
||||||
|
*.sdf
|
||||||
|
*.opensdf
|
||||||
|
*.vcxproj
|
||||||
|
*vcxproj.*
|
||||||
|
|
||||||
|
# MinGW generated files
|
||||||
|
*.Debug
|
||||||
|
*.Release
|
||||||
|
|
||||||
|
# Python byte code
|
||||||
|
*.pyc
|
||||||
|
|
||||||
|
# Binaries
|
||||||
|
# --------
|
||||||
|
*.dll
|
||||||
|
*.exe
|
||||||
|
|
||||||
32
CMakeLists.txt
Normal file
32
CMakeLists.txt
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
|
project(components VERSION 0.1 LANGUAGES CXX)
|
||||||
|
|
||||||
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
set(QT_QML_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})
|
||||||
|
|
||||||
|
find_package(Qt6 6.2 COMPONENTS Quick REQUIRED)
|
||||||
|
|
||||||
|
qt_add_library(components SHARED)
|
||||||
|
qt_add_qml_module(components
|
||||||
|
URI ru.ded.components
|
||||||
|
VERSION 1.0
|
||||||
|
QML_FILES MainMenu.qml MenuBackButton.qml SubtitledItemDelegate.qml
|
||||||
|
)
|
||||||
|
|
||||||
|
set_target_properties(components PROPERTIES
|
||||||
|
MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
|
||||||
|
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
|
||||||
|
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
|
||||||
|
MACOSX_BUNDLE TRUE
|
||||||
|
WIN32_EXECUTABLE TRUE
|
||||||
|
)
|
||||||
|
|
||||||
|
target_compile_definitions(components
|
||||||
|
PRIVATE $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:QT_QML_DEBUG>)
|
||||||
|
target_link_libraries(components
|
||||||
|
PRIVATE Qt6::Quick)
|
||||||
|
|
||||||
|
target_include_directories(components PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
61
MainMenu.qml
Normal file
61
MainMenu.qml
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
84
MenuBackButton.qml
Normal file
84
MenuBackButton.qml
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
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 }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
24
SubtitledItemDelegate.qml
Normal file
24
SubtitledItemDelegate.qml
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user