mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-04-24 15:37:23 +00:00
add wdiget.qml
This commit is contained in:
parent
6fb7da4b5b
commit
f188dea8a7
@ -18,14 +18,15 @@
|
|||||||
import QtQuick 2.0
|
import QtQuick 2.0
|
||||||
|
|
||||||
import org.kde.plasma.configuration 2.0
|
import org.kde.plasma.configuration 2.0
|
||||||
|
import org.kde.plasma.plasmoid 2.0
|
||||||
|
|
||||||
|
|
||||||
ConfigModel {
|
ConfigModel {
|
||||||
// ConfigCategory {
|
ConfigCategory {
|
||||||
// name: i18n("Netctl plasmoid")
|
name: i18n("Netctl plasmoid")
|
||||||
// icon: Plasmoid.icon
|
icon: "/usr/share/pixmaps/netctl-gui-widget.png"
|
||||||
// source: "appearance.qml"
|
source: "widget.qml"
|
||||||
// }
|
}
|
||||||
|
|
||||||
ConfigCategory {
|
ConfigCategory {
|
||||||
name: i18n("Appearance")
|
name: i18n("Appearance")
|
||||||
|
@ -5,8 +5,45 @@
|
|||||||
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
|
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
|
||||||
<kcfgfile name=""/>
|
<kcfgfile name=""/>
|
||||||
|
|
||||||
<!-- appearance -->
|
<group name="Widget">
|
||||||
|
<!-- widget -->
|
||||||
|
<entry name="autoUpdateInterval" type="int">
|
||||||
|
<default>100</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="guiPath" type="string">
|
||||||
|
<default>/usr/bin/netctl-gui</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="helperPath" type="string">
|
||||||
|
<default>/usr/bin/netctlgui-helper</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="netctlPath" type="string">
|
||||||
|
<default>/usr/bin/netctl</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="netctlAutoPath" type="string">
|
||||||
|
<default>/usr/bin/netctl-auto</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="sudoPath" type="string">
|
||||||
|
<default>/usr/bin/kdesu</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="wifiPath" type="string">
|
||||||
|
<default>/usr/bin/netctl-gui -t 3</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="useHelper" type="bool">
|
||||||
|
<default>true</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="useSudo" type="bool">
|
||||||
|
<default>true</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="useWifi" type="bool">
|
||||||
|
<default>false</default>
|
||||||
|
</entry>
|
||||||
|
<entry name="textPattern" type="string">
|
||||||
|
<default>$info\nIPv4: $intip4\nIPv6: $intip6</default>
|
||||||
|
</entry>
|
||||||
|
</group>
|
||||||
|
|
||||||
<group name="Appearance">
|
<group name="Appearance">
|
||||||
|
<!-- appearance -->
|
||||||
<entry name="textAlign" type="string">
|
<entry name="textAlign" type="string">
|
||||||
<default>center</default>
|
<default>center</default>
|
||||||
</entry>
|
</entry>
|
||||||
|
@ -171,7 +171,7 @@ Item {
|
|||||||
|
|
||||||
QtDialogs.FileDialog {
|
QtDialogs.FileDialog {
|
||||||
id: activeFileDialog
|
id: activeFileDialog
|
||||||
title: "Select a path"
|
title: i18n("Select a path")
|
||||||
nameFilters: [ "Image files (*.jpeg *.jpg *.png)", "All files (*)" ]
|
nameFilters: [ "Image files (*.jpeg *.jpg *.png)", "All files (*)" ]
|
||||||
selectExisting: true
|
selectExisting: true
|
||||||
onAccepted: activeIcon.text = activeFileDialog.fileUrl
|
onAccepted: activeIcon.text = activeFileDialog.fileUrl
|
||||||
@ -200,7 +200,7 @@ Item {
|
|||||||
|
|
||||||
QtDialogs.FileDialog {
|
QtDialogs.FileDialog {
|
||||||
id: inactiveFileDialog
|
id: inactiveFileDialog
|
||||||
title: "Select a path"
|
title: i18n("Select a path")
|
||||||
nameFilters: [ "Image files (*.jpeg *.jpg *.png)", "All files (*)" ]
|
nameFilters: [ "Image files (*.jpeg *.jpg *.png)", "All files (*)" ]
|
||||||
selectExisting: true
|
selectExisting: true
|
||||||
onAccepted: inactiveIcon.text = inactiveFileDialog.fileUrl
|
onAccepted: inactiveIcon.text = inactiveFileDialog.fileUrl
|
||||||
@ -210,7 +210,7 @@ Item {
|
|||||||
|
|
||||||
QtDialogs.ColorDialog {
|
QtDialogs.ColorDialog {
|
||||||
id: colorDialog
|
id: colorDialog
|
||||||
title: "Select a color"
|
title: i18n("Select a color")
|
||||||
color: selectColor.text
|
color: selectColor.text
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
selectColor.text = colorDialog.color
|
selectColor.text = colorDialog.color
|
||||||
@ -219,7 +219,7 @@ Item {
|
|||||||
|
|
||||||
QtDialogs.FontDialog {
|
QtDialogs.FontDialog {
|
||||||
id: fontDialog
|
id: fontDialog
|
||||||
title: "Select a font"
|
title: i18n("Select a font")
|
||||||
font: Qt.font({ family: selectFont.text, pointSize: fontSize.value, weight: Font.Normal })
|
font: Qt.font({ family: selectFont.text, pointSize: fontSize.value, weight: Font.Normal })
|
||||||
onAccepted: {
|
onAccepted: {
|
||||||
selectFont.text = fontDialog.font.family
|
selectFont.text = fontDialog.font.family
|
||||||
|
@ -38,10 +38,10 @@ Item {
|
|||||||
}
|
}
|
||||||
Text {
|
Text {
|
||||||
id: iconPath
|
id: iconPath
|
||||||
property string active: "/usr/share/icons/hicolor/64x64/apps/netctl-idle.png"
|
property string active: plasmoid.configuration.activeIconPath
|
||||||
property string inactive: "/usr/share/icons/hicolor/64x64/apps/netctl-offline.png"
|
property string inactive: plasmoid.configuration.inactiveIconPath
|
||||||
}
|
}
|
||||||
property int interval: 1000
|
property int interval: plasmoid.configuration.autoUpdateInterval
|
||||||
property bool status: false
|
property bool status: false
|
||||||
|
|
||||||
// init
|
// init
|
||||||
|
215
sources/plasmoid/plasmoid/contents/ui/widget.qml
Normal file
215
sources/plasmoid/plasmoid/contents/ui/widget.qml
Normal file
@ -0,0 +1,215 @@
|
|||||||
|
/***************************************************************************
|
||||||
|
* This file is part of netctl-gui *
|
||||||
|
* *
|
||||||
|
* netctl-gui is free software: you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License as *
|
||||||
|
* published by the Free Software Foundation, either version 3 of the *
|
||||||
|
* License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* netctl-gui is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with netctl-gui. If not, see http://www.gnu.org/licenses/ *
|
||||||
|
***************************************************************************/
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: widgetPage
|
||||||
|
width: childrenRect.width
|
||||||
|
height: childrenRect.height
|
||||||
|
|
||||||
|
property alias cfg_autoUpdateInterval: autoUpdate.value
|
||||||
|
property alias cfg_guiPath: guiPath.text
|
||||||
|
property alias cfg_useHelper: useHelper.checked
|
||||||
|
property alias cfg_helperPath: helperPath.text
|
||||||
|
property alias cfg_netctlPath: netctlPath.text
|
||||||
|
property alias cfg_netctlPathAuto: netctlAutoPath.text
|
||||||
|
property alias cfg_useSudo: useSudo.checked
|
||||||
|
property alias cfg_sudoPath: sudoPath.text
|
||||||
|
property alias cfg_useWifi: useWifi.checked
|
||||||
|
property alias cfg_wifiPath: wifiPath.text
|
||||||
|
property alias cfg_textPattern: textPattern.text
|
||||||
|
|
||||||
|
|
||||||
|
QtLayouts.ColumnLayout {
|
||||||
|
QtLayouts.RowLayout {
|
||||||
|
QtControls.Label {
|
||||||
|
text: i18n("Auto update interval, msec")
|
||||||
|
}
|
||||||
|
QtControls.SpinBox {
|
||||||
|
id: autoUpdate
|
||||||
|
minimumValue: 1000
|
||||||
|
maximumValue: 10000
|
||||||
|
stepSize: 500
|
||||||
|
value: plasmoid.configuration.autoUpdateInterval
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QtLayouts.RowLayout {
|
||||||
|
QtControls.Label {
|
||||||
|
text: i18n("Path to GUI")
|
||||||
|
}
|
||||||
|
QtControls.TextField {
|
||||||
|
id: guiPath
|
||||||
|
QtLayouts.Layout.fillWidth: true
|
||||||
|
text: plasmoid.configuration.guiPath
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
text: i18n("Browse")
|
||||||
|
onClicked: guiFileDialog.visible = true
|
||||||
|
}
|
||||||
|
|
||||||
|
QtDialogs.FileDialog {
|
||||||
|
id: guiFileDialog
|
||||||
|
title: i18n("Select a path")
|
||||||
|
folder: "/usr/bin"
|
||||||
|
nameFilters: [ "All files (*)" ]
|
||||||
|
selectExisting: true
|
||||||
|
onAccepted: guiPath.text = guiFileDialog.fileUrl
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QtLayouts.RowLayout {
|
||||||
|
QtControls.CheckBox {
|
||||||
|
id: useHelper
|
||||||
|
text: i18n("Use helper")
|
||||||
|
}
|
||||||
|
QtControls.TextField {
|
||||||
|
id: helperPath
|
||||||
|
enabled: useHelper.checked
|
||||||
|
QtLayouts.Layout.fillWidth: true
|
||||||
|
text: plasmoid.configuration.helperPath
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
enabled: useHelper.checked
|
||||||
|
text: i18n("Browse")
|
||||||
|
onClicked: helperFileDialog.visible = true
|
||||||
|
}
|
||||||
|
|
||||||
|
QtDialogs.FileDialog {
|
||||||
|
id: helperFileDialog
|
||||||
|
title: i18n("Select a path")
|
||||||
|
folder: "/usr/bin"
|
||||||
|
nameFilters: [ "All files (*)" ]
|
||||||
|
selectExisting: true
|
||||||
|
onAccepted: helperPath.text = helperFileDialog.fileUrl
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QtLayouts.RowLayout {
|
||||||
|
QtControls.Label {
|
||||||
|
text: i18n("Path to netctl")
|
||||||
|
}
|
||||||
|
QtControls.TextField {
|
||||||
|
id: netctlPath
|
||||||
|
QtLayouts.Layout.fillWidth: true
|
||||||
|
text: plasmoid.configuration.netctlPath
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
text: i18n("Browse")
|
||||||
|
onClicked: netctlFileDialog.visible = true
|
||||||
|
}
|
||||||
|
|
||||||
|
QtDialogs.FileDialog {
|
||||||
|
id: netctlFileDialog
|
||||||
|
title: i18n("Select a path")
|
||||||
|
folder: "/usr/bin"
|
||||||
|
nameFilters: [ "All files (*)" ]
|
||||||
|
selectExisting: true
|
||||||
|
onAccepted: netctlPath.text = netctlFileDialog.fileUrl
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QtLayouts.RowLayout {
|
||||||
|
QtControls.Label {
|
||||||
|
text: i18n("Path to netctl-auto")
|
||||||
|
}
|
||||||
|
QtControls.TextField {
|
||||||
|
id: netctlAutoPath
|
||||||
|
QtLayouts.Layout.fillWidth: true
|
||||||
|
text: plasmoid.configuration.netctlAutoPath
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
text: i18n("Browse")
|
||||||
|
onClicked: netctlAutoFileDialog.visible = true
|
||||||
|
}
|
||||||
|
|
||||||
|
QtDialogs.FileDialog {
|
||||||
|
id: netctlAutoFileDialog
|
||||||
|
title: i18n("Select a path")
|
||||||
|
folder: "/usr/bin"
|
||||||
|
nameFilters: [ "All files (*)" ]
|
||||||
|
selectExisting: true
|
||||||
|
onAccepted: netctlAutoPath.text = netctlAutoFileDialog.fileUrl
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QtLayouts.RowLayout {
|
||||||
|
QtControls.CheckBox {
|
||||||
|
id: useSudo
|
||||||
|
text: i18n("Use sudo for netctl")
|
||||||
|
}
|
||||||
|
QtControls.TextField {
|
||||||
|
id: sudoPath
|
||||||
|
enabled: useSudo.checked
|
||||||
|
QtLayouts.Layout.fillWidth: true
|
||||||
|
text: plasmoid.configuration.sudoPath
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
enabled: useSudo.checked
|
||||||
|
text: i18n("Browse")
|
||||||
|
onClicked: sudoFileDialog.visible = true
|
||||||
|
}
|
||||||
|
|
||||||
|
QtDialogs.FileDialog {
|
||||||
|
id: sudoFileDialog
|
||||||
|
title: i18n("Select a path")
|
||||||
|
folder: "/usr/bin"
|
||||||
|
nameFilters: [ "All files (*)" ]
|
||||||
|
selectExisting: true
|
||||||
|
onAccepted: sudoPath.text = sudoFileDialog.fileUrl
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QtLayouts.RowLayout {
|
||||||
|
QtControls.CheckBox {
|
||||||
|
id: useWifi
|
||||||
|
text: i18n("Show 'Start WiFi menu'")
|
||||||
|
}
|
||||||
|
QtControls.TextField {
|
||||||
|
id: wifiPath
|
||||||
|
enabled: useWifi.checked
|
||||||
|
QtLayouts.Layout.fillWidth: true
|
||||||
|
text: plasmoid.configuration.wifiPath
|
||||||
|
}
|
||||||
|
QtControls.Button {
|
||||||
|
enabled: useWifi.checked
|
||||||
|
text: i18n("Browse")
|
||||||
|
onClicked: wifiFileDialog.visible = true
|
||||||
|
}
|
||||||
|
|
||||||
|
QtDialogs.FileDialog {
|
||||||
|
id: wifiFileDialog
|
||||||
|
title: i18n("Select a path")
|
||||||
|
folder: "/usr/bin"
|
||||||
|
nameFilters: [ "All files (*)" ]
|
||||||
|
selectExisting: true
|
||||||
|
onAccepted: wifiPath.text = wifiFileDialog.fileUrl
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QtControls.TextArea {
|
||||||
|
id: textPattern
|
||||||
|
QtLayouts.Layout.fillWidth: true
|
||||||
|
text: plasmoid.configuration.textPattern
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user