Skip to content

Commit

Permalink
feat: attempt to upgrade fluentui to 1.7.5
Browse files Browse the repository at this point in the history
  • Loading branch information
ArcticLampyrid committed May 24, 2024
1 parent f969987 commit 55ae05a
Show file tree
Hide file tree
Showing 32 changed files with 624 additions and 554 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ foreach(filepath ${SOURCE_IMPORT_PATHS})
endforeach(filepath)

if(QT_KNOWN_POLICY_QTP0001)
qt_policy(SET QTP0001 OLD)
qt_policy(SET QTP0001 NEW)
endif()

set(VERSION_RC_PATH "")
Expand Down
2 changes: 1 addition & 1 deletion libs/FluentUI
Submodule FluentUI updated 513 files
2 changes: 2 additions & 0 deletions qml.qrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<RCC>
<qresource prefix="/">
<file>qml/App.qml</file>
<file>qml/component/FluContentStatusPage.qml</file>
<file>qml/component/FluScrollableStatusPage.qml</file>
<file>qml/window/LoginWindow.qml</file>
<file>qml/window/MainWindow.qml</file>
<file>qml/page/T_DepartmentEvents.qml</file>
Expand Down
18 changes: 8 additions & 10 deletions qml/App.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,26 @@ import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Window

Window {
FluLauncher {
id: app

flags: Qt.SplashScreen
Component.onCompleted: {
FluApp.init(app);
var list = [FluColors.Yellow, FluColors.Orange, FluColors.Red, FluColors.Magenta, FluColors.Purple, FluColors.Blue, FluColors.Teal, FluColors.Green];
FluTheme.darkMode = settings.value("darkMode", FluThemeType.System);
settings.darkMode = FluTheme.darkMode;
FluTheme.primaryColor = list[settings.value("colorIndex", 5)];
settings.colorIndex = list.indexOf(FluTheme.primaryColor);
FluTheme.enableAnimation = settings.value("enableAnimationSet", 1);
FluTheme.accentColor = list[settings.value("colorIndex", 5)] || FluColors.Blue;
settings.colorIndex = list.indexOf(FluTheme.accentColor);
FluTheme.animationEnabled = settings.value("enableAnimationSet", 1);
FluTheme.nativeText = settings.value("nativeTextSet", 1);
settings.displayMode = settings.value("displayMode", FluNavigationViewType.Auto);
appInfo.changeLang(settings.value("langMode", "En"));
FluApp.routes = {
FluRouter.routes = {
"/": "qrc:/qml/window/MainWindow.qml",
"/login": "qrc:/qml/window/LoginWindow.qml",
"/block": "qrc:/qml/window/EventoBlockWindow.qml"
};
FluApp.initialRoute = "/login";
FluApp.run();
FluRouter.navigate("/login");
}

Settings {
Expand All @@ -51,8 +49,8 @@ Window {
}

Connections {
function onEnableAnimationChanged() {
settings.enableAnimationSet = FluTheme.enableAnimation;
function onAnimationEnabledChanged() {
settings.enableAnimationSet = FluTheme.animationEnabled;
}

target: FluTheme
Expand Down
49 changes: 49 additions & 0 deletions qml/component/FluContentStatusPage.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import FluentUI
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Window

FluPage {
id: control

default property alias content: container.data
property alias color: status_view.color
property alias statusMode: status_view.statusMode
property alias loadingText: status_view.loadingText
property alias emptyText: status_view.emptyText
property alias errorText: status_view.errorText
property alias errorButtonText: status_view.errorButtonText
property alias loadingItem: status_view.loadingItem
property alias emptyItem: status_view.emptyItem
property alias errorItem: status_view.errorItem

signal errorClicked()

FluStatusLayout {
id: status_view

color: "#00000000"
statusMode: FluStatusLayoutType.Success
onErrorClicked: control.errorClicked()

anchors {
left: parent.left
right: parent.right
top: parent.top
bottom: parent.bottom
leftMargin: control.leftPadding
rightMargin: control.rightPadding
bottomMargin: control.bottomPadding
}

Item {
id: container

clip: true
anchors.fill: parent
}

}

}
73 changes: 73 additions & 0 deletions qml/component/FluScrollableStatusPage.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import FluentUI
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import QtQuick.Window

FluPage {
id: control

default property alias content: container.data
property alias color: status_view.color
property alias statusMode: status_view.statusMode
property alias loadingText: status_view.loadingText
property alias emptyText: status_view.emptyText
property alias errorText: status_view.errorText
property alias errorButtonText: status_view.errorButtonText
property alias loadingItem: status_view.loadingItem
property alias emptyItem: status_view.emptyItem
property alias errorItem: status_view.errorItem

signal errorClicked()

FluStatusLayout {
id: status_view

color: "#00000000"
statusMode: FluStatusLayoutType.Success
onErrorClicked: control.errorClicked()

anchors {
left: parent.left
right: parent.right
top: parent.top
bottom: parent.bottom
bottomMargin: control.bottomPadding
}

Flickable {
id: flickview

clip: true
anchors.fill: parent
contentWidth: parent.width
contentHeight: container.height
boundsBehavior: Flickable.StopAtBounds

ColumnLayout {
id: container

spacing: control.spacing
clip: true
width: parent.width

anchors {
left: parent.left
right: parent.right
top: parent.top
leftMargin: control.leftPadding
rightMargin: control.rightPadding
}

}

ScrollBar.vertical: FluScrollBar {
anchors.right: flickview.right
anchors.rightMargin: 2
}

}

}

}
113 changes: 31 additions & 82 deletions qml/page/T_Calendar.qml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import "../component"
import "../window"
import FluentUI
import QtQuick
Expand All @@ -6,15 +7,21 @@ import QtQuick.Layouts
import QtQuick.Window
import SAST_Evento

FluContentPage {
FluContentStatusPage {
id: calendar

property string dateString: date2String(new Date)
property var blockWindowRegister: registerForWindowResult("/block")
function getStartOfWeek_Monday(date) {
const day = date.getDay();
const diff = date.getDate() - day + (day === 0 ? -6 : 1);
const startOfWeek = new Date(date);
startOfWeek.setDate(diff);
startOfWeek.setHours(0, 0, 0, 0);
return startOfWeek;
}

function load() {
statusMode = FluStatusViewType.Loading;
CalendarController.loadAllEventoInfo(dateString);
statusMode = FluStatusLayoutType.Loading;
CalendarController.loadAllEventoInfo(date2String(date_picker.current));
}

function pushPage(url) {
Expand Down Expand Up @@ -48,9 +55,21 @@ FluContentPage {
errorButtonText: lang.lang_reload
loadingText: lang.lang_loading

FluWindowResultLauncher {
id: blockWindowLauncher

path: "/block"
onResult: (data) => {
if (data.enterPage) {
pushPage("qrc:/qml/page/T_EventoEdit.qml");
showInfo("注意:活动地点需要重新编辑", 4000);
}
}
}

Connections {
function onLoadAllEventoSuccessEvent() {
statusMode = FluStatusViewType.Success;
statusMode = FluStatusLayoutType.Success;
}

target: CalendarController
Expand All @@ -59,7 +78,7 @@ FluContentPage {
Connections {
function onLoadAllEventoErrorEvent(message) {
errorText = message;
statusMode = FluStatusViewType.Error;
statusMode = FluStatusLayoutType.Error;
}

target: CalendarController
Expand Down Expand Up @@ -98,17 +117,6 @@ FluContentPage {
target: CalendarController
}

Connections {
function onResult(data) {
if (data.enterPage) {
pushPage("qrc:/qml/page/T_EventoEdit.qml");
showInfo("注意:活动地点需要重新编辑", 4000);
}
}

target: blockWindowRegister
}

Item {
// deprecated

Expand All @@ -123,7 +131,6 @@ FluContentPage {
let date = new Date(date_picker.current);
date.setDate(date_picker.current.getDate() - 7);
date_picker.current = date;
dateString = date2String(date_picker.current);
load();
}

Expand All @@ -140,7 +147,6 @@ FluContentPage {

current: new Date
onAccepted: {
dateString = date2String(date_picker.current);
load();
}

Expand All @@ -151,62 +157,6 @@ FluContentPage {

}

FluArea {
id: rec_date

height: 30
width: 120
radius: [4, 4, 4, 4]

anchors {
left: btn_left.right
verticalCenter: parent.verticalCenter
}

FluText {
id: text_date

text: dateString
anchors.centerIn: parent
}

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);
}
}
}

MouseArea {
id: item_mouse

anchors.fill: parent
hoverEnabled: true
propagateComposedEvents: true
onClicked: function(mouse) {
mouse.accepted = false;
}
onPressed: function(mouse) {
mouse.accepted = false;
}
onReleased: function(mouse) {
mouse.accepted = false;
}
}

}

FluIconButton {
id: btn_right

Expand All @@ -215,7 +165,6 @@ FluContentPage {
let date = new Date(date_picker.current);
date.setDate(date_picker.current.getDate() + 7);
date_picker.current = date;
dateString = date2String(date_picker.current);
load();
}

Expand Down Expand Up @@ -292,9 +241,9 @@ FluContentPage {
id: btn_SRD_lesson_pic

text: "本周软研课表"
visible: dateString === date2String(new Date)
visible: getStartOfWeek_Monday(date_picker.current).getTime() === getStartOfWeek_Monday(new Date).getTime()
onClicked: {
CalendarController.generateLessonPic(dateString, CalendarController.SoftwareResearchAndDevelopmentDep);
CalendarController.generateLessonPic(date2String(date_picker.current), CalendarController.SoftwareResearchAndDevelopmentDep);
}

anchors {
Expand Down Expand Up @@ -342,7 +291,7 @@ FluContentPage {
bottomMargin: 5
}

FluArea {
FluFrame {
id: table

readonly property int blockHeight: 45
Expand Down Expand Up @@ -582,7 +531,7 @@ FluContentPage {
Repeater {
model: EventoBlockModel

delegate: FluArea {
delegate: FluFrame {
readonly property double width_min: table.blockWidth / (depth_max + 1)

height: is_all_day ? table.blockHeight : table.blockHeight * (end - start)
Expand Down Expand Up @@ -656,7 +605,7 @@ FluContentPage {
if (mouse.button === Qt.LeftButton) {
EventoHelper.id = id;
EventoInfoController.editable = editable;
blockWindowRegister.launch();
blockWindowLauncher.launch();
}
}
}
Expand Down
Loading

0 comments on commit 55ae05a

Please sign in to comment.