* advotracker: the framework project * crate/advotrackerdb: implementation of the database backend * crate/advotrackerd: implementation of the backend (daemon) * crate/adovtracker: implementaton of the application (CLI and GUI) Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
140 lines
5.3 KiB
Rust
140 lines
5.3 KiB
Rust
/*
|
|
* advotracker - Hotline tackingtool for Advocats
|
|
*
|
|
* Copyright 2020 Ralf Zerres <ralf.zerres@networkx.de>
|
|
* SPDX-License-Identifier: (0BSD or MIT)
|
|
*/
|
|
|
|
use orbtk::prelude::*;
|
|
|
|
use crate::{
|
|
data::constants::*,
|
|
widgets::configuration::configuration_state::{ConfigurationAction, ConfigurationState},
|
|
};
|
|
|
|
// Macro that initializes the widget structures/variables for our view
|
|
widget!(
|
|
ConfigurationView<ConfigurationState> {
|
|
configuration_file: String,
|
|
language_id: String
|
|
}
|
|
);
|
|
|
|
/// The template implementation of the configuration view
|
|
/// All GUI elements are styled using the "style" attribute referencing to a ron based css
|
|
impl Template for ConfigurationView {
|
|
fn template(self, id: Entity, ctx: &mut BuildContext<'_>) -> Self {
|
|
self.child(
|
|
Grid::new()
|
|
.id(ID_CONFIGURATION_FORM)
|
|
.style("configuration_form")
|
|
.columns(
|
|
Columns::create()
|
|
.push(120)
|
|
.push(12)
|
|
.push("auto")
|
|
)
|
|
.rows(Rows::create()
|
|
.push("auto") // Header_Bar
|
|
.push(4) // Seperator
|
|
.push("auto") // Configuartion_File
|
|
.push(4) // Seperator
|
|
.push("auto") // Language_ID
|
|
.push(12) // Seperator
|
|
.push("auto"), // Action
|
|
)
|
|
.child(
|
|
TextBlock::new()
|
|
.id(ID_CONFIGURATION_HEADER)
|
|
.h_align("start")
|
|
.attach(Grid::column(0))
|
|
.attach(Grid::row(0))
|
|
.attach(Grid::column_span(3))
|
|
.text("Configuration settings")
|
|
.style("header")
|
|
.build(ctx),
|
|
)
|
|
.child(
|
|
TextBlock::new()
|
|
.id(ID_CONFIGURATION_LABEL_CONFIG_FILE)
|
|
.attach(Grid::column(0))
|
|
.attach(Grid::row(2))
|
|
.v_align("center")
|
|
.h_align("end")
|
|
.text("Configuration file")
|
|
.build(ctx),
|
|
)
|
|
.child(
|
|
TextBox::new()
|
|
.id(ID_CONFIGURATION_CONFIG_FILE)
|
|
.attach(Grid::column(2))
|
|
.attach(Grid::row(2))
|
|
.text(("configuration_file", id))
|
|
.water_mark("Filename...")
|
|
.build(ctx),
|
|
)
|
|
.child(
|
|
TextBlock::new()
|
|
.id(ID_CONFIGURATION_LABEL_LANGUAGE_ID)
|
|
.attach(Grid::column(0))
|
|
.attach(Grid::row(4))
|
|
.v_align("center")
|
|
.h_align("end")
|
|
.text("Language Id")
|
|
.build(ctx),
|
|
)
|
|
.child(
|
|
TextBox::new()
|
|
.id(ID_CONFIGURATION_LANGUAGE_ID)
|
|
.attach(Grid::column(2))
|
|
.attach(Grid::row(4))
|
|
.text(("language_id", id))
|
|
.water_mark("Locale Identifier...")
|
|
.build(ctx),
|
|
)
|
|
.child(
|
|
Grid::new()
|
|
.h_align("center")
|
|
.attach(Grid::column(0))
|
|
.attach(Grid::row(6))
|
|
.attach(Grid::column_span(3))
|
|
.columns(
|
|
Columns::create()
|
|
.push("auto")
|
|
.push(8)
|
|
.push("auto")
|
|
)
|
|
.rows(Rows::create()
|
|
.push("auto")
|
|
)
|
|
.child(
|
|
Button::new()
|
|
.style("button_single_content")
|
|
.attach(Grid::column(0))
|
|
.attach(Grid::row(0))
|
|
.text("Load")
|
|
.on_click(move |ctx, _| {
|
|
ctx.send_message(ConfigurationAction::LoadConfiguration, id);
|
|
true
|
|
})
|
|
.build(ctx),
|
|
)
|
|
.child(
|
|
Button::new()
|
|
.text("Save")
|
|
.style("button_single_content")
|
|
.attach(Grid::column(2))
|
|
.attach(Grid::row(0))
|
|
.on_click(move |ctx, _| {
|
|
ctx.send_message(ConfigurationAction::SaveConfiguration, id);
|
|
true
|
|
})
|
|
.build(ctx),
|
|
)
|
|
.build(ctx),
|
|
)
|
|
.build(ctx),
|
|
)
|
|
}
|
|
}
|