Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: containers, nix, appman, flatseal and redshift #68

Merged
merged 35 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
10ea250
feat: containers, nix, zap and redshift
D-Brox Jun 21, 2024
37aa0b0
chore: update versions
D-Brox Jun 22, 2024
2b57670
chore: cargo fmt
D-Brox Jun 25, 2024
9520c0f
chore: cargo clippy
D-Brox Jun 25, 2024
fc1f0dd
fix: cargo clippy again
D-Brox Jun 25, 2024
f45e2bd
fix: cargo fmt once more
D-Brox Jun 25, 2024
735c9f7
chan: replace zap with appman
D-Brox Jul 26, 2024
565869b
fix: arch and apt/pacstall container packages
D-Brox Jul 26, 2024
f5dac55
fix: `-Q` flag
D-Brox Jul 26, 2024
aab2f87
feat: add flatseal
D-Brox Jul 26, 2024
e728a61
ref: no need to git clone
D-Brox Jul 26, 2024
63a8e0b
fix: cargo fmt, yet again
D-Brox Jul 26, 2024
3c42e74
upd: relm4 v0.9
D-Brox Jul 26, 2024
18e92a7
fix: `time` on rust 1.80 regression
D-Brox Jul 27, 2024
1b3de8e
fix: docker as user, remove docker-desktop
D-Brox Jul 27, 2024
362d1dc
fix: shell commands
D-Brox Aug 2, 2024
e30df5d
fix: `tabs` command issue on `pacstall -U`
D-Brox Aug 3, 2024
4c0d671
fix
oklopfer Aug 8, 2024
02d84d0
fix more
oklopfer Aug 8, 2024
91dd4cb
fix more more
oklopfer Aug 8, 2024
bdceb18
fix rust fmt
oklopfer Aug 8, 2024
4ed2462
ok
oklopfer Aug 8, 2024
e0585bf
no forcy part 1
oklopfer Aug 8, 2024
0367aaf
fix force 2
oklopfer Aug 8, 2024
7921ef1
remove unused profile
oklopfer Aug 8, 2024
e567467
more fixy fixy
oklopfer Aug 9, 2024
505c505
fix again
oklopfer Aug 13, 2024
5859e38
fix again again
oklopfer Aug 13, 2024
bdba63c
ok lmao
oklopfer Aug 13, 2024
28306d5
user usage is a regression
oklopfer Aug 13, 2024
be199cc
ok whatever
oklopfer Aug 14, 2024
3444c87
thats what I thought
oklopfer Aug 14, 2024
c7d2962
fix flatpak theme stuffs
oklopfer Aug 14, 2024
7aff931
yes sir
oklopfer Aug 14, 2024
587da53
pass -y
oklopfer Aug 14, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
593 changes: 339 additions & 254 deletions Cargo.lock

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rhino-setup"
version = "0.1.0"
version = "0.2.0"
edition = "2021"

[profile.release]
Expand All @@ -10,8 +10,9 @@ lto = true

[dependencies]
gettext-rs = { version = "0.7.0", features = ["gettext-system"] }
relm4 = { version = "0.5.1", features = ["libadwaita"] }
relm4-components = "0.5.1"
relm4 = { version = "0.9.0", features = ["libadwaita"] }
relm4-components = "0.9.1"
tracing = "0.1.37"
tracing-appender = "0.2.2"
tracing-subscriber = "0.3.17"
time = "=0.3.36"
94 changes: 51 additions & 43 deletions src/carousel.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
use relm4::adw::prelude::*;
use relm4::{adw, Component, ComponentController, ComponentParts, Controller, SimpleComponent};

use crate::containers::{ContainersModel, ContainersOutput};
use crate::done::DoneModel;
use crate::extra_settings::{ExtraSettingsModel, ExtraSettingsOutput};
use crate::package_manager::{PackageManagerModel, PackageManagerOutput};
use crate::progress::{ProgressInput, ProgressModel, ProgressOutput};
use crate::theme::{ThemeModel, ThemeOutput};
use crate::welcome::{WelcomeModel, WelcomeOutput};

