Skip to content

Commit

Permalink
Added Drawer with selected items; and animation
Browse files Browse the repository at this point in the history
  • Loading branch information
iiLubos committed Dec 7, 2023
1 parent 4389f21 commit 8feab04
Show file tree
Hide file tree
Showing 10 changed files with 461 additions and 381 deletions.
5 changes: 5 additions & 0 deletions app/icons/Download.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions app/icons/Info.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions app/icons/Sync.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions app/icons/icons.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,8 @@
<file>More.svg</file>
<file>ProjectButtonMore.svg</file>
<file>Stop.svg</file>
<file>Download.svg</file>
<file>Info.svg</file>
<file>Sync.svg</file>
</qresource>
</RCC>
6 changes: 6 additions & 0 deletions app/mmstyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,9 @@ class MMStyle: public QObject
Q_PROPERTY( QUrl moreIcon READ moreIcon CONSTANT )
Q_PROPERTY( QUrl projectButtonMoreIcon READ projectButtonMoreIcon CONSTANT )
Q_PROPERTY( QUrl stopIcon READ stopIcon CONSTANT )
Q_PROPERTY( QUrl syncIcon READ syncIcon CONSTANT )
Q_PROPERTY( QUrl infoIcon READ infoIcon CONSTANT )
Q_PROPERTY( QUrl downloadIcon READ downloadIcon CONSTANT )

// Images
Q_PROPERTY( QUrl uploadImage READ uploadImage CONSTANT )
Expand Down Expand Up @@ -177,6 +180,9 @@ class MMStyle: public QObject
QUrl moreIcon() {return QUrl( "qrc:/More.svg" );}
QUrl projectButtonMoreIcon() {return QUrl( "qrc:/ProjectButtonMore.svg" );}
QUrl stopIcon() {return QUrl( "qrc:/Stop.svg" );}
QUrl syncIcon() {return QUrl( "qrc:/Sync.svg" );}
QUrl infoIcon() {return QUrl( "qrc:/Info.svg" );}
QUrl downloadIcon() {return QUrl( "qrc:/Download.svg" );}

QUrl uploadImage() {return QUrl( "qrc:/UploadImage.svg" );}
QUrl reachedDataLimitImage() {return QUrl( "qrc:/ReachedDataLimitImage.svg" );}
Expand Down
107 changes: 107 additions & 0 deletions app/qml/components/MMListDrawer.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Basic

Drawer {
id: control

property alias title: title.text
property alias model: listView.model

padding: 20 * __dp

signal clicked(type: string)

width: window.width
height: mainColumn.height
edge: Qt.BottomEdge

Rectangle {
color: roundedRect.color
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: 2 * radius
anchors.topMargin: -radius
radius: 20 * __dp
}

Rectangle {
id: roundedRect

anchors.fill: parent
color: __style.whiteColor

Column {
id: mainColumn

width: parent.width
spacing: 20 * __dp
leftPadding: control.padding
rightPadding: control.padding
bottomPadding: control.padding

Row {
width: parent.width - 2 * control.padding
anchors.horizontalCenter: parent.horizontalCenter

Item { width: closeButton.width; height: 1 }

Text {
id: title

anchors.verticalCenter: parent.verticalCenter
font: __style.t2
width: parent.width - closeButton.width * 2
color: __style.forestColor
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}

Image {
id: closeButton

source: __style.closeButtonIcon

MouseArea {
anchors.fill: parent
onClicked: control.visible = false
}
}
}

ListView {
id: listView

width: parent.width - 2 * control.padding
height: control.model ? control.model.count * __style.menuDrawerHeight : 0
interactive: false

delegate: Item {
width: listView.width
height: __style.menuDrawerHeight

MMListDrawerItem {
width: listView.width

type: model.type
text: model.name
iconSource: model.iconSource

onClicked: function(type) { control.clicked(type); control.visible = false }
}
}
}
}
}
}
58 changes: 58 additions & 0 deletions app/qml/components/MMListDrawerItem.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/

import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Basic

Item {
id: control

signal clicked(type: string)

required property string type
required property string text
required property var iconSource

width: control.width
height: __style.menuDrawerHeight

Rectangle {
anchors.top: parent.top
width: parent.width
height: 1 * __dp
color: __style.grayColor
}

Row {
height: parent.height
width: parent.width
spacing: 10 * __dp

MMIcon {
height: parent.height
width: 20 * __dp
color: __style.forestColor
source: control.iconSource ?? ""
}

Text {
height: parent.height
verticalAlignment: Text.AlignVCenter
text: control.text
color: __style.nightColor
font: __style.t3
}
}

MouseArea {
anchors.fill: parent
onClicked: control.clicked(control.type)
}
}
Loading

1 comment on commit 8feab04

@inputapp-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS - version 23.12.493311 just submitted!

Please sign in to comment.