Make all properties configurable
- No more hard-coded properties except default values.
This commit is contained in:
parent
263cbabfdf
commit
a1bc1feb7b
@ -1,14 +1,25 @@
|
|||||||
component PowerMenuButton {
|
component PowerMenuButton {
|
||||||
in property <string> option_icon: "O";
|
in property <int> btn_width;
|
||||||
in property <string> option_name: "Log out";
|
in property <int> btn_height;
|
||||||
|
in property <int> btn_border_radius;
|
||||||
|
|
||||||
in property <int> btn_width: 120;
|
in property <color> btn_bg_normal;
|
||||||
in property <int> btn_height: 120;
|
in property <color> btn_bg_hover;
|
||||||
in property <int> btn_border_radius: 20;
|
in property <color> btn_bg_clicked;
|
||||||
|
|
||||||
in property <color> btn_bg_normal: #91919175;
|
in property <string> option_icon: "";
|
||||||
in property <color> btn_bg_hover: #92929284;
|
in property <int> option_icon_height;
|
||||||
in property <color> btn_bg_clicked: #9b9b9bab;
|
in property <int> icon_font_size;
|
||||||
|
in property <string> icon_font;
|
||||||
|
in property <color> icon_font_color;
|
||||||
|
|
||||||
|
in property <string> option_text: "Menu Option";
|
||||||
|
in property <int> option_text_height;
|
||||||
|
in property <int> option_text_font_size;
|
||||||
|
in property <string> option_text_font;
|
||||||
|
in property <color> option_text_color;
|
||||||
|
|
||||||
|
callback menu_btn_callback();
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: btn_width *1px;
|
width: btn_width *1px;
|
||||||
@ -22,7 +33,6 @@ component PowerMenuButton {
|
|||||||
: touch_area.has-hover ? btn_bg_hover
|
: touch_area.has-hover ? btn_bg_hover
|
||||||
: btn_bg_normal;
|
: btn_bg_normal;
|
||||||
|
|
||||||
callback menu_btn_callback();
|
|
||||||
|
|
||||||
VerticalLayout {
|
VerticalLayout {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
@ -30,24 +40,24 @@ component PowerMenuButton {
|
|||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: option_icon;
|
text: option_icon;
|
||||||
font-size: 55px;
|
font-size: icon_font_size *1px;
|
||||||
width: btn_width *1px;
|
width: btn_width *1px;
|
||||||
height: (btn_height/100) * 75 *1px;
|
height: option_icon_height *1px;
|
||||||
vertical-alignment: center;
|
vertical-alignment: center;
|
||||||
horizontal-alignment: center;
|
horizontal-alignment: center;
|
||||||
font-family: "IosevkaTermSlab Nerd Font Mono";
|
font-family: icon_font;
|
||||||
color: #ffffff;
|
color: icon_font_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: option_name;
|
text: option_text;
|
||||||
font-size: 14px;
|
font-size: option_text_font_size *1px;
|
||||||
width: btn_width *1px;
|
width: btn_width *1px;
|
||||||
height: (btn_height/100) * 25 *1px;
|
height: option_text_height *1px;
|
||||||
vertical-alignment: center;
|
vertical-alignment: center;
|
||||||
horizontal-alignment: center;
|
horizontal-alignment: center;
|
||||||
font-family: "IosevkaTermSlab Nerd Font Mono";
|
font-family: option_text_font;
|
||||||
color: #ffffff;
|
color: root.option_text_color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,6 +80,16 @@ export component PowerMenu inherits Window {
|
|||||||
in property <color> btn_bg_hover: #92929284;
|
in property <color> btn_bg_hover: #92929284;
|
||||||
in property <color> btn_bg_clicked: #9b9b9bab;
|
in property <color> btn_bg_clicked: #9b9b9bab;
|
||||||
|
|
||||||
|
in property <int> option_icon_height: (btn_height/100) * 75;
|
||||||
|
in property <int> icon_font_size: (option_icon_height/100) * 80;
|
||||||
|
in property <string> icon_font: "IosevkaTermSlab Nerd Font Mono";
|
||||||
|
in property <color> icon_font_color: #ffffff;
|
||||||
|
|
||||||
|
in property <int> option_text_height: (btn_height/100) * 25;
|
||||||
|
in property <int> option_text_font_size: (option_text_height/100) * 45;
|
||||||
|
in property <string> option_text_font: "IosevkaTermSlab Nerd Font Mono";
|
||||||
|
in property <color> option_text_color: #ffffff;
|
||||||
|
|
||||||
in property <int> menu_padding_x: 20;
|
in property <int> menu_padding_x: 20;
|
||||||
in property <int> menu_padding_y: menu_padding_x;
|
in property <int> menu_padding_y: menu_padding_x;
|
||||||
in property <int> menu_spacing: menu_padding_x;
|
in property <int> menu_spacing: menu_padding_x;
|
||||||
@ -82,6 +102,16 @@ export component PowerMenu inherits Window {
|
|||||||
|
|
||||||
in property <color> menu_bg: #7a7a7a28;
|
in property <color> menu_bg: #7a7a7a28;
|
||||||
|
|
||||||
|
in property <string> ico_lockscreen: "";
|
||||||
|
in property <string> ico_logout: "";
|
||||||
|
in property <string> ico_reboot: "";
|
||||||
|
in property <string> ico_poweroff: "";
|
||||||
|
|
||||||
|
in property <string> text_lockscreen: "Lock screen";
|
||||||
|
in property <string> text_logout: "Log Out";
|
||||||
|
in property <string> text_reboot: "Reboot";
|
||||||
|
in property <string> text_poweroff: "Power Off";
|
||||||
|
|
||||||
no-frame: true;
|
no-frame: true;
|
||||||
always-on-top: true;
|
always-on-top: true;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
@ -105,28 +135,106 @@ export component PowerMenu inherits Window {
|
|||||||
x: menu_pos_x *1px;
|
x: menu_pos_x *1px;
|
||||||
y: menu_pos_y *1px;
|
y: menu_pos_y *1px;
|
||||||
|
|
||||||
|
// Buttons
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
padding: menu_padding_x *1px;
|
padding: menu_padding_x *1px;
|
||||||
spacing: menu_spacing *1px;
|
spacing: menu_spacing *1px;
|
||||||
|
|
||||||
|
// Lock screen
|
||||||
PowerMenuButton {
|
PowerMenuButton {
|
||||||
option_icon: "O";
|
option_icon: ico_lockscreen;
|
||||||
option_name: "Lock screen";
|
option_text: text_lockscreen;
|
||||||
|
|
||||||
|
btn_width: root.btn_width;
|
||||||
|
btn_height: root.btn_height;
|
||||||
|
btn_border_radius: root.btn_border_radius;
|
||||||
|
|
||||||
|
btn_bg_normal: root.btn_bg_normal;
|
||||||
|
btn_bg_hover: root.btn_bg_hover;
|
||||||
|
btn_bg_clicked: root.btn_bg_clicked;
|
||||||
|
|
||||||
|
option_icon_height: root.option_icon_height;
|
||||||
|
icon_font_size: root.icon_font_size;
|
||||||
|
icon_font: root.icon_font;
|
||||||
|
icon_font_color: root.icon_font_color;
|
||||||
|
|
||||||
|
option_text_height: root.option_text_height;
|
||||||
|
option_text_font_size: root.option_text_font_size;
|
||||||
|
option_text_font: root.option_text_font;
|
||||||
|
option_text_color: root.option_text_color;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Log out
|
||||||
PowerMenuButton {
|
PowerMenuButton {
|
||||||
option_icon: "O";
|
option_icon: ico_logout;
|
||||||
option_name: "Log out";
|
option_text: text_logout;
|
||||||
|
|
||||||
|
btn_width: root.btn_width;
|
||||||
|
btn_height: root.btn_height;
|
||||||
|
btn_border_radius: root.btn_border_radius;
|
||||||
|
|
||||||
|
btn_bg_normal: root.btn_bg_normal;
|
||||||
|
btn_bg_hover: root.btn_bg_hover;
|
||||||
|
btn_bg_clicked: root.btn_bg_clicked;
|
||||||
|
|
||||||
|
option_icon_height: root.option_icon_height;
|
||||||
|
icon_font_size: root.icon_font_size;
|
||||||
|
icon_font: root.icon_font;
|
||||||
|
icon_font_color: root.icon_font_color;
|
||||||
|
|
||||||
|
option_text_height: root.option_text_height;
|
||||||
|
option_text_font_size: root.option_text_font_size;
|
||||||
|
option_text_font: root.option_text_font;
|
||||||
|
option_text_color: root.option_text_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Reboot
|
||||||
PowerMenuButton {
|
PowerMenuButton {
|
||||||
option_icon: "O";
|
option_icon: ico_reboot;
|
||||||
option_name: "Reboot";
|
option_text: text_reboot;
|
||||||
|
|
||||||
|
btn_width: root.btn_width;
|
||||||
|
btn_height: root.btn_height;
|
||||||
|
btn_border_radius: root.btn_border_radius;
|
||||||
|
|
||||||
|
btn_bg_normal: root.btn_bg_normal;
|
||||||
|
btn_bg_hover: root.btn_bg_hover;
|
||||||
|
btn_bg_clicked: root.btn_bg_clicked;
|
||||||
|
|
||||||
|
option_icon_height: root.option_icon_height;
|
||||||
|
icon_font_size: root.icon_font_size;
|
||||||
|
icon_font: root.icon_font;
|
||||||
|
icon_font_color: root.icon_font_color;
|
||||||
|
|
||||||
|
option_text_height: root.option_text_height;
|
||||||
|
option_text_font_size: root.option_text_font_size;
|
||||||
|
option_text_font: root.option_text_font;
|
||||||
|
option_text_color: root.option_text_color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Power off
|
||||||
PowerMenuButton {
|
PowerMenuButton {
|
||||||
option_icon: "O";
|
option_icon: ico_poweroff;
|
||||||
option_name: "Power off";
|
option_text: text_poweroff;
|
||||||
|
|
||||||
|
btn_width: root.btn_width;
|
||||||
|
btn_height: root.btn_height;
|
||||||
|
btn_border_radius: root.btn_border_radius;
|
||||||
|
|
||||||
|
btn_bg_normal: root.btn_bg_normal;
|
||||||
|
btn_bg_hover: root.btn_bg_hover;
|
||||||
|
btn_bg_clicked: root.btn_bg_clicked;
|
||||||
|
|
||||||
|
option_icon_height: root.option_icon_height;
|
||||||
|
icon_font_size: root.icon_font_size;
|
||||||
|
icon_font: root.icon_font;
|
||||||
|
icon_font_color: root.icon_font_color;
|
||||||
|
|
||||||
|
option_text_height: root.option_text_height;
|
||||||
|
option_text_font_size: root.option_text_font_size;
|
||||||
|
option_text_font: root.option_text_font;
|
||||||
|
option_text_color: root.option_text_color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user