qleany 1.7.2

Architecture generator for Rust and C++/Qt applications.
import { LineEdit, ProgressIndicator } from "std-widgets.slint";
import { ProjectTabState } from "../globals.slint";
import { Paper, FormField, StyledLineEdit, StyledComboBox, Alert } from "../components/misc.slint";


export component ProjectTab inherits Rectangle {
    background: #ffffff;

    VerticalLayout {
        padding: 5px;
        spacing: 0px;

        // Title
        Text {
            text: "Project Settings";
            font-size: 28px;
            font-weight: 700;
            color: #212529;
        }

        // Form in Paper
        Paper {
            with-border: true;
            
            VerticalLayout {
                padding: 16px;
                spacing: 16px;

                FormField {
                    label: "Language";
                    required: true;
                    
                    language-combo := StyledComboBox {
                        current-value <=> ProjectTabState.language;
                        model: ["Rust", "C++ / Qt"];
                        selected(val) => {
                            ProjectTabState.language_changed(val);
                        }
                    }
                }

                FormField {
                    label: "Application Name";
                    required: true;
                    error-message: ProjectTabState.application_name == "" ? "Application name is required" : "";
                    
                    StyledLineEdit {
                        text <=> ProjectTabState.application_name;
                        placeholder: "Enter application name";
                        has-error: ProjectTabState.application_name == "";
                        edited(text) => {
                            ProjectTabState.application_name_changed(text);
                        }
                    }
                }

                FormField {
                    label: "Organisation Name";
                    required: true;
                    error-message: ProjectTabState.organisation_name == "" ? "Organisation name is required" : "";
                    
                    StyledLineEdit {
                        text <=> ProjectTabState.organisation_name;
                        placeholder: "Enter organisation name";
                        has-error: ProjectTabState.organisation_name == "";
                        edited(text) => {
                            ProjectTabState.organisation_name_changed(text);
                        }
                    }
                }

                FormField {
                    label: "Organisation Domain";
                    required: true;
                    error-message: ProjectTabState.organisation_domain == "" ? "Organisation domain is required" : "";
                    
                    StyledLineEdit {
                        text <=> ProjectTabState.organisation_domain;
                        placeholder: "Enter organisation domain (e.g., com.example)";
                        has-error: ProjectTabState.organisation_domain == "";
                        edited(text) => {
                            ProjectTabState.organisation_domain_changed(text);
                        }
                    }
                }

                FormField {
                    label: "Prefix Path";
                    
                    StyledLineEdit {
                        text <=> ProjectTabState.prefix_path;
                        placeholder: ProjectTabState.language == "Rust" ? "default: crates" : "default: src" ;
                        edited(text) => {
                            ProjectTabState.prefix_path_changed(text);
                        }
                    }
                }
            }
        }

        // Spacer
        Rectangle { vertical-stretch: 1; }
    }
}