RinUI 0.0.9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- RinUI/__init__.py +4 -0
- RinUI/__pycache__/__init__.cpython-38.pyc +0 -0
- RinUI/assets/fonts/FluentSystemIcons-Index.js +5256 -0
- RinUI/assets/fonts/FluentSystemIcons-Resizable.ttf +0 -0
- RinUI/assets/img/default_app_icon.png +0 -0
- RinUI/components/Base.qml +79 -0
- RinUI/components/BasicInput/Button.qml +148 -0
- RinUI/components/BasicInput/CheckBox.qml +99 -0
- RinUI/components/BasicInput/ComboBox.qml +160 -0
- RinUI/components/BasicInput/DropDownButton.qml +21 -0
- RinUI/components/BasicInput/Hyperlink.qml +18 -0
- RinUI/components/BasicInput/RadioButton.qml +95 -0
- RinUI/components/BasicInput/Slider.qml +212 -0
- RinUI/components/BasicInput/Switch.qml +102 -0
- RinUI/components/BasicInput/ToggleButton.qml +11 -0
- RinUI/components/BasicInput/ToolButton.qml +31 -0
- RinUI/components/ContextMenu.qml +184 -0
- RinUI/components/DateAndTime/PickerView.qml +217 -0
- RinUI/components/DateAndTime/TimePicker.qml +115 -0
- RinUI/components/DialogsAndFlyouts/Dialog.qml +106 -0
- RinUI/components/DialogsAndFlyouts/DialogButtonBox.qml +47 -0
- RinUI/components/DialogsAndFlyouts/Flyout.qml +144 -0
- RinUI/components/DialogsAndFlyouts/Popup.qml +106 -0
- RinUI/components/FocusIndicator.qml +33 -0
- RinUI/components/IconWidget.qml +52 -0
- RinUI/components/Indicator.qml +90 -0
- RinUI/components/Layout/Expander.qml +160 -0
- RinUI/components/Layout/SettingExpander.qml +67 -0
- RinUI/components/Layout/SettingItem.qml +71 -0
- RinUI/components/ListAndCollections/Clip.qml +22 -0
- RinUI/components/ListAndCollections/Frame.qml +44 -0
- RinUI/components/ListAndCollections/ListView.qml +105 -0
- RinUI/components/ListAndCollections/ListViewDelegate.qml +83 -0
- RinUI/components/ListAndCollections/SettingCard.qml +73 -0
- RinUI/components/ListAndCollections/TableView.qml +82 -0
- RinUI/components/ListAndCollections/TableViewDelegate.qml +89 -0
- RinUI/components/MenusAndToolbars/Menu.qml +149 -0
- RinUI/components/MenusAndToolbars/MenuBar.qml +43 -0
- RinUI/components/MenusAndToolbars/MenuItem.qml +119 -0
- RinUI/components/MenusAndToolbars/MenuItemGroup.qml +43 -0
- RinUI/components/MenusAndToolbars/MenuSeparator.qml +14 -0
- RinUI/components/MenusAndToolbars/ToolSeparator.qml +17 -0
- RinUI/components/Navigation/ErrorPage.qml +48 -0
- RinUI/components/Navigation/NavigationBar.qml +179 -0
- RinUI/components/Navigation/NavigationItem.qml +193 -0
- RinUI/components/Navigation/NavigationSubItem.qml +103 -0
- RinUI/components/Navigation/NavigationView.qml +210 -0
- RinUI/components/Navigation/SelectorBar.qml +58 -0
- RinUI/components/ScrollBar.qml +163 -0
- RinUI/components/ScrollView.qml +13 -0
- RinUI/components/Shadow.qml +48 -0
- RinUI/components/StatusAndInfo/InfoBadge.qml +78 -0
- RinUI/components/StatusAndInfo/InfoBar.qml +246 -0
- RinUI/components/StatusAndInfo/ProgressBar.qml +127 -0
- RinUI/components/StatusAndInfo/Toast.qml +237 -0
- RinUI/components/StatusAndInfo/ToolTip.qml +93 -0
- RinUI/components/Text/SpinBox.qml +134 -0
- RinUI/components/Text/Text.qml +44 -0
- RinUI/components/Text/TextField.qml +94 -0
- RinUI/components/Text/TextInput.qml +29 -0
- RinUI/components/Utils/Blur.qml +42 -0
- RinUI/components/qmldir +76 -0
- RinUI/config/rin_ui.json +8 -0
- RinUI/core/__init__.py +3 -0
- RinUI/core/__pycache__/__init__.cpython-38.pyc +0 -0
- RinUI/core/__pycache__/config.cpython-38.pyc +0 -0
- RinUI/core/__pycache__/launcher.cpython-38.pyc +0 -0
- RinUI/core/__pycache__/theme.cpython-38.pyc +0 -0
- RinUI/core/config.py +109 -0
- RinUI/core/launcher.py +144 -0
- RinUI/core/theme.py +342 -0
- RinUI/hooks/__init__.py +3 -0
- RinUI/hooks/hook-RinUI.py +3 -0
- RinUI/qmldir +92 -0
- RinUI/themes/dark.qml +137 -0
- RinUI/themes/light.qml +137 -0
- RinUI/themes/qmldir +7 -0
- RinUI/themes/theme.qml +126 -0
- RinUI/themes/utils.qml +28 -0
- RinUI/utils/Animation.qml +12 -0
- RinUI/utils/FloatLayer.qml +123 -0
- RinUI/utils/FontIconLoader.qml +14 -0
- RinUI/utils/Position.qml +19 -0
- RinUI/utils/Severity.qml +13 -0
- RinUI/utils/Typography.qml +17 -0
- RinUI/utils/qmldir +5 -0
- RinUI/windows/CtrlBtn.qml +119 -0
- RinUI/windows/FluentPage.qml +92 -0
- RinUI/windows/FluentWindow.qml +32 -0
- RinUI/windows/FluentWindowBase.qml +157 -0
- RinUI/windows/TitleBar.qml +132 -0
- RinUI/windows/qmldir +8 -0
- RinUI/windows/window/ApplicationWindow.qml +9 -0
- RinUI/windows/window/Window.qml +112 -0
- rinui-0.0.9.data/data/LICENSE +21 -0
- rinui-0.0.9.data/data/README.md +90 -0
- rinui-0.0.9.dist-info/LICENSE +21 -0
- rinui-0.0.9.dist-info/METADATA +105 -0
- rinui-0.0.9.dist-info/RECORD +102 -0
- rinui-0.0.9.dist-info/WHEEL +5 -0
- rinui-0.0.9.dist-info/entry_points.txt +2 -0
- rinui-0.0.9.dist-info/top_level.txt +1 -0
RinUI/themes/dark.qml
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
|
2
|
+
import QtQuick 2.15
|
3
|
+
import "../themes"
|
4
|
+
|
5
|
+
QtObject {
|
6
|
+
property string name: "Dark"
|
7
|
+
property bool isDark: true
|
8
|
+
|
9
|
+
// Colors //
|
10
|
+
property QtObject colors: QtObject {
|
11
|
+
// Controls
|
12
|
+
property color controlColor: Qt.alpha("#ffffff", 0.065)
|
13
|
+
property color controlSecondaryColor: Qt.alpha("#ffffff", 0.1)
|
14
|
+
property color controlTertiaryColor: Qt.alpha("#ffffff", 0.0419)
|
15
|
+
property color controlQuaternaryColor: Qt.alpha("#ffffff", 0.0698)
|
16
|
+
property color controlStrongColor: Qt.alpha("#ffffff", 0.5442)
|
17
|
+
property color controlInputActiveColor: Qt.alpha("#1E1E1E", 0.7)
|
18
|
+
|
19
|
+
property color controlBorderColor: Qt.alpha("#ffffff", 0.09)
|
20
|
+
property color controlBottomBorderColor: Qt.alpha("#000000", 0.03)
|
21
|
+
property color controlAccentBottomBorderColor: Qt.alpha("#000000", 0.14)
|
22
|
+
property color controlBorderStrongColor: Qt.alpha("#ffffff", 0.6047)
|
23
|
+
property color controlBorderAccentColor: Qt.alpha("#ffffff", 0.08)
|
24
|
+
property color textControlBorderColor: Qt.alpha("#ffffff", 0.54)
|
25
|
+
property color textControlBorderFocusedColor: Utils.primaryColor
|
26
|
+
property color flyoutBorderColor: Qt.alpha("#000000", 0.2)
|
27
|
+
|
28
|
+
property color controlSolidColor: "#454545"
|
29
|
+
property color dividerBorderColor: Qt.alpha("#ffffff", 0.0837)
|
30
|
+
// Accessibility
|
31
|
+
property color focusBorderOuter: "#ffffff"
|
32
|
+
property color focusBorderInner: Qt.alpha("#000000", 0.7)
|
33
|
+
|
34
|
+
// Card
|
35
|
+
property color cardColor: Qt.alpha("#ffffff", 0.0512)
|
36
|
+
property color cardSecondaryColor: Qt.alpha("#ffffff", 0.0326)
|
37
|
+
property color cardTertiaryColor: Qt.alpha("#ffffff", 0.0698)
|
38
|
+
property color cardBorderColor: Qt.alpha("#000000", 0.1)
|
39
|
+
|
40
|
+
// Background
|
41
|
+
property color backgroundColor: "#202020"
|
42
|
+
property color windowBorderColor: Qt.alpha("#757575", 0.0698)
|
43
|
+
property color backgroundAcrylicColor: "#2c2c2c"
|
44
|
+
property color backgroundSmokeColor: Qt.alpha("#000000", 0.3)
|
45
|
+
|
46
|
+
property color subtleColor: "transparent"
|
47
|
+
property color subtleSecondaryColor: Qt.alpha("#ffffff", 0.0605)
|
48
|
+
property color subtleTertiaryColor: Qt.alpha("#ffffff", 0.0419)
|
49
|
+
property color captionCloseColor: "#c42b1c"
|
50
|
+
property color captionCloseTextColor: "#ffffff"
|
51
|
+
|
52
|
+
// Layer
|
53
|
+
property color layerColor: Qt.alpha("#3A3A3A", 0.3)
|
54
|
+
|
55
|
+
// Text
|
56
|
+
property color textColor: "#ffffff"
|
57
|
+
property color textSecondaryColor: Qt.alpha("#ffffff", 0.6047)
|
58
|
+
property color textAccentColor: primaryColor
|
59
|
+
property color textOnAccentColor: "#000000"
|
60
|
+
property color textSelectedColor: "#000000"
|
61
|
+
|
62
|
+
property color primaryColor: Qt.color(Utils.primaryColor).lighter(1.6).darker(1.2)
|
63
|
+
property color disabledColor: "#ffffff"
|
64
|
+
|
65
|
+
// System Colors
|
66
|
+
property color systemAttentionColor: primaryColor
|
67
|
+
property color systemSuccessColor: "#6ccb5f"
|
68
|
+
property color systemCautionColor: "#fce100"
|
69
|
+
property color systemCriticalColor: "#ff99a4"
|
70
|
+
property color systemNeutralColor: "#9f9f9f"
|
71
|
+
|
72
|
+
property color systemAttentionBackgroundColor: "#2e2e2e"
|
73
|
+
property color systemSuccessBackgroundColor: "#393d1b"
|
74
|
+
property color systemCautionBackgroundColor: "#433519"
|
75
|
+
property color systemCriticalBackgroundColor: "#442726"
|
76
|
+
property color systemNeutralBackgroundColor: "#333333"
|
77
|
+
}
|
78
|
+
|
79
|
+
// Appearance //
|
80
|
+
property QtObject appearance: QtObject {
|
81
|
+
property int buttonRadius: 5
|
82
|
+
property int borderWidth: 1
|
83
|
+
property real borderFactor: 1.2
|
84
|
+
property real borderOnAccentFactor: 1.08
|
85
|
+
property int smallRadius: 3
|
86
|
+
|
87
|
+
property int dialogTitleBarHeight: 32
|
88
|
+
property int windowTitleBarHeight: 48
|
89
|
+
property int windowRadius: 7
|
90
|
+
property int windowButtonWidth: 46
|
91
|
+
|
92
|
+
property int scrollBarMinWidth: 2
|
93
|
+
property int scrollBarWidth: 6
|
94
|
+
property int scrollBarPadding: 3
|
95
|
+
|
96
|
+
property int sliderHandleSize: 20
|
97
|
+
}
|
98
|
+
|
99
|
+
// Shadows //
|
100
|
+
property var shadows: {
|
101
|
+
"dialog": {
|
102
|
+
"color": Qt.rgba(0, 0, 0, 0.37), // 模糊颜色
|
103
|
+
"blur": 64, // 模糊度
|
104
|
+
"offsetY": 32
|
105
|
+
},
|
106
|
+
"tooltip": {
|
107
|
+
"color": Qt.alpha("#000000", 0.14),
|
108
|
+
"blur": 8,
|
109
|
+
"offsetY": 4
|
110
|
+
},
|
111
|
+
"cardRest": {
|
112
|
+
"color": Qt.rgba(0, 0, 0, 0.04),
|
113
|
+
"blur": 4,
|
114
|
+
"offsetY": 2
|
115
|
+
},
|
116
|
+
"flyout": {
|
117
|
+
"color": Qt.alpha("#000000", 0.14),
|
118
|
+
"blur": 24,
|
119
|
+
"offsetY": 8
|
120
|
+
},
|
121
|
+
}
|
122
|
+
|
123
|
+
// Typography //
|
124
|
+
property QtObject typography: QtObject {
|
125
|
+
// property string fontFamily: "Segoe UI"
|
126
|
+
// property string fontIcon: "FluentSystemIcons-Resizeable.ttf" // 字体图标路径 / font icon (put it in the "assets/fonts" folder)
|
127
|
+
// Font Sizes
|
128
|
+
property int displaySize: 68
|
129
|
+
property int titleLargeSize: 40
|
130
|
+
property int titleSize: 28
|
131
|
+
property int subtitleSize: 20
|
132
|
+
property int bodyLargeSize: 18
|
133
|
+
property int bodySize: 14
|
134
|
+
property int bodyStrongSize: 14
|
135
|
+
property int captionSize: 12
|
136
|
+
}
|
137
|
+
}
|
RinUI/themes/light.qml
ADDED
@@ -0,0 +1,137 @@
|
|
1
|
+
|
2
|
+
import QtQuick 2.15
|
3
|
+
import "../themes"
|
4
|
+
|
5
|
+
QtObject {
|
6
|
+
property string name: "Light"
|
7
|
+
property bool isDark: false
|
8
|
+
|
9
|
+
// Colors //
|
10
|
+
property QtObject colors: QtObject {
|
11
|
+
// Controls
|
12
|
+
property color controlColor: Qt.alpha("#ffffff", 0.7)
|
13
|
+
property color controlSecondaryColor: Qt.alpha("#F9F9F9", 0.5)
|
14
|
+
property color controlTertiaryColor: Qt.alpha("#F9F9F9", 0.3)
|
15
|
+
property color controlQuaternaryColor: Qt.alpha("#F3F3F3", 0.76)
|
16
|
+
property color controlStrongColor: Qt.alpha("#000000", 0.4458)
|
17
|
+
property color controlInputActiveColor: "#ffffff"
|
18
|
+
|
19
|
+
property color controlBorderColor: Qt.alpha("#000000", 0.06)
|
20
|
+
property color controlBottomBorderColor: Qt.alpha("#000000", 0.16)
|
21
|
+
property color controlAccentBottomBorderColor: Qt.alpha("#000000", 0.4)
|
22
|
+
property color controlBorderStrongColor: Qt.alpha("#000000", 0.6063)
|
23
|
+
property color controlBorderAccentColor: Qt.alpha("#000000", 0.3)
|
24
|
+
property color textControlBorderColor: Qt.alpha("#000000", 0.45)
|
25
|
+
property color textControlBorderFocusedColor: Utils.primaryColor
|
26
|
+
property color flyoutBorderColor: Qt.alpha("#000000", 0.0578)
|
27
|
+
|
28
|
+
property color controlSolidColor: "#ffffff"
|
29
|
+
property color dividerBorderColor: Qt.alpha("#000000", 0.0803)
|
30
|
+
// Accessibility
|
31
|
+
property color focusBorderOuter: Qt.alpha("#000000", 0.8956)
|
32
|
+
property color focusBorderInner: "#ffffff"
|
33
|
+
|
34
|
+
// Card
|
35
|
+
property color cardColor: Qt.alpha("#ffffff", 0.7)
|
36
|
+
property color cardSecondaryColor: Qt.alpha("#F6F6F6", 0.5)
|
37
|
+
property color cardTertiaryColor: Qt.alpha("#ffffff", 1)
|
38
|
+
property color cardBorderColor: Qt.alpha("#000000", 0.0578)
|
39
|
+
|
40
|
+
// Background
|
41
|
+
property color backgroundColor: "#F3F3F3"
|
42
|
+
property color windowBorderColor: Qt.alpha("#757575", 0.0924)
|
43
|
+
property color backgroundAcrylicColor: "#F9F9F9"
|
44
|
+
property color backgroundSmokeColor: Qt.alpha("#000000", 0.3)
|
45
|
+
|
46
|
+
property color subtleColor: "transparent"
|
47
|
+
property color subtleSecondaryColor: Qt.alpha("#000000", 0.0373)
|
48
|
+
property color subtleTertiaryColor: Qt.alpha("#000000", 0.0241)
|
49
|
+
property color captionCloseColor: "#c42b1c"
|
50
|
+
property color captionCloseTextColor: "#ffffff"
|
51
|
+
|
52
|
+
// Layer
|
53
|
+
property color layerColor: Qt.alpha("#ffffff", 0.5)
|
54
|
+
|
55
|
+
// Text
|
56
|
+
property color textColor: "#1b1b1b"
|
57
|
+
property color textSecondaryColor: Qt.alpha("#000000", 0.6063)
|
58
|
+
property color textAccentColor: primaryColor
|
59
|
+
property color textOnAccentColor: "#ffffff"
|
60
|
+
property color textSelectedColor: "#ffffff"
|
61
|
+
|
62
|
+
property color primaryColor: Utils.primaryColor
|
63
|
+
property color disabledColor: "#000000"
|
64
|
+
|
65
|
+
// System Colors
|
66
|
+
property color systemAttentionColor: primaryColor
|
67
|
+
property color systemSuccessColor: "#0f7b0f"
|
68
|
+
property color systemCautionColor: "#9d5d00"
|
69
|
+
property color systemCriticalColor: "#c42b1c"
|
70
|
+
property color systemNeutralColor: "#8d8d8d"
|
71
|
+
|
72
|
+
property color systemAttentionBackgroundColor: "#fbfbfb"
|
73
|
+
property color systemSuccessBackgroundColor: "#dff6dd"
|
74
|
+
property color systemCautionBackgroundColor: "#fff4ce"
|
75
|
+
property color systemCriticalBackgroundColor: "#fde7e9"
|
76
|
+
property color systemNeutralBackgroundColor: "#f9f9f9"
|
77
|
+
}
|
78
|
+
|
79
|
+
// Appearance //
|
80
|
+
property QtObject appearance: QtObject {
|
81
|
+
property int buttonRadius: 5
|
82
|
+
property int borderWidth: 1
|
83
|
+
property real borderFactor: 0.9
|
84
|
+
property real borderOnAccentFactor: 1.08
|
85
|
+
property int smallRadius: 3
|
86
|
+
|
87
|
+
property int dialogTitleBarHeight: 32
|
88
|
+
property int windowTitleBarHeight: 48
|
89
|
+
property int windowRadius: 7
|
90
|
+
property int windowButtonWidth: 46
|
91
|
+
|
92
|
+
property int scrollBarMinWidth: 2
|
93
|
+
property int scrollBarWidth: 6
|
94
|
+
property int scrollBarPadding: 3
|
95
|
+
|
96
|
+
property int sliderHandleSize: 20
|
97
|
+
}
|
98
|
+
|
99
|
+
// Shadows //
|
100
|
+
property var shadows: {
|
101
|
+
"dialog": {
|
102
|
+
"color": Qt.alpha("#000000", 0.19), // 模糊颜色
|
103
|
+
"blur": 64, // 模糊度
|
104
|
+
"offsetY": 32
|
105
|
+
},
|
106
|
+
"tooltip": {
|
107
|
+
"color": Qt.alpha("#000000", 0.14),
|
108
|
+
"blur": 8,
|
109
|
+
"offsetY": 4
|
110
|
+
},
|
111
|
+
"cardRest": {
|
112
|
+
"color": Qt.alpha("#000000", 0.04),
|
113
|
+
"blur": 4,
|
114
|
+
"offsetY": 2
|
115
|
+
},
|
116
|
+
"flyout": {
|
117
|
+
"color": Qt.alpha("#000000", 0.14),
|
118
|
+
"blur": 24,
|
119
|
+
"offsetY": 8
|
120
|
+
},
|
121
|
+
}
|
122
|
+
|
123
|
+
// Typography //
|
124
|
+
property QtObject typography: QtObject {
|
125
|
+
// property string fontFamily: "Segoe UI"
|
126
|
+
// property string fontIcon: "FluentSystemIcons-Resizeable.ttf" // 字体图标路径 / font icon (put it in the "assets/fonts" folder)
|
127
|
+
// Font Sizes
|
128
|
+
property int displaySize: 68
|
129
|
+
property int titleLargeSize: 40
|
130
|
+
property int titleSize: 28
|
131
|
+
property int subtitleSize: 20
|
132
|
+
property int bodyLargeSize: 18
|
133
|
+
property int bodySize: 14
|
134
|
+
property int bodyStrongSize: 14
|
135
|
+
property int captionSize: 12
|
136
|
+
}
|
137
|
+
}
|
RinUI/themes/qmldir
ADDED
RinUI/themes/theme.qml
ADDED
@@ -0,0 +1,126 @@
|
|
1
|
+
pragma Singleton
|
2
|
+
import QtQuick 2.15
|
3
|
+
// import "../themes"
|
4
|
+
|
5
|
+
Item {
|
6
|
+
id: themeManager
|
7
|
+
|
8
|
+
property var currentTheme: null
|
9
|
+
|
10
|
+
// 初始化时设置默认主题
|
11
|
+
Component.onCompleted: {
|
12
|
+
if (typeof ThemeManager === "undefined") {
|
13
|
+
currentTheme = Qt.createQmlObject("import '../themes'; Light {}", themeManager)
|
14
|
+
} else {
|
15
|
+
Utils.primaryColor = getThemeColor()
|
16
|
+
setTheme(ThemeManager.get_theme_name())
|
17
|
+
}
|
18
|
+
}
|
19
|
+
|
20
|
+
function isThemeMgrInitialized() {
|
21
|
+
return typeof ThemeManager!== "undefined"
|
22
|
+
}
|
23
|
+
|
24
|
+
function setBackdropEffect(effect) {
|
25
|
+
if (!isThemeMgrInitialized()) {
|
26
|
+
console.error("ThemeManager is not defined.")
|
27
|
+
return -1
|
28
|
+
}
|
29
|
+
ThemeManager.apply_backdrop_effect(effect)
|
30
|
+
}
|
31
|
+
|
32
|
+
function sendDragWindowEvent(window) {
|
33
|
+
if (!isThemeMgrInitialized()) {
|
34
|
+
console.error("ThemeManager is not defined.")
|
35
|
+
return -1
|
36
|
+
}
|
37
|
+
ThemeManager.dragWindowEvent(ThemeManager.getWindowId(window))
|
38
|
+
}
|
39
|
+
|
40
|
+
function getBackdropEffect() {
|
41
|
+
if (!isThemeMgrInitialized()) {
|
42
|
+
console.error("ThemeManager is not defined.")
|
43
|
+
return -1
|
44
|
+
}
|
45
|
+
return ThemeManager.get_backdrop_effect()
|
46
|
+
}
|
47
|
+
|
48
|
+
function getThemeColor() {
|
49
|
+
if (!isThemeMgrInitialized()) {
|
50
|
+
console.error("ThemeManager is not defined.")
|
51
|
+
return -1
|
52
|
+
}
|
53
|
+
return ThemeManager.get_theme_color()
|
54
|
+
}
|
55
|
+
|
56
|
+
function getTheme() {
|
57
|
+
if (!isThemeMgrInitialized()) {
|
58
|
+
console.error("ThemeManager is not defined.")
|
59
|
+
return -1
|
60
|
+
}
|
61
|
+
return ThemeManager.get_theme_name()
|
62
|
+
}
|
63
|
+
|
64
|
+
// 本来打算写多主题支持的()
|
65
|
+
|
66
|
+
function toggleMode() {
|
67
|
+
if (!isThemeMgrInitialized()) {
|
68
|
+
console.error("ThemeManager is not defined.")
|
69
|
+
return -1
|
70
|
+
}
|
71
|
+
var mode = ThemeManager.get_theme()
|
72
|
+
if (!currentTheme.isDark) {
|
73
|
+
mode = "Dark"
|
74
|
+
} else {
|
75
|
+
mode = "Light"
|
76
|
+
}
|
77
|
+
setTheme(mode)
|
78
|
+
}
|
79
|
+
|
80
|
+
// 切换主题
|
81
|
+
function setTheme(mode) {
|
82
|
+
if (!isThemeMgrInitialized()) {
|
83
|
+
console.error("ThemeManager is not defined.")
|
84
|
+
currentTheme = Qt.createQmlObject("import '../themes'; Light {}", themeManager)
|
85
|
+
return
|
86
|
+
}
|
87
|
+
|
88
|
+
// Call Python backend to toggle theme
|
89
|
+
ThemeManager.toggle_theme(mode)
|
90
|
+
|
91
|
+
// Get the actual theme name
|
92
|
+
var themeName = ThemeManager.get_theme_name()
|
93
|
+
if (themeName === "Auto") {
|
94
|
+
// Get the actual theme applied (Light or Dark)
|
95
|
+
themeName = ThemeManager.get_theme()
|
96
|
+
}
|
97
|
+
load_qml(themeName)
|
98
|
+
return 0;
|
99
|
+
}
|
100
|
+
|
101
|
+
function load_qml(themeName) {
|
102
|
+
if (themeName) {
|
103
|
+
let themeObject = Qt.createQmlObject("import '../themes'; " + themeName + " {}", themeManager)
|
104
|
+
let mode = ThemeManager.get_theme()
|
105
|
+
if (themeObject) {
|
106
|
+
currentTheme = themeObject
|
107
|
+
console.log("Switched to", mode, "mode")
|
108
|
+
} else {
|
109
|
+
console.error("Failed to create theme object for mode:", mode)
|
110
|
+
}
|
111
|
+
} else {
|
112
|
+
console.error("Invalid theme mode:", mode)
|
113
|
+
}
|
114
|
+
}
|
115
|
+
|
116
|
+
// 监听系统主题变化
|
117
|
+
Connections {
|
118
|
+
target: ThemeManager
|
119
|
+
function onThemeChanged(theme) {
|
120
|
+
load_qml(theme)
|
121
|
+
}
|
122
|
+
function onBackdropChanged(effect) {
|
123
|
+
Utils.backdropEnabled = effect !== "none";
|
124
|
+
}
|
125
|
+
}
|
126
|
+
}
|
RinUI/themes/utils.qml
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
pragma Singleton
|
2
|
+
import QtQuick 2.15
|
3
|
+
import "../assets/fonts/FluentSystemIcons-Index.js" as Icons
|
4
|
+
import "../themes"
|
5
|
+
import "../utils"
|
6
|
+
|
7
|
+
QtObject {
|
8
|
+
property string fontFamily: "Segoe UI" // 默认字体
|
9
|
+
property string iconFontFamily: FontIconLoader.name
|
10
|
+
property string fontIconSource: Qt.resolvedUrl("../assets/fonts/FluentSystemIcons-Resizable.ttf") // 字体图标路径
|
11
|
+
property var fontIconIndex: Icons.FluentIcons // 字体图标索引
|
12
|
+
|
13
|
+
property color primaryColor: "#605ed2" // 默认主题色
|
14
|
+
property int windowDragArea: 5 // 窗口可拖动范围 (px)
|
15
|
+
property int dialogMaximumWidth: 600 // 对话框最大宽度 (px)
|
16
|
+
property int dialogMinimumWidth: 320 // 对话框最小宽度 (px)
|
17
|
+
|
18
|
+
property bool backdropEnabled: false // 是否启用背景特效
|
19
|
+
property int animationSpeed: 250 // 动画速度 (ms)
|
20
|
+
property int animationSpeedFaster: 120 // 动画速度 (ms)
|
21
|
+
property int appearanceSpeed: 175 // 界面切换速度 (ms)
|
22
|
+
property int animationSpeedMiddle: 450 // 动画速度 (ms)
|
23
|
+
property int progressBarAnimationSpeed: 1550 // 进度条动画速度 (ms)
|
24
|
+
|
25
|
+
function loadFontIconIndex() {
|
26
|
+
Qt.include("assets/fonts/FluentSystemIcons-Index.js");
|
27
|
+
}
|
28
|
+
}
|
@@ -0,0 +1,123 @@
|
|
1
|
+
import QtQuick 2.15
|
2
|
+
import QtQuick.Controls 2.15
|
3
|
+
import QtQuick.Layouts 2.15
|
4
|
+
import "../components"
|
5
|
+
|
6
|
+
|
7
|
+
Item {
|
8
|
+
id: floatLayer
|
9
|
+
anchors.fill: parent
|
10
|
+
anchors.margins: margins
|
11
|
+
property int margins: 32
|
12
|
+
property int spacing: 12
|
13
|
+
|
14
|
+
// Position
|
15
|
+
ColumnLayout {
|
16
|
+
id: topLeft
|
17
|
+
anchors.top: parent.top
|
18
|
+
anchors.left: parent.left
|
19
|
+
spacing: floatLayer.spacing
|
20
|
+
width: floatLayer.width / 2
|
21
|
+
}
|
22
|
+
|
23
|
+
ColumnLayout {
|
24
|
+
id: topCenter
|
25
|
+
anchors.top: parent.top
|
26
|
+
anchors.horizontalCenter: parent.horizontalCenter
|
27
|
+
spacing: floatLayer.spacing
|
28
|
+
width: floatLayer.width / 2
|
29
|
+
}
|
30
|
+
|
31
|
+
ColumnLayout {
|
32
|
+
id: topRight
|
33
|
+
anchors.top: parent.top
|
34
|
+
anchors.right: parent.right
|
35
|
+
spacing: floatLayer.spacing
|
36
|
+
width: floatLayer.width / 2
|
37
|
+
}
|
38
|
+
|
39
|
+
ColumnLayout {
|
40
|
+
id: bottomLeft
|
41
|
+
anchors.bottom: parent.bottom
|
42
|
+
anchors.left: parent.left
|
43
|
+
spacing: floatLayer.spacing
|
44
|
+
width: floatLayer.width / 2
|
45
|
+
}
|
46
|
+
|
47
|
+
ColumnLayout {
|
48
|
+
id: bottomCenter
|
49
|
+
anchors.bottom: parent.bottom
|
50
|
+
anchors.horizontalCenter: parent.horizontalCenter
|
51
|
+
spacing: floatLayer.spacing
|
52
|
+
width: floatLayer.width / 2
|
53
|
+
}
|
54
|
+
|
55
|
+
ColumnLayout {
|
56
|
+
id: bottomRight
|
57
|
+
anchors.bottom: parent.bottom
|
58
|
+
anchors.right: parent.right
|
59
|
+
spacing: floatLayer.spacing
|
60
|
+
width: floatLayer.width / 2
|
61
|
+
}
|
62
|
+
|
63
|
+
Component {
|
64
|
+
id: infoBarComponent
|
65
|
+
InfoBar {
|
66
|
+
// title: "Title"
|
67
|
+
// text: "Text"
|
68
|
+
Layout.fillWidth: true
|
69
|
+
}
|
70
|
+
}
|
71
|
+
|
72
|
+
|
73
|
+
// Functions / 方法 //
|
74
|
+
function createInfoBar( options = {} ){
|
75
|
+
try{
|
76
|
+
const { title, text, severity, timeout, position, closable } = options;
|
77
|
+
var infoContainer = infoBarComponent.createObject(determinePosition(position), {
|
78
|
+
title: title || "",
|
79
|
+
text: text || "",
|
80
|
+
severity: severity ?? Severity.Info,
|
81
|
+
position: position || Position.Top,
|
82
|
+
timeout: timeout ?? 1500,
|
83
|
+
closable: closable ?? true
|
84
|
+
});
|
85
|
+
|
86
|
+
// return infoContainer;
|
87
|
+
}
|
88
|
+
catch(err){
|
89
|
+
console.error("Error: error creating InfoBar" || err)
|
90
|
+
}
|
91
|
+
}
|
92
|
+
|
93
|
+
function createCustom( component ){
|
94
|
+
try{
|
95
|
+
var infoContainer = component.createObject(determinePosition(component.position));
|
96
|
+
}
|
97
|
+
catch(err){
|
98
|
+
console.error("Error: error creating component: ", component.objectName || err)
|
99
|
+
}
|
100
|
+
}
|
101
|
+
|
102
|
+
function determinePosition(position){
|
103
|
+
switch(position){
|
104
|
+
case Position.TopLeft:
|
105
|
+
return topLeft;
|
106
|
+
case Position.Top:
|
107
|
+
return topCenter;
|
108
|
+
case Position.TopRight:
|
109
|
+
return topRight;
|
110
|
+
case Position.BottomLeft:
|
111
|
+
return bottomLeft;
|
112
|
+
case Position.Bottom:
|
113
|
+
return bottomCenter;
|
114
|
+
case Position.BottomRight:
|
115
|
+
return bottomRight;
|
116
|
+
case undefined:
|
117
|
+
return topCenter;
|
118
|
+
default:
|
119
|
+
console.log("Invalid position")
|
120
|
+
return topCenter;
|
121
|
+
}
|
122
|
+
}
|
123
|
+
}
|
@@ -0,0 +1,14 @@
|
|
1
|
+
pragma Singleton
|
2
|
+
import QtQuick 2.15
|
3
|
+
import "../themes"
|
4
|
+
|
5
|
+
|
6
|
+
Item {
|
7
|
+
property string name: fontLoader.name
|
8
|
+
FontLoader {
|
9
|
+
id: fontLoader
|
10
|
+
source: Utils.fontIconSource
|
11
|
+
}
|
12
|
+
|
13
|
+
Component.onCompleted: console.log("Font Source:", fontLoader.name, "Status:", fontLoader.status)
|
14
|
+
}
|
RinUI/utils/Position.qml
ADDED
RinUI/utils/Severity.qml
ADDED