diff --git a/sources/dataengine/CMakeLists.txt b/sources/dataengine/CMakeLists.txt
index 24672bb..c17f2ef 100644
--- a/sources/dataengine/CMakeLists.txt
+++ b/sources/dataengine/CMakeLists.txt
@@ -29,7 +29,6 @@ include_directories (${CMAKE_SOURCE_DIR}
set (PLUGIN_NAME ${SUBPROJECT})
file (GLOB SUBPROJECT_DESKTOP_IN *.desktop)
-message (STATUS ${SUBPROJECT_DESKTOP_IN})
file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN})
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp)
set (TASK_HEADER ${PROJECT_TRDPARTY_DIR}/task/task.h)
diff --git a/sources/plasmoid/appearance.ui b/sources/plasmoid/appearance.ui
deleted file mode 100644
index b106e34..0000000
--- a/sources/plasmoid/appearance.ui
+++ /dev/null
@@ -1,488 +0,0 @@
-
-
- AppearanceWindow
-
-
-
- 0
- 0
- 480
- 341
-
-
-
-
- 480
- 320
-
-
-
- Configuration Window
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 40
-
-
-
-
- -
-
-
-
-
-
-
- 80
- 23
-
-
-
- Inactive icon
-
-
-
- -
-
-
- -
-
-
-
- 100
- 0
-
-
-
- Browse
-
-
-
-
-
- -
-
-
-
-
-
-
- 80
- 23
-
-
-
- Font color
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 100
- 23
-
-
-
- Set font color
-
-
-
-
-
- -
-
-
- 5
-
-
- 5
-
-
- Qt::Horizontal
-
-
-
- -
-
-
-
-
-
-
- 80
- 23
-
-
-
- Font size
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 100
- 23
-
-
-
- Set font size
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- 7
-
-
- 48
-
-
- 12
-
-
-
-
-
- -
-
-
-
-
-
-
- 80
- 23
-
-
-
- Font weight
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 100
- 23
-
-
-
- Set font weight
-
-
- Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter
-
-
- 300
-
-
- 600
-
-
- 50
-
-
- 400
-
-
-
-
-
- -
-
-
-
-
-
-
- 80
- 23
-
-
-
- Font style
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 100
- 23
-
-
-
- Set font style
-
-
-
-
- normal
-
-
- -
-
- italic
-
-
-
-
-
-
- -
-
-
-
-
-
-
- 80
- 23
-
-
-
- Font
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 180
- 23
-
-
-
- Set font family
-
-
-
-
-
- -
-
-
-
-
-
-
- 80
- 23
-
-
-
- Active icon
-
-
-
- -
-
-
- -
-
-
-
- 100
- 0
-
-
-
- Browse
-
-
-
-
-
- -
-
-
-
-
-
-
- 80
- 23
-
-
-
- Text align
-
-
-
- -
-
-
- Qt::Horizontal
-
-
-
- 40
- 20
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 100
- 23
-
-
-
- Set text align
-
-
-
-
- center
-
-
- -
-
- right
-
-
- -
-
- left
-
-
- -
-
- justify
-
-
-
-
-
-
-
-
-
-
- KColorCombo
- QComboBox
-
-
-
-
- fontComboBox_font
- spinBox_fontSize
- kcolorcombo_fontColor
- spinBox_fontWeight
- comboBox_fontStyle
- lineEdit_activeIcon
- pushButton_activeIcon
- lineEdit_inactiveIcon
- pushButton_inactiveIcon
-
-
-
-
diff --git a/sources/plasmoid/plasmoid/contents/config/config.qml b/sources/plasmoid/plasmoid/contents/config/config.qml
new file mode 100644
index 0000000..85b74e5
--- /dev/null
+++ b/sources/plasmoid/plasmoid/contents/config/config.qml
@@ -0,0 +1,35 @@
+/***************************************************************************
+ * 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("Netctl plasmoid")
+// icon: Plasmoid.icon
+// source: "appearance.qml"
+// }
+
+ ConfigCategory {
+ name: i18n("Appearance")
+ icon: "preferences-desktop-theme"
+ source: "appearance.qml"
+ }
+}
diff --git a/sources/plasmoid/plasmoid/contents/config/main.xml b/sources/plasmoid/plasmoid/contents/config/main.xml
new file mode 100644
index 0000000..890f015
--- /dev/null
+++ b/sources/plasmoid/plasmoid/contents/config/main.xml
@@ -0,0 +1,36 @@
+
+
+
+
+
+
+
+ center
+
+
+ Terminus
+
+
+ 12
+
+
+ #000000
+
+
+ 400
+
+
+ normal
+
+
+ /usr/share/icons/hicolor/64x64/apps/netctl-idle.png
+
+
+ /usr/share/icons/hicolor/64x64/apps/netctl-offline.png
+
+
+
+
diff --git a/sources/plasmoid/plasmoid/contents/ui/appearance.qml b/sources/plasmoid/plasmoid/contents/ui/appearance.qml
new file mode 100644
index 0000000..c2c132e
--- /dev/null
+++ b/sources/plasmoid/plasmoid/contents/ui/appearance.qml
@@ -0,0 +1,229 @@
+/***************************************************************************
+ * 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: appearancePage
+ width: childrenRect.width
+ height: childrenRect.height
+
+ property string cfg_textAlign: textAlign.currentText
+ property alias cfg_fontFamily: selectFont.text
+ property alias cfg_fontSize: fontSize.value
+ property alias cfg_fontWeight: fontWeight.value
+ 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.SpinBox {
+ id: fontWeight
+ minimumValue: 100
+ maximumValue: 900
+ stepSize: 100
+ value: plasmoid.configuration.fontWeight
+ }
+ }
+
+ 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
+ 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: "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: "Select a path"
+ nameFilters: [ "Image files (*.jpeg *.jpg *.png)", "All files (*)" ]
+ selectExisting: true
+ onAccepted: inactiveIcon.text = inactiveFileDialog.fileUrl
+ }
+ }
+ }
+
+ QtDialogs.ColorDialog {
+ id: colorDialog
+ title: "Select a color"
+ color: selectColor.text
+ onAccepted: {
+ selectColor.text = colorDialog.color
+ }
+ }
+
+ QtDialogs.FontDialog {
+ id: fontDialog
+ title: "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
+ }
+ }
+}
diff --git a/sources/plasmoid/plasmoid/contents/ui/main.qml b/sources/plasmoid/plasmoid/contents/ui/main.qml
index 544b741..86fd8fa 100644
--- a/sources/plasmoid/plasmoid/contents/ui/main.qml
+++ b/sources/plasmoid/plasmoid/contents/ui/main.qml
@@ -18,6 +18,7 @@
import QtQuick 2.2
import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as PlasmaComponents
+import org.kde.plasma.plasmoid 2.0
Item {
@@ -26,6 +27,7 @@ Item {
// variables
Text {
id: info
+ property string current: "N\\A"
property string extip4: "127.0.0.1"
property string extip6: "::1"
property string intip4: "127.0.0.1"
@@ -42,6 +44,9 @@ Item {
property int interval: 1000
property bool status: false
+ // init
+ Plasmoid.icon: icon.source
+
PlasmaCore.DataSource {
id: mainData
engine: "netctl"
@@ -59,7 +64,8 @@ Item {
icon.source = iconPath.inactive
}
} else if (sourceName == "current") {
- text.text = data.value
+ info.current= data.value
+ // text update
} else if (sourceName == "extip4") {
info.extip4 = data.value
} else if (sourceName == "extip6") {
@@ -84,9 +90,11 @@ Item {
Image {
id: icon
+ source: iconPath.inactive
}
Text {
id: text
+ text: "N\\A"
}
}
}
diff --git a/sources/plasmoid/plasmoid/contents/ui/main.qml.autosave b/sources/plasmoid/plasmoid/contents/ui/main.qml.autosave
deleted file mode 100644
index 3a2c4c5..0000000
--- a/sources/plasmoid/plasmoid/contents/ui/main.qml.autosave
+++ /dev/null
@@ -1,92 +0,0 @@
-/***************************************************************************
- * 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.core 2.0 as PlasmaCore
-import org.kde.plasma.components 2.0 as PlasmaComponents
-
-
-Item {
- id: main
-
- // variables
- Text {
- id: info
- property string extip4: "127.0.0.1"
- property string extip6: "::1"
- property string intip4: "127.0.0.1"
- property string intip6: "::1"
- property var interfaces: ["lo"]
- property var profiles: []
- property string status: "N\\A"
- }
- Text {
- id: iconPath
- property string active: "/usr/share/icons/hicolor/64x64/apps/netctl-idle.png"
- property string inactive: "/usr/share/icons/hicolor/64x64/apps/netctl-offline.png"
- }
- property int interval: 1000
- property bool status: false
-
- PlasmaCore.DataSource {
- id: mainData
- engine: ""
- connectedSources: ["active", "current", "extip4", "extip6", "interfaces", "intip4", "intip6", "profiles", "status"]
- interval: main.interval
-
- onNewData: {
- if (data.isEmpty) return
- if (sourceName == "active") {
- if (data.value == "true") {
- main.status = true
- icon.source = iconPath.active
- } else {
- main.status = false
- icon.source = iconPath.inactive
- }
- } else if (sourceName == "current") {
- text.text = data.value
- } 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
- }
- }
- }
-
- Grid {
- id: mainGrid
- columns: 2
-
- Image {
- id: icon
- }
- Text {
- id: text
- }
- }
-}