Skip to content

Commit

Permalink
refactor: event create/edit (#126)
Browse files Browse the repository at this point in the history
* style: clang format

* add location model

* improve calendar

* build: update submodule

* feat(edit): department list view

* feat(edit): location tree view

* perf: optimize ui

* api fix


---------

Co-authored-by: Daedale <jimmyslashrice@outlook.com>
  • Loading branch information
Serein207 and AMOSOMNUM authored Dec 7, 2023
1 parent e4186ff commit 62ee757
Show file tree
Hide file tree
Showing 28 changed files with 745 additions and 542 deletions.
2 changes: 1 addition & 1 deletion libs/Qt-Based-JsonDeserialiser
2 changes: 1 addition & 1 deletion qml/page/T_Calendar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ FluScrollablePage {
wrapMode: Text.WordWrap
anchors {
top: parent.top
topMargin: parent.height / 2 - 15
topMargin: 5
left: parent.left
right: parent.right
leftMargin: 13
Expand Down
39 changes: 20 additions & 19 deletions qml/page/T_DepartmentEvents.qml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ FluScrollablePage {
id: department_view
width: 200
height: 500
clip: true
anchors.fill: parent
model: DepartmentModel
delegate: com_rect
Expand All @@ -144,7 +145,23 @@ FluScrollablePage {
height: 40
width: 180
border.width: 0

Rectangle {
anchors.fill: parent
radius: 8
color: {
if (FluTheme.dark) {
if (item_mouse.containsMouse) {
return Qt.rgba(1, 1, 1, 0.03)
}
return Qt.rgba(0, 0, 0, 0)
} else {
if (item_mouse.containsMouse) {
return Qt.rgba(0, 0, 0, 0.03)
}
return Qt.rgba(0, 0, 0, 0)
}
}
}
FluRectangle {
id: rect_division
width: 6
Expand All @@ -168,7 +185,7 @@ FluScrollablePage {
}

MouseArea {
id: item_mouse
id:item_mouse
anchors.fill: parent
hoverEnabled: true
onClicked: {
Expand All @@ -185,23 +202,7 @@ FluScrollablePage {
}
}

Rectangle {
anchors.fill: parent
radius: 8
color: {
if (FluTheme.dark) {
if (item_mouse.containsMouse) {
return Qt.rgba(1, 1, 1, 0.03)
}
return Qt.rgba(0, 0, 0, 0)
} else {
if (item_mouse.containsMouse) {
return Qt.rgba(0, 0, 0, 0.03)
}
return Qt.rgba(0, 0, 0, 0)
}
}
}

}
}
}
Expand Down
91 changes: 82 additions & 9 deletions qml/page/T_EventInfo.qml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ FluScrollablePage {
property string feedback_content

function loadEventoInfo() {
statusMode = FluStatusViewType.Loading
arr = []
EventoInfoController.loadEventoInfo(EventoHelper.id)
}

Component.onCompleted: {
statusMode = FluStatusViewType.Loading
loadEventoInfo()
}

onErrorClicked: {
statusMode = FluStatusViewType.Loading
loadEventoInfo()
}

Expand All @@ -36,6 +37,8 @@ FluScrollablePage {
loader_slide.sourceComponent = slide_com
page.listReady()
statusMode = FluStatusViewType.Success
btn_subscribe.loading = false
btn_register.loading = false
}
}

Expand Down Expand Up @@ -197,7 +200,7 @@ FluScrollablePage {
}
FluRectangle {
height: 20
width: 50
width: text_tag.implicitWidth + 5
radius: [5, 5, 5, 5]
color: "#99ffcc"
FluText {
Expand Down Expand Up @@ -235,13 +238,48 @@ FluScrollablePage {

FluToggleButton {
id: btn_register
property bool loading: false
Layout.topMargin: 15
implicitWidth: parent.width
text: EventoInfoController.isRegistrated ? lang.lang_cancellation : lang.lang_register
checked: EventoInfoController.isRegistrated
disabled: EventoHelper.state >= 2
disabled: EventoHelper.state >= 2 || loading
contentItem: Row{
spacing: 6
FluText {
text: EventoInfoController.isRegistrated ? lang.lang_cancellation : lang.lang_register
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
anchors.verticalCenter: parent.verticalCenter
color: {
if (btn_register.disabled)
return Qt.rgba(160/255,160/255,160/255,1)
else
return FluTheme.dark ? FluColors.White : FluColors.Grey220
}
}
Item{
width: btn_register.loading ? 16 : 0
height: 16
anchors.verticalCenter: parent.verticalCenter
visible: width!==0
clip: true
Behavior on width {
enabled: FluTheme.enableAnimation
NumberAnimation{
duration: 167
easing.type: Easing.OutCubic
}
}
FluProgressRing{
width: 16
height: 16
strokeWidth:3
anchors.centerIn: parent
}
}
}
onClicked: {
statusMode = FluStatusViewType.Loading
loading = true
EventoInfoController.isRegistrated = !EventoInfoController.isRegistrated
EventoInfoController.registerEvento(
EventoHelper.id,
Expand All @@ -266,24 +304,59 @@ FluScrollablePage {

FluToggleButton {
id: btn_subscribe
property bool loading: false
implicitWidth: parent.width
Layout.topMargin: 15
text: EventoInfoController.isSubscribed ? lang.lang_unsubscribe : lang.lang_subscribe
checked: EventoInfoController.isSubscribed
disabled: EventoHelper.state >= 2
disabled: EventoHelper.state >= 2 || loading
contentItem: Row{
spacing: 6
FluText {
text: EventoInfoController.isSubscribed ? lang.lang_unsubscribe : lang.lang_subscribe
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
anchors.verticalCenter: parent.verticalCenter
color: {
if (btn_register.disabled)
return Qt.rgba(160/255,160/255,160/255,1)
else
return FluTheme.dark ? FluColors.White : FluColors.Grey220
}
}
Item{
width: btn_subscribe.loading ? 16 : 0
height: 16
anchors.verticalCenter: parent.verticalCenter
visible: width!==0
clip: true
Behavior on width {
enabled: FluTheme.enableAnimation
NumberAnimation{
duration: 167
easing.type: Easing.OutCubic
}
}
FluProgressRing{
width: 16
height: 16
strokeWidth:3
anchors.centerIn: parent
}
}
}
onClicked: {
statusMode = FluStatusViewType.Loading
loading = true
EventoInfoController.isSubscribed = !EventoInfoController.isSubscribed
EventoInfoController.subscribeEvento(
EventoHelper.id,
EventoInfoController.isSubscribed)
}

}

Connections {
target: EventoInfoController
function onSubscribeSuccessEvent() {
statusMode = FluStatusViewType.Success
showSuccess((EventoInfoController.isSubscribed ? lang.lang_subscribe_success : lang.lang_cancelled))
loadEventoInfo()
}
Expand Down
Loading

0 comments on commit 62ee757

Please sign in to comment.