mirror of
https://github.com/hulthe/inkopslista.git
synced 2026-08-03 23:11:28 +02:00
made server address configurable
This commit is contained in:
@@ -10,22 +10,10 @@ import {
|
||||
TextEdit,
|
||||
GridBox,
|
||||
} from "std-widgets.slint";
|
||||
import { SettingsView } from "settings.slint";
|
||||
import { State, SItem } from "state.slint";
|
||||
export { State, SItem }
|
||||
|
||||
export struct SItem {
|
||||
name: string,
|
||||
checked: bool,
|
||||
}
|
||||
|
||||
export global State {
|
||||
in-out property <[SItem]> list: [
|
||||
{ name: "Test 1", checked: true },
|
||||
{ name: "Test 2", checked: false },
|
||||
{ name: "Test 3", checked: false },
|
||||
];
|
||||
callback add-to-list(string);
|
||||
callback check-item(string);
|
||||
callback delete-checked();
|
||||
}
|
||||
|
||||
component GoodListItem inherits Rectangle {
|
||||
in-out property <SItem> item;
|
||||
@@ -141,6 +129,11 @@ export component App inherits Window {
|
||||
preferred-height: 700px;
|
||||
preferred-width: 480px;
|
||||
TabWidget {
|
||||
Tab {
|
||||
title: "Settings";
|
||||
SettingsView { }
|
||||
}
|
||||
|
||||
Tab {
|
||||
title: "Add";
|
||||
AddView {
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import { VerticalBox, LineEdit } from "std-widgets.slint";
|
||||
import { State } from "state.slint";
|
||||
|
||||
export component SettingsView inherits VerticalBox {
|
||||
alignment: start;
|
||||
Text {
|
||||
text: "server address:";
|
||||
font-size: 25px;
|
||||
}
|
||||
|
||||
LineEdit {
|
||||
edited(text) => {
|
||||
State.set-server-address(text);
|
||||
}
|
||||
text: State.server-address;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
export struct SItem {
|
||||
name: string,
|
||||
checked: bool,
|
||||
}
|
||||
|
||||
export global State {
|
||||
in-out property <[SItem]> list: [
|
||||
{ name: "Test 1", checked: true },
|
||||
{ name: "Test 2", checked: false },
|
||||
{ name: "Test 3", checked: false },
|
||||
];
|
||||
callback add-to-list(string);
|
||||
callback check-item(string);
|
||||
callback delete-checked();
|
||||
in-out property <string> server-address;
|
||||
callback set-server-address(string);
|
||||
set-server-address(address) => {
|
||||
server-address = address;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user