summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/build.yml2
-rw-r--r--Cargo.toml69
-rw-r--r--PKGBUILD2
-rw-r--r--src/main.rs24
-rw-r--r--src/types/element_name.rs4
-rw-r--r--src/types/project.rs7
-rwxr-xr-xsrc/types/rendered_element.rs42
7 files changed, 80 insertions, 70 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 858f951..ded4bfb 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -10,7 +10,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- rust-version: [stable, nightly, 1.85.0]
+ rust-version: [stable, nightly, 1.88.0]
steps:
- uses: hecrj/setup-rust-action@v2
with:
diff --git a/Cargo.toml b/Cargo.toml
index 3396c1e..256833b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,14 +1,14 @@
[package]
name = "iced_builder"
description = "UI builder for iced, built with iced."
-version = "0.1.0"
-edition = "2024"
-authors = ["pml68 <contact@pml68.dev>"]
-repository = "https://github.com/pml68/iced-builder"
-license = "GPL-3.0-or-later"
-categories = ["gui"]
-keywords = ["gui", "ui", "graphics", "interface", "widgets"]
-rust-version = "1.85.0"
+version.workspace = true
+edition.workspace = true
+authors.workspace = true
+repository.workspace = true
+license.workspace = true
+categories.workspace = true
+keywords.workspace = true
+rust-version.workspace = true
[dependencies]
iced.workspace = true
@@ -28,6 +28,37 @@ fxhash.workspace = true
thiserror.workspace = true
dirs-next.workspace = true
+[build-dependencies]
+iced_fontello = { path = "iced_fontello" }
+
+[target.'cfg(target_os = "macos")'.dependencies]
+xdg = "3.0.0"
+
+[target.'cfg(windows)'.build-dependencies]
+embed-resource = "3.0.4"
+windows_exe_info = "0.5.2"
+
+[lints]
+workspace = true
+
+[[bin]]
+name = "iced-builder"
+path = "src/main.rs"
+
+[workspace]
+members = ["iced_fontello"]
+default-members = ["."]
+
+[workspace.package]
+version = "0.1.0"
+edition = "2024"
+authors = ["pml68 <contact@pml68.dev>"]
+repository = "https://github.com/pml68/iced-builder"
+license = "GPL-3.0-or-later"
+categories = ["gui"]
+keywords = ["gui", "ui", "graphics", "interface", "widgets"]
+rust-version = "1.88.0"
+
[workspace.dependencies]
iced_widget = { git = "https://github.com/pml68/iced", branch = "feat/rehighlight-on-redraw" }
iced_anim = { git = "https://github.com/pml68/iced_anim", features = ["derive"] }
@@ -58,16 +89,6 @@ git = "https://github.com/pml68/iced_material"
branch = "iced/personal"
features = ["animate", "serde", "dialog", "svg"]
-[build-dependencies]
-iced_fontello = { path = "iced_fontello" }
-
-[target.'cfg(target_os = "macos")'.dependencies]
-xdg = "3.0.0"
-
-[target.'cfg(windows)'.build-dependencies]
-embed-resource = "3.0.4"
-windows_exe_info = "0.5.2"
-
[profile.dev]
opt-level = 1
@@ -87,20 +108,12 @@ opt-level = 3
overflow-checks = false
strip = "debuginfo"
-[[bin]]
-name = "iced-builder"
-path = "src/main.rs"
-
-[workspace]
-members = ["iced_fontello"]
-default-members = ["."]
-
-[lints.rust]
+[workspace.lints.rust]
missing_debug_implementations = "deny"
unsafe_code = "deny"
unused_results = "deny"
-[lints.clippy]
+[workspace.lints.clippy]
type-complexity = "allow"
uninlined_format_args = "allow"
semicolon_if_nothing_returned = "deny"
diff --git a/PKGBUILD b/PKGBUILD
index 8b1f1f4..a26dcde 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,7 +1,7 @@
# Maintainer: pml68 <contact@pml68.dev>
pkgname=iced-builder
-pkgver=0.1.0.r189.gec42d61
+pkgver=0.1.0.r189.g04542e8
pkgrel=1
pkgdesc='UI builder for iced, built with iced.'
arch=(x86_64)
diff --git a/src/main.rs b/src/main.rs
index 545f176..389c827 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -101,13 +101,14 @@ impl IcedBuilder {
let mut tasks =
vec![Task::perform(Config::load(), Message::ConfigLoad)];
- if let Some(path) = project_path.as_deref() {
- if path.exists() && path.is_file() {
- tasks.push(Task::perform(
- Project::from_path(path.to_path_buf()),
- Message::FileOpened,
- ));
- }
+ if let Some(path) = project_path.as_deref()
+ && path.exists()
+ && path.is_file()
+ {
+ tasks.push(Task::perform(
+ Project::from_path(path.to_path_buf()),
+ Message::FileOpened,
+ ));
}
(
@@ -159,10 +160,8 @@ impl IcedBuilder {
self.config = config;
self.theme.settle_at(self.config.selected_theme());
- if let Some(path) = self
- .config
- .last_project()
- .filter(|_| self.project_path.is_none())
+ if let Some(path) = self.config.last_project()
+ && self.project_path.is_none()
{
if path.exists() && path.is_file() {
return Task::perform(
@@ -378,7 +377,8 @@ impl IcedBuilder {
match result {
Ok((path, project)) => {
self.project = project;
- self.project_path = Some(path);
+ self.project_path =
+ Some(path.canonicalize().unwrap_or(path));
return Task::done(
ConfigChangeType::LastProject.into(),
diff --git a/src/types/element_name.rs b/src/types/element_name.rs
index 186285d..c824fc5 100644
--- a/src/types/element_name.rs
+++ b/src/types/element_name.rs
@@ -38,8 +38,8 @@ impl ElementName {
Self::Svg(_) => svg(""),
Self::Image(_) => image(""),
Self::Container => container(None),
- Self::Row => row(None),
- Self::Column => column(None),
+ Self::Row => row(vec![]),
+ Self::Column => column(vec![]),
};
match action {
Action::Stop | Action::Drop => Ok(None),
diff --git a/src/types/project.rs b/src/types/project.rs
index 9f78445..5bd986f 100644
--- a/src/types/project.rs
+++ b/src/types/project.rs
@@ -66,9 +66,10 @@ impl Project {
use tokio::fs;
let path = if let Some(p) = path {
- let parent = p.parent();
- if parent.is_some_and(|parent| !parent.exists()) {
- fs::create_dir_all(parent.unwrap()).await?;
+ if let Some(parent) = p.parent()
+ && !parent.exists()
+ {
+ fs::create_dir_all(parent).await?;
}
p
diff --git a/src/types/rendered_element.rs b/src/types/rendered_element.rs
index b7fd839..be2a004 100755
--- a/src/types/rendered_element.rs
+++ b/src/types/rendered_element.rs
@@ -95,12 +95,11 @@ impl RenderedElement {
let Some(parent) = self.find_parent(element) else {
return;
};
- if let Some(child_elements) = parent.child_elements.as_mut() {
- if let Some(index) =
+ if let Some(child_elements) = parent.child_elements.as_mut()
+ && let Some(index) =
child_elements.iter().position(|x| x == element)
- {
- let _ = child_elements.remove(index);
- }
+ {
+ let _ = child_elements.remove(index);
}
}
@@ -525,25 +524,22 @@ pub fn container(content: Option<RenderedElement>) -> RenderedElement {
])
}
-pub fn row(child_elements: Option<Vec<RenderedElement>>) -> RenderedElement {
- RenderedElement::with(ElementName::Row, child_elements.unwrap_or_default())
- .preset_options(&[
- "spacing", "padding", "width", "height", "align_y", "clip",
- ])
+pub fn row(child_elements: Vec<RenderedElement>) -> RenderedElement {
+ RenderedElement::with(ElementName::Row, child_elements).preset_options(&[
+ "spacing", "padding", "width", "height", "align_y", "clip",
+ ])
}
-pub fn column(child_elements: Option<Vec<RenderedElement>>) -> RenderedElement {
- RenderedElement::with(
- ElementName::Column,
- child_elements.unwrap_or_default(),
+pub fn column(child_elements: Vec<RenderedElement>) -> RenderedElement {
+ RenderedElement::with(ElementName::Column, child_elements).preset_options(
+ &[
+ "spacing",
+ "padding",
+ "width",
+ "height",
+ "max_width",
+ "align_x",
+ "clip",
+ ],
)
- .preset_options(&[
- "spacing",
- "padding",
- "width",
- "height",
- "max_width",
- "align_x",
- "clip",
- ])
}