diff --git a/sources/dataengine/CMakeLists.txt b/sources/dataengine/CMakeLists.txt index c17f2ef..9a85ded 100644 --- a/sources/dataengine/CMakeLists.txt +++ b/sources/dataengine/CMakeLists.txt @@ -5,7 +5,7 @@ message (STATUS "Subproject ${SUBPROJECT}") # find required libaries find_package (Qt5 REQUIRED COMPONENTS Widgets Network) find_package (ECM 0.0.11 REQUIRED NO_MODULE) -set (CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) +set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) find_package(KF5 REQUIRED COMPONENTS Plasma Service) include (KDEInstallDirs) @@ -45,7 +45,6 @@ kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${SUBPROJECT_DESKTOP_IN}) # kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${SUBPROJECT_DESKTOP}) # install -install (TARGETS ${PLUGIN_NAME} DESTINATION lib/qt/plugins/plasma/dataengine) -# install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/dataengine) +install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/dataengine) install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR}) install (FILES ${SUBPROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR}) diff --git a/sources/plasmoid/CMakeLists.txt b/sources/plasmoid/CMakeLists.txt index f05492e..8902235 100644 --- a/sources/plasmoid/CMakeLists.txt +++ b/sources/plasmoid/CMakeLists.txt @@ -40,29 +40,27 @@ message (STATUS "Subproject ${SUBPROJECT}") # install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR}) # install (FILES ${SUBPROJECT_NOTIFY} DESTINATION ${DATA_INSTALL_DIR}/${PLUGIN_NAME}) # plasma_install_package(plasmoid org.kde.netctl) -find_package(ECM 0.0.12 REQUIRED NO_MODULE) -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) +find_package (Qt5 REQUIRED COMPONENTS Core Qml Widgets) +find_package (ECM 0.0.12 REQUIRED NO_MODULE) +set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) +find_package(KF5 REQUIRED I18n Service WidgetsAddons KIO CoreAddons Notifications Plasma) -include(KDEInstallDirs) -include(KDECMakeSettings) -include(KDECompilerSettings) +include (KDEInstallDirs) +include (KDECMakeSettings) +include (KDECompilerSettings) +add_definitions (${Qt5Core_DEFINITIONS} ${Qt5Qml_DEFINITIONS}) -include(ECMPackageConfigHelpers) -include(ECMOptionalAddSubdirectory) -include(FeatureSummary) - -find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS - Core - DBus - Network - Quick - Widgets -) - -find_package(KF5 REQUIRED - I18n WindowSystem Service Completion WidgetsAddons KIO CoreAddons Wallet ItemViews XmlGui - ConfigWidgets IconThemes Solid DBusAddons Notifications Plasma Declarative Init KDELibs4Support) +set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS} + ${Qt5Qml_INCLUDE_DIRS}) +set (Kf5_INCLUDE ${ConfigCore_INCLUDE_DIR} + ${CoreAddons_INCLUDE_DIR} + ${I18n_INCLUDE_DIR} + ${Notifications_INCLUDE_DIR} + ${Plasma_INCLUDE_DIR} + ${Service_INCLUDE_DIR}) +set (PLUGIN_NAME netctlplugin) +add_subdirectory (plugin) set(dir plasmoid) set(component org.kde.netctl) diff --git a/sources/plasmoid/netctl.h b/sources/plasmoid/netctl.h index 04a8a47..58a62de 100644 --- a/sources/plasmoid/netctl.h +++ b/sources/plasmoid/netctl.h @@ -18,33 +18,6 @@ #ifndef NETCTL_PLASMOID_H #define NETCTL_PLASMOID_H -#include -#include -#include - -#include -#include -#include -#include - - -class Netctl; - -class IconLabel : public QLabel -{ - Q_OBJECT - -public: - IconLabel(Netctl *wid, const bool debugCmd); - ~IconLabel(); - -protected: - void mousePressEvent(QMouseEvent *event); - -private: - bool debug; - Netctl *widget; -}; class Netctl : public Plasma::PopupApplet { diff --git a/sources/plasmoid/plasmoid/contents/config/config.qml b/sources/plasmoid/plasmoid/contents/config/config.qml index db4044b..6d931c9 100644 --- a/sources/plasmoid/plasmoid/contents/config/config.qml +++ b/sources/plasmoid/plasmoid/contents/config/config.qml @@ -18,12 +18,11 @@ import QtQuick 2.0 import org.kde.plasma.configuration 2.0 -import org.kde.plasma.plasmoid 2.0 ConfigModel { ConfigCategory { - name: i18n("Netctl plasmoid") + name: i18n("Widget") icon: "/usr/share/pixmaps/netctl-gui-widget.png" source: "widget.qml" } @@ -33,4 +32,10 @@ ConfigModel { icon: "preferences-desktop-theme" source: "appearance.qml" } + + ConfigCategory { + name: i18n("About") + icon: "help-about" + source: "about.qml" + } } diff --git a/sources/plasmoid/plasmoid/contents/config/main.xml b/sources/plasmoid/plasmoid/contents/config/main.xml index 75125e6..a6936dd 100644 --- a/sources/plasmoid/plasmoid/contents/config/main.xml +++ b/sources/plasmoid/plasmoid/contents/config/main.xml @@ -38,7 +38,9 @@ false - $info\nIPv4: $intip4\nIPv6: $intip6 + $info +IPv4: $intip4 +IPv6: $intip6 diff --git a/sources/plasmoid/plasmoid/contents/ui/about.qml b/sources/plasmoid/plasmoid/contents/ui/about.qml new file mode 100644 index 0000000..0a5b9f7 --- /dev/null +++ b/sources/plasmoid/plasmoid/contents/ui/about.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 QtQuick.Controls 1.0 as QtControls +import QtQuick.Layouts 1.0 as QtLayouts + + +Item { + id: aboutPage + width: childrenRect.width + height: childrenRect.height + + + QtLayouts.ColumnLayout { + QtControls.Label { + horizontalAlignment: Text.AlignHCenter + text: i18n("Some text") + } + } +} diff --git a/sources/plasmoid/plasmoid/contents/ui/main.qml b/sources/plasmoid/plasmoid/contents/ui/main.qml index e952221..e230276 100644 --- a/sources/plasmoid/plasmoid/contents/ui/main.qml +++ b/sources/plasmoid/plasmoid/contents/ui/main.qml @@ -20,21 +20,22 @@ 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 +import org.kde.plasma.private.netctl 1.0 + Item { id: main // 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" - property string intip6: "::1" - property var interfaces: ["lo"] - property var profiles: [] - property string status: "N\\A" + 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" } Text { id: iconPath @@ -64,22 +65,25 @@ Item { icon.source = iconPath.inactive } } else if (sourceName == "current") { - info.current= data.value + info["current"] = data.value // text update + for (var prop in info) { + console.log(prop + " = " + info[prop]) + } } else if (sourceName == "extip4") { - info.extip4 = data.value + info["extip4"] = data.value } else if (sourceName == "extip6") { - info.extip6 = data.value + info["extip6"] = data.value } else if (sourceName == "interfaces") { - info.interfaces = data.value + info["interfaces"] = data.value } else if (sourceName == "intip4") { - info.intip4 = data.value + info["intip4"] = data.value } else if (sourceName == "intip6") { - info.intip6 = data.value + info["intip6"] = data.value } else if (sourceName == "profiles") { - info.profiles = data.value + info["profiles"] = data.value } else if (sourceName == "status") { - info.status = data.value + info["status"] = data.value } } } diff --git a/sources/plasmoid/plugin/CMakeLists.txt b/sources/plasmoid/plugin/CMakeLists.txt new file mode 100644 index 0000000..a9cd708 --- /dev/null +++ b/sources/plasmoid/plugin/CMakeLists.txt @@ -0,0 +1,15 @@ +include_directories (${CMAKE_SOURCE_DIR} + ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/../ + ${PROJECT_TRDPARTY_DIR} + ${Qt_INCLUDE} + ${Kf5_INCLUDE}) + +file (GLOB SUBPROJECT_SOURCE *.cpp) + +add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE}) +target_link_libraries (${PLUGIN_NAME} ${Qt5Core_LIBRARIES} ${Qt5Qml_LIBRARIES} ${I18n_LIBRARIES} ${Plasma_LIBRARIES}) + +install (TARGETS ${PLUGIN_NAME} DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/netctl) +install (FILES qmldir DESTINATION ${QML_INSTALL_DIR}/org/kde/plasma/private/netctl) diff --git a/sources/plasmoid/plugin/netctl.cpp b/sources/plasmoid/plugin/netctl.cpp new file mode 100644 index 0000000..31d7886 --- /dev/null +++ b/sources/plasmoid/plugin/netctl.cpp @@ -0,0 +1,40 @@ +/*************************************************************************** + * 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/ * + ***************************************************************************/ + +#include + +#include + +#include "netctl.h" +#include "version.h" + + +QString NetctlPlugin::parsePattern(QString pattern, const QString key, const QString value) +{ +// if (debug) qDebug() << PDEBUG; + + return pattern.replace(QString("$") + key, value); +} + +void NetctlPlugin::registerTypes(const char *uri) +{ + Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.netctl")); + +// qmlRegisterType(uri, 1, 0, "ProcessRunner"); +// qmlRegisterType(uri, 1, 0, "TimeZoneModel"); +// qmlRegisterSingletonType(uri, 1, 0, "TimezonesI18n", timezonesi18n_singletontype_provider); +} diff --git a/sources/plasmoid/plugin/netctl.h b/sources/plasmoid/plugin/netctl.h new file mode 100644 index 0000000..4e4bd40 --- /dev/null +++ b/sources/plasmoid/plugin/netctl.h @@ -0,0 +1,38 @@ +/*************************************************************************** + * 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/ * + ***************************************************************************/ + + +#ifndef NETCTLPLUGIN_H +#define NETCTLPLUGIN_H + +#include + + +class QQmlEngine; + +class NetctlPlugin : public QQmlExtensionPlugin +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") + +public: + void registerTypes(const char *uri); + static QString parsePattern(QString pattern, const QString key, const QString value); +}; + + +#endif /* NETCTLPLUGIN_H */ diff --git a/sources/plasmoid/plugin/qmldir b/sources/plasmoid/plugin/qmldir new file mode 100644 index 0000000..38fdc11 --- /dev/null +++ b/sources/plasmoid/plugin/qmldir @@ -0,0 +1,3 @@ +module org.kde.plasma.private.netctl + +plugin netctlplugin diff --git a/sources/plasmoid/widget.ui b/sources/plasmoid/widget.ui deleted file mode 100644 index f4b1d07..0000000 --- a/sources/plasmoid/widget.ui +++ /dev/null @@ -1,343 +0,0 @@ - - - ConfigWindow - - - - 0 - 0 - 480 - 340 - - - - - 480 - 320 - - - - Configuration Window - - - - - - - - - 150 - 23 - - - - Auto update interval, msec - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - 100 - 0 - - - - Qt::LeftToRight - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - 333 - - - 10000 - - - 500 - - - 1000 - - - - - - - - - - - - 150 - 23 - - - - Path to GUI - - - - - - - - - - - 100 - 23 - - - - Browse - - - - - - - - - - - - 150 - 23 - - - - Use helper - - - true - - - - - - - - - - - 100 - 23 - - - - Browse - - - - - - - - - - - - 150 - 23 - - - - Path to netctl - - - - - - - - - - - 100 - 23 - - - - Browse - - - - - - - - - - - - 150 - 23 - - - - Path to netctl-auto - - - - - - - - - - - 100 - 23 - - - - Browse - - - - - - - - - - - - 150 - 23 - - - - Use sudo for netctl - - - true - - - - - - - - - - - 100 - 23 - - - - Browse - - - - - - - - - - - - 150 - 23 - - - - Show 'Start WiFi menu' - - - true - - - - - - - - - - - 100 - 23 - - - - Browse - - - - - - - - - Show more detailed interface - - - true - - - - - - - $info - active profile information -$current - current profile name -$extip4 - external IPv4 -$extip6 - external IPv6 -$interfaces - list of the network interfaces -$intip4 - internal IPv4 -$intip6 - internal IPv6 -$profiles - list of the netctl profiles -$status - current profile status (static/enabled) - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - spinBox_autoUpdate - lineEdit_gui - pushButton_gui - lineEdit_netctl - pushButton_netctl - checkBox_sudo - lineEdit_sudo - pushButton_sudo - checkBox_wifi - lineEdit_wifi - pushButton_wifi - - - -