NCombox + NTextInput proper label/description support
+ Associated changes in window settings
This commit is contained in:
parent
3997a369ec
commit
0417590221
8 changed files with 111 additions and 125 deletions
|
|
@ -146,6 +146,8 @@ NLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
NComboBox {
|
NComboBox {
|
||||||
|
label: "Animal"
|
||||||
|
description: "What's your favorite"
|
||||||
optionsKeys: ["cat", "dog", "bird", "monkey", "fish", "turtle", "elephant", "tiger"]
|
optionsKeys: ["cat", "dog", "bird", "monkey", "fish", "turtle", "elephant", "tiger"]
|
||||||
optionsLabels: ["Cat", "Dog", "Bird", "Monkey", "Fish", "Turtle", "Elephant", "Tiger"]
|
optionsLabels: ["Cat", "Dog", "Bird", "Monkey", "Fish", "Turtle", "Elephant", "Tiger"]
|
||||||
currentKey: "cat"
|
currentKey: "cat"
|
||||||
|
|
@ -169,16 +171,18 @@ NLoader {
|
||||||
}
|
}
|
||||||
|
|
||||||
NTextInput {
|
NTextInput {
|
||||||
|
label: "Input label"
|
||||||
|
description: "A cool description"
|
||||||
text: "Type anything"
|
text: "Type anything"
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
NDivider {
|
NDivider {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// NBusyIndicator
|
// NBusyIndicator
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
|
|
|
||||||
|
|
@ -58,20 +58,10 @@ ColumnLayout {
|
||||||
borderColor: Colors.accentPrimary
|
borderColor: Colors.accentPrimary
|
||||||
borderWidth: Math.max(1, Style.borderMedium)
|
borderWidth: Math.max(1, Style.borderMedium)
|
||||||
}
|
}
|
||||||
ColumnLayout {
|
|
||||||
Layout.fillWidth: true
|
|
||||||
spacing: Style.marginTiny * scaling
|
|
||||||
NText {
|
|
||||||
text: "Profile Picture"
|
|
||||||
color: Colors.textPrimary
|
|
||||||
font.weight: Style.fontWeightBold
|
|
||||||
}
|
|
||||||
NText {
|
|
||||||
text: "Your profile picture displayed in various places throughout the shell"
|
|
||||||
color: Colors.textSecondary
|
|
||||||
font.pointSize: Style.fontSizeSmall * scaling
|
|
||||||
}
|
|
||||||
NTextInput {
|
NTextInput {
|
||||||
|
label: "Profile Picture"
|
||||||
|
description: "Your profile picture displayed in various places throughout the shell"
|
||||||
text: Settings.data.general.avatarImage
|
text: Settings.data.general.avatarImage
|
||||||
placeholderText: "/home/user/.face"
|
placeholderText: "/home/user/.face"
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
@ -82,7 +72,6 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
NDivider {
|
NDivider {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,7 @@ ColumnLayout {
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
padding: 16
|
padding: Style.marginMedium * scaling
|
||||||
rightPadding: 12
|
|
||||||
clip: true
|
clip: true
|
||||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||||
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
||||||
|
|
@ -32,26 +31,12 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
spacing: 4
|
spacing: Style.marginLarge * scaling
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
NText {
|
NText {
|
||||||
text: "Network Settings"
|
text: "Network Settings"
|
||||||
font.pointSize: 18
|
font.pointSize: Style.fontSizeXL * scaling
|
||||||
font.weight: Style.fontWeightBold
|
|
||||||
color: Colors.textPrimary
|
|
||||||
Layout.bottomMargin: 8
|
|
||||||
}
|
|
||||||
|
|
||||||
// Network interfaces section
|
|
||||||
ColumnLayout {
|
|
||||||
spacing: 8
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.topMargin: 8
|
|
||||||
|
|
||||||
NText {
|
|
||||||
text: "Network Interfaces"
|
|
||||||
font.pointSize: 13
|
|
||||||
font.weight: Style.fontWeightBold
|
font.weight: Style.fontWeightBold
|
||||||
color: Colors.textPrimary
|
color: Colors.textPrimary
|
||||||
}
|
}
|
||||||
|
|
@ -77,4 +62,3 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ ColumnLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
NText {
|
NText {
|
||||||
text: "Screen Recording"
|
text: "Recording"
|
||||||
font.pointSize: Style.fontSizeXL * scaling
|
font.pointSize: Style.fontSizeXL * scaling
|
||||||
font.weight: Style.fontWeightBold
|
font.weight: Style.fontWeightBold
|
||||||
color: Colors.textPrimary
|
color: Colors.textPrimary
|
||||||
|
|
@ -46,24 +46,10 @@ ColumnLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: Style.marginSmall * scaling
|
Layout.topMargin: Style.marginSmall * scaling
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
spacing: Style.marginTiny * scaling
|
|
||||||
|
|
||||||
NText {
|
|
||||||
text: "Output Directory"
|
|
||||||
font.weight: Style.fontWeightBold
|
|
||||||
color: Colors.textPrimary
|
|
||||||
}
|
|
||||||
|
|
||||||
NText {
|
|
||||||
text: "Directory where screen recordings will be saved"
|
|
||||||
font.pointSize: Style.fontSizeSmall * scaling
|
|
||||||
color: Colors.textSecondary
|
|
||||||
wrapMode: Text.WordWrap
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NTextInput {
|
NTextInput {
|
||||||
|
label: "Output Directory"
|
||||||
|
description: "Directory where screen recordings will be saved"
|
||||||
|
placeholderText: "/home/xxx/Videos"
|
||||||
text: Settings.data.screenRecorder.directory
|
text: Settings.data.screenRecorder.directory
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
Settings.data.screenRecorder.directory = text
|
Settings.data.screenRecorder.directory = text
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,10 @@ ColumnLayout {
|
||||||
Layout.topMargin: Style.marginSmall * scaling
|
Layout.topMargin: Style.marginSmall * scaling
|
||||||
|
|
||||||
NTextInput {
|
NTextInput {
|
||||||
|
label: "Location name"
|
||||||
|
description: "Choose a known location near you"
|
||||||
text: Settings.data.location.name
|
text: Settings.data.location.name
|
||||||
placeholderText: "Enter city name"
|
placeholderText: "Enter the location name"
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
onEditingFinished: {
|
onEditingFinished: {
|
||||||
Settings.data.location.name = text
|
Settings.data.location.name = text
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,7 @@ ColumnLayout {
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
padding: 16
|
padding: Style.marginMedium * scaling
|
||||||
rightPadding: 12
|
|
||||||
clip: true
|
clip: true
|
||||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||||
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ ColumnLayout {
|
||||||
implicitWidth: 120 * scaling
|
implicitWidth: 120 * scaling
|
||||||
implicitHeight: preferredHeight
|
implicitHeight: preferredHeight
|
||||||
color: Colors.surfaceVariant
|
color: Colors.surfaceVariant
|
||||||
border.color: root.activeFocus ? Colors.hover : Colors.outline
|
border.color: combo.activeFocus ? Colors.hover : Colors.outline
|
||||||
border.width: Math.max(1, Style.borderThin * scaling)
|
border.width: Math.max(1, Style.borderThin * scaling)
|
||||||
radius: Style.radiusMedium * scaling
|
radius: Style.radiusMedium * scaling
|
||||||
}
|
}
|
||||||
|
|
@ -69,7 +69,6 @@ ColumnLayout {
|
||||||
leftPadding: Style.marginLarge * scaling
|
leftPadding: Style.marginLarge * scaling
|
||||||
rightPadding: combo.indicator.width + Style.marginLarge * scaling
|
rightPadding: combo.indicator.width + Style.marginLarge * scaling
|
||||||
font.pointSize: Style.fontSizeMedium * scaling
|
font.pointSize: Style.fontSizeMedium * scaling
|
||||||
font.weight: Style.fontWeightBold
|
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
text: {
|
text: {
|
||||||
|
|
@ -79,16 +78,16 @@ ColumnLayout {
|
||||||
|
|
||||||
// Drop down indicator
|
// Drop down indicator
|
||||||
indicator: NText {
|
indicator: NText {
|
||||||
x: root.width - width - Style.marginMedium * scaling
|
x: combo.width - width - Style.marginMedium * scaling
|
||||||
y: root.topPadding + (root.availableHeight - height) / 2
|
y: combo.topPadding + (combo.availableHeight - height) / 2
|
||||||
text: "arrow_drop_down"
|
text: "arrow_drop_down"
|
||||||
font.family: "Material Symbols Outlined"
|
font.family: "Material Symbols Outlined"
|
||||||
font.pointSize: Style.fontSizeXL * scaling
|
font.pointSize: Style.fontSizeXL * scaling
|
||||||
}
|
}
|
||||||
|
|
||||||
popup: Popup {
|
popup: Popup {
|
||||||
y: root.height
|
y: combo.height
|
||||||
width: root.width
|
width: combo.width
|
||||||
implicitHeight: Math.min(160 * scaling, contentItem.implicitHeight + Style.marginMedium * scaling * 2)
|
implicitHeight: Math.min(160 * scaling, contentItem.implicitHeight + Style.marginMedium * scaling * 2)
|
||||||
padding: Style.marginMedium * scaling
|
padding: Style.marginMedium * scaling
|
||||||
|
|
||||||
|
|
@ -109,8 +108,8 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
delegate: ItemDelegate {
|
delegate: ItemDelegate {
|
||||||
width: root.width
|
width: combo.width
|
||||||
highlighted: root.highlightedIndex === index
|
highlighted: combo.highlightedIndex === index
|
||||||
|
|
||||||
contentItem: NText {
|
contentItem: NText {
|
||||||
text: {
|
text: {
|
||||||
|
|
@ -123,7 +122,7 @@ ColumnLayout {
|
||||||
}
|
}
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
width: root.width - Style.marginMedium * scaling * 3
|
width: combo.width - Style.marginMedium * scaling * 3
|
||||||
color: highlighted ? Colors.hover : "transparent"
|
color: highlighted ? Colors.hover : "transparent"
|
||||||
radius: Style.radiusSmall * scaling
|
radius: Style.radiusSmall * scaling
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,23 +7,45 @@ Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
readonly property real scaling: Scaling.scale(screen)
|
readonly property real scaling: Scaling.scale(screen)
|
||||||
|
property string label: ""
|
||||||
// API
|
property string description: ""
|
||||||
property alias text: input.text
|
|
||||||
property alias placeholderText: input.placeholderText
|
|
||||||
property bool readOnly: false
|
property bool readOnly: false
|
||||||
property bool enabled: true
|
property bool enabled: true
|
||||||
|
|
||||||
|
property alias text: input.text
|
||||||
|
property alias placeholderText: input.placeholderText
|
||||||
|
|
||||||
signal editingFinished
|
signal editingFinished
|
||||||
|
|
||||||
// Sizing
|
// Sizing
|
||||||
implicitWidth: 320 * scaling
|
implicitWidth: 320 * scaling
|
||||||
implicitHeight: Style.baseWidgetSize * 1.25 * scaling
|
implicitHeight: Style.baseWidgetSize * 2.75 * scaling
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
spacing: Style.marginTiniest * scaling
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
NText {
|
||||||
|
text: label
|
||||||
|
font.pointSize: Style.fontSizeMedium * scaling
|
||||||
|
font.weight: Style.fontWeightBold
|
||||||
|
color: Colors.textPrimary
|
||||||
|
}
|
||||||
|
|
||||||
|
NText {
|
||||||
|
text: description
|
||||||
|
font.pointSize: Style.fontSizeSmall * scaling
|
||||||
|
color: Colors.textSecondary
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
// Container
|
// Container
|
||||||
Rectangle {
|
Rectangle {
|
||||||
id: frame
|
id: frame
|
||||||
anchors.fill: parent
|
Layout.topMargin: Style.marginTiny * scaling
|
||||||
|
implicitWidth: root.width
|
||||||
|
implicitHeight: Style.baseWidgetSize * 1.35 * scaling
|
||||||
radius: Style.radiusMedium * scaling
|
radius: Style.radiusMedium * scaling
|
||||||
color: Colors.surfaceVariant
|
color: Colors.surfaceVariant
|
||||||
border.color: Colors.outline
|
border.color: Colors.outline
|
||||||
|
|
@ -63,3 +85,4 @@ Item {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue