Use naming convention for all components/widgets

This commit is contained in:
Jarrod Doyle 2024-04-10 16:50:54 +01:00
parent 658acc8b29
commit 35966bc8e3
Signed by: Jayrude
GPG Key ID: 38B57B16E7C0ADF7
7 changed files with 60 additions and 66 deletions

View File

@ -11,16 +11,16 @@ export component AppWindow inherits Window {
preferred-width: 1280px;
preferred-height: 720px;
VerticalBox {
j-rounding: 0px;
j-padding: Metrics.padding-sm;
j-spacing: Metrics.spacing-sm;
p-rounding: 0px;
p-padding: Metrics.padding-sm;
p-spacing: Metrics.spacing-sm;
background: DarkPalette.background[0];
EditorBar { }
HorizontalBox {
background: DarkPalette.background[0];
j-padding: 0px;
j-spacing: Metrics.spacing-sm;
p-padding: 0px;
p-spacing: Metrics.spacing-sm;
ToolBar { }

View File

@ -3,8 +3,8 @@ import { HorizontalBox } from "widgets/layout.slint";
export component EditorBar inherits HorizontalBox {
height: Metrics.size-xl;
j-spacing: Metrics.spacing-xl;
j-alignment: start;
p-spacing: Metrics.spacing-xl;
p-alignment: start;
Text {
color: DarkPalette.text[4];

View File

@ -15,14 +15,14 @@ export component ObjectToolPanel inherits VerticalBox {
}
Panel {
j-alignment: start;
title: @tr("Favourites");
j-elevation: 2;
p-alignment: start;
p-title: @tr("Favourites");
p-elevation: 2;
Panel {
title: "Group Name";
title-alignment: center;
j-spacing: 0px;
p-title: "Group Name";
p-title-alignment: center;
p-spacing: 0px;
Text {
height: Metrics.size-md;
@ -50,9 +50,9 @@ export component ObjectToolPanel inherits VerticalBox {
}
Panel {
title: "Group Name";
title-alignment: center;
j-spacing: 0px;
p-title: "Group Name";
p-title-alignment: center;
p-spacing: 0px;
Text {
height: Metrics.size-md;
@ -81,14 +81,14 @@ export component ObjectToolPanel inherits VerticalBox {
}
Panel {
title: @tr("Hierarchy");
j-elevation: 2;
p-title: @tr("Hierarchy");
p-elevation: 2;
vertical-stretch: 1;
HorizontalBox {
j-elevation: 2;
j-padding: 0px;
j-spacing: Metrics.spacing-md;
p-elevation: 2;
p-padding: 0px;
p-spacing: Metrics.spacing-md;
height: Metrics.size-md;
Text {
@ -99,7 +99,7 @@ export component ObjectToolPanel inherits VerticalBox {
}
Box {
j-padding: 0px;
p-padding: 0px;
Text {
color: DarkPalette.text[4];
@ -112,14 +112,14 @@ export component ObjectToolPanel inherits VerticalBox {
Box {
width: Metrics.size-md;
j-elevation: 3;
p-elevation: 3;
Rectangle { }
}
Box {
width: Metrics.size-md;
j-elevation: 3;
p-elevation: 3;
Rectangle { }
}

View File

@ -4,8 +4,8 @@ import { HorizontalBox } from "widgets/layout.slint";
export component StatusBar inherits HorizontalBox {
height: Metrics.size-lg;
j-spacing: Metrics.spacing-lg;
j-alignment: start;
p-spacing: Metrics.spacing-lg;
p-alignment: start;
Text {
color: DarkPalette.text[4];

View File

@ -11,7 +11,7 @@ component ToolBarItem inherits Button {
export component ToolBar inherits VerticalBox {
width: Metrics.size-xl;
j-alignment: start;
p-alignment: start;
ToolBarItem {
p-text: "s";

View File

@ -1,60 +1,54 @@
import {Metrics, DarkPalette} from "../theme.slint";
struct BorderStyle {
border-width: length,
border-color: brush,
border-radius: length,
}
export component HorizontalBox inherits Rectangle {
// TODO: border, shadow
in property <int> j-elevation: 1;
in property <length> j-rounding: Metrics.radius-md;
in property <length> j-padding: Metrics.padding-md;
in property <length> j-spacing: Metrics.spacing-md;
in property <LayoutAlignment> j-alignment: stretch;
in property <int> p-elevation: 1;
in property <length> p-rounding: Metrics.radius-md;
in property <length> p-padding: Metrics.padding-md;
in property <length> p-spacing: Metrics.spacing-md;
in property <LayoutAlignment> p-alignment: stretch;
background: DarkPalette.background[j-elevation];
border-radius: j-rounding;
background: DarkPalette.background[p-elevation];
border-radius: p-rounding;
clip: true;
HorizontalLayout {
alignment: j-alignment;
padding: j-padding;
spacing: j-spacing;
c-layout := HorizontalLayout {
alignment: p-alignment;
padding: p-padding;
spacing: p-spacing;
@children
}
}
export component VerticalBox inherits Rectangle {
// TODO: border, shadow
in property <int> j-elevation: 1;
in property <length> j-rounding: Metrics.radius-md;
in property <length> j-padding: Metrics.padding-md;
in property <length> j-spacing: Metrics.spacing-md;
in property <LayoutAlignment> j-alignment: stretch;
in property <int> p-elevation: 1;
in property <length> p-rounding: Metrics.radius-md;
in property <length> p-padding: Metrics.padding-md;
in property <length> p-spacing: Metrics.spacing-md;
in property <LayoutAlignment> p-alignment: stretch;
background: DarkPalette.background[j-elevation];
border-radius: j-rounding;
background: DarkPalette.background[p-elevation];
border-radius: p-rounding;
clip: true;
VerticalLayout {
alignment: j-alignment;
padding: j-padding;
spacing: j-spacing;
c-layout := VerticalLayout {
alignment: p-alignment;
padding: p-padding;
spacing: p-spacing;
@children
}
}
export component Box inherits Rectangle {
in property <int> j-elevation: 1;
in property <length> j-rounding: Metrics.radius-md;
in property <length> j-padding: Metrics.padding-md;
in property <int> p-elevation: 1;
in property <length> p-rounding: Metrics.radius-md;
in property <length> p-padding: Metrics.padding-md;
background: DarkPalette.background[j-elevation];
border-radius: j-rounding;
background: DarkPalette.background[p-elevation];
border-radius: p-rounding;
clip: true;
padding: j-padding;
padding: p-padding;
@children
}

View File

@ -2,16 +2,16 @@ import { Metrics, DarkPalette } from "../theme.slint";
import { VerticalBox } from "layout.slint";
export component Panel inherits VerticalBox {
in property <string> title: "Title";
in property <TextHorizontalAlignment> title-alignment: left;
in property <string> p-title: "Title";
in property <TextHorizontalAlignment> p-title-alignment: left;
Text {
c-title := Text {
height: Metrics.size-md;
color: DarkPalette.text[4];
font-size: Metrics.font-md;
text: title;
text: p-title;
vertical-alignment: center;
horizontal-alignment: title-alignment;
horizontal-alignment: p-title-alignment;
}
@children