pub(crate) struct CarouselModel {
current_page: u32,
pub(crate) struct CarouselPagesModel {
current: u32,

welcome_page: Controller<WelcomeModel>,
theme_page: Controller<ThemeModel>,
package_manager_page: Controller<PackageManagerModel>,
extra_settings_page: Controller<ExtraSettingsModel>,
progress_page: Controller<ProgressModel>,
done_page: Controller<DoneModel>,
welcome: Controller<WelcomeModel>,
theme: Controller<ThemeModel>,
package_manager: Controller<PackageManagerModel>,
containers: Controller<ContainersModel>,
extra_settings: Controller<ExtraSettingsModel>,
progress: Controller<ProgressModel>,
done: Controller<DoneModel>,
}

#[derive(Debug)]
Expand All @@ -27,7 +29,7 @@ pub(crate) enum CarouselInput {
/// Move to the previous page.
PreviousPage,
/// An error has occurred in one of the pages.
/// Move to the [crate::done] page, with the error state.
/// Move to the [`crate::done`] page, with the error state.
SkipToErrorPage,
}

Expand All @@ -40,7 +42,7 @@ pub(crate) enum CarouselOutput {
}

#[relm4::component(pub)]
impl SimpleComponent for CarouselModel {
impl SimpleComponent for CarouselPagesModel {
type Init = ();
type Input = CarouselInput;
type Output = CarouselOutput;
Expand All @@ -55,54 +57,60 @@ impl SimpleComponent for CarouselModel {
set_allow_mouse_drag: false,
set_allow_long_swipes: false,

append: model.welcome_page.widget(),
append: model.theme_page.widget(),
append: model.package_manager_page.widget(),
append: model.extra_settings_page.widget(),
append: model.progress_page.widget(),
append: model.done_page.widget(),
append: model.welcome.widget(),
append: model.theme.widget(),
append: model.package_manager.widget(),
append: model.containers.widget(),
append: model.extra_settings.widget(),
append: model.progress.widget(),
append: model.done.widget(),
}
}

fn init(
_init: Self::Init,
root: &Self::Root,
root: Self::Root,
sender: relm4::ComponentSender<Self>,
) -> relm4::ComponentParts<Self> {
let model = CarouselModel {
current_page: 0,
welcome_page: WelcomeModel::builder().launch(()).forward(
sender.input_sender(),
|msg| match msg {
WelcomeOutput::NextPage => CarouselInput::NextPage,
},
),
theme_page: ThemeModel::builder()
let model = CarouselPagesModel {
current: 0,
welcome: WelcomeModel::builder()
.launch(())
.forward(sender.input_sender(), |msg| match msg {
WelcomeOutput::NextPage => CarouselInput::NextPage,
}),
theme: ThemeModel::builder().launch(()).forward(
sender.input_sender(),
|msg| match msg {
ThemeOutput::NextPage => CarouselInput::NextPage,
ThemeOutput::ErrorOccured => CarouselInput::SkipToErrorPage,
}),
package_manager_page: PackageManagerModel::builder().launch(()).forward(
},
),
package_manager: PackageManagerModel::builder().launch(()).forward(
sender.input_sender(),
|msg| match msg {
PackageManagerOutput::NextPage => CarouselInput::NextPage,
},
),
extra_settings_page: ExtraSettingsModel::builder().launch(()).forward(
containers: ContainersModel::builder().launch(()).forward(
sender.input_sender(),
|msg| match msg {
ExtraSettingsOutput::NextPage => CarouselInput::NextPage,
ContainersOutput::NextPage => CarouselInput::NextPage,
},
),
progress_page: ProgressModel::builder().launch(()).forward(
extra_settings: ExtraSettingsModel::builder().launch(()).forward(
sender.input_sender(),
|msg| match msg {
ProgressOutput::InstallationComplete => CarouselInput::NextPage,
ProgressOutput::InstallationError => CarouselInput::SkipToErrorPage,
ExtraSettingsOutput::NextPage => CarouselInput::NextPage,
},
),
done_page: DoneModel::builder().launch(()).detach(),
progress: ProgressModel::builder()
.launch(())
.forward(sender.input_sender(), |msg| match msg {
ProgressOutput::InstallationComplete => CarouselInput::NextPage,
ProgressOutput::InstallationError => CarouselInput::SkipToErrorPage,
}),
done: DoneModel::builder().launch(()).detach(),
};

let widgets = view_output!();
Expand All @@ -113,36 +121,36 @@ impl SimpleComponent for CarouselModel {
fn update(&mut self, message: Self::Input, sender: relm4::ComponentSender<Self>) {
match message {
CarouselInput::NextPage => {
self.current_page += 1;
self.current += 1;

// If the user hasn't reached the progress page yet.
if self.current_page < 4 {
if self.current < 5 {
sender.output(CarouselOutput::ShowBackButton).unwrap();
}

// When the user is at the progress page.
if self.current_page == 4 {
if self.current == 5 {
// Hide the back button, as the user is not supposed to return to previous pages
// after this point.
sender.output(CarouselOutput::HideBackButton).unwrap();

self.progress_page
self.progress
.sender()
.send(ProgressInput::StartInstallation)
.unwrap();
}
},
CarouselInput::PreviousPage => {
self.current_page -= 1;
self.current -= 1;

// When on the first page (pages starts from 0), disable the back button.
if self.current_page == 0 {
if self.current == 0 {
sender.output(CarouselOutput::HideBackButton).unwrap();
}
},
CarouselInput::SkipToErrorPage => {
self.current_page = 5;
self.done_page
self.current = 6;
self.done
.sender()
.send(crate::done::DoneInput::SwitchToErrorState)
.unwrap();
Expand All @@ -151,5 +159,5 @@ impl SimpleComponent for CarouselModel {
}
}

fn post_view() { carousel.scroll_to(&carousel.nth_page(model.current_page), true); }
fn post_view() { carousel.scroll_to(&carousel.nth_page(model.current), true); }
}
Loading
Loading