add ability to build kde4 and kf5 packages

This commit is contained in:
arcan1s
2015-01-03 13:56:00 +03:00
parent cbac07b29e
commit 00a35d75d2
44 changed files with 4144 additions and 42 deletions

View File

@ -0,0 +1,41 @@
/***************************************************************************
* 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 org.kde.plasma.configuration 2.0
ConfigModel {
ConfigCategory {
name: i18n("Widget")
icon: "/usr/share/pixmaps/netctl-gui-widget.png"
source: "widget.qml"
}
ConfigCategory {
name: i18n("Appearance")
icon: "preferences-desktop-theme"
source: "appearance.qml"
}
ConfigCategory {
name: i18n("About")
icon: "help-about"
source: "about.qml"
}
}

View File

@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8"?>
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
<kcfgfile name=""/>
<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
IPv4: $intip4
IPv6: $intip6</default>
</entry>
</group>
<group name="Appearance">
<!-- appearance -->
<entry name="textAlign" type="string">
<default>center</default>
</entry>
<entry name="fontFamily" type="string">
<default>Terminus</default>
</entry>
<entry name="fontSize" type="int">
<default>12</default>
</entry>
<entry name="fontColor" type="string">
<default>#000000</default>
</entry>
<entry name="fontWeight" type="string">
<default>normal</default>
</entry>
<entry name="fontStyle" type="string">
<default>normal</default>
</entry>
<entry name="activeIconPath" type="string">
<default>/usr/share/icons/hicolor/64x64/apps/netctl-idle.png</default>
</entry>
<entry name="inactiveIconPath" type="string">
<default>/usr/share/icons/hicolor/64x64/apps/netctl-offline.png</default>
</entry>
</group>
</kcfg>

View File

@ -0,0 +1,85 @@
/***************************************************************************
* 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.3 as QtControls
import QtQuick.Layouts 1.0 as QtLayouts
import org.kde.plasma.private.netctl 1.0
Item {
id: aboutPage
width: childrenRect.width
height: childrenRect.height
Grid {
QtControls.TabView {
QtControls.Tab {
title: i18n("About")
QtLayouts.ColumnLayout {
QtControls.Label {
QtLayouts.Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
text: NetctlAdds.getAboutText("header")
}
QtControls.Label {
QtLayouts.Layout.fillWidth: true
horizontalAlignment: Text.AlignJustify
text: NetctlAdds.getAboutText("description")
}
QtControls.Label {
QtLayouts.Layout.fillWidth: true
horizontalAlignment: Text.AlignLeft
textFormat: Text.RichText
text: NetctlAdds.getAboutText("links")
}
QtControls.Label {
QtLayouts.Layout.fillWidth: true
font.capitalization: Font.SmallCaps
horizontalAlignment: Text.AlignHCenter
textFormat: Text.RichText
text: NetctlAdds.getAboutText("copy")
}
}
}
QtControls.Tab {
title: i18n("Acknowledgment")
QtLayouts.ColumnLayout {
QtControls.Label {
QtLayouts.Layout.fillWidth: true
horizontalAlignment: Text.AlignJustify
text: NetctlAdds.getAboutText("translators")
}
QtControls.Label {
QtLayouts.Layout.fillWidth: true
horizontalAlignment: Text.AlignJustify
textFormat: Text.RichText
text: NetctlAdds.getAboutText("3rdparty")
}
}
}
}
}
}

View File

@ -0,0 +1,272 @@
/***************************************************************************
* 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.Controls.Styles 1.3 as QtStyles
import QtQuick.Dialogs 1.1 as QtDialogs
import QtQuick.Layouts 1.0 as QtLayouts
Item {
id: appearancePage
width: childrenRect.width
height: childrenRect.height
property variant weight: {
25: 0,
50: 1,
63: 3,
75: 4,
87: 5
}
property string cfg_textAlign: textAlign.currentText
property alias cfg_fontFamily: selectFont.text
property alias cfg_fontSize: fontSize.value
property string cfg_fontWeight: fontWeight.currentText
property string cfg_fontStyle: fontStyle.currentText
property alias cfg_fontColor: selectColor.text
property alias cfg_activeIconPath: activeIcon.text
property alias cfg_inactiveIconPath: inactiveIcon.text
QtLayouts.ColumnLayout {
QtLayouts.RowLayout {
QtControls.Label {
text: i18n("Text align")
}
QtControls.ComboBox {
id: textAlign
textRole: "label"
model: [
{
'label': i18n("center"),
'name': "center"
},
{
'label': i18n("right"),
'name': "right"
},
{
'label': i18n("left"),
'name': "left"
},
{
'label': i18n("justify"),
'name': "justify"
}
]
onCurrentIndexChanged: cfg_textAlign = model[currentIndex]["name"]
Component.onCompleted: {
for (var i = 0; i < model.length; i++) {
if (model[i]["name"] == plasmoid.configuration.textAlign) {
textAlign.currentIndex = i;
}
}
}
}
}
QtLayouts.RowLayout {
QtControls.Label {
text: i18n("Font")
}
QtControls.Button {
id: selectFont
text: plasmoid.configuration.fontFamily
onClicked: fontDialog.visible = true
}
}
QtLayouts.RowLayout {
QtControls.Label {
text: i18n("Font size")
}
QtControls.SpinBox {
id: fontSize
minimumValue: 8
maximumValue: 24
stepSize: 1
value: plasmoid.configuration.fontSize
}
}
QtLayouts.RowLayout {
QtControls.Label {
text: i18n("Font weight")
}
QtControls.ComboBox {
id: fontWeight
textRole: "label"
model: [
{
'label': i18n("light"),
'name': "light"
},
{
'label': i18n("normal"),
'name': "normal"
},
{
'label': i18n("demi bold"),
'name': "demibold"
},
{
'label': i18n("bold"),
'name': "bold"
},
{
'label': i18n("black"),
'name': "black"
}
]
onCurrentIndexChanged: cfg_fontWeight = model[currentIndex]["name"]
Component.onCompleted: {
for (var i = 0; i < model.length; i++) {
if (model[i]["name"] == plasmoid.configuration.fontWeight) {
fontWeight.currentIndex = i;
}
}
}
}
}
QtLayouts.RowLayout {
QtControls.Label {
text: i18n("Font style")
}
QtControls.ComboBox {
id: fontStyle
textRole: "label"
model: [
{
'label': i18n("normal"),
'name': "normal"
},
{
'label': i18n("italic"),
'name': "italic"
}
]
onCurrentIndexChanged: cfg_fontStyle = model[currentIndex]["name"]
Component.onCompleted: {
for (var i = 0; i < model.length; i++) {
if (model[i]["name"] == plasmoid.configuration.fontStyle) {
fontStyle.currentIndex = i;
}
}
}
}
}
QtLayouts.RowLayout {
QtControls.Label {
text: i18n("Font color")
}
QtControls.Button {
id: selectColor
style: QtStyles.ButtonStyle {
background: Rectangle {
color: plasmoid.configuration.fontColor
}
}
text: plasmoid.configuration.fontColor
onClicked: colorDialog.visible = true
}
}
QtLayouts.RowLayout {
QtControls.Label {
text: i18n("Active icon")
}
QtControls.TextField {
id: activeIcon
QtLayouts.Layout.fillWidth: true
text: plasmoid.configuration.activeIconPath
}
QtControls.Button {
text: i18n("Browse")
onClicked: {
// FIXME: more clean directory definition
var list = inactiveIcon.text.split('/')
list.pop()
activeFileDialog.folder = "/" + list.join('/')
activeFileDialog.visible = true
}
}
QtDialogs.FileDialog {
id: activeFileDialog
title: i18n("Select a path")
nameFilters: [ "Image files (*.jpeg *.jpg *.png)", "All files (*)" ]
selectExisting: true
onAccepted: activeIcon.text = activeFileDialog.fileUrl
}
}
QtLayouts.RowLayout {
QtControls.Label {
text: i18n("Inactive icon")
}
QtControls.TextField {
id: inactiveIcon
QtLayouts.Layout.fillWidth: true
text: plasmoid.configuration.inactiveIconPath
}
QtControls.Button {
text: i18n("Browse")
onClicked: {
// FIXME: more clean directory definition
var list = inactiveIcon.text.split('/')
list.pop()
inactiveFileDialog.folder = "/" + list.join('/')
inactiveFileDialog.visible = true
}
}
QtDialogs.FileDialog {
id: inactiveFileDialog
title: i18n("Select a path")
nameFilters: [ "Image files (*.jpeg *.jpg *.png)", "All files (*)" ]
selectExisting: true
onAccepted: inactiveIcon.text = inactiveFileDialog.fileUrl
}
}
}
QtDialogs.ColorDialog {
id: colorDialog
title: i18n("Select a color")
color: selectColor.text
onAccepted: {
selectColor.text = colorDialog.color
}
}
QtDialogs.FontDialog {
id: fontDialog
title: i18n("Select a font")
font: Qt.font({ family: selectFont.text, pointSize: fontSize.value, weight: Font.Normal })
onAccepted: {
selectFont.text = fontDialog.font.family
fontSize.value = fontDialog.font.pointSize
fontStyle.currentIndex = fontDialog.font.italic ? 1 : 0
fontWeight.currentIndex = weight[fontDialog.font.weight]
}
}
}

View File

@ -0,0 +1,121 @@
/***************************************************************************
* 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.2
import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
import org.kde.plasma.private.netctl 1.0
Item {
id: main
// variables
// internal
property variant weight: {
"light": Font.Light,
"normal": Font.Normal,
"demibold": Font.DemiBold,
"bold": Font.Bold,
"black": Font.Black
}
property variant align: {
"left": Text.AlignLeft,
"center": Text.AlignHCenter,
"right": Text.AlignRight,
"justify": Text.AlignJustify
}
// external
property variant iconPath: {
"true": plasmoid.configuration.activeIconPath,
"false": plasmoid.configuration.inactiveIconPath
}
property variant info: {
"current": "N\\A",
"extip4": "127.0.0.1",
"extip6": "::1",
"intip4": "127.0.0.1",
"intip6": "::1",
"interfaces": "lo",
"profiles": "",
"status": "N\\A"
}
property int interval: plasmoid.configuration.autoUpdateInterval
property string pattern: plasmoid.configuration.textPattern
property bool status: false
// init
Plasmoid.icon: icon.source
PlasmaCore.DataSource {
id: mainData
engine: "netctl"
connectedSources: ["active", "current", "extip4", "extip6", "interfaces", "intip4", "intip6", "profiles", "status"]
interval: main.interval
onNewData: {
if (data.isEmpty) return
if (sourceName == "active") {
main.status = data.value == "true" ? true : false
icon.source = iconPath[data.value]
} else if (sourceName == "current") {
info["current"] = data.value
// text update
info["info"] = NetctlAdds.getInfo(info["current"], info["status"])
text.text = NetctlAdds.parsePattern(pattern, info)
} else if (sourceName == "extip4") {
info["extip4"] = data.value
} else if (sourceName == "extip6") {
info["extip6"] = data.value
} else if (sourceName == "interfaces") {
info["interfaces"] = data.value
} else if (sourceName == "intip4") {
info["intip4"] = data.value
} else if (sourceName == "intip6") {
info["intip6"] = data.value
} else if (sourceName == "profiles") {
info["profiles"] = data.value
} else if (sourceName == "status") {
info["status"] = data.value
}
}
}
// ui
Grid {
id: mainGrid
columns: 2
Image {
id: icon
source: iconPath["false"]
}
Text {
id: text
color: plasmoid.configuration.fontColor
font.family: plasmoid.configuration.fontFamily
font.italic: plasmoid.configuration.fontStyle == "italic" ? true : false
font.pointSize: plasmoid.configuration.fontSize
font.weight: weight[plasmoid.configuration.fontWeight]
horizontalAlignment: align[plasmoid.configuration.textAlign]
textFormat: Text.RichText
text: "N\\A"
}
}
}

View 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
}
}
}