merge stable version #2

Merged
doryan merged 97 commits from experimental into main 2024-08-28 18:54:00 +03:00
14 changed files with 16 additions and 38 deletions
Showing only changes of commit fcc2567aa2 - Show all commits

View File

@ -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::*,

View File

@ -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;

View File

@ -1,5 +1,4 @@
use gio::glib::Object; use gio::glib::Object;
use gtk4 as gtk;
use std::str::FromStr; use std::str::FromStr;

View File

@ -1,4 +1,4 @@
use gtk4 as gtk; #![windows_subsystem = "windows"]
extern crate gio; extern crate gio;

View File

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

View File

@ -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::*,

View File

@ -1,10 +1,9 @@
use adw::HeaderBar; use adw::HeaderBar;
use gio::{glib::Variant, SimpleAction}; use gio::{glib::Variant, SimpleAction};
use gtk4 as gtk;
use gtk::{ use gtk::{
prelude::{BoxExt, GtkWindowExt}, prelude::{BoxExt, GtkWindowExt},
AboutDialog, Box, Image, Label, Orientation, ScrolledWindow, Window, AboutDialog, Box, Image, Label, Orientation, ScrolledWindow, Window, License, NaturalWrapMode, PolicyType
}; };
use std::path::Path; use std::path::Path;
@ -24,7 +23,7 @@ pub fn open_about_dialogue(_action: &SimpleAction, _var: Option<&Variant>) {
.authors(vec!["Сагиев А.Д.", "Ефимов И.П."]) .authors(vec!["Сагиев А.Д.", "Ефимов И.П."])
.version("1.0-beta") .version("1.0-beta")
.program_name("Прикладная теория информаций") .program_name("Прикладная теория информаций")
.license_type(gtk4::License::Apache20) .license_type(License::Apache20)
.logo(&logo) .logo(&logo)
.website("https://gitea.doryan04.ru/doryan/AIT") .website("https://gitea.doryan04.ru/doryan/AIT")
.build() .build()
@ -44,7 +43,7 @@ pub fn open_help_dialogue(_action: &SimpleAction, _var: Option<&Variant>) {
.width_request(400) .width_request(400)
.max_width_chars(50) .max_width_chars(50)
.single_line_mode(false) .single_line_mode(false)
.natural_wrap_mode(gtk4::NaturalWrapMode::Word) .natural_wrap_mode(NaturalWrapMode::Word)
.label(crate::view::resources::HELP) .label(crate::view::resources::HELP)
.build(); .build();
@ -52,7 +51,7 @@ pub fn open_help_dialogue(_action: &SimpleAction, _var: Option<&Variant>) {
let scrollable = ScrolledWindow::builder() let scrollable = ScrolledWindow::builder()
.child(&help) .child(&help)
.hscrollbar_policy(gtk4::PolicyType::Never) .hscrollbar_policy(PolicyType::Never)
.build(); .build();
let custom_header = HeaderBar::new(); let custom_header = HeaderBar::new();

View File

@ -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;
@ -94,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
} }

View File

@ -1,5 +1,3 @@
use gtk4 as gtk;
use crate::{model::builder_traits::*, view::properties::*}; use crate::{model::builder_traits::*, view::properties::*};
use gtk::{prelude::*, *}; use gtk::{prelude::*, *};

View File

@ -1,7 +1,5 @@
use std::fmt::{Debug, Display}; use std::fmt::{Debug, Display};
use gtk4 as gtk;
use gio::{ use gio::{
glib::Variant, prelude::ActionMapExtManual, ActionEntry, Menu, SimpleAction, SimpleActionGroup, glib::Variant, prelude::ActionMapExtManual, ActionEntry, Menu, SimpleAction, SimpleActionGroup,
}; };

View File

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

View File

@ -1,5 +1,3 @@
use gtk4 as gtk;
use crate::{ use crate::{
model::builder_traits::Product, model::builder_traits::Product,
view::{ view::{

View File

@ -19,8 +19,6 @@ use gtk::{
Align, *, 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()));

View File

@ -1,5 +1,3 @@
use gtk4 as gtk;
use gtk::builders::*; use gtk::builders::*;
use gtk::Align; use gtk::Align;