From 54583eae6e26bc9de178af6510aeeff90b489860 Mon Sep 17 00:00:00 2001 From: arcan1s Date: Fri, 9 Jan 2015 02:40:24 +0300 Subject: [PATCH] update interface painting --- .../plasmoid/contents/ui/about.qml | 3 +- .../plasmoid/contents/ui/appearance.qml | 18 +-- .../plasmoid/contents/ui/dataengine.qml | 73 +++++++++-- .../plasmoid/contents/ui/main.qml | 1 + .../plasmoid/contents/ui/widget.qml | 116 +++++++++++++++--- 5 files changed, 168 insertions(+), 43 deletions(-) diff --git a/sources/plasmoid-kf5/plasmoid/contents/ui/about.qml b/sources/plasmoid-kf5/plasmoid/contents/ui/about.qml index 9a2cc38..2d47fa7 100644 --- a/sources/plasmoid-kf5/plasmoid/contents/ui/about.qml +++ b/sources/plasmoid-kf5/plasmoid/contents/ui/about.qml @@ -26,6 +26,8 @@ Item { id: aboutPage width: childrenRect.width height: childrenRect.height + implicitWidth: pageColumn.implicitWidth + implicitHeight: pageColumn.implicitHeight property bool debug: NetctlAdds.isDebugEnabled() @@ -59,7 +61,6 @@ Item { } QtControls.Label { - anchors.top: parent.top QtLayouts.Layout.fillWidth: true font.capitalization: Font.SmallCaps horizontalAlignment: Text.AlignHCenter diff --git a/sources/plasmoid-kf5/plasmoid/contents/ui/appearance.qml b/sources/plasmoid-kf5/plasmoid/contents/ui/appearance.qml index abe8654..3a788d9 100644 --- a/sources/plasmoid-kf5/plasmoid/contents/ui/appearance.qml +++ b/sources/plasmoid-kf5/plasmoid/contents/ui/appearance.qml @@ -258,17 +258,12 @@ Item { QtControls.Button { id: activeIconButton text: i18n("Browse") - onClicked: { - // FIXME: more clean directory definition - var list = inactiveIcon.text.split('/') - list.pop() - activeFileDialog.folder = "/" + list.join('/') - activeFileDialog.visible = true - } + onClicked: activeFileDialog.visible = true } QtDialogs.FileDialog { id: activeFileDialog + modality: Qt.NonModal title: i18n("Select a path") nameFilters: [ "Image files (*.jpeg *.jpg *.png)", "All files (*)" ] selectExisting: true @@ -295,17 +290,12 @@ Item { QtControls.Button { id: inactiveIconButton text: i18n("Browse") - onClicked: { - // FIXME: more clean directory definition - var list = inactiveIcon.text.split('/') - list.pop() - inactiveFileDialog.folder = "/" + list.join('/') - inactiveFileDialog.visible = true - } + onClicked: inactiveFileDialog.visible = true } QtDialogs.FileDialog { id: inactiveFileDialog + modality: Qt.NonModal title: i18n("Select a path") nameFilters: [ "Image files (*.jpeg *.jpg *.png)", "All files (*)" ] selectExisting: true diff --git a/sources/plasmoid-kf5/plasmoid/contents/ui/dataengine.qml b/sources/plasmoid-kf5/plasmoid/contents/ui/dataengine.qml index ad7cd2b..ef03fdd 100644 --- a/sources/plasmoid-kf5/plasmoid/contents/ui/dataengine.qml +++ b/sources/plasmoid-kf5/plasmoid/contents/ui/dataengine.qml @@ -19,6 +19,7 @@ import QtQuick 2.0 import QtQuick.Controls 1.0 as QtControls import QtQuick.Dialogs 1.1 as QtDialogs import QtQuick.Layouts 1.0 as QtLayouts +import QtQuick.Controls.Styles 1.3 as QtStyles import org.kde.plasma.private.netctl 1.0 @@ -27,6 +28,8 @@ Item { id: dataenginePage width: childrenRect.width height: childrenRect.height + implicitWidth: pageColumn.implicitWidth + implicitHeight: pageColumn.implicitHeight property bool debug: NetctlAdds.isDebugEnabled() @@ -40,7 +43,7 @@ Item { width: parent.width QtControls.Label { height: parent.height - width: parent.width / 3 + width: parent.width * 2 / 5 horizontalAlignment: Text.AlignRight verticalAlignment: Text.AlignVCenter text: i18n("Path to netctl") @@ -48,7 +51,7 @@ Item { QtControls.TextField { id: netctlPath height: parent.height - width: parent.width * 2 / 3 - netctlPathButton.width + width: parent.width * 3 / 5 - netctlPathButton.width text: cfg_dataengine["NETCTLCMD"] } QtControls.Button { @@ -59,6 +62,7 @@ Item { QtDialogs.FileDialog { id: netctlFileDialog + modality: Qt.NonModal title: i18n("Select a path") folder: "/usr/bin" nameFilters: [ "All files (*)" ] @@ -72,7 +76,7 @@ Item { width: parent.width QtControls.Label { height: parent.height - width: parent.width / 3 + width: parent.width * 2 / 5 horizontalAlignment: Text.AlignRight verticalAlignment: Text.AlignVCenter text: i18n("Path to netctl-auto") @@ -80,7 +84,7 @@ Item { QtControls.TextField { id: netctlAutoPath height: parent.height - width: parent.width * 2 / 3 - netctlAutoPathButton.width + width: parent.width * 3 / 5 - netctlAutoPathButton.width text: cfg_dataengine["NETCTLAUTOCMD"] } QtControls.Button { @@ -91,6 +95,7 @@ Item { QtDialogs.FileDialog { id: netctlAutoFileDialog + modality: Qt.NonModal title: i18n("Select a path") folder: "/usr/bin" nameFilters: [ "All files (*)" ] @@ -102,18 +107,41 @@ Item { Row { height: implicitHeight width: parent.width + QtControls.Label { + height: parent.height + width: parent.width * 2 / 5 - extIp4.width + horizontalAlignment: Text.AlignRight + verticalAlignment: Text.AlignVCenter + text: i18n("Check external IPv4") + } QtControls.CheckBox { id: extIp4 height: parent.height - width: parent.width / 3 - text: i18n("Check external IPv4") + width: implicitWidth checked: cfg_dataengine["EXTIP4"] == "true" + style: QtStyles.CheckBoxStyle { + indicator: Rectangle { + implicitWidth: 16 + implicitHeight: 16 + radius: 3 + border.width: 1 + border.color: control.activeFocus ? "darkblue" : "gray" + Rectangle { + visible: control.checked + radius: 1 + anchors.fill: parent + anchors.margins: 4 + color: "#555555" + border.color: "#333333" + } + } + } } QtControls.TextField { id: extIp4Path enabled: extIp4.checked height: parent.height - width: parent.width * 2 / 3 - extIp4PathButton.width + width: parent.width * 3 / 5 - extIp4PathButton.width text: cfg_dataengine["EXTIP4CMD"] } QtControls.Button { @@ -125,6 +153,7 @@ Item { QtDialogs.FileDialog { id: extIp4FileDialog + modality: Qt.NonModal title: i18n("Select a path") folder: "/usr/bin" nameFilters: [ "All files (*)" ] @@ -136,18 +165,41 @@ Item { Row { height: implicitHeight width: parent.width + QtControls.Label { + height: parent.height + width: parent.width * 2 / 5 - extIp6.width + horizontalAlignment: Text.AlignRight + verticalAlignment: Text.AlignVCenter + text: i18n("Check external IPv6") + } QtControls.CheckBox { id: extIp6 height: parent.height - width: parent.width / 3 - text: i18n("Check external IPv6") + width: implicitWidth checked: cfg_dataengine["EXTIP6"] == "true" + style: QtStyles.CheckBoxStyle { + indicator: Rectangle { + implicitWidth: 16 + implicitHeight: 16 + radius: 3 + border.width: 1 + border.color: control.activeFocus ? "darkblue" : "gray" + Rectangle { + visible: control.checked + radius: 1 + anchors.fill: parent + anchors.margins: 4 + color: "#555555" + border.color: "#333333" + } + } + } } QtControls.TextField { id: extIp6Path enabled: extIp6.checked height: parent.height - width: parent.width * 2 / 3 - extIp6PathButton.width + width: parent.width * 3 / 5 - extIp6PathButton.width text: cfg_dataengine["EXTIP6CMD"] } QtControls.Button { @@ -159,6 +211,7 @@ Item { QtDialogs.FileDialog { id: extIp6FileDialog + modality: Qt.NonModal title: i18n("Select a path") folder: "/usr/bin" nameFilters: [ "All files (*)" ] diff --git a/sources/plasmoid-kf5/plasmoid/contents/ui/main.qml b/sources/plasmoid-kf5/plasmoid/contents/ui/main.qml index 2277cc3..0c31239 100644 --- a/sources/plasmoid-kf5/plasmoid/contents/ui/main.qml +++ b/sources/plasmoid-kf5/plasmoid/contents/ui/main.qml @@ -53,6 +53,7 @@ Item { "current": "N\\A", "extip4": "127.0.0.1", "extip6": "::1", + "info": "N\\A", "intip4": "127.0.0.1", "intip6": "::1", "interfaces": "lo", diff --git a/sources/plasmoid-kf5/plasmoid/contents/ui/widget.qml b/sources/plasmoid-kf5/plasmoid/contents/ui/widget.qml index 66dba15..639ad25 100644 --- a/sources/plasmoid-kf5/plasmoid/contents/ui/widget.qml +++ b/sources/plasmoid-kf5/plasmoid/contents/ui/widget.qml @@ -19,6 +19,7 @@ import QtQuick 2.0 import QtQuick.Controls 1.3 as QtControls import QtQuick.Dialogs 1.1 as QtDialogs import QtQuick.Layouts 1.0 as QtLayouts +import QtQuick.Controls.Styles 1.3 as QtStyles import org.kde.plasma.private.netctl 1.0 @@ -27,6 +28,8 @@ Item { id: widgetPage width: childrenRect.width height: childrenRect.height + implicitWidth: pageColumn.implicitWidth + implicitHeight: pageColumn.implicitHeight property bool debug: NetctlAdds.isDebugEnabled() @@ -51,15 +54,14 @@ Item { width: parent.width QtControls.Label { height: parent.height - width: parent.width / 3 + width: parent.width * 2 / 5 horizontalAlignment: Text.AlignRight verticalAlignment: Text.AlignVCenter text: i18n("Auto update interval, msec") } QtControls.SpinBox { id: autoUpdate - height: parent.height - width: parent.width * 2 / 3 + width: parent.width * 3 / 5 minimumValue: 1000 maximumValue: 10000 stepSize: 500 @@ -72,7 +74,7 @@ Item { width: parent.width QtControls.Label { height: parent.height - width: parent.width / 3 + width: parent.width * 2 / 5 horizontalAlignment: Text.AlignRight verticalAlignment: Text.AlignVCenter text: i18n("Path to GUI") @@ -80,7 +82,7 @@ Item { QtControls.TextField { id: guiPath height: parent.height - width: parent.width * 2 / 3 - guiPathButton.width + width: parent.width * 3 / 5 - guiPathButton.width text: plasmoid.configuration.guiPath } QtControls.Button { @@ -91,6 +93,7 @@ Item { QtDialogs.FileDialog { id: guiFileDialog + modality: Qt.NonModal title: i18n("Select a path") folder: "/usr/bin" nameFilters: [ "All files (*)" ] @@ -102,17 +105,40 @@ Item { Row { height: implicitHeight width: parent.width + QtControls.Label { + height: parent.height + width: parent.width * 2 / 5 - useHelper.width + horizontalAlignment: Text.AlignRight + verticalAlignment: Text.AlignVCenter + text: i18n("Use helper") + } QtControls.CheckBox { id: useHelper height: parent.height - width: parent.width / 3 - text: i18n("Use helper") + width: implicitWidth + style: QtStyles.CheckBoxStyle { + indicator: Rectangle { + implicitWidth: 16 + implicitHeight: 16 + radius: 3 + border.width: 1 + border.color: control.activeFocus ? "darkblue" : "gray" + Rectangle { + visible: control.checked + radius: 1 + anchors.fill: parent + anchors.margins: 4 + color: "#555555" + border.color: "#333333" + } + } + } } QtControls.TextField { id: helperPath enabled: useHelper.checked height: parent.height - width: parent.width * 2 / 3 - helperPathButton.width + width: parent.width * 3 / 5 - helperPathButton.width text: plasmoid.configuration.helperPath } QtControls.Button { @@ -137,25 +163,28 @@ Item { width: parent.width QtControls.Label { height: parent.height - width: parent.width / 3 + width: parent.width * 2 / 5 horizontalAlignment: Text.AlignRight verticalAlignment: Text.AlignVCenter text: i18n("Path to netctl") } QtControls.TextField { id: netctlPath + enabled: !useHelper.checked height: parent.height - width: parent.width * 2 / 3 - netctlPathButton.width + width: parent.width * 3 / 5 - netctlPathButton.width text: plasmoid.configuration.netctlPath } QtControls.Button { id: netctlPathButton + enabled: !useHelper.checked text: i18n("Browse") onClicked: netctlFileDialog.visible = true } QtDialogs.FileDialog { id: netctlFileDialog + modality: Qt.NonModal title: i18n("Select a path") folder: "/usr/bin" nameFilters: [ "All files (*)" ] @@ -169,25 +198,28 @@ Item { width: parent.width QtControls.Label { height: parent.height - width: parent.width / 3 + width: parent.width * 2 / 5 horizontalAlignment: Text.AlignRight verticalAlignment: Text.AlignVCenter text: i18n("Path to netctl-auto") } QtControls.TextField { id: netctlAutoPath + enabled: !useHelper.checked height: parent.height - width: parent.width * 2 / 3 - netctlAutoPathButton.width + width: parent.width * 3 / 5 - netctlAutoPathButton.width text: plasmoid.configuration.netctlAutoPath } QtControls.Button { id: netctlAutoPathButton + enabled: !useHelper.checked text: i18n("Browse") onClicked: netctlAutoFileDialog.visible = true } QtDialogs.FileDialog { id: netctlAutoFileDialog + modality: Qt.NonModal title: i18n("Select a path") folder: "/usr/bin" nameFilters: [ "All files (*)" ] @@ -199,17 +231,40 @@ Item { Row { height: implicitHeight width: parent.width + QtControls.Label { + height: parent.height + width: parent.width * 2 / 5 - useSudo.width + horizontalAlignment: Text.AlignRight + verticalAlignment: Text.AlignVCenter + text: i18n("Use sudo for netctl") + } QtControls.CheckBox { id: useSudo height: parent.height - width: parent.width / 3 - text: i18n("Use sudo for netctl") + width: implicitWidth + style: QtStyles.CheckBoxStyle { + indicator: Rectangle { + implicitWidth: 16 + implicitHeight: 16 + radius: 3 + border.width: 1 + border.color: control.activeFocus ? "darkblue" : "gray" + Rectangle { + visible: control.checked + radius: 1 + anchors.fill: parent + anchors.margins: 4 + color: "#555555" + border.color: "#333333" + } + } + } } QtControls.TextField { id: sudoPath enabled: useSudo.checked height: parent.height - width: parent.width * 2 / 3 - sudoPathButton.width + width: parent.width * 3 / 5 - sudoPathButton.width text: plasmoid.configuration.sudoPath } QtControls.Button { @@ -221,6 +276,7 @@ Item { QtDialogs.FileDialog { id: sudoFileDialog + modality: Qt.NonModal title: i18n("Select a path") folder: "/usr/bin" nameFilters: [ "All files (*)" ] @@ -232,17 +288,40 @@ Item { Row { height: implicitHeight width: parent.width + QtControls.Label { + height: parent.height + width: parent.width * 2 / 5 - useWifi.width + horizontalAlignment: Text.AlignRight + verticalAlignment: Text.AlignVCenter + text: i18n("Show 'Start WiFi menu'") + } QtControls.CheckBox { id: useWifi height: parent.height - width: parent.width / 3 - text: i18n("Show 'Start WiFi menu'") + width: implicitWidth + style: QtStyles.CheckBoxStyle { + indicator: Rectangle { + implicitWidth: 16 + implicitHeight: 16 + radius: 3 + border.width: 1 + border.color: control.activeFocus ? "darkblue" : "gray" + Rectangle { + visible: control.checked + radius: 1 + anchors.fill: parent + anchors.margins: 4 + color: "#555555" + border.color: "#333333" + } + } + } } QtControls.TextField { id: wifiPath enabled: useWifi.checked height: parent.height - width: parent.width * 2 / 3 - wifiPathButton.width + width: parent.width * 3 / 5 - wifiPathButton.width text: plasmoid.configuration.wifiPath } QtControls.Button { @@ -254,6 +333,7 @@ Item { QtDialogs.FileDialog { id: wifiFileDialog + modality: Qt.NonModal title: i18n("Select a path") folder: "/usr/bin" nameFilters: [ "All files (*)" ]