Compare commits
68 Commits
0d2987a968
...
experiment
| Author | SHA1 | Date | |
|---|---|---|---|
| 27f9a8e10b | |||
| 229f525653 | |||
| c211f3002a | |||
| 1edbe06401 | |||
| a787464c44 | |||
| fcc2567aa2 | |||
| 34d2af08c6 | |||
| 21bc19e893 | |||
| 17098e6e88 | |||
| d8d9311841 | |||
| c102917e09 | |||
| b26cfa5b54 | |||
| e617f1694e | |||
| c1c9543868 | |||
| 9d42c56423 | |||
| ac650c3678 | |||
| 2547239a50 | |||
| 9455412170 | |||
| 3a605854c1 | |||
| 1aa393345b | |||
| cff06ea8b0 | |||
| 5cc92eb8ae | |||
| cc4ba6168f | |||
| dd2007c895 | |||
| bafa837931 | |||
| f12c499df0 | |||
| ef979fde48 | |||
| ad79c741e7 | |||
| 32fd0305ad | |||
| bbe0f42bb1 | |||
| 5f544f4fe5 | |||
| e6a38f3ffe | |||
| 2399903cda | |||
| ddff777d58 | |||
| 3fdac01687 | |||
| 5dde8ab20c | |||
| 4c07134d9e | |||
| b88290468f | |||
| bd20644269 | |||
| 62b7036933 | |||
| 3d896c7061 | |||
| e8c73b75a1 | |||
| b4fb37539c | |||
| f9699180b9 | |||
| 839694edc1 | |||
| cedb844826 | |||
| a7cf11737a | |||
| f78001167a | |||
| 11ba24d7ed | |||
| e9764cf0e8 | |||
| ac9e8953a9 | |||
| 4e872ddcff | |||
| 8e8cecd463 | |||
| cd697b9f5d | |||
| 7116b565de | |||
| 7282045c98 | |||
| f57aed1fb8 | |||
| 2e1f4b6a12 | |||
| d3327a7c36 | |||
| 06439585eb | |||
| 418e916c0d | |||
| 23bfd10e2b | |||
| 269b30312d | |||
| 24b60e74a0 | |||
| 28c569d547 | |||
| 3041e821a7 | |||
| 7887afc6af | |||
| 2a88eeaf01 |
Binary file not shown.
Binary file not shown.
BIN
.vs/AIT/v17/.wsuo
Normal file
BIN
.vs/AIT/v17/.wsuo
Normal file
Binary file not shown.
54
.vs/AIT/v17/DocumentLayout.backup.json
Normal file
54
.vs/AIT/v17/DocumentLayout.backup.json
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
{
|
||||||
|
"Version": 1,
|
||||||
|
"WorkspaceRootPath": "C:\\msys64\\home\\doryan\\AIT\\",
|
||||||
|
"Documents": [
|
||||||
|
{
|
||||||
|
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\msys64\\home\\doryan\\AIT\\src\\main.rs||{3B902123-F8A7-4915-9F01-361F908088D0}",
|
||||||
|
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:src\\main.rs||{3B902123-F8A7-4915-9F01-361F908088D0}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\msys64\\home\\doryan\\AIT\\.gitignore||{3B902123-F8A7-4915-9F01-361F908088D0}",
|
||||||
|
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:.gitignore||{3B902123-F8A7-4915-9F01-361F908088D0}"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"DocumentGroupContainers": [
|
||||||
|
{
|
||||||
|
"Orientation": 0,
|
||||||
|
"VerticalTabListWidth": 256,
|
||||||
|
"DocumentGroups": [
|
||||||
|
{
|
||||||
|
"DockedWidth": 200,
|
||||||
|
"SelectedChildIndex": 1,
|
||||||
|
"Children": [
|
||||||
|
{
|
||||||
|
"$type": "Document",
|
||||||
|
"DocumentIndex": 1,
|
||||||
|
"Title": ".gitignore",
|
||||||
|
"DocumentMoniker": "C:\\msys64\\home\\doryan\\AIT\\.gitignore",
|
||||||
|
"RelativeDocumentMoniker": ".gitignore",
|
||||||
|
"ToolTip": "C:\\msys64\\home\\doryan\\AIT\\.gitignore",
|
||||||
|
"RelativeToolTip": ".gitignore",
|
||||||
|
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||||
|
"Icon": "00000000-0000-0000-0000-000000000000.000000|iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAF8SURBVDhPjVNLTgJBEG1lwpoFB3GNK9fieA48hD8iwT/ihwgSDAIHgAGXXsEV18CNzL/LquqZdsYM6kteXqcy3fWqpmpNRBgOhyABBEgpAFVKPIMUcYzUyOU\u002BXM/b2qtU3vkSfRjjZTCAMAw1A2LwzdFoBPP5HNqdzuL27n4juibWI\u002BUshBA1DIkhEx9iEorFotgslQqGYbxxAGFEqt1MxmPWJLbLZdZ\u002Bv89q5PMFPiTR6z2zdaxR0fXA0XTBcVywkb4fwHXjRteecIDNQ7UmExVYAdPcxYaqclN46na5WenMKjtlVnTYwcXlVYaDqImW9beD5N/TeGy32QHXm6hZ03ZgiSQHp2fnWQ4oBmJqWSqwAqZpZjt4aLXAD4J0VqyZsmoubfB8H2r1eoaD6NXZ9HcHO\u002BSA3f4AjifXl8rItOETM8ckB9WTWpYD9RdeZ1PWVWAHWXPQaDb59f/w8LiqHeh1pvGkCaP6qB8yXusoxmuNZ7XmII4O9vGuEF86osuDYRkpYQAAAABJRU5ErkJggg==",
|
||||||
|
"WhenOpened": "2024-08-18T21:59:06.655Z",
|
||||||
|
"EditorCaption": ""
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$type": "Document",
|
||||||
|
"DocumentIndex": 0,
|
||||||
|
"Title": "main.rs",
|
||||||
|
"DocumentMoniker": "C:\\msys64\\home\\doryan\\AIT\\src\\main.rs",
|
||||||
|
"RelativeDocumentMoniker": "src\\main.rs",
|
||||||
|
"ToolTip": "C:\\msys64\\home\\doryan\\AIT\\src\\main.rs",
|
||||||
|
"RelativeToolTip": "src\\main.rs",
|
||||||
|
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||||
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|",
|
||||||
|
"WhenOpened": "2024-08-18T21:59:04.875Z",
|
||||||
|
"EditorCaption": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
53
.vs/AIT/v17/DocumentLayout.json
Normal file
53
.vs/AIT/v17/DocumentLayout.json
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
"Version": 1,
|
||||||
|
"WorkspaceRootPath": "C:\\msys64\\home\\doryan\\AIT\\",
|
||||||
|
"Documents": [
|
||||||
|
{
|
||||||
|
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\msys64\\home\\doryan\\AIT\\src\\main.rs||{3B902123-F8A7-4915-9F01-361F908088D0}",
|
||||||
|
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:src\\main.rs||{3B902123-F8A7-4915-9F01-361F908088D0}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\msys64\\home\\doryan\\AIT\\.gitignore||{3B902123-F8A7-4915-9F01-361F908088D0}",
|
||||||
|
"RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:.gitignore||{3B902123-F8A7-4915-9F01-361F908088D0}"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"DocumentGroupContainers": [
|
||||||
|
{
|
||||||
|
"Orientation": 0,
|
||||||
|
"VerticalTabListWidth": 256,
|
||||||
|
"DocumentGroups": [
|
||||||
|
{
|
||||||
|
"DockedWidth": 200,
|
||||||
|
"SelectedChildIndex": 1,
|
||||||
|
"Children": [
|
||||||
|
{
|
||||||
|
"$type": "Document",
|
||||||
|
"DocumentIndex": 1,
|
||||||
|
"Title": ".gitignore",
|
||||||
|
"DocumentMoniker": "C:\\msys64\\home\\doryan\\AIT\\.gitignore",
|
||||||
|
"RelativeDocumentMoniker": ".gitignore",
|
||||||
|
"ToolTip": "C:\\msys64\\home\\doryan\\AIT\\.gitignore",
|
||||||
|
"RelativeToolTip": ".gitignore",
|
||||||
|
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==",
|
||||||
|
"Icon": "00000000-0000-0000-0000-000000000000.000000|iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAF8SURBVDhPjVNLTgJBEG1lwpoFB3GNK9fieA48hD8iwT/ihwgSDAIHgAGXXsEV18CNzL/LquqZdsYM6kteXqcy3fWqpmpNRBgOhyABBEgpAFVKPIMUcYzUyOU\u002BXM/b2qtU3vkSfRjjZTCAMAw1A2LwzdFoBPP5HNqdzuL27n4juibWI\u002BUshBA1DIkhEx9iEorFotgslQqGYbxxAGFEqt1MxmPWJLbLZdZ\u002Bv89q5PMFPiTR6z2zdaxR0fXA0XTBcVywkb4fwHXjRteecIDNQ7UmExVYAdPcxYaqclN46na5WenMKjtlVnTYwcXlVYaDqImW9beD5N/TeGy32QHXm6hZ03ZgiSQHp2fnWQ4oBmJqWSqwAqZpZjt4aLXAD4J0VqyZsmoubfB8H2r1eoaD6NXZ9HcHO\u002BSA3f4AjifXl8rItOETM8ckB9WTWpYD9RdeZ1PWVWAHWXPQaDb59f/w8LiqHeh1pvGkCaP6qB8yXusoxmuNZ7XmII4O9vGuEF86osuDYRkpYQAAAABJRU5ErkJggg==",
|
||||||
|
"WhenOpened": "2024-08-18T21:59:06.655Z"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"$type": "Document",
|
||||||
|
"DocumentIndex": 0,
|
||||||
|
"Title": "main.rs",
|
||||||
|
"DocumentMoniker": "C:\\msys64\\home\\doryan\\AIT\\src\\main.rs",
|
||||||
|
"RelativeDocumentMoniker": "src\\main.rs",
|
||||||
|
"ToolTip": "C:\\msys64\\home\\doryan\\AIT\\src\\main.rs",
|
||||||
|
"RelativeToolTip": "src\\main.rs",
|
||||||
|
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAwAAAAAAAAAAAAAAA==",
|
||||||
|
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|",
|
||||||
|
"WhenOpened": "2024-08-18T21:59:04.875Z",
|
||||||
|
"EditorCaption": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
3
.vs/ProjectSettings.json
Normal file
3
.vs/ProjectSettings.json
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"CurrentProjectSetting": null
|
||||||
|
}
|
||||||
7
.vs/VSWorkspaceState.json
Normal file
7
.vs/VSWorkspaceState.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"ExpandedNodes": [
|
||||||
|
"",
|
||||||
|
"\\src"
|
||||||
|
],
|
||||||
|
"PreviewInSolutionExplorer": false
|
||||||
|
}
|
||||||
BIN
.vs/slnx.sqlite
Normal file
BIN
.vs/slnx.sqlite
Normal file
Binary file not shown.
45
.vscode/launch.json
vendored
Normal file
45
.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"type": "lldb",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Debug executable 'AIT'",
|
||||||
|
"cargo": {
|
||||||
|
"args": [
|
||||||
|
"build",
|
||||||
|
"--bin=AIT",
|
||||||
|
"--package=AIT"
|
||||||
|
],
|
||||||
|
"filter": {
|
||||||
|
"name": "AIT",
|
||||||
|
"kind": "bin"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"args": [],
|
||||||
|
"cwd": "${workspaceFolder}"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "lldb",
|
||||||
|
"request": "launch",
|
||||||
|
"name": "Debug unit tests in executable 'AIT'",
|
||||||
|
"cargo": {
|
||||||
|
"args": [
|
||||||
|
"test",
|
||||||
|
"--no-run",
|
||||||
|
"--bin=AIT",
|
||||||
|
"--package=AIT"
|
||||||
|
],
|
||||||
|
"filter": {
|
||||||
|
"name": "AIT",
|
||||||
|
"kind": "bin"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"args": [],
|
||||||
|
"cwd": "${workspaceFolder}"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
258
Cargo.lock
generated
258
Cargo.lock
generated
@@ -2,11 +2,23 @@
|
|||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 3
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "AIT"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"bitvec",
|
||||||
|
"gio",
|
||||||
|
"gtk4",
|
||||||
|
"libadwaita",
|
||||||
|
"tokio",
|
||||||
|
"winres",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "addr2line"
|
name = "addr2line"
|
||||||
version = "0.21.0"
|
version = "0.22.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb"
|
checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gimli",
|
"gimli",
|
||||||
]
|
]
|
||||||
@@ -19,15 +31,15 @@ checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
version = "1.2.0"
|
version = "1.3.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80"
|
checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "backtrace"
|
name = "backtrace"
|
||||||
version = "0.3.71"
|
version = "0.3.73"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d"
|
checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"addr2line",
|
"addr2line",
|
||||||
"cc",
|
"cc",
|
||||||
@@ -58,15 +70,14 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cairo-rs"
|
name = "cairo-rs"
|
||||||
version = "0.20.0"
|
version = "0.20.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "797fd5a634dcb0ad0d7d583df794deb0a236d88e759cd34b7da20198c6c9d145"
|
checksum = "e8a0ea147c94108c9613235388f540e4d14c327f7081c9e471fc8ee8a2533e69"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"cairo-sys-rs",
|
"cairo-sys-rs",
|
||||||
"glib",
|
"glib",
|
||||||
"libc",
|
"libc",
|
||||||
"thiserror",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -82,15 +93,18 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cc"
|
name = "cc"
|
||||||
version = "1.0.94"
|
version = "1.1.13"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "17f6e324229dc011159fcc089755d1e2e216a90d43a7dea6853ca740b84f35e7"
|
checksum = "72db2f7947ecee9b03b510377e8bb9077afa27176fdbff55c51027e976fdcc48"
|
||||||
|
dependencies = [
|
||||||
|
"shlex",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-expr"
|
name = "cfg-expr"
|
||||||
version = "0.15.8"
|
version = "0.16.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02"
|
checksum = "345c78335be0624ed29012dc10c49102196c6882c12dde65d9f35b02da2aada8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"target-lexicon",
|
"target-lexicon",
|
||||||
@@ -189,9 +203,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gdk-pixbuf"
|
name = "gdk-pixbuf"
|
||||||
version = "0.20.0"
|
version = "0.20.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "28bb53ecb56857c683c9ec859908e076dd3969c7d67598bd8b1ce095d211304a"
|
checksum = "8730751991b97419fc3f0c2dca2c9e45b48edf46e48e0f965964ecf33889812f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gdk-pixbuf-sys",
|
"gdk-pixbuf-sys",
|
||||||
"gio",
|
"gio",
|
||||||
@@ -201,9 +215,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gdk-pixbuf-sys"
|
name = "gdk-pixbuf-sys"
|
||||||
version = "0.20.0"
|
version = "0.20.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9f6681a0c1330d1d3968bec1529f7172d62819ef0bdbb0d18022320654158b03"
|
checksum = "1ffbf649fd5b1c8c0f0feeb015b7533c3ef92da2887fb95ddd338bc2b1644a7c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gio-sys",
|
"gio-sys",
|
||||||
"glib-sys",
|
"glib-sys",
|
||||||
@@ -246,15 +260,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gimli"
|
name = "gimli"
|
||||||
version = "0.28.1"
|
version = "0.29.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253"
|
checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gio"
|
name = "gio"
|
||||||
version = "0.20.0"
|
version = "0.20.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "398e3da68749fdc32783cbf7521ec3f65c9cf946db8c7774f8460af49e52c6e2"
|
checksum = "dcacaa37401cad0a95aadd266bc39c72a131d454fc012f6dfd217f891d76cc52"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"futures-channel",
|
"futures-channel",
|
||||||
"futures-core",
|
"futures-core",
|
||||||
@@ -265,14 +279,13 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
"pin-project-lite",
|
"pin-project-lite",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"thiserror",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gio-sys"
|
name = "gio-sys"
|
||||||
version = "0.20.0"
|
version = "0.20.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e4feb96b31c32730ea3e1e89aecd2e4e37ecb1c473ad8f685e3430a159419f63"
|
checksum = "5237611e97e9b86ab5768adc3eef853ae713ea797aa3835404acdfacffc9fb38"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"glib-sys",
|
"glib-sys",
|
||||||
"gobject-sys",
|
"gobject-sys",
|
||||||
@@ -283,9 +296,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glib"
|
name = "glib"
|
||||||
version = "0.20.0"
|
version = "0.20.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "fee90a615ce05be7a32932cfb8adf2c4bbb4700e80d37713c981fb24c0c56238"
|
checksum = "b19429cb83fcbf1f00b31ae3a123fab5cd3761bdd15b0cc07905804742f0d0e4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"futures-channel",
|
"futures-channel",
|
||||||
@@ -300,14 +313,13 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
"memchr",
|
"memchr",
|
||||||
"smallvec",
|
"smallvec",
|
||||||
"thiserror",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glib-macros"
|
name = "glib-macros"
|
||||||
version = "0.20.0"
|
version = "0.20.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4da558d8177c0c8c54368818b508a4244e1286fce2858cef4e547023f0cfa5ef"
|
checksum = "960349f56469b75794157e93bf04f0bc8a622d0a6612d6a8f8d7eac41e0e1ee1"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"heck",
|
"heck",
|
||||||
"proc-macro-crate",
|
"proc-macro-crate",
|
||||||
@@ -318,9 +330,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "glib-sys"
|
name = "glib-sys"
|
||||||
version = "0.20.0"
|
version = "0.20.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4958c26e5a01c9af00dea669a97369eccbec29a8e6d125c24ea2d85ee7467b60"
|
checksum = "44edae63bea922f18f7e63977ee60a257ec27c4613aff1a6a9bb572ad0d88269"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"libc",
|
"libc",
|
||||||
"system-deps",
|
"system-deps",
|
||||||
@@ -328,9 +340,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "gobject-sys"
|
name = "gobject-sys"
|
||||||
version = "0.20.0"
|
version = "0.20.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c6908864f5ffff15b56df7e90346863904f49b949337ed0456b9287af61903b8"
|
checksum = "fa3d1dcd8a1eb2e7c22be3d5e792b14b186f3524f79b25631730f9a8c169d49a"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"glib-sys",
|
"glib-sys",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -339,9 +351,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "graphene-rs"
|
name = "graphene-rs"
|
||||||
version = "0.20.0"
|
version = "0.20.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "630e940ad5824f90221d6579043a9cd1f8bec86b4a17faaf7827d58eb16e8c1f"
|
checksum = "80aac87f74e81c0e13433e892a047237abdc37945c86887f5eed905038356e69"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"glib",
|
"glib",
|
||||||
"graphene-sys",
|
"graphene-sys",
|
||||||
@@ -350,9 +362,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "graphene-sys"
|
name = "graphene-sys"
|
||||||
version = "0.20.0"
|
version = "0.20.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6fb8fade7b754982f47ebbed241fd2680816fdd4598321784da10b9e1168836a"
|
checksum = "cc2f91ecd32989efad60326cc20a8fb252bd2852239a08e4e70cde8c100de9ca"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"glib-sys",
|
"glib-sys",
|
||||||
"libc",
|
"libc",
|
||||||
@@ -445,9 +457,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hashbrown"
|
name = "hashbrown"
|
||||||
version = "0.14.3"
|
version = "0.14.5"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
|
checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "heck"
|
name = "heck"
|
||||||
@@ -457,24 +469,14 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "indexmap"
|
name = "indexmap"
|
||||||
version = "2.2.6"
|
version = "2.4.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26"
|
checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"equivalent",
|
"equivalent",
|
||||||
"hashbrown",
|
"hashbrown",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "laboratory_works"
|
|
||||||
version = "0.1.0"
|
|
||||||
dependencies = [
|
|
||||||
"bitvec",
|
|
||||||
"gtk4",
|
|
||||||
"libadwaita",
|
|
||||||
"tokio",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libadwaita"
|
name = "libadwaita"
|
||||||
version = "0.7.0"
|
version = "0.7.0"
|
||||||
@@ -508,9 +510,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libc"
|
||||||
version = "0.2.155"
|
version = "0.2.156"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
|
checksum = "a5f43f184355eefb8d17fc948dbecf6c13be3c141f20d834ae842193a448c72a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "memchr"
|
name = "memchr"
|
||||||
@@ -529,27 +531,27 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "miniz_oxide"
|
name = "miniz_oxide"
|
||||||
version = "0.7.2"
|
version = "0.7.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7"
|
checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"adler",
|
"adler",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "object"
|
name = "object"
|
||||||
version = "0.32.2"
|
version = "0.36.3"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441"
|
checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pango"
|
name = "pango"
|
||||||
version = "0.20.0"
|
version = "0.20.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "54768854025df6903061d0084fd9702a253ddfd60db7d9b751d43b76689a7f0a"
|
checksum = "5764e5a174a5a0ec054fe5962ce6d4fc7052e2d0dcc23bbc77202b40a4a403d3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"gio",
|
"gio",
|
||||||
"glib",
|
"glib",
|
||||||
@@ -559,9 +561,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pango-sys"
|
name = "pango-sys"
|
||||||
version = "0.20.0"
|
version = "0.20.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b07cc57d10cee4ec661f718a6902cee18c2f4cfae08e87e5a390525946913390"
|
checksum = "fd317e1de76b14b3d3efe05518c08b360327f1ab7fec150473a89ffcad4b072d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"glib-sys",
|
"glib-sys",
|
||||||
"gobject-sys",
|
"gobject-sys",
|
||||||
@@ -622,9 +624,9 @@ checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc-demangle"
|
name = "rustc-demangle"
|
||||||
version = "0.1.23"
|
version = "0.1.24"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
|
checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc_version"
|
name = "rustc_version"
|
||||||
@@ -637,24 +639,24 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "semver"
|
name = "semver"
|
||||||
version = "1.0.22"
|
version = "1.0.23"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca"
|
checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.197"
|
version = "1.0.208"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2"
|
checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde_derive",
|
"serde_derive",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_derive"
|
name = "serde_derive"
|
||||||
version = "1.0.197"
|
version = "1.0.208"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
|
checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -663,13 +665,19 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde_spanned"
|
name = "serde_spanned"
|
||||||
version = "0.6.5"
|
version = "0.6.7"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1"
|
checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "shlex"
|
||||||
|
version = "1.3.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "slab"
|
name = "slab"
|
||||||
version = "0.4.9"
|
version = "0.4.9"
|
||||||
@@ -687,9 +695,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "2.0.72"
|
version = "2.0.74"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af"
|
checksum = "1fceb41e3d546d0bd83421d3409b1460cc7444cd389341a4c880fe7a042cb3d7"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
@@ -698,14 +706,14 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "system-deps"
|
name = "system-deps"
|
||||||
version = "7.0.1"
|
version = "7.0.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6c81f13d9a334a6c242465140bd262fae382b752ff2011c4f7419919a9c97922"
|
checksum = "070a0a5e7da2d24be457809c4b3baa57a835fd2829ad8b86f9a049052fe71031"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-expr",
|
"cfg-expr",
|
||||||
"heck",
|
"heck",
|
||||||
"pkg-config",
|
"pkg-config",
|
||||||
"toml",
|
"toml 0.8.19",
|
||||||
"version-compare",
|
"version-compare",
|
||||||
]
|
]
|
||||||
|
|
||||||
@@ -717,29 +725,9 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "target-lexicon"
|
name = "target-lexicon"
|
||||||
version = "0.12.14"
|
version = "0.12.16"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f"
|
checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "thiserror"
|
|
||||||
version = "1.0.58"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297"
|
|
||||||
dependencies = [
|
|
||||||
"thiserror-impl",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "thiserror-impl"
|
|
||||||
version = "1.0.58"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tokio"
|
name = "tokio"
|
||||||
@@ -765,21 +753,30 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml"
|
name = "toml"
|
||||||
version = "0.8.12"
|
version = "0.5.11"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "e9dd1545e8208b4a5af1aa9bbd0b4cf7e9ea08fabc5d0a5c67fcaafa17433aa3"
|
checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234"
|
||||||
|
dependencies = [
|
||||||
|
"serde",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "toml"
|
||||||
|
version = "0.8.19"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
"serde_spanned",
|
"serde_spanned",
|
||||||
"toml_datetime",
|
"toml_datetime",
|
||||||
"toml_edit 0.22.9",
|
"toml_edit 0.22.20",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_datetime"
|
name = "toml_datetime"
|
||||||
version = "0.6.5"
|
version = "0.6.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1"
|
checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
@@ -797,15 +794,15 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "toml_edit"
|
name = "toml_edit"
|
||||||
version = "0.22.9"
|
version = "0.22.20"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8e40bb779c5187258fd7aad0eb68cb8706a0a81fa712fbea808ab43c4b8374c4"
|
checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"indexmap",
|
"indexmap",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_spanned",
|
"serde_spanned",
|
||||||
"toml_datetime",
|
"toml_datetime",
|
||||||
"winnow 0.6.6",
|
"winnow 0.6.18",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -831,9 +828,9 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows-targets"
|
name = "windows-targets"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb"
|
checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"windows_aarch64_gnullvm",
|
"windows_aarch64_gnullvm",
|
||||||
"windows_aarch64_msvc",
|
"windows_aarch64_msvc",
|
||||||
@@ -847,51 +844,51 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_aarch64_gnullvm"
|
name = "windows_aarch64_gnullvm"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263"
|
checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_aarch64_msvc"
|
name = "windows_aarch64_msvc"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6"
|
checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_gnu"
|
name = "windows_i686_gnu"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670"
|
checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_gnullvm"
|
name = "windows_i686_gnullvm"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9"
|
checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_i686_msvc"
|
name = "windows_i686_msvc"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf"
|
checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_gnu"
|
name = "windows_x86_64_gnu"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9"
|
checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_gnullvm"
|
name = "windows_x86_64_gnullvm"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596"
|
checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "windows_x86_64_msvc"
|
name = "windows_x86_64_msvc"
|
||||||
version = "0.52.5"
|
version = "0.52.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0"
|
checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winnow"
|
name = "winnow"
|
||||||
@@ -904,13 +901,22 @@ dependencies = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winnow"
|
name = "winnow"
|
||||||
version = "0.6.6"
|
version = "0.6.18"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f0c976aaaa0e1f90dbb21e9587cdaf1d9679a1cde8875c0d6bd83ab96a208352"
|
checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"memchr",
|
"memchr",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "winres"
|
||||||
|
version = "0.1.12"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b68db261ef59e9e52806f688020631e987592bd83619edccda9c47d42cde4f6c"
|
||||||
|
dependencies = [
|
||||||
|
"toml 0.5.11",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "wyz"
|
name = "wyz"
|
||||||
version = "0.5.1"
|
version = "0.5.1"
|
||||||
|
|||||||
@@ -1,13 +1,16 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "laboratory_works"
|
name = "AIT"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
adw = { version = "0.7.0", package = "libadwaita", features = ["v1_4"] }
|
adw = { version = "0.7.0", package = "libadwaita"}
|
||||||
bitvec = "1.0.1"
|
bitvec = "1.0.1"
|
||||||
gtk4 = "0.9.0"
|
gio = { version = "0.20.0", features = ["v2_74"] }
|
||||||
|
gtk = { version = "0.9.0", package = "gtk4", features = ["v4_12"] }
|
||||||
tokio = { version = "1.39.2", features = ["rt", "time", "rt-multi-thread", "macros", "sync"] }
|
tokio = { version = "1.39.2", features = ["rt", "time", "rt-multi-thread", "macros", "sync"] }
|
||||||
|
|
||||||
|
[build-dependencies]
|
||||||
|
winres = "0.1"
|
||||||
9
build.rs
Normal file
9
build.rs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
extern crate winres;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
if cfg!(target_os = "windows") {
|
||||||
|
let mut res = winres::WindowsResource::new();
|
||||||
|
res.set_icon("./src/view/resources/icon.ico"); // Replace this with the filename of your .ico file.
|
||||||
|
res.compile().unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,7 +2,7 @@ use std::collections::HashMap;
|
|||||||
use std::sync::LazyLock;
|
use std::sync::LazyLock;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
controller::view_utils::{hamming_code_input_utils::*, input_utils::*},
|
controller::view_utils::{hamming_code_utils::*, input_utils::*},
|
||||||
model::{models::*, Result},
|
model::{models::*, Result},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ pub fn hamming(raw_input: String, mode: HammingMode) -> Result<String> {
|
|||||||
let prepared_input: String = processing_input(&raw_input);
|
let prepared_input: String = processing_input(&raw_input);
|
||||||
|
|
||||||
let (first_condition, second_condition): (bool, bool) =
|
let (first_condition, second_condition): (bool, bool) =
|
||||||
check_correct_binary_code(&raw_input, &prepared_input, length_of_code);
|
check_correct_binary_code(&prepared_input, length_of_code);
|
||||||
|
|
||||||
if raw_input.is_empty() {
|
if raw_input.is_empty() {
|
||||||
Err("Введите код.".into())
|
Err("Введите код.".into())
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
use crate::model::Frequency;
|
||||||
|
|
||||||
|
use gio::{prelude::Cast, ListStore};
|
||||||
|
|
||||||
#[allow(non_snake_case)]
|
#[allow(non_snake_case)]
|
||||||
pub fn reactive_resistance_of_capacitor(Cm: f64, L: f64, f: f64) -> f64 {
|
pub fn reactive_resistance_of_capacitor(Cm: f64, L: f64, f: f64) -> f64 {
|
||||||
if f == 0.0 || Cm == 0.0 || L == 0.0 {
|
if f == 0.0 || Cm == 0.0 || L == 0.0 {
|
||||||
@@ -29,3 +33,19 @@ pub fn coef_of_signal_reduce(Vs: f64, V: f64) -> f64 {
|
|||||||
Vs / V
|
Vs / V
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_default_values(model: &ListStore) {
|
||||||
|
for number in (0..=100).step_by(5) {
|
||||||
|
if number == 0 {
|
||||||
|
model.append(&Frequency::new(1.0));
|
||||||
|
} else if (number >= 70 && number % 10 == 0) || (number < 70 && number % 5 == 0) {
|
||||||
|
model.append(&Frequency::new(number as f64));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn find_by_frequency_value(model: &ListStore, new_elem: &Frequency) -> Option<u32> {
|
||||||
|
model.find_with_equal_func(|elem| {
|
||||||
|
elem.downcast_ref::<Frequency>().unwrap().frequency() == new_elem.frequency()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
use gtk4 as gtk;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
model::{models::*, Result},
|
model::{models::*, Result},
|
||||||
model_utils::hamming_code_seven_four::*,
|
model_utils::hamming_code_seven_four::*,
|
||||||
@@ -25,10 +23,10 @@ pub fn start_hamming_algorithm(input: &TextView, state: bool) -> Result<String>
|
|||||||
hamming(parsed_input, operation)
|
hamming(parsed_input, operation)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn check_correct_binary_code(input: &str, prepared_input: &str, l: usize) -> (bool, bool) {
|
pub fn check_correct_binary_code(prepared_input: &str, l: usize) -> (bool, bool) {
|
||||||
let first_condition: bool = prepared_input.len() % l == 0;
|
let first_condition: bool = prepared_input.len() % l == 0;
|
||||||
|
|
||||||
let second_condition: bool = input.chars().all(|c| c == '1' || c == '0' || c == ' ');
|
let second_condition: bool = prepared_input.chars().all(|c| c == '1' || c == '0');
|
||||||
|
|
||||||
(first_condition, second_condition)
|
(first_condition, second_condition)
|
||||||
}
|
}
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
use gtk4 as gtk;
|
|
||||||
|
|
||||||
use bitvec::{order::Lsb0, view::AsBits};
|
use bitvec::{order::Lsb0, view::AsBits};
|
||||||
use gtk::{prelude::*, *};
|
use gtk::{prelude::*, *};
|
||||||
use std::ops::Deref;
|
use std::ops::Deref;
|
||||||
@@ -9,8 +7,8 @@ const ASCII_ZERO_CHAR_POSITION: u8 = 48;
|
|||||||
pub fn processing_input(input: impl Into<String>) -> String {
|
pub fn processing_input(input: impl Into<String>) -> String {
|
||||||
input
|
input
|
||||||
.into()
|
.into()
|
||||||
.split_ascii_whitespace()
|
.split(&[' ', '\n'][..])
|
||||||
.filter(|&x| !x.is_empty())
|
.filter(|x| !x.is_empty())
|
||||||
.fold(String::new(), |c: String, n: &str| c + n)
|
.fold(String::new(), |c: String, n: &str| c + n)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
pub mod hamming_code_input_utils;
|
pub mod hamming_code_utils;
|
||||||
pub mod input_utils;
|
pub mod input_utils;
|
||||||
pub mod signal_reduce_input_utils;
|
pub mod signal_reduce_utils;
|
||||||
|
|
||||||
|
|||||||
@@ -1,49 +0,0 @@
|
|||||||
use gtk4 as gtk;
|
|
||||||
|
|
||||||
use std::str::FromStr;
|
|
||||||
|
|
||||||
use gtk::{
|
|
||||||
prelude::{TextBufferExt, TextViewExt},
|
|
||||||
TextBuffer,
|
|
||||||
};
|
|
||||||
|
|
||||||
use crate::{
|
|
||||||
model::{models::SignalReduce, Error, Result},
|
|
||||||
view::components::input::Input,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub fn get_error_message(error: Error) -> Option<&'static str> {
|
|
||||||
match error.to_string().as_str() {
|
|
||||||
"cannot parse float from empty string" => Some("Вы не ввели данные в поле/-я"),
|
|
||||||
"invalid float literal" => Some("Вы ввели не корректные данные в поле/-я"),
|
|
||||||
_ => None,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn parse_fields(all_inputs: Vec<Input>) -> Result<SignalReduce> {
|
|
||||||
let mut values: [f64; 6] = [0.0; 6];
|
|
||||||
|
|
||||||
for (i, input) in all_inputs.iter().enumerate() {
|
|
||||||
let input_text_buffer: TextBuffer = input.clone().get_input().buffer();
|
|
||||||
let extracted_value = f64::from_str(
|
|
||||||
input_text_buffer
|
|
||||||
.text(
|
|
||||||
&input_text_buffer.start_iter(),
|
|
||||||
&input_text_buffer.end_iter(),
|
|
||||||
false,
|
|
||||||
)
|
|
||||||
.as_str()
|
|
||||||
.trim(),
|
|
||||||
)?;
|
|
||||||
values[i] = extracted_value;
|
|
||||||
}
|
|
||||||
|
|
||||||
Ok(SignalReduce {
|
|
||||||
length: values[0],
|
|
||||||
wire_resistance: values[1],
|
|
||||||
wire_capacity: values[2],
|
|
||||||
source_resistance: values[3],
|
|
||||||
source_voltage: values[4],
|
|
||||||
frequency: values[5],
|
|
||||||
})
|
|
||||||
}
|
|
||||||
124
src/controller/view_utils/signal_reduce_utils.rs
Normal file
124
src/controller/view_utils/signal_reduce_utils.rs
Normal file
@@ -0,0 +1,124 @@
|
|||||||
|
use gio::glib::Object;
|
||||||
|
|
||||||
|
use std::str::FromStr;
|
||||||
|
|
||||||
|
use crate::{
|
||||||
|
model::{models::SignalReduce, Error, Frequency, Result},
|
||||||
|
model_utils::signal_reducer::*,
|
||||||
|
view::components::input::Input,
|
||||||
|
};
|
||||||
|
|
||||||
|
use gtk::{
|
||||||
|
prelude::{Cast, CastNone, EditableExt, ListItemExt, WidgetExt},
|
||||||
|
ColumnView, Entry, Label, ListItem, SignalListItemFactory,
|
||||||
|
};
|
||||||
|
|
||||||
|
pub fn get_error_message(error: Error) -> Option<&'static str> {
|
||||||
|
match error.to_string().as_str() {
|
||||||
|
"cannot parse float from empty string" => Some("Вы не ввели данные в поле/-я"),
|
||||||
|
"invalid float literal" => Some("Вы ввели не корректные данные в поле/-я"),
|
||||||
|
_ => None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn parse_fields(all_inputs: Vec<Input<Entry>>) -> Result<SignalReduce> {
|
||||||
|
let mut values: [f64; 6] = [0.0; 6];
|
||||||
|
|
||||||
|
for (i, input) in all_inputs.iter().enumerate() {
|
||||||
|
let input_text_buffer = input.get_input();
|
||||||
|
let extracted_value =
|
||||||
|
f64::from_str(input_text_buffer.text().replace(',', ".").as_str().trim())?;
|
||||||
|
values[i] = extracted_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(SignalReduce {
|
||||||
|
length: values[0],
|
||||||
|
wire_resistance: values[1],
|
||||||
|
wire_capacity: values[2],
|
||||||
|
source_resistance: values[3],
|
||||||
|
source_voltage: values[4],
|
||||||
|
frequency: values[5],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn update_column_view(column_view: &ColumnView) {
|
||||||
|
column_view.set_visible(false);
|
||||||
|
column_view.set_visible(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn column_view_setup_factory(_factory: &SignalListItemFactory, list_item: &Object) {
|
||||||
|
list_item
|
||||||
|
.downcast_ref::<ListItem>()
|
||||||
|
.expect("Needs to be ListItem")
|
||||||
|
.set_child(Some(&Label::new(None)));
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn get_cell_data(list_item: &Object) -> (Frequency, Label) {
|
||||||
|
let cell_value = list_item
|
||||||
|
.downcast_ref::<ListItem>()
|
||||||
|
.expect("Needs to be ListItem")
|
||||||
|
.item()
|
||||||
|
.and_downcast::<Frequency>()
|
||||||
|
.expect("The item has to be an `IntegerObject`.");
|
||||||
|
|
||||||
|
let cell_label = list_item
|
||||||
|
.downcast_ref::<ListItem>()
|
||||||
|
.expect("Needs to be ListItem")
|
||||||
|
.child()
|
||||||
|
.and_downcast::<Label>()
|
||||||
|
.expect("The child has to be a `Label`.");
|
||||||
|
|
||||||
|
cell_label.set_selectable(true);
|
||||||
|
|
||||||
|
(cell_value, cell_label)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn frequency_column_fabric(list_item: &Object) {
|
||||||
|
let (cell_value, cell_label) = get_cell_data(list_item);
|
||||||
|
|
||||||
|
cell_label.set_label(&cell_value.frequency().to_string());
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn reactive_resist_fabric(list_item: &Object, values: SignalReduce) {
|
||||||
|
let (cell_value, cell_label) = get_cell_data(list_item);
|
||||||
|
|
||||||
|
cell_value.set_reactive_resist(reactive_resistance_of_capacitor(
|
||||||
|
values.wire_capacity * 10f64.powi(-12),
|
||||||
|
values.length,
|
||||||
|
cell_value.frequency() * 10f64.powi(6),
|
||||||
|
));
|
||||||
|
|
||||||
|
cell_label.set_label(format!("{0:.1$}", cell_value.reactive_resist(), 6).as_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn signal_source_voltage_fabric(list_item: &Object, values: SignalReduce) {
|
||||||
|
let (cell_value, cell_label) = get_cell_data(list_item);
|
||||||
|
|
||||||
|
cell_value.set_full_resistance(full_resistance_of_capacitor(
|
||||||
|
cell_value.reactive_resist(),
|
||||||
|
values.source_resistance,
|
||||||
|
values.wire_resistance,
|
||||||
|
values.length,
|
||||||
|
));
|
||||||
|
|
||||||
|
cell_value.set_signal_source_voltage(
|
||||||
|
voltage_from_signal_source(
|
||||||
|
values.source_voltage * 10f64.powi(-3),
|
||||||
|
cell_value.reactive_resist(),
|
||||||
|
cell_value.full_resistance(),
|
||||||
|
) * 1000.0,
|
||||||
|
);
|
||||||
|
|
||||||
|
cell_label.set_label(format!("{0:.1$}", cell_value.signal_source_voltage(), 6).as_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn coef_fabric(list_item: &Object, values: SignalReduce) {
|
||||||
|
let (cell_value, cell_label) = get_cell_data(list_item);
|
||||||
|
|
||||||
|
let coef: f64 =
|
||||||
|
coef_of_signal_reduce(values.source_voltage, cell_value.signal_source_voltage());
|
||||||
|
|
||||||
|
cell_label.set_label(format!("{0:.1$}", coef, 6).as_str());
|
||||||
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
use gtk4 as gtk;
|
#![windows_subsystem = "windows"]
|
||||||
|
|
||||||
|
extern crate gio;
|
||||||
|
|
||||||
use gtk::prelude::*;
|
use gtk::prelude::*;
|
||||||
|
|
||||||
@@ -12,7 +14,7 @@ use view::ui::*;
|
|||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() {
|
async fn main() {
|
||||||
let app: adw::Application = adw::Application::builder()
|
let app: adw::Application = adw::Application::builder()
|
||||||
.application_id("com.laboratory-work")
|
.application_id("org.gtk-rs.AIT")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
app.connect_activate(ui);
|
app.connect_activate(ui);
|
||||||
|
|||||||
@@ -1,14 +1,12 @@
|
|||||||
pub mod builder_traits;
|
pub mod builder_traits;
|
||||||
pub mod models;
|
pub mod models;
|
||||||
|
|
||||||
use crate::gtk::glib;
|
use gtk::glib::{Object, wrapper};
|
||||||
|
|
||||||
use glib::Object;
|
|
||||||
|
|
||||||
pub type Result<T> = core::result::Result<T, Error>;
|
pub type Result<T> = core::result::Result<T, Error>;
|
||||||
pub type Error = std::boxed::Box<dyn std::error::Error>;
|
pub type Error = std::boxed::Box<dyn std::error::Error>;
|
||||||
|
|
||||||
glib::wrapper! {
|
wrapper! {
|
||||||
pub struct Frequency(ObjectSubclass<models::Frequency>);
|
pub struct Frequency(ObjectSubclass<models::Frequency>);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
use std::cell::Cell;
|
use std::cell::Cell;
|
||||||
|
|
||||||
use crate::gtk;
|
|
||||||
|
|
||||||
use gtk::{
|
use gtk::{
|
||||||
glib::{self, Properties},
|
glib::{self, Properties},
|
||||||
prelude::*,
|
prelude::*,
|
||||||
@@ -16,7 +14,7 @@ pub enum HammingMode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
#[derive(Default, Copy, Clone, Debug)]
|
#[derive(Default, Copy, Clone, Debug, PartialEq)]
|
||||||
pub struct SignalReduce {
|
pub struct SignalReduce {
|
||||||
pub length: f64,
|
pub length: f64,
|
||||||
pub wire_resistance: f64,
|
pub wire_resistance: f64,
|
||||||
@@ -31,6 +29,12 @@ pub struct SignalReduce {
|
|||||||
pub struct Frequency {
|
pub struct Frequency {
|
||||||
#[property(get, set)]
|
#[property(get, set)]
|
||||||
frequency: Cell<f64>,
|
frequency: Cell<f64>,
|
||||||
|
#[property(get, set)]
|
||||||
|
reactive_resist: Cell<f64>,
|
||||||
|
#[property(get, set)]
|
||||||
|
full_resistance: Cell<f64>,
|
||||||
|
#[property(get, set)]
|
||||||
|
signal_source_voltage: Cell<f64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[glib::derived_properties]
|
#[glib::derived_properties]
|
||||||
|
|||||||
68
src/view/components/dialogues.rs
Normal file
68
src/view/components/dialogues.rs
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
use adw::HeaderBar;
|
||||||
|
use gio::{glib::Variant, SimpleAction};
|
||||||
|
|
||||||
|
use gtk::{
|
||||||
|
prelude::{BoxExt, GtkWindowExt},
|
||||||
|
AboutDialog, Box, Image, Label, Orientation, ScrolledWindow, Window, License, NaturalWrapMode, PolicyType
|
||||||
|
};
|
||||||
|
|
||||||
|
use std::path::Path;
|
||||||
|
|
||||||
|
use crate::view::properties::Setters;
|
||||||
|
|
||||||
|
#[cfg(debug_assertions)]
|
||||||
|
const PATH: &str = "./src/view/resources/logo.png";
|
||||||
|
|
||||||
|
#[cfg(not(debug_assertions))]
|
||||||
|
const PATH: &str = "./resources/logo.png";
|
||||||
|
|
||||||
|
pub fn open_about_dialogue(_action: &SimpleAction, _var: Option<&Variant>) {
|
||||||
|
let logo = Image::from_file(Path::new(PATH)).paintable().unwrap();
|
||||||
|
|
||||||
|
AboutDialog::builder()
|
||||||
|
.authors(vec!["Сагиев А.Д.", "Ефимов И.П."])
|
||||||
|
.version("1.0-beta")
|
||||||
|
.program_name("Прикладная теория информации")
|
||||||
|
.license_type(License::Apache20)
|
||||||
|
.logo(&logo)
|
||||||
|
.website("https://gitea.doryan04.ru/doryan/AIT")
|
||||||
|
.build()
|
||||||
|
.present();
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn open_help_dialogue(_action: &SimpleAction, _var: Option<&Variant>) {
|
||||||
|
let help = Box::builder()
|
||||||
|
.width_request(400)
|
||||||
|
.orientation(Orientation::Vertical)
|
||||||
|
.set_margin(crate::view::properties::MarginData::EqualsMargin(15))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let label = Label::builder()
|
||||||
|
.use_markup(true)
|
||||||
|
.wrap(true)
|
||||||
|
.width_request(400)
|
||||||
|
.max_width_chars(50)
|
||||||
|
.single_line_mode(false)
|
||||||
|
.natural_wrap_mode(NaturalWrapMode::Word)
|
||||||
|
.label(crate::view::resources::HELP)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
help.append(&label);
|
||||||
|
|
||||||
|
let scrollable = ScrolledWindow::builder()
|
||||||
|
.child(&help)
|
||||||
|
.hscrollbar_policy(PolicyType::Never)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let custom_header = HeaderBar::new();
|
||||||
|
|
||||||
|
Window::builder()
|
||||||
|
.width_request(800)
|
||||||
|
.height_request(600)
|
||||||
|
.name("help")
|
||||||
|
.title("Помощь")
|
||||||
|
.titlebar(&custom_header)
|
||||||
|
.child(&scrollable)
|
||||||
|
.build()
|
||||||
|
.present();
|
||||||
|
}
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
use gtk4 as gtk;
|
use gio::glib::clone;
|
||||||
|
|
||||||
use std::{collections::VecDeque, sync::LazyLock};
|
use std::{collections::VecDeque, sync::LazyLock};
|
||||||
|
|
||||||
use gtk::{
|
use gtk::{
|
||||||
builders::{BoxBuilder, ButtonBuilder, LabelBuilder},
|
builders::{BoxBuilder, ButtonBuilder, LabelBuilder},
|
||||||
prelude::{BoxExt, ButtonExt, ObjectExt, WidgetExt},
|
prelude::{BoxExt, ButtonExt, ObjectExt, WidgetExt},
|
||||||
Box, Button, Label, Revealer, RevealerTransitionType,
|
Box, Button, Label, Revealer, RevealerTransitionType
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::model::builder_traits::Product;
|
use crate::model::builder_traits::Product;
|
||||||
@@ -26,8 +26,6 @@ pub struct InfoBarBuilder {
|
|||||||
button: ButtonBuilder,
|
button: ButtonBuilder,
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Develop a method to safely mutate static.
|
|
||||||
// Not necessary.
|
|
||||||
static mut TASKS_QUEUE: VecDeque<JoinHandle<()>> = VecDeque::new();
|
static mut TASKS_QUEUE: VecDeque<JoinHandle<()>> = VecDeque::new();
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -96,20 +94,20 @@ impl InfoBarBuilder {
|
|||||||
|
|
||||||
info_bar_box.append(&info_bar_label);
|
info_bar_box.append(&info_bar_label);
|
||||||
info_bar_box.append(&info_bar_close_btn);
|
info_bar_box.append(&info_bar_close_btn);
|
||||||
info_bar_box.set_widget_name("info_bar");
|
|
||||||
|
|
||||||
let info_bar: &Revealer = &INFO_BAR_INSTANCE.instance;
|
let info_bar: &Revealer = &INFO_BAR_INSTANCE.instance;
|
||||||
|
|
||||||
info_bar.set_transition_type(RevealerTransitionType::SlideUp);
|
info_bar.set_transition_type(RevealerTransitionType::SlideUp);
|
||||||
info_bar.set_transition_duration(200);
|
info_bar.set_transition_duration(200);
|
||||||
|
|
||||||
info_bar.set_child(Some(&info_bar_box));
|
info_bar.set_child(Some(&info_bar_box));
|
||||||
|
info_bar.set_widget_name("infobar");
|
||||||
|
info_bar.set_css_classes(&[".warning"]);
|
||||||
|
|
||||||
let info_bar_to_close = info_bar.clone();
|
info_bar_close_btn.connect_clicked(clone!(
|
||||||
|
#[strong]
|
||||||
info_bar_close_btn.connect_clicked(move |_| {
|
info_bar,
|
||||||
info_bar_to_close.set_reveal_child(false);
|
move |_| info_bar.set_reveal_child(false)
|
||||||
});
|
));
|
||||||
|
|
||||||
&INFO_BAR_INSTANCE
|
&INFO_BAR_INSTANCE
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,25 +1,59 @@
|
|||||||
use gtk4 as gtk;
|
|
||||||
|
|
||||||
use crate::{model::builder_traits::*, view::properties::*};
|
use crate::{model::builder_traits::*, view::properties::*};
|
||||||
use gtk::{prelude::*, *};
|
use gtk::{prelude::*, *};
|
||||||
|
|
||||||
pub type InputLabel = String;
|
pub type InputLabel = String;
|
||||||
|
|
||||||
|
macro_rules! build_for {
|
||||||
|
( $(($comp:ty,$name:ident)),* ) => {
|
||||||
|
$(
|
||||||
|
pub fn $name(self, input_height: Option<i32>) -> Input<$comp> {
|
||||||
|
let input_component = Box::new(Orientation::Vertical, 0);
|
||||||
|
|
||||||
|
let input_label = Label::builder()
|
||||||
|
.halign(self.align.horizontal)
|
||||||
|
.valign(self.align.vertical)
|
||||||
|
.set_margin(self.margins)
|
||||||
|
.use_markup(self.markup)
|
||||||
|
.label(self.label)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let mut input_builder = <$comp>::builder()
|
||||||
|
.set_margin(MarginData::EqualsMargin(6));
|
||||||
|
|
||||||
|
if let Some(height) = input_height {
|
||||||
|
input_builder = input_builder.height_request(height);
|
||||||
|
}
|
||||||
|
|
||||||
|
let input = input_builder.build();
|
||||||
|
|
||||||
|
input_component.append(&input_label);
|
||||||
|
input_component.append(&input);
|
||||||
|
|
||||||
|
Input {
|
||||||
|
component: input_component,
|
||||||
|
input: input.clone(),
|
||||||
|
input_label: input_label.clone(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)*
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct Input {
|
pub struct Input<I> {
|
||||||
component: Box,
|
component: Box,
|
||||||
input: TextView,
|
input: I,
|
||||||
input_label: Label,
|
input_label: Label,
|
||||||
input_frame: Frame,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct InputBuilder {
|
pub struct InputBuilder {
|
||||||
align: Alignment,
|
align: Alignment,
|
||||||
label: InputLabel,
|
label: InputLabel,
|
||||||
margins: MarginData,
|
margins: MarginData,
|
||||||
|
markup: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Product<InputBuilder, Box> for Input {
|
impl<I> Product<InputBuilder, Box> for Input<I> {
|
||||||
fn builder() -> InputBuilder {
|
fn builder() -> InputBuilder {
|
||||||
InputBuilder {
|
InputBuilder {
|
||||||
align: Alignment {
|
align: Alignment {
|
||||||
@@ -28,6 +62,7 @@ impl Product<InputBuilder, Box> for Input {
|
|||||||
},
|
},
|
||||||
label: String::new(),
|
label: String::new(),
|
||||||
margins: MarginData::EqualsMargin(5),
|
margins: MarginData::EqualsMargin(5),
|
||||||
|
markup: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,13 +71,13 @@ impl Product<InputBuilder, Box> for Input {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Input {
|
impl<I> Input<I> {
|
||||||
pub fn get_input(&self) -> &TextView {
|
pub fn get_component(&self) -> &Box {
|
||||||
&self.input
|
&self.component
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_frame(&self) -> &Frame {
|
pub fn get_input(&self) -> &I {
|
||||||
&self.input_frame
|
&self.input
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_label(&self) -> &Label {
|
pub fn get_label(&self) -> &Label {
|
||||||
@@ -57,6 +92,12 @@ impl InputBuilder {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn markup(mut self, toggle: bool) -> Self {
|
||||||
|
self.markup = toggle;
|
||||||
|
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
pub fn align(mut self, align: Alignment) -> Self {
|
pub fn align(mut self, align: Alignment) -> Self {
|
||||||
self.align = align;
|
self.align = align;
|
||||||
|
|
||||||
@@ -69,36 +110,5 @@ impl InputBuilder {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build(self, monospace: bool, wrap_mode: WrapMode, input_height: i32) -> Input {
|
build_for!((TextView, build), (Entry, build_entry));
|
||||||
let input_component = Box::new(Orientation::Vertical, 0);
|
|
||||||
|
|
||||||
let text_view_label = Label::builder()
|
|
||||||
.halign(self.align.horizontal)
|
|
||||||
.valign(self.align.vertical)
|
|
||||||
.set_margin(self.margins)
|
|
||||||
.label(self.label)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let text_view_input = TextView::builder()
|
|
||||||
.monospace(monospace)
|
|
||||||
.height_request(input_height)
|
|
||||||
.set_text_view_margin(MarginData::EqualsMargin(6))
|
|
||||||
.wrap_mode(wrap_mode)
|
|
||||||
.build();
|
|
||||||
|
|
||||||
let text_view_input_frame = Frame::builder()
|
|
||||||
.child(&text_view_input)
|
|
||||||
.set_margin(MarginData::MultipleMargin((0, 5, 0, 5)))
|
|
||||||
.build();
|
|
||||||
|
|
||||||
input_component.append(&text_view_label);
|
|
||||||
input_component.append(&text_view_input_frame);
|
|
||||||
|
|
||||||
Input {
|
|
||||||
component: input_component,
|
|
||||||
input: text_view_input.clone(),
|
|
||||||
input_frame: text_view_input_frame.clone(),
|
|
||||||
input_label: text_view_label.clone(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
79
src/view/components/menu.rs
Normal file
79
src/view/components/menu.rs
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
use std::fmt::{Debug, Display};
|
||||||
|
|
||||||
|
use gio::{
|
||||||
|
glib::Variant, prelude::ActionMapExtManual, ActionEntry, Menu, SimpleAction, SimpleActionGroup,
|
||||||
|
};
|
||||||
|
|
||||||
|
use gtk::{MenuButton, PopoverMenu};
|
||||||
|
|
||||||
|
pub struct HeaderMenu<T> {
|
||||||
|
model: Menu,
|
||||||
|
actions_group: (SimpleActionGroup, Option<T>),
|
||||||
|
button: MenuButton,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T> HeaderMenu<T>
|
||||||
|
where
|
||||||
|
T: Into<String> + Debug + Display + Clone,
|
||||||
|
{
|
||||||
|
pub fn new() -> Self {
|
||||||
|
let menu_btn = MenuButton::builder().icon_name("open-menu").build();
|
||||||
|
let menu_model = Menu::new();
|
||||||
|
let menu_popover = PopoverMenu::from_model(Some(&menu_model));
|
||||||
|
|
||||||
|
menu_btn.set_popover(Some(&menu_popover));
|
||||||
|
|
||||||
|
let action_group = SimpleActionGroup::new();
|
||||||
|
|
||||||
|
Self {
|
||||||
|
model: menu_model,
|
||||||
|
actions_group: (action_group, None),
|
||||||
|
button: menu_btn,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn set_action_group_name(&mut self, name: Option<T>) {
|
||||||
|
self.actions_group.1 = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn get_button(&self) -> &MenuButton {
|
||||||
|
&self.button
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn get_model(&self) -> &Menu {
|
||||||
|
&self.model
|
||||||
|
}
|
||||||
|
|
||||||
|
#[inline]
|
||||||
|
pub fn get_actions_group(&self) -> &SimpleActionGroup {
|
||||||
|
&self.actions_group.0
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn append_items<F, I>(&self, items: I)
|
||||||
|
where
|
||||||
|
F: Fn(&SimpleAction, Option<&Variant>) + 'static,
|
||||||
|
I: IntoIterator<Item = &'static (F, &'static str, &'static str)>,
|
||||||
|
{
|
||||||
|
for (callback, action_name, action_label) in items {
|
||||||
|
let action = ActionEntry::<SimpleActionGroup>::builder(action_name)
|
||||||
|
.activate(move |_, a, b| callback(a, b))
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let action_path = &*format!(
|
||||||
|
"{}.{}",
|
||||||
|
self.actions_group
|
||||||
|
.1
|
||||||
|
.clone()
|
||||||
|
.expect("ActionGroupName isn't defined"),
|
||||||
|
action_name
|
||||||
|
);
|
||||||
|
|
||||||
|
self.actions_group.0.add_action_entries([action]);
|
||||||
|
|
||||||
|
self.model.append(Some(action_label), Some(action_path));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,12 @@
|
|||||||
|
pub mod dialogues;
|
||||||
pub mod info_bar;
|
pub mod info_bar;
|
||||||
pub mod input;
|
pub mod input;
|
||||||
|
pub mod menu;
|
||||||
pub mod pages;
|
pub mod pages;
|
||||||
pub mod tabs;
|
pub mod tabs;
|
||||||
pub mod wrapper;
|
|
||||||
|
pub type MenuActions<'a> = (fn(&SimpleAction, Option<&Variant>), &'a str, &'a str);
|
||||||
|
|
||||||
|
use gio::{glib::Variant, SimpleAction};
|
||||||
|
|
||||||
use crate::model::builder_traits;
|
use crate::model::builder_traits;
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
use gtk4::{self as gtk, prelude::WidgetExt};
|
|
||||||
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
use gtk::{
|
use gtk::{
|
||||||
prelude::{BoxExt, IsA},
|
prelude::{BoxExt, IsA, WidgetExt},
|
||||||
Box, Orientation, Stack, StackSidebar, StackSwitcher, StackTransitionType, Widget,
|
Box, Orientation, Stack, StackSidebar, StackSwitcher, StackTransitionType, Widget,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
use gtk4 as gtk;
|
|
||||||
|
|
||||||
use super::builder_traits::*;
|
use super::builder_traits::*;
|
||||||
use gtk::{Box, Label, Notebook};
|
use gtk::{Box, Label, Notebook};
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
use gtk4 as gtk;
|
|
||||||
|
|
||||||
use gtk::{Orientation, builders::BoxBuilder, Box};
|
|
||||||
|
|
||||||
#[allow(dead_code)]
|
|
||||||
pub struct Wrapper;
|
|
||||||
|
|
||||||
impl Wrapper{
|
|
||||||
|
|
||||||
pub fn row_builder() -> BoxBuilder {
|
|
||||||
Box::builder().orientation(Orientation::Vertical)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn col_builder() -> BoxBuilder {
|
|
||||||
Box::builder().orientation(Orientation::Horizontal)
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
pub mod components;
|
pub mod components;
|
||||||
pub mod pages;
|
pub mod pages;
|
||||||
pub mod properties;
|
pub mod properties;
|
||||||
|
pub mod resources;
|
||||||
pub mod styles;
|
pub mod styles;
|
||||||
pub mod ui;
|
pub mod ui;
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
use gtk4 as gtk;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
model::builder_traits::Product,
|
model::builder_traits::Product,
|
||||||
view::{
|
view::{
|
||||||
components::{info_bar::InfoBar, input::Input, wrapper::*},
|
components::{info_bar::InfoBar, input::Input},
|
||||||
properties::*,
|
properties::*,
|
||||||
},
|
},
|
||||||
view_utils::{hamming_code_input_utils::start_hamming_algorithm, input_utils::clearing},
|
view_utils::{hamming_code_utils::start_hamming_algorithm, input_utils::clearing},
|
||||||
};
|
};
|
||||||
|
|
||||||
use gtk::{glib::clone, prelude::*, *};
|
use gtk::{glib::clone, prelude::*, *};
|
||||||
@@ -14,20 +12,25 @@ use gtk::{glib::clone, prelude::*, *};
|
|||||||
pub fn hamming_code_page(wrapper: &Box) {
|
pub fn hamming_code_page(wrapper: &Box) {
|
||||||
let info_bar = InfoBar::get_instance();
|
let info_bar = InfoBar::get_instance();
|
||||||
|
|
||||||
let input_code = Input::builder()
|
let input_code = Input::<TextView>::builder()
|
||||||
.label("Поле ввода для кода:")
|
.label("Поле ввода для кода:")
|
||||||
.margins(MarginData::EqualsMargin(6))
|
.margins(MarginData::EqualsMargin(6))
|
||||||
.align(Alignment::new(Align::Start, Align::Start))
|
.align(Alignment::new(Align::Start, Align::Start))
|
||||||
.build(true, WrapMode::Word, 64);
|
.build(Some(64));
|
||||||
|
|
||||||
let output_code = Input::builder()
|
let output_code = Input::<TextView>::builder()
|
||||||
.label("Результат:")
|
.label("Результат:")
|
||||||
.margins(MarginData::EqualsMargin(6))
|
.margins(MarginData::EqualsMargin(6))
|
||||||
.align(Alignment::new(Align::Start, Align::Start))
|
.align(Alignment::new(Align::Start, Align::Start))
|
||||||
.build(true, WrapMode::Word, 64);
|
.build(Some(64));
|
||||||
|
|
||||||
output_code.get_input().set_editable(false);
|
output_code.get_input().set_editable(false);
|
||||||
|
|
||||||
|
for input in [&input_code, &output_code] {
|
||||||
|
input.get_input().set_monospace(true);
|
||||||
|
input.get_input().set_wrap_mode(WrapMode::Word);
|
||||||
|
}
|
||||||
|
|
||||||
let clear_input_button = Button::builder()
|
let clear_input_button = Button::builder()
|
||||||
.set_align(Alignment::new(Align::Fill, Align::Fill))
|
.set_align(Alignment::new(Align::Fill, Align::Fill))
|
||||||
.label("Очистка полей")
|
.label("Очистка полей")
|
||||||
@@ -42,13 +45,15 @@ pub fn hamming_code_page(wrapper: &Box) {
|
|||||||
|
|
||||||
let crypt_mode_label = Label::builder().label("Режим: кодирование").build();
|
let crypt_mode_label = Label::builder().label("Режим: кодирование").build();
|
||||||
|
|
||||||
let crypt_mode_wrapper = Wrapper::col_builder()
|
let crypt_mode_wrapper = Box::builder()
|
||||||
|
.orientation(Orientation::Horizontal)
|
||||||
.set_align(Alignment::new(Align::Fill, Align::Center))
|
.set_align(Alignment::new(Align::Fill, Align::Center))
|
||||||
.hexpand(true)
|
.hexpand(true)
|
||||||
.spacing(10)
|
.spacing(10)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
let action_components_wrapper = Wrapper::col_builder()
|
let action_components_wrapper = Box::builder()
|
||||||
|
.orientation(Orientation::Horizontal)
|
||||||
.set_align(Alignment::new(Align::Fill, Align::Fill))
|
.set_align(Alignment::new(Align::Fill, Align::Fill))
|
||||||
.set_margin(MarginData::MultipleMargin((0, 5, 0, 5)))
|
.set_margin(MarginData::MultipleMargin((0, 5, 0, 5)))
|
||||||
.spacing(10)
|
.spacing(10)
|
||||||
|
|||||||
@@ -1,33 +1,29 @@
|
|||||||
use std::cell::Cell;
|
use std::{cell::Cell, rc::Rc};
|
||||||
use std::rc::Rc;
|
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
model::{builder_traits::Product, models::SignalReduce, Frequency},
|
model::{builder_traits::Product, models::SignalReduce, Frequency},
|
||||||
model_utils::signal_reducer::{
|
model_utils::signal_reducer::{find_by_frequency_value, set_default_values},
|
||||||
coef_of_signal_reduce, full_resistance_of_capacitor, reactive_resistance_of_capacitor,
|
|
||||||
voltage_from_signal_source,
|
|
||||||
},
|
|
||||||
view::{
|
view::{
|
||||||
components::{info_bar::InfoBar, input::Input},
|
components::{info_bar::InfoBar, input::Input},
|
||||||
properties::*,
|
properties::*,
|
||||||
},
|
},
|
||||||
view_utils::signal_reduce_input_utils::{get_error_message, parse_fields},
|
view_utils::signal_reduce_utils::*,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
use glib::clone;
|
||||||
|
|
||||||
|
use gio::ListStore;
|
||||||
|
|
||||||
use gtk::{
|
use gtk::{
|
||||||
prelude::{BoxExt, ButtonExt, Cast, CastNone, GridExt, ListItemExt, ListModelExt},
|
prelude::{BoxExt, ButtonExt, Cast, GridExt, SorterExt},
|
||||||
Align, WrapMode, *,
|
Align, *,
|
||||||
};
|
};
|
||||||
use gtk4 as gtk;
|
|
||||||
|
|
||||||
pub fn signal_reducing_page(wrapper: &Box) {
|
pub fn signal_reducing_page(wrapper: &Box) {
|
||||||
let values = Rc::new(Cell::new(SignalReduce::default()));
|
let values = Rc::new(Cell::new(SignalReduce::default()));
|
||||||
|
|
||||||
let info_bar = InfoBar::get_instance();
|
let info_bar = InfoBar::get_instance();
|
||||||
|
|
||||||
let (input_height, monospace, input_wrapping): (i32, bool, WrapMode) =
|
|
||||||
(24, true, WrapMode::Word);
|
|
||||||
|
|
||||||
let input_block: Grid = Grid::new();
|
let input_block: Grid = Grid::new();
|
||||||
|
|
||||||
input_block.set_column_homogeneous(true);
|
input_block.set_column_homogeneous(true);
|
||||||
@@ -38,125 +34,82 @@ pub fn signal_reducing_page(wrapper: &Box) {
|
|||||||
vertical: Align::Fill,
|
vertical: Align::Fill,
|
||||||
};
|
};
|
||||||
|
|
||||||
let input_labels: [&str; 6] = ["l, м:", "Rм, Ом", "Cм, пФ:", "Rи, Ом:", "Vи, мВ", "f, мГц:"];
|
let input_labels: [&str; 6] = [
|
||||||
|
"l, м:",
|
||||||
|
"R<sub>м</sub>, Ом",
|
||||||
|
"C<sub>м</sub>, пФ:",
|
||||||
|
"R<sub>и</sub>, Ом:",
|
||||||
|
"V<sub>и</sub>, мВ",
|
||||||
|
"f, мГц:",
|
||||||
|
];
|
||||||
|
|
||||||
let all_inputs: Vec<Input> = input_labels
|
let all_inputs: Vec<Input<Entry>> = input_labels
|
||||||
.iter()
|
.iter()
|
||||||
.map(move |label| {
|
.enumerate()
|
||||||
Input::builder()
|
.map(|(index, label)| {
|
||||||
|
let elem = Input::<Entry>::builder()
|
||||||
.label(label)
|
.label(label)
|
||||||
|
.markup(true)
|
||||||
.margins(MarginData::EqualsMargin(6))
|
.margins(MarginData::EqualsMargin(6))
|
||||||
.align(input_label_alignment)
|
.align(input_label_alignment)
|
||||||
.build(monospace, input_wrapping, input_height)
|
.build_entry(None);
|
||||||
|
|
||||||
|
let row = index as i32 / 3;
|
||||||
|
|
||||||
|
input_block.attach(elem.get(), (index as i32) - (3 * row), row, 1, 1);
|
||||||
|
|
||||||
|
elem
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let mut row_position = 0i32;
|
|
||||||
|
|
||||||
for (id, elem) in all_inputs.iter().enumerate() {
|
|
||||||
if id % 3 == 0 {
|
|
||||||
row_position += 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
input_block.attach(
|
|
||||||
elem.clone().get(),
|
|
||||||
(id as i32) - (3 * row_position),
|
|
||||||
row_position,
|
|
||||||
1,
|
|
||||||
1,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
let calculate_button = Button::builder().label("Расчитать").build();
|
let calculate_button = Button::builder().label("Расчитать").build();
|
||||||
|
|
||||||
let result_table_headers_labels: [&str; 4] = ["f, МГц", "Xc, Ом", "Vп, мВ", "ζ"];
|
let result_table_headers_labels: [&str; 4] = ["f, МГц", "Xc, Ом", "Vп, мВ", "ζ"];
|
||||||
|
|
||||||
let model = gio::ListStore::new::<Frequency>();
|
let model = ListStore::new::<Frequency>();
|
||||||
let model_for_events = model.clone();
|
|
||||||
|
|
||||||
for number in (0..=100).step_by(5) {
|
set_default_values(&model);
|
||||||
if number == 0 {
|
|
||||||
model.append(&Frequency::new(1.0));
|
|
||||||
} else if (number >= 70 && number % 10 == 0) || (number < 70 && number % 5 == 0) {
|
|
||||||
model.append(&Frequency::new(number as f64));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let selection_model = NoSelection::new(Some(model));
|
let numeric_sorter = CustomSorter::new(|a, b| {
|
||||||
|
let a = a.downcast_ref::<Frequency>().unwrap().frequency();
|
||||||
|
let b = b.downcast_ref::<Frequency>().unwrap().frequency();
|
||||||
|
|
||||||
|
a.total_cmp(&b).into()
|
||||||
|
});
|
||||||
|
|
||||||
|
let sorted_model = SortListModel::new(Some(model.clone()), Some(numeric_sorter.clone()));
|
||||||
|
|
||||||
|
let selection_model = NoSelection::new(Some(sorted_model.clone()));
|
||||||
|
|
||||||
let result_table = ColumnView::builder()
|
let result_table = ColumnView::builder()
|
||||||
.reorderable(true)
|
|
||||||
.show_row_separators(true)
|
.show_row_separators(true)
|
||||||
.model(&selection_model)
|
.model(&selection_model)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
result_table.connect_activate(clone!(
|
||||||
|
#[strong]
|
||||||
|
numeric_sorter,
|
||||||
|
move |_, _| numeric_sorter.changed(SorterChange::Different)
|
||||||
|
));
|
||||||
|
|
||||||
for label in result_table_headers_labels {
|
for label in result_table_headers_labels {
|
||||||
let factory = SignalListItemFactory::new();
|
let factory = SignalListItemFactory::new();
|
||||||
|
|
||||||
factory.connect_setup(move |_, list_item| {
|
factory.connect_setup(column_view_setup_factory);
|
||||||
list_item
|
|
||||||
.downcast_ref::<ListItem>()
|
|
||||||
.expect("Needs to be ListItem")
|
|
||||||
.set_child(Some(&Label::new(None)));
|
|
||||||
});
|
|
||||||
|
|
||||||
let values_for_factory = values.clone();
|
factory.connect_bind(clone!(
|
||||||
|
#[strong]
|
||||||
factory.connect_bind(move |_, list_item| {
|
values,
|
||||||
let cell_value = list_item
|
move |_, list| {
|
||||||
.downcast_ref::<ListItem>()
|
match label {
|
||||||
.expect("Needs to be ListItem")
|
"f, МГц" => frequency_column_fabric(list),
|
||||||
.item()
|
"Xc, Ом" => reactive_resist_fabric(list, values.get()),
|
||||||
.and_downcast::<Frequency>()
|
"Vп, мВ" => signal_source_voltage_fabric(list, values.get()),
|
||||||
.expect("The item has to be an `IntegerObject`.");
|
"ζ" => coef_fabric(list, values.get()),
|
||||||
|
_ => {}
|
||||||
let cell_label = list_item
|
|
||||||
.downcast_ref::<ListItem>()
|
|
||||||
.expect("Needs to be ListItem")
|
|
||||||
.child()
|
|
||||||
.and_downcast::<Label>()
|
|
||||||
.expect("The child has to be a `Label`.");
|
|
||||||
|
|
||||||
let result_values = values_for_factory.get();
|
|
||||||
|
|
||||||
let reactive_resist: f64 = reactive_resistance_of_capacitor(
|
|
||||||
result_values.wire_capacity * 10f64.powi(-12),
|
|
||||||
result_values.length,
|
|
||||||
cell_value.frequency() * 10f64.powi(6),
|
|
||||||
);
|
|
||||||
|
|
||||||
let full_resistance: f64 = full_resistance_of_capacitor(
|
|
||||||
reactive_resist,
|
|
||||||
result_values.source_resistance,
|
|
||||||
result_values.wire_resistance,
|
|
||||||
result_values.length,
|
|
||||||
);
|
|
||||||
|
|
||||||
let signal_source_voltage: f64 = voltage_from_signal_source(
|
|
||||||
result_values.source_voltage * 10f64.powi(-3),
|
|
||||||
reactive_resist,
|
|
||||||
full_resistance,
|
|
||||||
) * 1000.0;
|
|
||||||
|
|
||||||
match label {
|
|
||||||
"f, МГц" => {
|
|
||||||
cell_label.set_label(&cell_value.frequency().to_string());
|
|
||||||
}
|
}
|
||||||
"Xc, Ом" => {
|
|
||||||
cell_label.set_label(format!("{0:.1$}", reactive_resist, 6).as_str());
|
|
||||||
}
|
|
||||||
"Vп, мВ" => {
|
|
||||||
cell_label.set_label(format!("{0:.1$}", signal_source_voltage, 6).as_str());
|
|
||||||
}
|
|
||||||
"ζ" => {
|
|
||||||
let coef: f64 =
|
|
||||||
coef_of_signal_reduce(result_values.source_voltage, signal_source_voltage);
|
|
||||||
|
|
||||||
cell_label.set_label(format!("{0:.1$}", coef, 6).as_str());
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
});
|
));
|
||||||
|
|
||||||
let column = ColumnViewColumn::builder()
|
let column = ColumnViewColumn::builder()
|
||||||
.title(label)
|
.title(label)
|
||||||
@@ -178,20 +131,35 @@ pub fn signal_reducing_page(wrapper: &Box) {
|
|||||||
.vexpand(true)
|
.vexpand(true)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
calculate_button.connect_clicked(move |_| match parse_fields(all_inputs.clone()) {
|
calculate_button.connect_clicked(clone!(
|
||||||
Ok(results) => {
|
#[strong]
|
||||||
values.set(results);
|
model,
|
||||||
|
#[strong]
|
||||||
|
result_table,
|
||||||
|
move |_| match parse_fields(all_inputs.clone()) {
|
||||||
|
Ok(results) => {
|
||||||
|
if values.get() == results {
|
||||||
|
info_bar.set_text_label(Some("Эти данные уже были введены."));
|
||||||
|
info_bar.show_infobar(5u64);
|
||||||
|
} else {
|
||||||
|
values.set(results);
|
||||||
|
|
||||||
model_for_events.items_changed(0, 0, 18);
|
let new_elem = Frequency::new(values.get().frequency);
|
||||||
model_for_events.items_changed(18, 18, 0);
|
|
||||||
}
|
|
||||||
Err(error) => {
|
|
||||||
let error_kind: Option<&str> = get_error_message(error);
|
|
||||||
|
|
||||||
info_bar.set_text_label(error_kind);
|
if find_by_frequency_value(&model, &new_elem).is_none() {
|
||||||
info_bar.show_infobar(5u64);
|
model.append(&new_elem);
|
||||||
|
}
|
||||||
|
update_column_view(&result_table);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(error) => {
|
||||||
|
let error_kind: Option<&str> = get_error_message(error);
|
||||||
|
|
||||||
|
info_bar.set_text_label(error_kind);
|
||||||
|
info_bar.show_infobar(5u64);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
));
|
||||||
|
|
||||||
wrapper.append(&input_block);
|
wrapper.append(&input_block);
|
||||||
wrapper.append(&calculate_button);
|
wrapper.append(&calculate_button);
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
use gtk4 as gtk;
|
|
||||||
|
|
||||||
use gtk::builders::*;
|
use gtk::builders::*;
|
||||||
use gtk::Align;
|
use gtk::Align;
|
||||||
|
|
||||||
@@ -23,7 +21,6 @@ pub enum MarginData {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
|
||||||
pub struct Size {
|
pub struct Size {
|
||||||
pub width: i32,
|
pub width: i32,
|
||||||
pub height: i32,
|
pub height: i32,
|
||||||
@@ -44,27 +41,6 @@ pub trait Setters {
|
|||||||
fn set_align(self, align: Alignment) -> Self;
|
fn set_align(self, align: Alignment) -> Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait TextViewSetters {
|
|
||||||
fn set_text_view_margin(self, margin: MarginData) -> Self;
|
|
||||||
}
|
|
||||||
|
|
||||||
impl TextViewSetters for TextViewBuilder {
|
|
||||||
fn set_text_view_margin(self, margin: MarginData) -> Self {
|
|
||||||
match margin {
|
|
||||||
MarginData::EqualsMargin(margin) => self
|
|
||||||
.top_margin(margin)
|
|
||||||
.left_margin(margin)
|
|
||||||
.bottom_margin(margin)
|
|
||||||
.right_margin(margin),
|
|
||||||
MarginData::MultipleMargin(margins) => self
|
|
||||||
.top_margin(margins.0)
|
|
||||||
.left_margin(margins.1)
|
|
||||||
.bottom_margin(margins.2)
|
|
||||||
.right_margin(margins.3),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Macros
|
* Macros
|
||||||
*/
|
*/
|
||||||
@@ -97,7 +73,7 @@ macro_rules! impl_setters {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl_setters! {ButtonBuilder, EntryBuilder, TextViewBuilder,
|
impl_setters! {ButtonBuilder, EntryBuilder, TextViewBuilder,
|
||||||
BoxBuilder, SwitchBuilder, FrameBuilder, LabelBuilder}
|
BoxBuilder, SwitchBuilder, FrameBuilder, LabelBuilder, PasswordEntryBuilder}
|
||||||
|
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
impl Size {
|
impl Size {
|
||||||
|
|||||||
51
src/view/resources/help.html
Normal file
51
src/view/resources/help.html
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
<span size="x-large"><b> Код Хэмминга </b></span>
|
||||||
|
|
||||||
|
|
||||||
|
В данной лабораторной работе используется код Хэмминга 7-4, другими словами, код, который нужно закодировать, имеет длину в 4 бита, в то же время выходной код будет иметь 7 бит.
|
||||||
|
|
||||||
|
Программа умеет как кодировать ключевые слова, так и проверять их.
|
||||||
|
|
||||||
|
<b> Режим кодирования </b>
|
||||||
|
|
||||||
|
В этом режиме мы вводим код, в котором каждое "слово" имеет 4 бита. Это может выглядеть следующим образом:
|
||||||
|
|
||||||
|
<tt>1010 1100 1110 0000</tt>
|
||||||
|
|
||||||
|
Мы получим следующее:
|
||||||
|
|
||||||
|
<tt>1100110 0111100 0101010 0000000</tt>
|
||||||
|
|
||||||
|
В противном случае появится информационный блок с предупреждением: "Проверьте корректность кода".
|
||||||
|
|
||||||
|
<b> Режим проверки </b>
|
||||||
|
|
||||||
|
Данный режим проверяет код на ошибки. Проверка в лучшем случае пишет: "Все коды корректны". При ошибочно введённом коде, программа построчно отобразит в каких кодах есть ошибка.
|
||||||
|
|
||||||
|
Пример ввода аналогичен предыдущему:
|
||||||
|
|
||||||
|
<tt>1100110 0111100 0101010 0000000</tt>
|
||||||
|
|
||||||
|
Результат:
|
||||||
|
|
||||||
|
<tt>Все коды корректны.</tt>
|
||||||
|
|
||||||
|
Если мы поменяем какой-либо бит в одном или в нескольких "словах":
|
||||||
|
|
||||||
|
<tt>1100110 0011100 0101110 0000010</tt>
|
||||||
|
|
||||||
|
Мы получим результат:
|
||||||
|
<tt>
|
||||||
|
Ошибка в коде 2 [0011100], позиция ошибки 2, корректный код: [0111100];
|
||||||
|
Ошибка в коде 3 [0101110], позиция ошибки 5, корректный код: [0101010];
|
||||||
|
Ошибка в коде 4 [0000010], позиция ошибки 6, корректный код: [0000000];
|
||||||
|
</tt>
|
||||||
|
|
||||||
|
|
||||||
|
<span size="x-large"><b> Затухание сигнала </b></span>
|
||||||
|
|
||||||
|
|
||||||
|
Лабораторная работа подразумевает рассчитать для каждого из девятнадцати значений частоты реактивного сопротивление конденсатора X<sub>c</sub>, напряжение сигнала на стороне приёмника информации V<sub>п</sub> и коэффициент затухания сигнала ζ.
|
||||||
|
|
||||||
|
Значения вводятся согласно исходным данным для расчёта затухания сигнала. Значения можно вводить как с ",", так и с ".".
|
||||||
|
|
||||||
|
При вводе одних и тех же данных без изменений, будет показано предупреждение и операция расчёта не будет выполнена. Можно не менять данные в случае частоты, чтобы обновить данные расчёта в соответствии с новыми (К примеру, в случае длины провода, или сопротивления провода).
|
||||||
BIN
src/view/resources/icon.ico
Normal file
BIN
src/view/resources/icon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 166 KiB |
BIN
src/view/resources/icon.png
Normal file
BIN
src/view/resources/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1023 B |
BIN
src/view/resources/logo.png
Normal file
BIN
src/view/resources/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
1
src/view/resources/mod.rs
Normal file
1
src/view/resources/mod.rs
Normal file
@@ -0,0 +1 @@
|
|||||||
|
pub static HELP: &str = include_str!("help.html");
|
||||||
22
src/view/styles/base_dark.css
Normal file
22
src/view/styles/base_dark.css
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
label{
|
||||||
|
font-size: 11pt;
|
||||||
|
}
|
||||||
|
textview {
|
||||||
|
border-radius: 7px;
|
||||||
|
padding: 7px 8px;
|
||||||
|
background: rgba(90, 90, 90, 0.5);
|
||||||
|
outline-offset: 2px;
|
||||||
|
outline: 2px solid #81ABDF00;
|
||||||
|
transition-duration: .15s;
|
||||||
|
transition-timing-function: ease-in-out;
|
||||||
|
}
|
||||||
|
textview:focus-within {
|
||||||
|
outline-offset: -2px;
|
||||||
|
outline: 2px solid #81ABDF;
|
||||||
|
}
|
||||||
|
revealer#infobar > box {
|
||||||
|
padding: 8px;
|
||||||
|
border-spacing: 12px;
|
||||||
|
border-bottom: 1px solid lighten(darken(#f6f5f4, 10%), 5%);
|
||||||
|
background-color: #4a351b;
|
||||||
|
}
|
||||||
22
src/view/styles/base_light.css
Normal file
22
src/view/styles/base_light.css
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
label{
|
||||||
|
font-size: 11pt;
|
||||||
|
}
|
||||||
|
textview {
|
||||||
|
border-radius: 7px;
|
||||||
|
padding: 7px 8px;
|
||||||
|
background: rgba(141, 141, 141, 0.18);
|
||||||
|
outline-offset: 2px;
|
||||||
|
outline: 2px solid #81ABDF00;
|
||||||
|
transition-duration: .15s;
|
||||||
|
transition-timing-function: ease-in-out;
|
||||||
|
}
|
||||||
|
textview:focus-within {
|
||||||
|
outline-offset: -2px;
|
||||||
|
outline: 2px solid #81ABDF;
|
||||||
|
}
|
||||||
|
revealer#infobar > box {
|
||||||
|
padding: 8px;
|
||||||
|
border-spacing: 12px;
|
||||||
|
border-bottom: 1px solid lighten(darken(#f6f5f4, 18%), 5%);
|
||||||
|
background-color: #f1e6d9;
|
||||||
|
}
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#info_bar{
|
|
||||||
background-color:#F1E6D9;
|
|
||||||
padding: 5px;
|
|
||||||
font-size: 11pt;
|
|
||||||
}
|
|
||||||
#info_bar > button {
|
|
||||||
transform: scale(0.9);
|
|
||||||
background-color: transparent;
|
|
||||||
}
|
|
||||||
#info_bar > button:hover {
|
|
||||||
background-color: #00000010;
|
|
||||||
}
|
|
||||||
#info_bar > button:active {
|
|
||||||
background-color: #00000020;
|
|
||||||
}
|
|
||||||
@@ -1,15 +1,25 @@
|
|||||||
use adw::gdk::Display;
|
use adw::gdk::Display;
|
||||||
use gtk4 as gtk;
|
|
||||||
|
|
||||||
use std::path::Path;
|
|
||||||
|
|
||||||
use gtk::{
|
use gtk::{
|
||||||
style_context_add_provider_for_display, CssProvider, STYLE_PROVIDER_PRIORITY_APPLICATION,
|
style_context_add_provider_for_display, CssProvider, STYLE_PROVIDER_PRIORITY_APPLICATION, Settings
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn load_css() {
|
pub fn load_css(settings: &Settings) {
|
||||||
let style_provider = CssProvider::new();
|
let style_provider = CssProvider::new();
|
||||||
style_provider.load_from_path(Path::new("./src/view/styles/info_bar.css"));
|
|
||||||
|
let theme = settings.gtk_theme_name();
|
||||||
|
|
||||||
|
match theme {
|
||||||
|
Some(theme_type) => {
|
||||||
|
let theme_string = theme_type.to_string();
|
||||||
|
if theme_string.contains("dark") || settings.is_gtk_application_prefer_dark_theme() {
|
||||||
|
style_provider.load_from_string(include_str!("base_dark.css"));
|
||||||
|
} else {
|
||||||
|
style_provider.load_from_string(include_str!("base_light.css"));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
None => eprintln!("Theme hasn't been determined."),
|
||||||
|
}
|
||||||
|
|
||||||
style_context_add_provider_for_display(
|
style_context_add_provider_for_display(
|
||||||
&Display::default().expect("Could not connect to a display"),
|
&Display::default().expect("Could not connect to a display"),
|
||||||
|
|||||||
@@ -1,23 +1,38 @@
|
|||||||
use crate::model::builder_traits::*;
|
use crate::model::builder_traits::*;
|
||||||
|
|
||||||
use gtk4 as gtk;
|
use adw::HeaderBar;
|
||||||
|
|
||||||
use gtk::{prelude::*, StackTransitionType::SlideLeftRight, *};
|
use gtk::{prelude::*, StackTransitionType::SlideLeftRight, *};
|
||||||
use info_bar::InfoBar;
|
|
||||||
|
|
||||||
#[allow(unused)]
|
|
||||||
use crate::view::{
|
use crate::view::{
|
||||||
components::{pages::Pages, wrapper::*, *},
|
components::{
|
||||||
|
dialogues::{open_about_dialogue, open_help_dialogue},
|
||||||
|
info_bar::InfoBar,
|
||||||
|
menu::HeaderMenu,
|
||||||
|
pages::Pages,
|
||||||
|
},
|
||||||
pages::*,
|
pages::*,
|
||||||
properties::*,
|
properties::*,
|
||||||
};
|
};
|
||||||
|
|
||||||
use super::styles::load_css;
|
use super::{components::MenuActions, styles::load_css};
|
||||||
|
|
||||||
pub fn ui(application: &adw::Application) {
|
pub fn ui(application: &adw::Application) {
|
||||||
load_css();
|
|
||||||
|
|
||||||
let hamming_code = Wrapper::row_builder()
|
let default_settings = Settings::default();
|
||||||
|
|
||||||
|
if let Some(settings) = default_settings {
|
||||||
|
{
|
||||||
|
#[cfg(target_os = "windows")]
|
||||||
|
settings.set_gtk_font_name(Some("Segoe UI 9"));
|
||||||
|
}
|
||||||
|
settings.connect_gtk_application_prefer_dark_theme_notify(load_css);
|
||||||
|
settings.connect_gtk_theme_name_notify(load_css);
|
||||||
|
load_css(&settings);
|
||||||
|
}
|
||||||
|
|
||||||
|
let hamming_code = Box::builder()
|
||||||
|
.orientation(Orientation::Vertical)
|
||||||
.set_align(Alignment::new(Align::Fill, Align::Fill))
|
.set_align(Alignment::new(Align::Fill, Align::Fill))
|
||||||
.set_margin(MarginData::EqualsMargin(15))
|
.set_margin(MarginData::EqualsMargin(15))
|
||||||
.spacing(10)
|
.spacing(10)
|
||||||
@@ -25,12 +40,13 @@ pub fn ui(application: &adw::Application) {
|
|||||||
|
|
||||||
let info_bar = InfoBar::builder()
|
let info_bar = InfoBar::builder()
|
||||||
.set_text_label("Sample text")
|
.set_text_label("Sample text")
|
||||||
.set_button_icon("close")
|
.set_button_icon("window-close-symbolic")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
hamming_code::hamming_code_page(&hamming_code);
|
hamming_code::hamming_code_page(&hamming_code);
|
||||||
|
|
||||||
let signal_reducing = Wrapper::row_builder()
|
let signal_reducing = Box::builder()
|
||||||
|
.orientation(Orientation::Vertical)
|
||||||
.set_align(Alignment::new(Align::Fill, Align::Fill))
|
.set_align(Alignment::new(Align::Fill, Align::Fill))
|
||||||
.set_margin(MarginData::EqualsMargin(15))
|
.set_margin(MarginData::EqualsMargin(15))
|
||||||
.spacing(10)
|
.spacing(10)
|
||||||
@@ -51,13 +67,41 @@ pub fn ui(application: &adw::Application) {
|
|||||||
application_box.append(info_bar.get());
|
application_box.append(info_bar.get());
|
||||||
application_box.append(pages.get());
|
application_box.append(pages.get());
|
||||||
|
|
||||||
|
let title_bar = Box::new(Orientation::Horizontal, 0);
|
||||||
|
|
||||||
|
let mut menu_button = HeaderMenu::<&str>::new();
|
||||||
|
|
||||||
|
let actions: &[MenuActions] = &[
|
||||||
|
(open_about_dialogue, "about_software", "О программе"),
|
||||||
|
(open_help_dialogue, "help", "Помощь"),
|
||||||
|
];
|
||||||
|
|
||||||
|
menu_button.set_action_group_name(Some("menu_group_action"));
|
||||||
|
menu_button.append_items(actions);
|
||||||
|
|
||||||
|
title_bar.append(
|
||||||
|
&Label::builder()
|
||||||
|
.css_name("title")
|
||||||
|
.set_align(Alignment::new(Align::Center, Align::Center))
|
||||||
|
.hexpand(true)
|
||||||
|
.vexpand(true)
|
||||||
|
.use_markup(true)
|
||||||
|
.label("<span size=\"larger\"><b>Комплексная программа для лаб. работ</b></span>")
|
||||||
|
.build(),
|
||||||
|
);
|
||||||
|
title_bar.append(menu_button.get_button());
|
||||||
|
|
||||||
|
let header_bar = HeaderBar::builder().title_widget(&title_bar).build();
|
||||||
|
|
||||||
let window = ApplicationWindow::builder()
|
let window = ApplicationWindow::builder()
|
||||||
.title("Комплексная программа для лаб. работ")
|
.width_request(800)
|
||||||
.width_request(700)
|
.height_request(600)
|
||||||
.height_request(400)
|
|
||||||
.application(application)
|
.application(application)
|
||||||
|
.titlebar(&header_bar)
|
||||||
.child(&application_box)
|
.child(&application_box)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
window.show();
|
window.insert_action_group("menu_group_action", Some(menu_button.get_actions_group()));
|
||||||
|
|
||||||
|
window.present();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user