-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
205 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { Util, Theme, Icons } from "../../def.slint"; | ||
import { About, AboutSetting, ExampleComponent } from "../../../base/widgets.slint"; | ||
|
||
export component AboutExample inherits Flickable { | ||
viewport-height: vbox.preferred-height; | ||
viewport-width: vbox.preferred-width; | ||
|
||
vbox := VerticalLayout { | ||
spacing: Theme.spacing * 20; | ||
padding-top: Theme.padding * 5; | ||
padding-bottom: Theme.padding * 5; | ||
alignment: LayoutAlignment.center; | ||
|
||
HorizontalLayout { | ||
width: root.width; | ||
alignment: LayoutAlignment.center; | ||
|
||
ExampleComponent { | ||
width: Math.max(1000px, root.width * 0.8); | ||
|
||
About { | ||
width: 60%; | ||
is-show-header: false; | ||
|
||
init => { | ||
AboutSetting.app-name = "About Example"; | ||
AboutSetting.version = "1.0.0"; | ||
AboutSetting.sponsor = ""; | ||
AboutSetting.text = "A value between 0 and 1 (or a percentage) that is used to draw the element and its children with transparency. 0 is fully transparent (invisible), and 1 is fully opaque. The opacity is applied to the tree of child elements as if they were first drawn into an intermediate layer, and then the whole layer is rendered with this opacity. (default value: 1)"; | ||
} | ||
} | ||
|
||
code: "About {\n width: 60%;\n is-show-header: false;\n\n init => {\n AboutSetting.app-name = \"About Example\";\n AboutSetting.version = \"1.0.0\";\n AboutSetting.sponsor = \"\";\n AboutSetting.text = \"A value between 0 and 1 (or a percentage) that is used to draw the element and its children with transparency. 0 is fully transparent (invisible), and 1 is fully opaque. The opacity is applied to the tree of child elements as if they were first drawn into an intermediate layer, and then the whole layer is rendered with this opacity. (default value: 1)\";\n }\n}"; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { Util, Theme, Icons } from "../../def.slint"; | ||
import { Head, ExampleComponent } from "../../../base/widgets.slint"; | ||
|
||
export component HeadExample inherits Flickable { | ||
viewport-height: vbox.preferred-height; | ||
viewport-width: vbox.preferred-width; | ||
|
||
vbox := VerticalLayout { | ||
spacing: Theme.spacing * 20; | ||
padding-top: Theme.padding * 5; | ||
padding-bottom: Theme.padding * 5; | ||
alignment: LayoutAlignment.center; | ||
|
||
HorizontalLayout { | ||
width: root.width; | ||
alignment: LayoutAlignment.center; | ||
|
||
ExampleComponent { | ||
width: Math.max(1000px, root.width * 0.8); | ||
|
||
Head { | ||
width: parent.width * 0.6; | ||
background: Theme.secondary-background; | ||
icon: Icons.home-fill; | ||
title: "Head Example"; | ||
hbox-alignment: LayoutAlignment.space-between; | ||
is-show-divider: true; | ||
icon-colorize: blue; | ||
|
||
Rectangle { | ||
background: red; | ||
width: 20%; | ||
} | ||
|
||
clicked => { | ||
debug("clicked") | ||
} | ||
} | ||
|
||
code: "Head {\n width: parent.width * 0.6;\n background: Theme.secondary-background;\n icon: Icons.home-fill;\n title: \"Head Example\";\n hbox-alignment: LayoutAlignment.space-between;\n is-show-divider: true;\n icon-colorize: blue;\n\n Rectangle {\n background: red;\n width: 20%;\n }\n\n clicked => {\n debug(\"clicked\")\n }\n}"; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { Util, Store, Theme, Icons } from "../../def.slint"; | ||
import { Help, AboutSetting, ExampleComponent } from "../../../base/widgets.slint"; | ||
|
||
export component HelpExample inherits Flickable { | ||
viewport-height: vbox.preferred-height; | ||
viewport-width: vbox.preferred-width; | ||
|
||
vbox := VerticalLayout { | ||
spacing: Theme.spacing * 20; | ||
padding-top: Theme.padding * 5; | ||
padding-bottom: Theme.padding * 5; | ||
alignment: LayoutAlignment.center; | ||
|
||
HorizontalLayout { | ||
width: root.width; | ||
alignment: LayoutAlignment.center; | ||
|
||
ExampleComponent { | ||
width: Math.max(1000px, root.width * 0.8); | ||
|
||
Help { | ||
width: 60%; | ||
is-show-header: false; | ||
background: Theme.secondary-background; | ||
border-radius: Theme.border-radius; | ||
|
||
entries: Store.is-cn ? [ | ||
"配置文件保存目录: ~/.config/slint-template", | ||
"数据库保存目录: ~/.local/share/slint-template", | ||
] : [ | ||
"Config directory: ~/.config/slint-template", | ||
"Data directory: ~/.local/share/slint-template", | ||
]; | ||
} | ||
|
||
code: "Help {\n width: 60%;\n is-show-header: false;\n background: Theme.secondary-background;\n border-radius: Theme.border-radius;\n\n entries: Store.is-cn ? [\n \"配置文件保存目录: ~/.config/slint-template\",\n \"数据库保存目录: ~/.local/share/slint-template\",\n ] : [\n \"Config directory: ~/.config/slint-template\",\n \"Data directory: ~/.local/share/slint-template\",\n ];\n}"; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { Util, Theme, Icons } from "../../def.slint"; | ||
import { News, ExampleComponent } from "../../../base/widgets.slint"; | ||
|
||
export component NewsExample inherits Flickable { | ||
viewport-height: vbox.preferred-height; | ||
viewport-width: vbox.preferred-width; | ||
|
||
vbox := VerticalLayout { | ||
spacing: Theme.spacing * 20; | ||
padding-top: Theme.padding * 5; | ||
padding-bottom: Theme.padding * 5; | ||
alignment: LayoutAlignment.center; | ||
|
||
HorizontalLayout { | ||
width: root.width; | ||
alignment: LayoutAlignment.center; | ||
|
||
ExampleComponent { | ||
width: Math.max(1000px, root.width * 0.8); | ||
|
||
News { | ||
width: parent.width * 0.6; | ||
link-text: "How to learn Slint"; | ||
pub-date: "12-15 10:12"; | ||
summary: "the character will be either a control character, or it will be mapped to a private unicode character. The mapping of these non-printable, special characters is available in the Key namespace"; | ||
author: "Heng30"; | ||
is-read: false; | ||
} | ||
|
||
code: "News {\n width: parent.width * 0.6;\n link-text: \"How to learn Slint\";\n pub-date: \"12-15 10:12\";\n summary: \"the character will be either a control character, or it will be mapped to a private unicode character. The mapping of these non-printable, special characters is available in the Key namespace\";\n author: \"Heng30\";\n is-read: false;\n}"; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters