Using git_version as title

This commit is contained in:
Imbus 2024-05-11 10:26:57 +02:00
parent d4e06590ac
commit c378de371e

View file

@ -1,7 +1,9 @@
use iced::theme::{self, Theme}; use iced::theme::{self, Theme};
use iced::widget::{button, column, row, text}; use iced::widget::{button, column, row, text};
use iced::widget::{text_input, TextInput}; use iced::widget::{text_input, TextInput};
use iced::{Alignment, Color, Element, Length, Sandbox, Settings}; use iced::{window, Alignment, Color, Element, Length, Sandbox, Settings, Size};
use git_version::git_version;
mod my_theme; mod my_theme;
use my_theme::{get_theme, FromHexColor, OneDark}; use my_theme::{get_theme, FromHexColor, OneDark};
@ -12,8 +14,23 @@ use search_bar::*;
mod message; mod message;
use message::*; use message::*;
// Static string to get the git hash
pub const GIT_HASH: &'static str = git_version!();
pub fn main() -> iced::Result { pub fn main() -> iced::Result {
Counter::run(Settings::default()) let settings: Settings<()> = Settings {
window: window::Settings {
size: Size {
width: 800.0,
height: 600.0,
},
resizable: false,
decorations: true,
..window::Settings::default()
},
..Default::default()
};
Counter::run(settings)
} }
struct AppSettings { struct AppSettings {
@ -44,7 +61,7 @@ impl Sandbox for Counter {
} }
fn title(&self) -> String { fn title(&self) -> String {
String::from("Counter - Iced") format!("TFTool - {}", GIT_HASH)
} }
fn update(&mut self, message: Message) { fn update(&mut self, message: Message) {