Skip to content

Commit

Permalink
add network interface config
Browse files Browse the repository at this point in the history
  • Loading branch information
raoulh committed Nov 11, 2024
1 parent bfa00e6 commit a4a6fff
Show file tree
Hide file tree
Showing 13 changed files with 492 additions and 1 deletion.
97 changes: 97 additions & 0 deletions qml/SharedComponents/CalaosCombo.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import QtQuick
import QtQuick.Controls as Controls
import "."

Controls.ComboBox {
id: control

implicitHeight: Units.dp(40)
implicitWidth: Units.dp(120)

delegate: Controls.ItemDelegate {
id: delegate

required property var model
required property int index

width: control.width
contentItem: Text {
text: delegate.model[control.textRole]
color: Theme.whiteColor
font: control.font
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
highlighted: control.highlightedIndex === index

background: Rectangle {
color: delegate.highlighted ? Theme.colorAlpha(Theme.blueColor, 0.40) : Theme.backgroundColor
}
}

indicator: Canvas {
id: canvas
x: control.width - width - control.rightPadding
y: control.topPadding + (control.availableHeight - height) / 2
width: 12
height: 8
contextType: "2d"

Connections {
target: control
function onPressedChanged() { canvas.requestPaint(); }
}

onPaint: {
context.reset();
context.moveTo(0, 0);
context.lineTo(width, 0);
context.lineTo(width / 2, height);
context.closePath();
context.fillStyle = control.pressed ? Theme.blueColor : Theme.colorAlpha(Theme.whiteColor, 0.40);
context.fill();
}
}

contentItem: Text {
leftPadding: 0
rightPadding: control.indicator.width + control.spacing

text: control.displayText
font: control.font
color: control.pressed ? Theme.blueColor : Theme.whiteColor
verticalAlignment: Text.AlignVCenter
elide: Text.ElideRight
}

background: Rectangle {
implicitWidth: 120
implicitHeight: 40
border.color: Theme.blueColor
border.width: Units.dp(2)
radius: Units.dp(4)
color: Theme.backgroundColor
}

popup: Controls.Popup {
y: control.height - 1
width: control.width
implicitHeight: contentItem.implicitHeight
padding: 1

contentItem: ListView {
clip: true
implicitHeight: contentHeight
model: control.popup.visible ? control.delegateModel : null
currentIndex: control.highlightedIndex

Controls.ScrollIndicator.vertical: Controls.ScrollIndicator { }
}

background: Rectangle {
border.color: Theme.blueColor
radius: Units.dp(2)
color: Theme.backgroundColor
}
}
}
1 change: 1 addition & 0 deletions qml/SharedComponents/Theme.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ QtObject {
property color redColor: "#ff5555"
property color greenColor: "#5fd35f"
property color whiteColor: "#e7e7e7"
property color backgroundColor: "#171717"

function colorAlpha(c, alpha) {
var realColor = Qt.darker(c, 1)
Expand Down
1 change: 1 addition & 0 deletions qml/SharedComponents/qmldir
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ ItemListView 1.0 ItemListView.qml
CalaosButton 1.0 CalaosButton.qml
CalaosRadio 1.0 CalaosRadio.qml
CalaosCheck 1.0 CalaosCheck.qml
CalaosCombo 1.0 CalaosCombo.qml
singleton Theme 1.0 Theme.qml
5 changes: 4 additions & 1 deletion qml/desktop/ConfigNetworkView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ Item {
Layout.alignment: Qt.AlignVCenter
imageSource: "button_empty"
iconSource: "qrc:/img/ic_pen.svg"
onButtonClicked: {}
onButtonClicked: dialogNetInterface.show(index)
}
}

Expand Down Expand Up @@ -151,7 +151,10 @@ Item {

ScrollBar { listObject: list }
}
}

DialogNetInterface {
id: dialogNetInterface
}

ConfigTabs {
Expand Down
Loading

0 comments on commit a4a6fff

Please sign in to comment.