diff --git a/Cargo.toml b/Cargo.toml index 24a7abc..09fcea0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,6 +2,7 @@ name = "iced_demo" version = "0.1.0" edition = "2021" +license = "MIT" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..fdf32e4 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2024 Imbus + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/makefile b/makefile index 3a226f9..d9a6715 100644 --- a/makefile +++ b/makefile @@ -1,6 +1,8 @@ PROJECT = $(shell basename $(CURDIR)) GITHASH = $(shell git rev-parse --short HEAD) +PROJ_NAME = iced-demo + debug: cargo run @@ -26,3 +28,15 @@ sign: release source-release publish: sign scp $(PROJECT)_$(GITHASH).tar.gz* $(PROJECT)_$(GITHASH)_source.tar.gz* server:/public/$(PROJECT)/ + +#cp packaging/$(PROJ_NAME).svg ~/.local/share/icons/ +install: release + install -Dm755 target/release/$(PROJECT) ~/.local/bin/$(PROJ_NAME) + cp packaging/$(PROJ_NAME).desktop ~/.local/share/applications/ + update-desktop-database ~/.local/share/applications/ + +uninstall: + rm -f ~/.local/bin/$(PROJ_NAME) + rm -f ~/.local/share/applications/$(PROJ_NAME).desktop + rm -f ~/.local/share/icons/$(PROJ_NAME).svg + update-desktop-database ~/.local/share/applications/ diff --git a/packaging/iced-demo.desktop b/packaging/iced-demo.desktop new file mode 100644 index 0000000..938a9e9 --- /dev/null +++ b/packaging/iced-demo.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Type=Application +Name=Iced Demo +GenericName=Iced Demo +Comment=Iced Demo is a simple demo application +Categories=Utility +Path=/home/imbus/.local/bin +Exec=iced-demo +Icon=/home/imbus/.local/share/icons/iced-demo.svg +Terminal=false +Keywords=demo diff --git a/packaging/iced-demo.svg b/packaging/iced-demo.svg new file mode 100644 index 0000000..c56707a --- /dev/null +++ b/packaging/iced-demo.svg @@ -0,0 +1,17 @@ + + + + + desktop + Created with Sketch Beta. + + + + + + + + + + + \ No newline at end of file diff --git a/packaging/iced_demo.spec b/packaging/iced_demo.spec new file mode 100644 index 0000000..eabb17f --- /dev/null +++ b/packaging/iced_demo.spec @@ -0,0 +1,53 @@ +# Generated by rust2rpm 26 +%bcond_without check + +# prevent library files from being installed +%global cargo_install_lib 0 + +Name: iced_demo +Version: 0.1.0 +Release: %autorelease +Summary: A demo application using the Iced toolkit + +SourceLicense: MIT +# FIXME: paste output of %%cargo_license_summary here +License: MIT +# LICENSE.dependencies contains a full license breakdown + +URL: https://git.silversoft.se/Imbus/iced_demo +Source: %{url}/archive/%{version}.tar.gz + +BuildRequires: cargo-rpm-macros >= 26 + +%global _description %{expand: +%{summary}.} + +%description %{_description} + +%prep +%autosetup -n %{crate}-%{version} -p1 +%cargo_prep + +%generate_buildrequires +%cargo_generate_buildrequires + +%build +%cargo_build +%{cargo_license_summary} +%{cargo_license} > LICENSE.dependencies + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif + +%files +%license LICENSE.md +%license LICENSE.dependencies +%{_bindir}/iced_demo + +%changelog +%autochangelog diff --git a/src/main.rs b/src/main.rs index 2ce4d0c..e07ddbc 100755 --- a/src/main.rs +++ b/src/main.rs @@ -26,7 +26,7 @@ pub fn main() -> iced::Result { width: 800.0, height: 600.0, }, - resizable: false, + resizable: true, decorations: true, ..window::Settings::default() }, @@ -70,6 +70,7 @@ impl Sandbox for Counter { match message { Message::InputChanged(value) => { self.input_val = value.clone(); + println!("InputChanged: {}", value); if let Ok(value) = value.parse::() { self.value = value; } @@ -90,10 +91,9 @@ impl Sandbox for Counter { } ] .width(Length::Fill) - .padding([55, 0]) + .padding([0, 0]) .align_items(Alignment::Center) .into() - // row![TextInput::new("Search", &self.input_val).on_input(Message::InputChanged)].into() } fn theme(&self) -> Theme { diff --git a/src/search_bar.rs b/src/search_bar.rs index 065c063..3d0d15f 100755 --- a/src/search_bar.rs +++ b/src/search_bar.rs @@ -11,6 +11,7 @@ use crate::{message::Message::*, Counter}; pub fn search_bar(state: &Counter) -> Element { row![TextInput::new("Search", &state.input_val) .on_input(Message::InputChanged) + .padding(Padding::from(15)) .width(300)] .into() } @@ -29,8 +30,8 @@ pub fn tabs(state: &Counter) -> Element { menu_tab_button("Settings", Tab::Settings), ] .padding(10) - .spacing(20) - .width(300) + // .spacing(20) + .width(Length::Fixed(200f32)) .height(Length::Shrink) .into() }