From 0898a9987897fb825422a0cb64b90eb58aa5819c Mon Sep 17 00:00:00 2001 From: arcan1s Date: Tue, 21 Oct 2014 13:06:57 +0400 Subject: [PATCH 01/12] updte dataengine skel --- sources/dataengine/CMakeLists.txt | 49 ++++++++++++++++++++++++++----- sources/dataengine/netctl.cpp | 5 ++-- 2 files changed, 43 insertions(+), 11 deletions(-) diff --git a/sources/dataengine/CMakeLists.txt b/sources/dataengine/CMakeLists.txt index 8712186..4c78a58 100644 --- a/sources/dataengine/CMakeLists.txt +++ b/sources/dataengine/CMakeLists.txt @@ -3,16 +3,49 @@ set (SUBPROJECT plasma_engine_netctl) message (STATUS "Subproject ${SUBPROJECT}") # find required libaries -find_package (KDE4 REQUIRED) -include (KDE4Defaults) +set(QT_MIN_VERSION "5.3.0") +set(KF5_MIN_VERSION "5.0.0") +set(INSTALL_SDDM_THEME TRUE) +find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Widgets Quick QuickWidgets Concurrent Test Script Network) -add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) +find_package(ECM 0.0.11 REQUIRED NO_MODULE) +set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) + +find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS + Plasma DocTools Runner JsEmbed NotifyConfig Su NewStuff Wallet KCMUtils Baloo + IdleTime Declarative WebKit TextWidgets KDELibs4Support Crash) + +# WARNING PlasmaQuick provides unversioned CMake config +find_package(KF5 REQUIRED COMPONENTS PlasmaQuick) +find_package(KF5 REQUIRED COMPONENTS SysGuard) +find_package(KF5 REQUIRED COMPONENTS Screen) +find_package(KF5TextEditor) +find_package(KWinDBusInterface CONFIG REQUIRED) + +include(KDEInstallDirs) +include(KDECMakeSettings) +include(KDECompilerSettings) +include(ECMPackageConfigHelpers) +include(ECMMarkNonGuiExecutable) +include(CMakePackageConfigHelpers) +include(WriteBasicConfigVersionFile) +include(CheckIncludeFiles) +include(FeatureSummary) + +include_directories (/usr/include/KF5/KService + /usr/include/KF5/KConfigCore + /usr/include/KF5/KCoreAddons) +add_definitions(${Qt5Core_DEFINITIONS} ${Qt5Network_DEFINITIONS}) +# add_definitions (${QT_DEFINITIONS} ${KF5_DEFINITIONS}) include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} - ${KDE4_INCLUDES} + ${INTERFACE_INCLUDE_DIRECTORIES} + ${Plasma_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/../ - ${PROJECT_TRDPARTY_DIR}) + ${PROJECT_TRDPARTY_DIR} + ${Qt5Core_INCLUDE_DIRS} + ${Qt5Network_INCLUDE_DIRS}) set (PLUGIN_NAME ${SUBPROJECT}) file (GLOB SUBPROJECT_DESKTOP_IN *.desktop) @@ -25,9 +58,9 @@ file (GLOB SUBPROJECT_CONF *.conf) configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP}) # make -qt4_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER}) -kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE} ${TASK_MOC_SOURCE}) -target_link_libraries (${PLUGIN_NAME} ${KDE4_KDECORE_LIBS} ${KDE4_PLASMA_LIBS} ${QT_QTNETWORK_LIBRARY}) +qt5_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER}) +add_library (${PLUGIN_NAME} MODULE ${SUBPROJECT_SOURCE} ${TASK_MOC_SOURCE}) +target_link_libraries (${PLUGIN_NAME} KF5::Plasma ${Qt5Network_LIBRARIES}) # install install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}) diff --git a/sources/dataengine/netctl.cpp b/sources/dataengine/netctl.cpp index f37bcc2..0b2ed04 100644 --- a/sources/dataengine/netctl.cpp +++ b/sources/dataengine/netctl.cpp @@ -17,8 +17,6 @@ #include "netctl.h" -#include -#include #include #include @@ -89,7 +87,8 @@ void Netctl::readConfiguration() rawConfig[QString("NETCTLCMD")] = QString("/usr/bin/netctl"); rawConfig[QString("NETCTLAUTOCMD")] = QString("/usr/bin/netctl-auto"); - QString fileName = KGlobal::dirs()->findResource("config", "netctl.conf"); + // TODO: correct filename + QString fileName = QString(".config/netctl.conf"); if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName; QFile configFile(fileName); if (!configFile.open(QIODevice::ReadOnly)) { From 030dec5e147a0a1c15523b593f1643a9d6cdfd3b Mon Sep 17 00:00:00 2001 From: arcan1s Date: Tue, 21 Oct 2014 16:26:35 +0400 Subject: [PATCH 02/12] end porting of DE to KF5 --- sources/CMakeLists.txt | 2 +- sources/dataengine/CMakeLists.txt | 54 ++++++++++--------------------- sources/dataengine/netctl.cpp | 4 +-- 3 files changed, 20 insertions(+), 40 deletions(-) diff --git a/sources/CMakeLists.txt b/sources/CMakeLists.txt index d0a774e..de0b2c2 100644 --- a/sources/CMakeLists.txt +++ b/sources/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 2.8.12) cmake_policy (SET CMP0003 OLD) cmake_policy (SET CMP0002 OLD) diff --git a/sources/dataengine/CMakeLists.txt b/sources/dataengine/CMakeLists.txt index 4c78a58..2c1b074 100644 --- a/sources/dataengine/CMakeLists.txt +++ b/sources/dataengine/CMakeLists.txt @@ -3,49 +3,29 @@ set (SUBPROJECT plasma_engine_netctl) message (STATUS "Subproject ${SUBPROJECT}") # find required libaries -set(QT_MIN_VERSION "5.3.0") -set(KF5_MIN_VERSION "5.0.0") -set(INSTALL_SDDM_THEME TRUE) -find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Widgets Quick QuickWidgets Concurrent Test Script Network) +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}) +find_package(KF5 REQUIRED COMPONENTS Plasma Service) -find_package(ECM 0.0.11 REQUIRED NO_MODULE) -set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) +include (KDEInstallDirs) +include (KDECMakeSettings) +include (KDECompilerSettings) +add_definitions (${Qt5Core_DEFINITIONS} ${Qt5Network_DEFINITIONS}) -find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS - Plasma DocTools Runner JsEmbed NotifyConfig Su NewStuff Wallet KCMUtils Baloo - IdleTime Declarative WebKit TextWidgets KDELibs4Support Crash) - -# WARNING PlasmaQuick provides unversioned CMake config -find_package(KF5 REQUIRED COMPONENTS PlasmaQuick) -find_package(KF5 REQUIRED COMPONENTS SysGuard) -find_package(KF5 REQUIRED COMPONENTS Screen) -find_package(KF5TextEditor) -find_package(KWinDBusInterface CONFIG REQUIRED) - -include(KDEInstallDirs) -include(KDECMakeSettings) -include(KDECompilerSettings) -include(ECMPackageConfigHelpers) -include(ECMMarkNonGuiExecutable) -include(CMakePackageConfigHelpers) -include(WriteBasicConfigVersionFile) -include(CheckIncludeFiles) -include(FeatureSummary) - -include_directories (/usr/include/KF5/KService - /usr/include/KF5/KConfigCore - /usr/include/KF5/KCoreAddons) -add_definitions(${Qt5Core_DEFINITIONS} ${Qt5Network_DEFINITIONS}) -# add_definitions (${QT_DEFINITIONS} ${KF5_DEFINITIONS}) +set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS} + ${Qt5Network_INCLUDE_DIRS}) +set (Kf5_INCLUDE ${ConfigCore_INCLUDE_DIR} + ${CoreAddons_INCLUDE_DIR} + ${Plasma_INCLUDE_DIR} + ${Service_INCLUDE_DIR}) include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} - ${INTERFACE_INCLUDE_DIRECTORIES} - ${Plasma_INCLUDE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/../ ${PROJECT_TRDPARTY_DIR} - ${Qt5Core_INCLUDE_DIRS} - ${Qt5Network_INCLUDE_DIRS}) + ${Qt_INCLUDE} + ${Kf5_INCLUDE}) set (PLUGIN_NAME ${SUBPROJECT}) file (GLOB SUBPROJECT_DESKTOP_IN *.desktop) @@ -60,7 +40,7 @@ configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJEC # make qt5_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER}) add_library (${PLUGIN_NAME} MODULE ${SUBPROJECT_SOURCE} ${TASK_MOC_SOURCE}) -target_link_libraries (${PLUGIN_NAME} KF5::Plasma ${Qt5Network_LIBRARIES}) +target_link_libraries (${PLUGIN_NAME} ${Plasma_LIBRARIES} ${Qt5Network_LIBRARIES}) # install install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}) diff --git a/sources/dataengine/netctl.cpp b/sources/dataengine/netctl.cpp index 0b2ed04..3f51029 100644 --- a/sources/dataengine/netctl.cpp +++ b/sources/dataengine/netctl.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -87,8 +88,7 @@ void Netctl::readConfiguration() rawConfig[QString("NETCTLCMD")] = QString("/usr/bin/netctl"); rawConfig[QString("NETCTLAUTOCMD")] = QString("/usr/bin/netctl-auto"); - // TODO: correct filename - QString fileName = QString(".config/netctl.conf"); + QString fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString("netctl.conf")); if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName; QFile configFile(fileName); if (!configFile.open(QIODevice::ReadOnly)) { From a35e9b016488dbdc84d713d6e2fa72e64e38bb78 Mon Sep 17 00:00:00 2001 From: arcan1s Date: Fri, 26 Dec 2014 08:22:26 +0300 Subject: [PATCH 03/12] first work on plasmoid --- sources/dataengine/CMakeLists.txt | 6 +- sources/dataengine/netctl.cpp | 3 +- ...sktop => plasma-dataengine-netctl.desktop} | 0 sources/plasmoid/CMakeLists.txt | 102 ++++++++++++------ .../plasmoid/plasmoid/contents/ui/main.qml | 92 ++++++++++++++++ .../plasmoid/contents/ui/main.qml.autosave | 92 ++++++++++++++++ .../metadata.desktop} | 12 ++- 7 files changed, 270 insertions(+), 37 deletions(-) rename sources/dataengine/{plasma-engine-netctl.desktop => plasma-dataengine-netctl.desktop} (100%) create mode 100644 sources/plasmoid/plasmoid/contents/ui/main.qml create mode 100644 sources/plasmoid/plasmoid/contents/ui/main.qml.autosave rename sources/plasmoid/{plasma-applet-netctl.desktop => plasmoid/metadata.desktop} (64%) diff --git a/sources/dataengine/CMakeLists.txt b/sources/dataengine/CMakeLists.txt index 2c1b074..24672bb 100644 --- a/sources/dataengine/CMakeLists.txt +++ b/sources/dataengine/CMakeLists.txt @@ -29,6 +29,7 @@ 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) @@ -41,8 +42,11 @@ configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJEC qt5_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER}) add_library (${PLUGIN_NAME} MODULE ${SUBPROJECT_SOURCE} ${TASK_MOC_SOURCE}) target_link_libraries (${PLUGIN_NAME} ${Plasma_LIBRARIES} ${Qt5Network_LIBRARIES}) +kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${SUBPROJECT_DESKTOP_IN}) +# kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${SUBPROJECT_DESKTOP}) # install -install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}) +install (TARGETS ${PLUGIN_NAME} DESTINATION lib/qt/plugins/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/dataengine/netctl.cpp b/sources/dataengine/netctl.cpp index 3f51029..bf8c4bf 100644 --- a/sources/dataengine/netctl.cpp +++ b/sources/dataengine/netctl.cpp @@ -387,6 +387,7 @@ bool Netctl::updateSourceEvent(const QString &source) } -K_EXPORT_PLASMA_DATAENGINE(netctl, Netctl) +// K_EXPORT_PLASMA_DATAENGINE(netctl, Netctl) +K_EXPORT_PLASMA_DATAENGINE_WITH_JSON(netctl, Netctl, "plasma-dataengine-netctl.json") #include "netctl.moc" diff --git a/sources/dataengine/plasma-engine-netctl.desktop b/sources/dataengine/plasma-dataengine-netctl.desktop similarity index 100% rename from sources/dataengine/plasma-engine-netctl.desktop rename to sources/dataengine/plasma-dataengine-netctl.desktop diff --git a/sources/plasmoid/CMakeLists.txt b/sources/plasmoid/CMakeLists.txt index d795ae3..f05492e 100644 --- a/sources/plasmoid/CMakeLists.txt +++ b/sources/plasmoid/CMakeLists.txt @@ -2,40 +2,82 @@ set (SUBPROJECT plasma_applet_netctl) message (STATUS "Subproject ${SUBPROJECT}") # find resources -set (RESOURCES ${PROJECT_RESOURCE_DIR}/resources-plasmoid.qrc) +# set (RESOURCES ${PROJECT_RESOURCE_DIR}/resources-plasmoid.qrc) +# +# # find required libaries +# find_package (KDE4 REQUIRED) +# include (KDE4Defaults) +# +# add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) +# include_directories (${CMAKE_SOURCE_DIR} +# ${CMAKE_BINARY_DIR} +# ${KDE4_INCLUDES} +# ${CMAKE_CURRENT_BINARY_DIR} +# ${CMAKE_CURRENT_BINARY_DIR}/../ +# ${PROJECT_TRDPARTY_DIR}) +# +# # add_subdirectory (po) +# +# # set sources +# set (PLUGIN_NAME ${SUBPROJECT}) +# file (GLOB SUBPROJECT_DESKTOP_IN *.desktop) +# file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN}) +# file (GLOB SUBPROJECT_NOTIFY *.notifyrc) +# file (GLOB SUBPROJECT_SOURCE *.cpp) +# file (GLOB_RECURSE SUBPROJECT_UI *.ui ${PROJECT_TRDPARTY_DIR}/about/*.ui) +# +# # prepare +# configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP}) +# +# # make +# qt4_add_resources (QRC_SOURCES ${RESOURCES}) +# kde4_add_ui_files (SUBPROJECT_SOURCE ${SUBPROJECT_UI}) +# kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE} ${QRC_SOURCES}) +# target_link_libraries (${PLUGIN_NAME} ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS}) +# +# # install +# install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}) +# 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 required libaries -find_package (KDE4 REQUIRED) -include (KDE4Defaults) +include(KDEInstallDirs) +include(KDECMakeSettings) +include(KDECompilerSettings) -add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) -include_directories (${CMAKE_SOURCE_DIR} - ${CMAKE_BINARY_DIR} - ${KDE4_INCLUDES} - ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_BINARY_DIR}/../ - ${PROJECT_TRDPARTY_DIR}) +include(ECMPackageConfigHelpers) +include(ECMOptionalAddSubdirectory) +include(FeatureSummary) -add_subdirectory (po) +find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS + Core + DBus + Network + Quick + Widgets +) -# set sources -set (PLUGIN_NAME ${SUBPROJECT}) -file (GLOB SUBPROJECT_DESKTOP_IN *.desktop) -file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN}) -file (GLOB SUBPROJECT_NOTIFY *.notifyrc) -file (GLOB SUBPROJECT_SOURCE *.cpp) -file (GLOB_RECURSE SUBPROJECT_UI *.ui ${PROJECT_TRDPARTY_DIR}/about/*.ui) +find_package(KF5 REQUIRED + I18n WindowSystem Service Completion WidgetsAddons KIO CoreAddons Wallet ItemViews XmlGui + ConfigWidgets IconThemes Solid DBusAddons Notifications Plasma Declarative Init KDELibs4Support) -# prepare -configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP}) -# make -qt4_add_resources (QRC_SOURCES ${RESOURCES}) -kde4_add_ui_files (SUBPROJECT_SOURCE ${SUBPROJECT_UI}) -kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE} ${QRC_SOURCES}) -target_link_libraries (${PLUGIN_NAME} ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS}) +set(dir plasmoid) +set(component org.kde.netctl) +set(root ${ARGV2}) + set(type ${ARGV3}) + if(NOT root) + set(root plasmoids) + endif() + if(NOT type) + set(type applet) + endif() + install(DIRECTORY ${dir}/ DESTINATION ${PLASMA_DATA_INSTALL_DIR}/${root}/${component} + PATTERN CMakeLists.txt EXCLUDE + PATTERN README.txt EXCLUDE + PATTERN Messages.sh EXCLUDE + PATTERN dummydata EXCLUDE) -# install -install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}) -install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR}) -install (FILES ${SUBPROJECT_NOTIFY} DESTINATION ${DATA_INSTALL_DIR}/${PLUGIN_NAME}) + install(FILES ${dir}/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR} RENAME plasma-${type}-${component}.desktop) diff --git a/sources/plasmoid/plasmoid/contents/ui/main.qml b/sources/plasmoid/plasmoid/contents/ui/main.qml new file mode 100644 index 0000000..544b741 --- /dev/null +++ b/sources/plasmoid/plasmoid/contents/ui/main.qml @@ -0,0 +1,92 @@ +/*************************************************************************** + * 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: "netctl" + 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 + } + } +} diff --git a/sources/plasmoid/plasmoid/contents/ui/main.qml.autosave b/sources/plasmoid/plasmoid/contents/ui/main.qml.autosave new file mode 100644 index 0000000..3a2c4c5 --- /dev/null +++ b/sources/plasmoid/plasmoid/contents/ui/main.qml.autosave @@ -0,0 +1,92 @@ +/*************************************************************************** + * 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 + } + } +} diff --git a/sources/plasmoid/plasma-applet-netctl.desktop b/sources/plasmoid/plasmoid/metadata.desktop similarity index 64% rename from sources/plasmoid/plasma-applet-netctl.desktop rename to sources/plasmoid/plasmoid/metadata.desktop index ef2656a..11757e8 100644 --- a/sources/plasmoid/plasma-applet-netctl.desktop +++ b/sources/plasmoid/plasmoid/metadata.desktop @@ -5,16 +5,18 @@ Comment=Plasmoid for netctl Type=Service Icon=netctl-gui-widget -X-KDE-ServiceTypes=Plasma/Applet,Plasma/PopupApplet -X-KDE-Library=plasma_applet_netctl +X-KDE-ServiceTypes=Plasma/Applet +X-Plasma-API=declarativeappletscript +X-Plasma-MainScript=ui/main.qml +X-Plasma-NotificationArea=true +X-Plasma-RemoteLocation= X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis X-KDE-PluginInfo-Email=esalexeev@gmail.com -X-KDE-PluginInfo-Name=netctl +X-KDE-PluginInfo-Name=org.kde.netctl X-KDE-PluginInfo-Version=@PROJECT_VERSION@ -X-KDE-PluginInfo-Website=http://arcan1s.github.io/projects/netctlplasmoid +X-KDE-PluginInfo-Website=http://arcanis.name/projects/netctl-gui X-KDE-PluginInfo-Category=Network X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPLv3 X-KDE-PluginInfo-EnabledByDefault=true -X-Plasma-NotificationArea=true From 6fb7da4b5b2bbfd80b2ce4838123e50c8409d568 Mon Sep 17 00:00:00 2001 From: arcan1s Date: Sat, 27 Dec 2014 03:50:31 +0300 Subject: [PATCH 04/12] add appearance.qml --- sources/dataengine/CMakeLists.txt | 1 - sources/plasmoid/appearance.ui | 488 ------------------ .../plasmoid/contents/config/config.qml | 35 ++ .../plasmoid/contents/config/main.xml | 36 ++ .../plasmoid/contents/ui/appearance.qml | 229 ++++++++ .../plasmoid/plasmoid/contents/ui/main.qml | 10 +- .../plasmoid/contents/ui/main.qml.autosave | 92 ---- 7 files changed, 309 insertions(+), 582 deletions(-) delete mode 100644 sources/plasmoid/appearance.ui create mode 100644 sources/plasmoid/plasmoid/contents/config/config.qml create mode 100644 sources/plasmoid/plasmoid/contents/config/main.xml create mode 100644 sources/plasmoid/plasmoid/contents/ui/appearance.qml delete mode 100644 sources/plasmoid/plasmoid/contents/ui/main.qml.autosave 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 -
kcolorcombo.h
-
-
- - 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 - } - } -} From f188dea8a753ab711b8652a86902202436e48b7a Mon Sep 17 00:00:00 2001 From: arcan1s Date: Sat, 27 Dec 2014 12:24:05 +0300 Subject: [PATCH 05/12] add wdiget.qml --- .../plasmoid/contents/config/config.qml | 11 +- .../plasmoid/contents/config/main.xml | 39 +++- .../plasmoid/contents/ui/appearance.qml | 8 +- .../plasmoid/plasmoid/contents/ui/main.qml | 6 +- .../plasmoid/plasmoid/contents/ui/widget.qml | 215 ++++++++++++++++++ 5 files changed, 266 insertions(+), 13 deletions(-) create mode 100644 sources/plasmoid/plasmoid/contents/ui/widget.qml diff --git a/sources/plasmoid/plasmoid/contents/config/config.qml b/sources/plasmoid/plasmoid/contents/config/config.qml index 85b74e5..db4044b 100644 --- a/sources/plasmoid/plasmoid/contents/config/config.qml +++ b/sources/plasmoid/plasmoid/contents/config/config.qml @@ -18,14 +18,15 @@ import QtQuick 2.0 import org.kde.plasma.configuration 2.0 +import org.kde.plasma.plasmoid 2.0 ConfigModel { -// ConfigCategory { -// name: i18n("Netctl plasmoid") -// icon: Plasmoid.icon -// source: "appearance.qml" -// } + ConfigCategory { + name: i18n("Netctl plasmoid") + icon: "/usr/share/pixmaps/netctl-gui-widget.png" + source: "widget.qml" + } ConfigCategory { name: i18n("Appearance") diff --git a/sources/plasmoid/plasmoid/contents/config/main.xml b/sources/plasmoid/plasmoid/contents/config/main.xml index 890f015..75125e6 100644 --- a/sources/plasmoid/plasmoid/contents/config/main.xml +++ b/sources/plasmoid/plasmoid/contents/config/main.xml @@ -5,8 +5,45 @@ http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" > - + + + + 100 + + + /usr/bin/netctl-gui + + + /usr/bin/netctlgui-helper + + + /usr/bin/netctl + + + /usr/bin/netctl-auto + + + /usr/bin/kdesu + + + /usr/bin/netctl-gui -t 3 + + + true + + + true + + + false + + + $info\nIPv4: $intip4\nIPv6: $intip6 + + + + center diff --git a/sources/plasmoid/plasmoid/contents/ui/appearance.qml b/sources/plasmoid/plasmoid/contents/ui/appearance.qml index c2c132e..434f4b7 100644 --- a/sources/plasmoid/plasmoid/contents/ui/appearance.qml +++ b/sources/plasmoid/plasmoid/contents/ui/appearance.qml @@ -171,7 +171,7 @@ Item { QtDialogs.FileDialog { id: activeFileDialog - title: "Select a path" + title: i18n("Select a path") nameFilters: [ "Image files (*.jpeg *.jpg *.png)", "All files (*)" ] selectExisting: true onAccepted: activeIcon.text = activeFileDialog.fileUrl @@ -200,7 +200,7 @@ Item { QtDialogs.FileDialog { id: inactiveFileDialog - title: "Select a path" + title: i18n("Select a path") nameFilters: [ "Image files (*.jpeg *.jpg *.png)", "All files (*)" ] selectExisting: true onAccepted: inactiveIcon.text = inactiveFileDialog.fileUrl @@ -210,7 +210,7 @@ Item { QtDialogs.ColorDialog { id: colorDialog - title: "Select a color" + title: i18n("Select a color") color: selectColor.text onAccepted: { selectColor.text = colorDialog.color @@ -219,7 +219,7 @@ Item { QtDialogs.FontDialog { id: fontDialog - title: "Select a font" + title: i18n("Select a font") font: Qt.font({ family: selectFont.text, pointSize: fontSize.value, weight: Font.Normal }) onAccepted: { selectFont.text = fontDialog.font.family diff --git a/sources/plasmoid/plasmoid/contents/ui/main.qml b/sources/plasmoid/plasmoid/contents/ui/main.qml index 86fd8fa..e952221 100644 --- a/sources/plasmoid/plasmoid/contents/ui/main.qml +++ b/sources/plasmoid/plasmoid/contents/ui/main.qml @@ -38,10 +38,10 @@ Item { } 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 string active: plasmoid.configuration.activeIconPath + property string inactive: plasmoid.configuration.inactiveIconPath } - property int interval: 1000 + property int interval: plasmoid.configuration.autoUpdateInterval property bool status: false // init diff --git a/sources/plasmoid/plasmoid/contents/ui/widget.qml b/sources/plasmoid/plasmoid/contents/ui/widget.qml new file mode 100644 index 0000000..c105a58 --- /dev/null +++ b/sources/plasmoid/plasmoid/contents/ui/widget.qml @@ -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 + } + } +} From edb386d24ef296b269db3d9040ec66071d40e360 Mon Sep 17 00:00:00 2001 From: arcan1s Date: Sun, 28 Dec 2014 17:42:08 +0300 Subject: [PATCH 06/12] implement binary module --- sources/dataengine/CMakeLists.txt | 5 +- sources/plasmoid/CMakeLists.txt | 38 +- sources/plasmoid/netctl.h | 27 -- .../plasmoid/contents/config/config.qml | 9 +- .../plasmoid/contents/config/main.xml | 4 +- .../plasmoid/plasmoid/contents/ui/about.qml | 35 ++ .../plasmoid/plasmoid/contents/ui/main.qml | 40 +- sources/plasmoid/plugin/CMakeLists.txt | 15 + sources/plasmoid/plugin/netctl.cpp | 40 ++ sources/plasmoid/plugin/netctl.h | 38 ++ sources/plasmoid/plugin/qmldir | 3 + sources/plasmoid/widget.ui | 343 ------------------ 12 files changed, 183 insertions(+), 414 deletions(-) create mode 100644 sources/plasmoid/plasmoid/contents/ui/about.qml create mode 100644 sources/plasmoid/plugin/CMakeLists.txt create mode 100644 sources/plasmoid/plugin/netctl.cpp create mode 100644 sources/plasmoid/plugin/netctl.h create mode 100644 sources/plasmoid/plugin/qmldir delete mode 100644 sources/plasmoid/widget.ui 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 - - - - From c8f260c8e2487cf12031ef60cb71cc7ca81c3dd3 Mon Sep 17 00:00:00 2001 From: arcan1s Date: Mon, 29 Dec 2014 08:35:23 +0300 Subject: [PATCH 07/12] rename applet to *plasma* --- sources/plasmoid/CMakeLists.txt | 4 ++-- sources/plasmoid/plasmoid/contents/ui/main.qml | 2 +- sources/plasmoid/plasmoid/metadata.desktop | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/sources/plasmoid/CMakeLists.txt b/sources/plasmoid/CMakeLists.txt index 8902235..c152176 100644 --- a/sources/plasmoid/CMakeLists.txt +++ b/sources/plasmoid/CMakeLists.txt @@ -39,7 +39,7 @@ message (STATUS "Subproject ${SUBPROJECT}") # install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}) # 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) +# plasma_install_package(plasmoid org.kde.plasma.netctl) 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}) @@ -63,7 +63,7 @@ set (PLUGIN_NAME netctlplugin) add_subdirectory (plugin) set(dir plasmoid) -set(component org.kde.netctl) +set(component org.kde.plasma.netctl) set(root ${ARGV2}) set(type ${ARGV3}) if(NOT root) diff --git a/sources/plasmoid/plasmoid/contents/ui/main.qml b/sources/plasmoid/plasmoid/contents/ui/main.qml index e230276..4417e41 100644 --- a/sources/plasmoid/plasmoid/contents/ui/main.qml +++ b/sources/plasmoid/plasmoid/contents/ui/main.qml @@ -16,9 +16,9 @@ ***************************************************************************/ 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.plasmoid 2.0 import org.kde.plasma.private.netctl 1.0 diff --git a/sources/plasmoid/plasmoid/metadata.desktop b/sources/plasmoid/plasmoid/metadata.desktop index 11757e8..3a816c5 100644 --- a/sources/plasmoid/plasmoid/metadata.desktop +++ b/sources/plasmoid/plasmoid/metadata.desktop @@ -13,7 +13,7 @@ X-Plasma-RemoteLocation= X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis X-KDE-PluginInfo-Email=esalexeev@gmail.com -X-KDE-PluginInfo-Name=org.kde.netctl +X-KDE-PluginInfo-Name=org.kde.plasma.netctl X-KDE-PluginInfo-Version=@PROJECT_VERSION@ X-KDE-PluginInfo-Website=http://arcanis.name/projects/netctl-gui X-KDE-PluginInfo-Category=Network From afed94745a540091fd03bfee2a1f5044142ffa82 Mon Sep 17 00:00:00 2001 From: arcan1s Date: Mon, 29 Dec 2014 20:56:35 +0300 Subject: [PATCH 08/12] fix plugin --- sources/plasmoid/plugin/netctl.cpp | 10 ++---- sources/plasmoid/plugin/netctl.h | 1 - sources/plasmoid/plugin/netctladds.cpp | 42 ++++++++++++++++++++++++++ sources/plasmoid/plugin/netctladds.h | 39 ++++++++++++++++++++++++ 4 files changed, 83 insertions(+), 9 deletions(-) create mode 100644 sources/plasmoid/plugin/netctladds.cpp create mode 100644 sources/plasmoid/plugin/netctladds.h diff --git a/sources/plasmoid/plugin/netctl.cpp b/sources/plasmoid/plugin/netctl.cpp index 31d7886..d9668ef 100644 --- a/sources/plasmoid/plugin/netctl.cpp +++ b/sources/plasmoid/plugin/netctl.cpp @@ -20,21 +20,15 @@ #include #include "netctl.h" +#include "netctladds.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, "NetctlAdds"); // 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 index 4e4bd40..a77269e 100644 --- a/sources/plasmoid/plugin/netctl.h +++ b/sources/plasmoid/plugin/netctl.h @@ -31,7 +31,6 @@ class NetctlPlugin : public QQmlExtensionPlugin public: void registerTypes(const char *uri); - static QString parsePattern(QString pattern, const QString key, const QString value); }; diff --git a/sources/plasmoid/plugin/netctladds.cpp b/sources/plasmoid/plugin/netctladds.cpp new file mode 100644 index 0000000..8854263 --- /dev/null +++ b/sources/plasmoid/plugin/netctladds.cpp @@ -0,0 +1,42 @@ +/*************************************************************************** + * 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 "netctladds.h" +#include "version.h" + + +NetctlAdds::NetctlAdds(QObject *parent) + : QObject(parent) +{ +} + + +NetctlAdds::~NetctlAdds() +{ +// if (debug) qDebug() << PDEBUG; +} + + +QString NetctlAdds::parsePattern(QString pattern, const QString key, const QString value) +{ +// if (debug) qDebug() << PDEBUG; + + return pattern.replace(QString("$") + key, value); +} + diff --git a/sources/plasmoid/plugin/netctladds.h b/sources/plasmoid/plugin/netctladds.h new file mode 100644 index 0000000..ff341e7 --- /dev/null +++ b/sources/plasmoid/plugin/netctladds.h @@ -0,0 +1,39 @@ +/*************************************************************************** + * 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 NETCTLADDS_H +#define NETCTLADDS_H + +#include + + +class QQmlEngine; + +class NetctlAdds : public QObject +{ + Q_OBJECT + +public: + NetctlAdds(QObject *parent = 0); + ~NetctlAdds(); + + Q_INVOKABLE QString parsePattern(QString pattern, const QString key, const QString value); +}; + + +#endif /* NETCTLADDS_H */ From 7972f2d6d3007da86cbc9737a41cdeb5a9968487 Mon Sep 17 00:00:00 2001 From: arcan1s Date: Mon, 29 Dec 2014 23:37:21 +0300 Subject: [PATCH 09/12] some configuration interface changes --- .../plasmoid/contents/config/main.xml | 4 +- .../plasmoid/contents/ui/appearance.qml | 55 +++++++++++++++++-- .../plasmoid/plasmoid/contents/ui/main.qml | 48 ++++++++++------ sources/plasmoid/plugin/netctl.cpp | 16 ++++-- sources/plasmoid/plugin/netctladds.cpp | 39 +++++++++++-- sources/plasmoid/plugin/netctladds.h | 10 +++- 6 files changed, 134 insertions(+), 38 deletions(-) diff --git a/sources/plasmoid/plasmoid/contents/config/main.xml b/sources/plasmoid/plasmoid/contents/config/main.xml index a6936dd..e3af196 100644 --- a/sources/plasmoid/plasmoid/contents/config/main.xml +++ b/sources/plasmoid/plasmoid/contents/config/main.xml @@ -58,8 +58,8 @@ IPv6: $intip6 #000000 - - 400 + + normal normal diff --git a/sources/plasmoid/plasmoid/contents/ui/appearance.qml b/sources/plasmoid/plasmoid/contents/ui/appearance.qml index 434f4b7..ac59fd6 100644 --- a/sources/plasmoid/plasmoid/contents/ui/appearance.qml +++ b/sources/plasmoid/plasmoid/contents/ui/appearance.qml @@ -17,6 +17,7 @@ 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 @@ -26,10 +27,18 @@ Item { 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 alias cfg_fontWeight: fontWeight.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 @@ -101,12 +110,39 @@ Item { QtControls.Label { text: i18n("Font weight") } - QtControls.SpinBox { + QtControls.ComboBox { id: fontWeight - minimumValue: 100 - maximumValue: 900 - stepSize: 100 - value: plasmoid.configuration.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; + } + } + } } } @@ -144,6 +180,11 @@ Item { } QtControls.Button { id: selectColor + style: QtStyles.ButtonStyle { + background: Rectangle { + color: plasmoid.configuration.fontColor + } + } text: plasmoid.configuration.fontColor onClicked: colorDialog.visible = true } @@ -224,6 +265,8 @@ Item { onAccepted: { selectFont.text = fontDialog.font.family fontSize.value = fontDialog.font.pointSize + fontStyle.currentIndex = fontDialog.font.italic ? 1 : 0 + fontWeight.currentIndex = weight[fontDialog.font.weight] } } } diff --git a/sources/plasmoid/plasmoid/contents/ui/main.qml b/sources/plasmoid/plasmoid/contents/ui/main.qml index 4417e41..01c8039 100644 --- a/sources/plasmoid/plasmoid/contents/ui/main.qml +++ b/sources/plasmoid/plasmoid/contents/ui/main.qml @@ -27,6 +27,25 @@ 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", @@ -37,12 +56,8 @@ Item { "profiles": "", "status": "N\\A" } - Text { - id: iconPath - property string active: plasmoid.configuration.activeIconPath - property string inactive: plasmoid.configuration.inactiveIconPath - } property int interval: plasmoid.configuration.autoUpdateInterval + property string pattern: plasmoid.configuration.textPattern property bool status: false // init @@ -57,19 +72,13 @@ Item { 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 - } + main.status = data.value == "true" ? true : false + icon.source = iconPath[data.value] } else if (sourceName == "current") { info["current"] = data.value // text update - for (var prop in info) { - console.log(prop + " = " + info[prop]) - } + 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") { @@ -94,10 +103,17 @@ Item { Image { id: icon - source: iconPath.inactive + source: iconPath["inactive"] } 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" } } diff --git a/sources/plasmoid/plugin/netctl.cpp b/sources/plasmoid/plugin/netctl.cpp index d9668ef..4e17fb0 100644 --- a/sources/plasmoid/plugin/netctl.cpp +++ b/sources/plasmoid/plugin/netctl.cpp @@ -17,18 +17,22 @@ #include -#include - #include "netctl.h" #include "netctladds.h" -#include "version.h" + + +static QObject *netctl_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine) +{ + Q_UNUSED(engine) + Q_UNUSED(scriptEngine) + + return new NetctlAdds(); +} void NetctlPlugin::registerTypes(const char *uri) { Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.netctl")); - qmlRegisterType(uri, 1, 0, "NetctlAdds"); -// qmlRegisterType(uri, 1, 0, "TimeZoneModel"); -// qmlRegisterSingletonType(uri, 1, 0, "TimezonesI18n", timezonesi18n_singletontype_provider); + qmlRegisterSingletonType(uri, 1, 0, "NetctlAdds", netctl_singletontype_provider); } diff --git a/sources/plasmoid/plugin/netctladds.cpp b/sources/plasmoid/plugin/netctladds.cpp index 8854263..816a33a 100644 --- a/sources/plasmoid/plugin/netctladds.cpp +++ b/sources/plasmoid/plugin/netctladds.cpp @@ -15,7 +15,10 @@ * along with netctl-gui. If not, see http://www.gnu.org/licenses/ * ***************************************************************************/ -//#include +#include +#include + +#include #include "netctladds.h" #include "version.h" @@ -24,19 +27,45 @@ NetctlAdds::NetctlAdds(QObject *parent) : QObject(parent) { + // debug + QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); + QString debugEnv = environment.value(QString("NETCTLGUI_DEBUG"), QString("no")); + debug = (debugEnv == QString("yes")); } NetctlAdds::~NetctlAdds() { -// if (debug) qDebug() << PDEBUG; + if (debug) qDebug() << PDEBUG; } -QString NetctlAdds::parsePattern(QString pattern, const QString key, const QString value) +QString NetctlAdds::getInfo(const QString current, const QString status) { -// if (debug) qDebug() << PDEBUG; + if (debug) qDebug() << PDEBUG; + if (debug) qDebug() << PDEBUG << ":" << "Current profiles" << current; + if (debug) qDebug() << PDEBUG << ":" << "Statuses" << status; - return pattern.replace(QString("$") + key, value); + QStringList profiles; + for (int i=0; i dict) +{ + if (debug) qDebug() << PDEBUG; + if (debug) qDebug() << PDEBUG << ":" << "Dictionary" << dict; + + QString parsed = pattern; + for (int i=0; i")); + + return parsed; } diff --git a/sources/plasmoid/plugin/netctladds.h b/sources/plasmoid/plugin/netctladds.h index ff341e7..f5dfea5 100644 --- a/sources/plasmoid/plugin/netctladds.h +++ b/sources/plasmoid/plugin/netctladds.h @@ -19,11 +19,11 @@ #ifndef NETCTLADDS_H #define NETCTLADDS_H +#include #include +#include -class QQmlEngine; - class NetctlAdds : public QObject { Q_OBJECT @@ -32,7 +32,11 @@ public: NetctlAdds(QObject *parent = 0); ~NetctlAdds(); - Q_INVOKABLE QString parsePattern(QString pattern, const QString key, const QString value); + Q_INVOKABLE QString getInfo(const QString current, const QString status); + Q_INVOKABLE QString parsePattern(const QString pattern, const QMap dict); + +private: + bool debug = false; }; From cbac07b29e1c60253b18578229b13cbfa8ad87b4 Mon Sep 17 00:00:00 2001 From: arcan1s Date: Tue, 30 Dec 2014 14:39:25 +0300 Subject: [PATCH 10/12] move method from original one --- sources/plasmoid/CMakeLists.txt | 44 ++-- .../plasmoid/plasmoid/contents/ui/about.qml | 60 ++++- .../plasmoid/plasmoid/contents/ui/main.qml | 3 +- sources/plasmoid/plugin/CMakeLists.txt | 3 +- sources/plasmoid/plugin/netctladds.cpp | 226 ++++++++++++++++++ sources/plasmoid/plugin/netctladds.h | 31 +++ 6 files changed, 340 insertions(+), 27 deletions(-) diff --git a/sources/plasmoid/CMakeLists.txt b/sources/plasmoid/CMakeLists.txt index c152176..192f1e3 100644 --- a/sources/plasmoid/CMakeLists.txt +++ b/sources/plasmoid/CMakeLists.txt @@ -40,21 +40,24 @@ 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.plasma.netctl) -find_package (Qt5 REQUIRED COMPONENTS Core Qml Widgets) +find_package (Qt5 REQUIRED COMPONENTS Core DBus 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) +find_package(KF5 REQUIRED COMPONENTS I18n Service WidgetsAddons KIO CoreAddons Notifications Plasma) +find_package(KF5I18n CONFIG REQUIRED) include (KDEInstallDirs) include (KDECMakeSettings) include (KDECompilerSettings) -add_definitions (${Qt5Core_DEFINITIONS} ${Qt5Qml_DEFINITIONS}) +add_definitions (${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS} ${Qt5Qml_DEFINITIONS}) set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS} + ${Qt5DBus_INCLUDE_DIRS} ${Qt5Qml_INCLUDE_DIRS}) set (Kf5_INCLUDE ${ConfigCore_INCLUDE_DIR} ${CoreAddons_INCLUDE_DIR} ${I18n_INCLUDE_DIR} + ${INTERFACE_INCLUDE_DIRECTORIES} ${Notifications_INCLUDE_DIR} ${Plasma_INCLUDE_DIR} ${Service_INCLUDE_DIR}) @@ -62,20 +65,21 @@ set (Kf5_INCLUDE ${ConfigCore_INCLUDE_DIR} set (PLUGIN_NAME netctlplugin) add_subdirectory (plugin) -set(dir plasmoid) -set(component org.kde.plasma.netctl) -set(root ${ARGV2}) - set(type ${ARGV3}) - if(NOT root) - set(root plasmoids) - endif() - if(NOT type) - set(type applet) - endif() - install(DIRECTORY ${dir}/ DESTINATION ${PLASMA_DATA_INSTALL_DIR}/${root}/${component} - PATTERN CMakeLists.txt EXCLUDE - PATTERN README.txt EXCLUDE - PATTERN Messages.sh EXCLUDE - PATTERN dummydata EXCLUDE) - - install(FILES ${dir}/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR} RENAME plasma-${type}-${component}.desktop) +# set(dir plasmoid) +# set(component org.kde.plasma.netctl) +# set(root ${ARGV2}) +# set(type ${ARGV3}) +# if(NOT root) +# set(root plasmoids) +# endif() +# if(NOT type) +# set(type applet) +# endif() +# install(DIRECTORY ${dir}/ DESTINATION ${PLASMA_DATA_INSTALL_DIR}/${root}/${component} +# PATTERN CMakeLists.txt EXCLUDE +# PATTERN README.txt EXCLUDE +# PATTERN Messages.sh EXCLUDE +# PATTERN dummydata EXCLUDE) +# +# install(FILES ${dir}/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR} RENAME plasma-${type}-${component}.desktop) +plasma_install_package (plasmoid org.kde.plasma.netctl) diff --git a/sources/plasmoid/plasmoid/contents/ui/about.qml b/sources/plasmoid/plasmoid/contents/ui/about.qml index 0a5b9f7..bdcd2a6 100644 --- a/sources/plasmoid/plasmoid/contents/ui/about.qml +++ b/sources/plasmoid/plasmoid/contents/ui/about.qml @@ -16,20 +16,70 @@ ***************************************************************************/ import QtQuick 2.0 -import QtQuick.Controls 1.0 as QtControls +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 { - horizontalAlignment: Text.AlignHCenter - text: i18n("Some text") + 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") + } + } + } } } } diff --git a/sources/plasmoid/plasmoid/contents/ui/main.qml b/sources/plasmoid/plasmoid/contents/ui/main.qml index 01c8039..994b19b 100644 --- a/sources/plasmoid/plasmoid/contents/ui/main.qml +++ b/sources/plasmoid/plasmoid/contents/ui/main.qml @@ -97,13 +97,14 @@ Item { } } + // ui Grid { id: mainGrid columns: 2 Image { id: icon - source: iconPath["inactive"] + source: iconPath["false"] } Text { id: text diff --git a/sources/plasmoid/plugin/CMakeLists.txt b/sources/plasmoid/plugin/CMakeLists.txt index a9cd708..bea8154 100644 --- a/sources/plasmoid/plugin/CMakeLists.txt +++ b/sources/plasmoid/plugin/CMakeLists.txt @@ -9,7 +9,8 @@ include_directories (${CMAKE_SOURCE_DIR} 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}) +target_link_libraries (${PLUGIN_NAME} ${Qt5Core_LIBRARIES} ${Qt5DBus_LIBRARIES} ${Qt5Qml_LIBRARIES} ${I18n_LIBRARIES} ${Plasma_LIBRARIES} + KF5::I18n KF5::Notifications) 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/netctladds.cpp b/sources/plasmoid/plugin/netctladds.cpp index 816a33a..fe7c538 100644 --- a/sources/plasmoid/plugin/netctladds.cpp +++ b/sources/plasmoid/plugin/netctladds.cpp @@ -15,6 +15,11 @@ * along with netctl-gui. If not, see http://www.gnu.org/licenses/ * ***************************************************************************/ +#include +#include + +#include +#include #include #include @@ -40,6 +45,83 @@ NetctlAdds::~NetctlAdds() } +bool NetctlAdds::checkHelperStatus(const bool useHelper) +{ + if (debug) qDebug() << PDEBUG; + + if (useHelper) + return !sendDBusRequest(QString("Active"), QList()).isEmpty(); + else + return useHelper; +} + + +void NetctlAdds::startHelper(const QString cmd) +{ + if (debug) qDebug() << PDEBUG; + + QProcess command; + + command.startDetached(cmd); +} + + +QList NetctlAdds::sendDBusRequest(const QString cmd, const QList args) +{ + if (debug) qDebug() << PDEBUG; + if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd; + if (debug) qDebug() << PDEBUG << ":" << "args" << args; + + QDBusConnection bus = QDBusConnection::systemBus(); + QDBusMessage request = QDBusMessage::createMethodCall(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH, + DBUS_HELPER_INTERFACE, cmd); + if (!args.isEmpty()) + request.setArguments(args); + QDBusMessage response = bus.call(request, QDBus::BlockWithGui); + QList arguments = response.arguments(); + if (arguments.size() == 0) + if (debug) qDebug() << PDEBUG << ":" << "Error message" << response.errorMessage(); + + return arguments; +} + + +QString NetctlAdds::getAboutText(const QString type) +{ + if (debug) qDebug() << PDEBUG; + if (debug) qDebug() << PDEBUG << ":" << "Type" << type; + + QString text; + if (type == QString("header")) + text = QString(NAME); + else if (type == QString("description")) + text = i18n("KDE widget which interacts with netctl."); + else if (type == QString("links")) + text = i18n("Links:") + QString("
") + + QString("%2
").arg(QString(HOMEPAGE)).arg(i18n("Homepage")) + + QString("%2
").arg(QString(REPOSITORY)).arg(i18n("Repository")) + + QString("%2
").arg(QString(BUGTRACKER)).arg(i18n("Bugtracker")) + + QString("%2
").arg(QString(TRANSLATION)).arg(i18n("Translation issue")) + + QString("%2").arg(QString(AUR_PACKAGES)).arg(i18n("AUR packages")); + else if (type == QString("copy")) + text = QString("© %1 %3
").arg(QString(DATE)).arg(QString(EMAIL)).arg(QString(AUTHOR)) + + i18n("This software is licensed under %1", QString(LICENSE)) + QString("
"); + else if (type == QString("translators")) + text = i18n("Translators: %1", QString(TRANSLATORS)); + else if (type == QString("3rdparty")) { + QStringList trdPartyList = QString(TRDPARTY_LICENSE).split(QChar(';'), QString::SkipEmptyParts); + for (int i=0; i%1 (%2 license)") + .arg(trdPartyList[i].split(QChar(','))[0]) + .arg(trdPartyList[i].split(QChar(','))[1]) + .arg(trdPartyList[i].split(QChar(','))[2]); + text = i18n("This software uses: %1", trdPartyList.join(QString(", "))); + } + + return text; +} + + QString NetctlAdds::getInfo(const QString current, const QString status) { if (debug) qDebug() << PDEBUG; @@ -69,3 +151,147 @@ QString NetctlAdds::parsePattern(const QString pattern, const QMap dict, const bool useHelper, + const QString cmd, const QString sudoCmd) +{ + if (debug) qDebug() << PDEBUG; + + QString enableStatus = QString(""); + if (dict[QString("status")].toString().contains(QString("enabled"))) { + enableStatus = QString(" disable "); + sendNotification(QString("Info"), i18n("Set profile %1 disabled", dict[QString("current")].toString())); + } else { + enableStatus = QString(" enable "); + sendNotification(QString("Info"), i18n("Set profile %1 enabled", dict[QString("current")].toString())); + } + if (useHelper) { + QList args; + args.append(dict[QString("current")].toString()); + sendDBusRequest(QString("Enable"), args); + } else { + QProcess command; + QString commandLine = sudoCmd + QString(" ") + cmd + enableStatus + dict[QString("current")].toString(); + command.startDetached(commandLine); + } +} + + +void NetctlAdds::restartProfileSlot(const QMap dict, const bool useHelper, + const QString cmd, const QString sudoCmd) +{ + if (debug) qDebug() << PDEBUG; + + sendNotification(QString("Info"), i18n("Restart profile %1", dict[QString("current")].toString())); + if (useHelper) { + QList args; + args.append(dict[QString("current")].toString()); + sendDBusRequest(QString("Restart"), args); + } else { + QProcess command; + QString commandLine = sudoCmd + QString(" ") + cmd + QString(" restart ") + dict[QString("current")].toString(); + command.startDetached(commandLine); + } +} + + +void NetctlAdds::startProfileSlot(QString profile, const bool status, + const bool useHelper, const QString cmd, const QString sudoCmd) +{ + if (debug) qDebug() << PDEBUG; + if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile; + + profile.remove(QChar('&')); + sendNotification(QString("Info"), i18n("Start profile %1", profile)); + if (useHelper) { + QList args; + args.append(profile); + if (status) + sendDBusRequest(QString("SwitchTo"), args); + else + sendDBusRequest(QString("Start"), args); + } else { + QProcess command; + QString commandLine = sudoCmd + QString(" ") + cmd; + if (status) + commandLine += QString(" switch-to ") + profile; + else + commandLine += QString(" start ") + profile; + command.startDetached(commandLine); + } +} + + +void NetctlAdds::stopProfileSlot(const QMap dict, const bool useHelper, + const QString cmd, const QString sudoCmd) +{ + if (debug) qDebug() << PDEBUG; + + sendNotification(QString("Info"), i18n("Stop profile %1", dict[QString("current")].toString())); + if (useHelper) { + QList args; + args.append(dict[QString("current")].toString()); + sendDBusRequest(QString("Start"), args); + } else { + QProcess command; + QString commandLine = sudoCmd + QString(" ") + cmd + QString(" stop ") + dict[QString("current")].toString(); + command.startDetached(commandLine); + } +} + + +void NetctlAdds::stopAllProfilesSlot(const bool useHelper, const QString cmd, const QString sudoCmd) +{ + if (debug) qDebug() << PDEBUG; + + sendNotification(QString("Info"), i18n("Stop all profiles")); + if (useHelper) + sendDBusRequest(QString("StopAll"), QList()); + else { + QProcess command; + QString commandLine = sudoCmd + QString(" ") + cmd + QString(" stop-all"); + command.startDetached(commandLine); + } +} + + +void NetctlAdds::switchToProfileSlot(QString profile, const bool useHelper, + const QString cmd) +{ + if (debug) qDebug() << PDEBUG; + if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile; + + profile.remove(QChar('&')); + sendNotification(QString("Info"), i18n("Switch to profile %1", profile)); + if (useHelper) { + QList args; + args.append(profile); + sendDBusRequest(QString("autoStart"), args); + } else { + QProcess command; + QString commandLine = cmd + QString(" switch-to ") + profile; + command.startDetached(commandLine); + } +} diff --git a/sources/plasmoid/plugin/netctladds.h b/sources/plasmoid/plugin/netctladds.h index f5dfea5..733aad9 100644 --- a/sources/plasmoid/plugin/netctladds.h +++ b/sources/plasmoid/plugin/netctladds.h @@ -32,11 +32,42 @@ public: NetctlAdds(QObject *parent = 0); ~NetctlAdds(); + Q_INVOKABLE QString getAboutText(const QString type = "header"); Q_INVOKABLE QString getInfo(const QString current, const QString status); Q_INVOKABLE QString parsePattern(const QString pattern, const QMap dict); + Q_INVOKABLE void runCmd(const QString cmd); + Q_INVOKABLE void sendNotification(const QString eventId, const QString message); + // context menu + Q_INVOKABLE void enableProfileSlot(const QMap dict, + const bool useHelper = true, + const QString cmd = QString("/usr/bin/netctl"), + const QString sudoCmd = QString("")); + Q_INVOKABLE void restartProfileSlot(const QMap dict, + const bool useHelper = true, + const QString cmd = QString("/usr/bin/netctl"), + const QString sudoCmd = QString("")); + Q_INVOKABLE void startProfileSlot(QString profile, const bool status, + const bool useHelper = true, + const QString cmd = QString("/usr/bin/netctl"), + const QString sudoCmd = QString("")); + Q_INVOKABLE void stopProfileSlot(const QMap dict, + const bool useHelper = true, + const QString cmd = QString("/usr/bin/netctl"), + const QString sudoCmd = QString("")); + Q_INVOKABLE void stopAllProfilesSlot(const bool useHelper = true, + const QString cmd = QString("/usr/bin/netctl"), + const QString sudoCmd = QString("")); + Q_INVOKABLE void switchToProfileSlot(QString profile, + const bool useHelper = true, + const QString cmd = QString("/usr/bin/netctl-auto")); private: bool debug = false; + // helper + bool checkHelperStatus(const bool useHelper = true); + void startHelper(const QString cmd = QString("/usr/bin/netctlgui-helper")); + // dbus + QList sendDBusRequest(const QString cmd, const QList args = QList()); }; From 3ac0484f21edb10859dd946f3fcfade9b0782690 Mon Sep 17 00:00:00 2001 From: arcan1s Date: Wed, 31 Dec 2014 08:09:53 +0300 Subject: [PATCH 11/12] some test with actions --- .../plasmoid/plasmoid/contents/ui/main.qml | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/sources/plasmoid/plasmoid/contents/ui/main.qml b/sources/plasmoid/plasmoid/contents/ui/main.qml index 994b19b..7227b2b 100644 --- a/sources/plasmoid/plasmoid/contents/ui/main.qml +++ b/sources/plasmoid/plasmoid/contents/ui/main.qml @@ -16,6 +16,7 @@ ***************************************************************************/ import QtQuick 2.2 +import QtQuick.Controls 1.3 as QtControls 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 @@ -58,7 +59,12 @@ Item { } property int interval: plasmoid.configuration.autoUpdateInterval property string pattern: plasmoid.configuration.textPattern + property variant paths: { + "netctl": plasmoid.configuration.netctlPath, + "sudo": plasmoid.configuration.sudoPath + } property bool status: false + property bool useHelper: plasmoid.configuration.useHelper // init Plasmoid.icon: icon.source @@ -118,4 +124,20 @@ Item { text: "N\\A" } } + + QtControls.Action { + id: stopProfile + text: i18n("Stop profile") + iconSource: "dialog-close" + onTriggered: NetctlAdds.stopProfileSlot(info, useHelper, paths["netctl"], paths["sudo"]) + } + + Component.onCompleted: { + plasmoid.setAction("stopProfile", i18n("Stop profile"), "dialog-close") +// plasmoid.setAction("powerdevilkcm", i18n("&Configure Power Saving..."), "preferences-system-power-management"); + } + + function action_stopProfile() { + NetctlAdds.stopProfileSlot(info, useHelper, paths["netctl"], paths["sudo"]) + } } From 00a35d75d2db0e7752513fa972fcc944ea70d7e5 Mon Sep 17 00:00:00 2001 From: arcan1s Date: Sat, 3 Jan 2015 13:56:00 +0300 Subject: [PATCH 12/12] add ability to build kde4 and kf5 packages --- sources/CMakeLists.txt | 35 +- sources/dataengine/CMakeLists.txt | 59 +- sources/dataengine/netctl.cpp | 22 +- .../plasma-dataengine-netctl.desktop | 4 +- sources/plasmoid-kde4/CMakeLists.txt | 41 + sources/plasmoid-kde4/appearance.ui | 488 ++++++++ .../{plasmoid => plasmoid-kde4}/dataengine.ui | 0 .../{plasmoid => plasmoid-kde4}/netctl.cpp | 0 sources/plasmoid-kde4/netctl.h | 139 +++ .../plasma-applet-netctl.desktop | 20 + .../plasma_applet_netctl.notifyrc | 0 .../plasmoid.cppcheck | 0 .../po/CMakeLists.txt | 0 sources/{plasmoid => plasmoid-kde4}/po/en.po | 0 .../po/extract_messages.sh | 0 sources/{plasmoid => plasmoid-kde4}/po/ja.po | 0 .../po/plasma_applet_netctl.pot | 0 sources/{plasmoid => plasmoid-kde4}/po/ru.po | 0 sources/plasmoid-kde4/widget.ui | 343 ++++++ .../{plasmoid => plasmoid-kf5}/CMakeLists.txt | 0 sources/plasmoid-kf5/dataengine.ui | 185 +++ sources/plasmoid-kf5/netctl.cpp | 1035 +++++++++++++++++ sources/{plasmoid => plasmoid-kf5}/netctl.h | 0 .../plasma_applet_netctl.notifyrc | 14 + .../plasmoid/contents/config/config.qml | 0 .../plasmoid/contents/config/main.xml | 0 .../plasmoid/contents/ui/about.qml | 0 .../plasmoid/contents/ui/appearance.qml | 0 .../plasmoid/contents/ui/main.qml | 0 .../plasmoid/contents/ui/widget.qml | 0 .../plasmoid/metadata.desktop | 2 +- .../plugin/CMakeLists.txt | 0 .../plugin/netctl.cpp | 0 .../plugin/netctl.h | 0 .../plugin/netctladds.cpp | 0 .../plugin/netctladds.h | 0 .../{plasmoid => plasmoid-kf5}/plugin/qmldir | 0 sources/plasmoid-kf5/po/CMakeLists.txt | 24 + sources/plasmoid-kf5/po/en.po | 448 +++++++ sources/plasmoid-kf5/po/extract_messages.sh | 47 + sources/plasmoid-kf5/po/ja.po | 422 +++++++ .../plasmoid-kf5/po/plasma_applet_netctl.pot | 409 +++++++ sources/plasmoid-kf5/po/ru.po | 448 +++++++ sources/version.h.in | 1 + 44 files changed, 4144 insertions(+), 42 deletions(-) create mode 100644 sources/plasmoid-kde4/CMakeLists.txt create mode 100644 sources/plasmoid-kde4/appearance.ui rename sources/{plasmoid => plasmoid-kde4}/dataengine.ui (100%) rename sources/{plasmoid => plasmoid-kde4}/netctl.cpp (100%) create mode 100644 sources/plasmoid-kde4/netctl.h create mode 100644 sources/plasmoid-kde4/plasma-applet-netctl.desktop rename sources/{plasmoid => plasmoid-kde4}/plasma_applet_netctl.notifyrc (100%) rename sources/{plasmoid => plasmoid-kde4}/plasmoid.cppcheck (100%) rename sources/{plasmoid => plasmoid-kde4}/po/CMakeLists.txt (100%) rename sources/{plasmoid => plasmoid-kde4}/po/en.po (100%) rename sources/{plasmoid => plasmoid-kde4}/po/extract_messages.sh (100%) rename sources/{plasmoid => plasmoid-kde4}/po/ja.po (100%) rename sources/{plasmoid => plasmoid-kde4}/po/plasma_applet_netctl.pot (100%) rename sources/{plasmoid => plasmoid-kde4}/po/ru.po (100%) create mode 100644 sources/plasmoid-kde4/widget.ui rename sources/{plasmoid => plasmoid-kf5}/CMakeLists.txt (100%) create mode 100644 sources/plasmoid-kf5/dataengine.ui create mode 100644 sources/plasmoid-kf5/netctl.cpp rename sources/{plasmoid => plasmoid-kf5}/netctl.h (100%) create mode 100644 sources/plasmoid-kf5/plasma_applet_netctl.notifyrc rename sources/{plasmoid => plasmoid-kf5}/plasmoid/contents/config/config.qml (100%) rename sources/{plasmoid => plasmoid-kf5}/plasmoid/contents/config/main.xml (100%) rename sources/{plasmoid => plasmoid-kf5}/plasmoid/contents/ui/about.qml (100%) rename sources/{plasmoid => plasmoid-kf5}/plasmoid/contents/ui/appearance.qml (100%) rename sources/{plasmoid => plasmoid-kf5}/plasmoid/contents/ui/main.qml (100%) rename sources/{plasmoid => plasmoid-kf5}/plasmoid/contents/ui/widget.qml (100%) rename sources/{plasmoid => plasmoid-kf5}/plasmoid/metadata.desktop (91%) rename sources/{plasmoid => plasmoid-kf5}/plugin/CMakeLists.txt (100%) rename sources/{plasmoid => plasmoid-kf5}/plugin/netctl.cpp (100%) rename sources/{plasmoid => plasmoid-kf5}/plugin/netctl.h (100%) rename sources/{plasmoid => plasmoid-kf5}/plugin/netctladds.cpp (100%) rename sources/{plasmoid => plasmoid-kf5}/plugin/netctladds.h (100%) rename sources/{plasmoid => plasmoid-kf5}/plugin/qmldir (100%) create mode 100644 sources/plasmoid-kf5/po/CMakeLists.txt create mode 100644 sources/plasmoid-kf5/po/en.po create mode 100755 sources/plasmoid-kf5/po/extract_messages.sh create mode 100644 sources/plasmoid-kf5/po/ja.po create mode 100644 sources/plasmoid-kf5/po/plasma_applet_netctl.pot create mode 100644 sources/plasmoid-kf5/po/ru.po diff --git a/sources/CMakeLists.txt b/sources/CMakeLists.txt index de0b2c2..f1cdb21 100644 --- a/sources/CMakeLists.txt +++ b/sources/CMakeLists.txt @@ -29,21 +29,22 @@ option (BUILD_HELPER "Build helper" ON) option (BUILD_LIBRARY "Build library" ON) option (BUILD_DATAENGINE "Build DataEngine" ON) option (BUILD_PLASMOID "Build plasmoid" ON) +option (BUILD_KDE4 "Build on KDE4" OFF) if (BUILD_GUI OR BUILD_HELPER) - set (BUILD_LIBRARY ON) + set (BUILD_LIBRARY ON) endif () if (BUILD_PLASMOID) - set (BUILD_DATAENGINE ON) + set (BUILD_DATAENGINE ON) endif () # documentation option (BUILD_DOCS "Build Doxygen documentation" OFF) if (BUILD_DOCS) - set (BUILD_LIBRARY ON) + set (BUILD_LIBRARY ON) endif () # test option (BUILD_TEST "Build unit tests" OFF) if (BUILD_TEST) - set (BUILD_LIBRARY ON) + set (BUILD_LIBRARY ON) endif () # FIXME: dbus path set (DBUS_SYSTEMCONF_PATH "/etc/dbus-1/system.d/" CACHE STRING "Path to dbus system configuration files") @@ -51,11 +52,11 @@ set (SYSTEMD_SERVICE_PATH "lib/systemd/system" CACHE STRING "Path to systemd ser # flags if (CMAKE_COMPILER_IS_GNUCXX) - set (CMAKE_CXX_FLAGS "-Wall -std=c++11") - set (CMAKE_CXX_FLAGS_DEBUG "-g -O0") - set (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG") + set (CMAKE_CXX_FLAGS "-Wall -std=c++11") + set (CMAKE_CXX_FLAGS_DEBUG "-g -O0") + set (CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG") else () - message (STATUS "Unknown compiler") + message (STATUS "Unknown compiler") endif () configure_file (${CMAKE_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h) @@ -68,21 +69,25 @@ add_subdirectory (${PROJECT_RESOURCE_DIR}) # components if (BUILD_LIBRARY) - add_subdirectory (${PROJECT_LIBRARY}) + add_subdirectory (${PROJECT_LIBRARY}) endif () if (BUILD_HELPER) - add_subdirectory (helper) + add_subdirectory (helper) endif () if (BUILD_TEST) - enable_testing () - add_subdirectory (test) + enable_testing () + add_subdirectory (test) endif () if (BUILD_GUI) - add_subdirectory (gui) + add_subdirectory (gui) endif () if (BUILD_DATAENGINE) - add_subdirectory (dataengine) + add_subdirectory (dataengine) endif () if (BUILD_PLASMOID) - add_subdirectory (plasmoid) + if (BUILD_KDE4) + add_subdirectory (plasmoid-kde4) + else () + add_subdirectory (plasmoid-kf5) + endif (BUILD_KDE4) endif () diff --git a/sources/dataengine/CMakeLists.txt b/sources/dataengine/CMakeLists.txt index 9a85ded..95933f6 100644 --- a/sources/dataengine/CMakeLists.txt +++ b/sources/dataengine/CMakeLists.txt @@ -3,29 +3,37 @@ set (SUBPROJECT plasma_engine_netctl) 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 ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) -find_package(KF5 REQUIRED COMPONENTS Plasma Service) +if (BUILD_KDE4) + find_package (KDE4 REQUIRED) + include (KDE4Defaults) -include (KDEInstallDirs) -include (KDECMakeSettings) -include (KDECompilerSettings) -add_definitions (${Qt5Core_DEFINITIONS} ${Qt5Network_DEFINITIONS}) + add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) +else () + find_package (Qt5 REQUIRED COMPONENTS Widgets Network) + find_package (ECM 0.0.11 REQUIRED NO_MODULE) + set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) + find_package(KF5 REQUIRED COMPONENTS Plasma Service) + + include (KDEInstallDirs) + include (KDECMakeSettings) + include (KDECompilerSettings) + add_definitions (${Qt5Core_DEFINITIONS} ${Qt5Network_DEFINITIONS}) + + set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS} + ${Qt5Network_INCLUDE_DIRS}) + set (KDE_INCLUDE ${ConfigCore_INCLUDE_DIR} + ${CoreAddons_INCLUDE_DIR} + ${Plasma_INCLUDE_DIR} + ${Service_INCLUDE_DIR}) +endif () -set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS} - ${Qt5Network_INCLUDE_DIRS}) -set (Kf5_INCLUDE ${ConfigCore_INCLUDE_DIR} - ${CoreAddons_INCLUDE_DIR} - ${Plasma_INCLUDE_DIR} - ${Service_INCLUDE_DIR}) include_directories (${CMAKE_SOURCE_DIR} ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/../ ${PROJECT_TRDPARTY_DIR} ${Qt_INCLUDE} - ${Kf5_INCLUDE}) + ${KDE_INCLUDE}) set (PLUGIN_NAME ${SUBPROJECT}) file (GLOB SUBPROJECT_DESKTOP_IN *.desktop) @@ -38,13 +46,22 @@ file (GLOB SUBPROJECT_CONF *.conf) configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP}) # make -qt5_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER}) -add_library (${PLUGIN_NAME} MODULE ${SUBPROJECT_SOURCE} ${TASK_MOC_SOURCE}) -target_link_libraries (${PLUGIN_NAME} ${Plasma_LIBRARIES} ${Qt5Network_LIBRARIES}) -kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${SUBPROJECT_DESKTOP_IN}) -# kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${SUBPROJECT_DESKTOP}) +if (BUILD_KDE4) + qt4_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER}) + kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE} ${TASK_MOC_SOURCE}) + target_link_libraries (${PLUGIN_NAME} ${KDE4_KDECORE_LIBS} ${KDE4_PLASMA_LIBS} ${QT_QTNETWORK_LIBRARY}) +else () + qt5_wrap_cpp (TASK_MOC_SOURCE ${TASK_HEADER}) + add_library (${PLUGIN_NAME} MODULE ${SUBPROJECT_SOURCE} ${TASK_MOC_SOURCE}) + target_link_libraries (${PLUGIN_NAME} ${Plasma_LIBRARIES} ${Qt5Network_LIBRARIES}) + kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP}) +endif () # install -install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/dataengine) +if (BUILD_KDE4) + install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}) +else () + install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}/plasma/dataengine) +endif () install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR}) install (FILES ${SUBPROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR}) diff --git a/sources/dataengine/netctl.cpp b/sources/dataengine/netctl.cpp index bf8c4bf..0ff6816 100644 --- a/sources/dataengine/netctl.cpp +++ b/sources/dataengine/netctl.cpp @@ -23,11 +23,19 @@ #include #include #include -#include #include #include #include +#include + +// KF5-KDE4 compability +#ifdef BUILD_KDE4 +#include +#include +#else +#include +#endif /* BUILD_KDE4 */ Netctl::Netctl(QObject *parent, const QVariantList &args) @@ -88,7 +96,12 @@ void Netctl::readConfiguration() rawConfig[QString("NETCTLCMD")] = QString("/usr/bin/netctl"); rawConfig[QString("NETCTLAUTOCMD")] = QString("/usr/bin/netctl-auto"); - QString fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString("netctl.conf")); + QString fileName; +#ifdef BUILD_KDE4 + fileName = KGlobal::dirs()->findResource("config", "netctl.conf"); +#else + fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString("netctl.conf")); +#endif /* BUILD_KDE4 */ if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName; QFile configFile(fileName); if (!configFile.open(QIODevice::ReadOnly)) { @@ -387,7 +400,10 @@ bool Netctl::updateSourceEvent(const QString &source) } -// K_EXPORT_PLASMA_DATAENGINE(netctl, Netctl) +#ifdef BUILD_KDE4 +K_EXPORT_PLASMA_DATAENGINE(netctl, Netctl) +#else K_EXPORT_PLASMA_DATAENGINE_WITH_JSON(netctl, Netctl, "plasma-dataengine-netctl.json") +#endif /* BUILD_KDE4 */ #include "netctl.moc" diff --git a/sources/dataengine/plasma-dataengine-netctl.desktop b/sources/dataengine/plasma-dataengine-netctl.desktop index 00b6fb2..9f6521c 100644 --- a/sources/dataengine/plasma-dataengine-netctl.desktop +++ b/sources/dataengine/plasma-dataengine-netctl.desktop @@ -10,11 +10,11 @@ X-KDE-ServiceTypes=Plasma/DataEngine X-KDE-Library=plasma_engine_netctl X-Plasma-EngineName=netctl -X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis +X-KDE-PluginInfo-Author=Evgeniy Alekseev X-KDE-PluginInfo-Email=esalexeev@gmail.com X-KDE-PluginInfo-Name=netctl X-KDE-PluginInfo-Version=@PROJECT_VERSION@ -X-KDE-PluginInfo-Website=http://arcan1s.github.io/projects/netctlplasmoid +X-KDE-PluginInfo-Website=http://arcanis.name/ru/projects/netctl-gui/ X-KDE-PluginInfo-Category=Network X-KDE-PluginInfo-Depends= X-KDE-PluginInfo-License=GPLv3 diff --git a/sources/plasmoid-kde4/CMakeLists.txt b/sources/plasmoid-kde4/CMakeLists.txt new file mode 100644 index 0000000..d795ae3 --- /dev/null +++ b/sources/plasmoid-kde4/CMakeLists.txt @@ -0,0 +1,41 @@ +# set project name +set (SUBPROJECT plasma_applet_netctl) +message (STATUS "Subproject ${SUBPROJECT}") +# find resources +set (RESOURCES ${PROJECT_RESOURCE_DIR}/resources-plasmoid.qrc) + +# find required libaries +find_package (KDE4 REQUIRED) +include (KDE4Defaults) + +add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS}) +include_directories (${CMAKE_SOURCE_DIR} + ${CMAKE_BINARY_DIR} + ${KDE4_INCLUDES} + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/../ + ${PROJECT_TRDPARTY_DIR}) + +add_subdirectory (po) + +# set sources +set (PLUGIN_NAME ${SUBPROJECT}) +file (GLOB SUBPROJECT_DESKTOP_IN *.desktop) +file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN}) +file (GLOB SUBPROJECT_NOTIFY *.notifyrc) +file (GLOB SUBPROJECT_SOURCE *.cpp) +file (GLOB_RECURSE SUBPROJECT_UI *.ui ${PROJECT_TRDPARTY_DIR}/about/*.ui) + +# prepare +configure_file (${SUBPROJECT_DESKTOP_IN} ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP}) + +# make +qt4_add_resources (QRC_SOURCES ${RESOURCES}) +kde4_add_ui_files (SUBPROJECT_SOURCE ${SUBPROJECT_UI}) +kde4_add_plugin (${PLUGIN_NAME} ${SUBPROJECT_SOURCE} ${QRC_SOURCES}) +target_link_libraries (${PLUGIN_NAME} ${KDE4_PLASMA_LIBS} ${KDE4_KDEUI_LIBS} ${KDE4_KIO_LIBS}) + +# install +install (TARGETS ${PLUGIN_NAME} DESTINATION ${PLUGIN_INSTALL_DIR}) +install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR}) +install (FILES ${SUBPROJECT_NOTIFY} DESTINATION ${DATA_INSTALL_DIR}/${PLUGIN_NAME}) diff --git a/sources/plasmoid-kde4/appearance.ui b/sources/plasmoid-kde4/appearance.ui new file mode 100644 index 0000000..b106e34 --- /dev/null +++ b/sources/plasmoid-kde4/appearance.ui @@ -0,0 +1,488 @@ + + + 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 +
kcolorcombo.h
+
+
+ + fontComboBox_font + spinBox_fontSize + kcolorcombo_fontColor + spinBox_fontWeight + comboBox_fontStyle + lineEdit_activeIcon + pushButton_activeIcon + lineEdit_inactiveIcon + pushButton_inactiveIcon + + + +
diff --git a/sources/plasmoid/dataengine.ui b/sources/plasmoid-kde4/dataengine.ui similarity index 100% rename from sources/plasmoid/dataengine.ui rename to sources/plasmoid-kde4/dataengine.ui diff --git a/sources/plasmoid/netctl.cpp b/sources/plasmoid-kde4/netctl.cpp similarity index 100% rename from sources/plasmoid/netctl.cpp rename to sources/plasmoid-kde4/netctl.cpp diff --git a/sources/plasmoid-kde4/netctl.h b/sources/plasmoid-kde4/netctl.h new file mode 100644 index 0000000..04a8a47 --- /dev/null +++ b/sources/plasmoid-kde4/netctl.h @@ -0,0 +1,139 @@ +/*************************************************************************** + * 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 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 +{ + Q_OBJECT + +public: + Netctl(QObject *parent, const QVariantList &args); + ~Netctl(); + void init(); + QString parsePattern(const QString rawLine); + QMap readDataEngineConfiguration(); + void writeDataEngineConfiguration(const QMap settings); + QMap updateDataEngineConfiguration(const QMap rawConfig); + +public slots: + // events + void sendNotification(const QString eventId, const QString message); + void showGui(); + void showWifi(); + // dataengine + void dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data); + // configuration interface + void configAccepted(); + void configChanged(); + void setBigInterface(); + void setDataEngineExternalIp4(); + void setDataEngineExternalIp6(); + void setHelper(); + void setSudo(); + void setWifi(); + +private slots: + // ui + void updateIcon(); + void updateInterface(bool setHidden); + // configuration interface + void selectAbstractSomething(); + // context menu + void enableProfileSlot(); + void restartProfileSlot(); + void startProfileSlot(QAction *profile); + void stopProfileSlot(); + void stopAllProfilesSlot(); + void switchToProfileSlot(QAction *profile); + // helper + void checkHelperStatus(); + void startHelper(); + +protected: + void createConfigurationInterface(KConfigDialog *parent); + QList contextualActions(); + +private: + // ui + QWidget *graphicsWidget; + QHBoxLayout *layout; + IconLabel *iconLabel; + QLabel *textLabel; + // information + bool status; + QMap info; + QStringList profileList; + // context menu + void createActions(); + QList menuActions; + QMenu *startProfileMenu; + QMenu *switchToProfileMenu; + QMap contextMenu; + // data engine + Plasma::DataEngine *netctlEngine; + void connectToEngine(); + void disconnectFromEngine(); + QList sendDBusRequest(const QString cmd, const QList args = QList()); + // configuration interface + Ui::AppearanceWindow uiAppConfig; + Ui::DataEngineWindow uiDEConfig; + Ui::ConfigWindow uiWidConfig; + Ui::About uiAboutConfig; + // configuration + int autoUpdateInterval; + bool bigInterface; + bool debug; + QString textPattern; + QStringList formatLine; + QMap paths; + bool useHelper, useSudo, useWifi; +}; + +K_EXPORT_PLASMA_APPLET(netctl, Netctl) + + +#endif /* NETCTL_PLASMOID_H */ diff --git a/sources/plasmoid-kde4/plasma-applet-netctl.desktop b/sources/plasmoid-kde4/plasma-applet-netctl.desktop new file mode 100644 index 0000000..2bb2549 --- /dev/null +++ b/sources/plasmoid-kde4/plasma-applet-netctl.desktop @@ -0,0 +1,20 @@ +[Desktop Entry] +Encoding=UTF-8 +Name=Netctl +Comment=Plasmoid for netctl +Type=Service +Icon=netctl-gui-widget + +X-KDE-ServiceTypes=Plasma/Applet,Plasma/PopupApplet +X-KDE-Library=plasma_applet_netctl + +X-KDE-PluginInfo-Author=Evgeniy Alekseev +X-KDE-PluginInfo-Email=esalexeev@gmail.com +X-KDE-PluginInfo-Name=netctl +X-KDE-PluginInfo-Version=@PROJECT_VERSION@ +X-KDE-PluginInfo-Website=http://arcanis.name/ru/projects/netctl-gui/ +X-KDE-PluginInfo-Category=Network +X-KDE-PluginInfo-Depends= +X-KDE-PluginInfo-License=GPLv3 +X-KDE-PluginInfo-EnabledByDefault=true +X-Plasma-NotificationArea=true diff --git a/sources/plasmoid/plasma_applet_netctl.notifyrc b/sources/plasmoid-kde4/plasma_applet_netctl.notifyrc similarity index 100% rename from sources/plasmoid/plasma_applet_netctl.notifyrc rename to sources/plasmoid-kde4/plasma_applet_netctl.notifyrc diff --git a/sources/plasmoid/plasmoid.cppcheck b/sources/plasmoid-kde4/plasmoid.cppcheck similarity index 100% rename from sources/plasmoid/plasmoid.cppcheck rename to sources/plasmoid-kde4/plasmoid.cppcheck diff --git a/sources/plasmoid/po/CMakeLists.txt b/sources/plasmoid-kde4/po/CMakeLists.txt similarity index 100% rename from sources/plasmoid/po/CMakeLists.txt rename to sources/plasmoid-kde4/po/CMakeLists.txt diff --git a/sources/plasmoid/po/en.po b/sources/plasmoid-kde4/po/en.po similarity index 100% rename from sources/plasmoid/po/en.po rename to sources/plasmoid-kde4/po/en.po diff --git a/sources/plasmoid/po/extract_messages.sh b/sources/plasmoid-kde4/po/extract_messages.sh similarity index 100% rename from sources/plasmoid/po/extract_messages.sh rename to sources/plasmoid-kde4/po/extract_messages.sh diff --git a/sources/plasmoid/po/ja.po b/sources/plasmoid-kde4/po/ja.po similarity index 100% rename from sources/plasmoid/po/ja.po rename to sources/plasmoid-kde4/po/ja.po diff --git a/sources/plasmoid/po/plasma_applet_netctl.pot b/sources/plasmoid-kde4/po/plasma_applet_netctl.pot similarity index 100% rename from sources/plasmoid/po/plasma_applet_netctl.pot rename to sources/plasmoid-kde4/po/plasma_applet_netctl.pot diff --git a/sources/plasmoid/po/ru.po b/sources/plasmoid-kde4/po/ru.po similarity index 100% rename from sources/plasmoid/po/ru.po rename to sources/plasmoid-kde4/po/ru.po diff --git a/sources/plasmoid-kde4/widget.ui b/sources/plasmoid-kde4/widget.ui new file mode 100644 index 0000000..f4b1d07 --- /dev/null +++ b/sources/plasmoid-kde4/widget.ui @@ -0,0 +1,343 @@ + + + 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 + + + + diff --git a/sources/plasmoid/CMakeLists.txt b/sources/plasmoid-kf5/CMakeLists.txt similarity index 100% rename from sources/plasmoid/CMakeLists.txt rename to sources/plasmoid-kf5/CMakeLists.txt diff --git a/sources/plasmoid-kf5/dataengine.ui b/sources/plasmoid-kf5/dataengine.ui new file mode 100644 index 0000000..019f720 --- /dev/null +++ b/sources/plasmoid-kf5/dataengine.ui @@ -0,0 +1,185 @@ + + + DataEngineWindow + + + + 0 + 0 + 480 + 333 + + + + + 480 + 320 + + + + Configuration Window + + + + + + + + + 150 + 23 + + + + Path to netctl + + + + + + + + + + + 100 + 23 + + + + Browse + + + + + + + + + + + + 150 + 23 + + + + Path to netctl-auto + + + + + + + + + + + 100 + 23 + + + + Browse + + + + + + + + + + + + 150 + 23 + + + + Check external IPv4 + + + true + + + + + + + + + + + 100 + 23 + + + + Browse + + + + + + + + + + + + 150 + 23 + + + + Check external IPv6 + + + true + + + + + + + + + + + 100 + 23 + + + + Browse + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + lineEdit_netctl + pushButton_netctl + checkBox_extIp4 + lineEdit_extIp4 + pushButton_extIp4 + + + + diff --git a/sources/plasmoid-kf5/netctl.cpp b/sources/plasmoid-kf5/netctl.cpp new file mode 100644 index 0000000..a9689d0 --- /dev/null +++ b/sources/plasmoid-kf5/netctl.cpp @@ -0,0 +1,1035 @@ +/*************************************************************************** + * 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 +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include "netctl.h" +#include "ui_about.h" +#include "ui_appearance.h" +#include "ui_dataengine.h" +#include "ui_widget.h" +#include "version.h" + + +IconLabel::IconLabel(Netctl *wid, const bool debugCmd) + : QLabel(), + debug(debugCmd), + widget(wid) +{ +} + + +IconLabel::~IconLabel() +{ +} + + +void IconLabel::mousePressEvent(QMouseEvent *event) +{ + if (debug) qDebug() << PDEBUG; + + if (event->button() == Qt::LeftButton) + widget->showGui(); +} + + +Netctl::Netctl(QObject *parent, const QVariantList &args) + : Plasma::PopupApplet(parent, args) +{ + // debug + QProcessEnvironment environment = QProcessEnvironment::systemEnvironment(); + QString debugEnv = environment.value(QString("NETCTLGUI_DEBUG"), QString("no")); + if (debugEnv == QString("yes")) + debug = true; + else + debug = false; + + setBackgroundHints(DefaultBackground); + setAspectRatioMode(Plasma::IgnoreAspectRatio); + setHasConfigurationInterface(true); + // text format init + formatLine.append(QString("")); + formatLine.append(QString("")); +} + + +Netctl::~Netctl() +{ + if (debug) qDebug() << PDEBUG; + +// // actions +// delete startProfileMenu; +// delete switchToProfileMenu; +// // dataengine +// disconnectFromEngine(); +// delete netctlEngine; +// // ui +// delete iconWidget; +// delete textLabel; +// delete layout; +// delete graphicsWidget; +} + + +void Netctl::init() +{ + if (debug) qDebug() << PDEBUG; + + info[QString("current")] = QString("N\\A"); + info[QString("extip4")] = QString("N\\A"); + info[QString("extip6")] = QString("N\\A"); + info[QString("interfaces")] = QString("N\\A"); + info[QString("info")] = QString("N\\A (N\\A)"); + info[QString("intip4")] = QString("N\\A"); + info[QString("intip6")] = QString("N\\A"); + info[QString("profiles")] = QString("N\\A"); + info[QString("status")] = QString("N\\A"); + + netctlEngine = dataEngine(QString("netctl")); + createActions(); + // generate ui + graphicsWidget = new QWidget(); + graphicsWidget->setAttribute(Qt::WA_TranslucentBackground, true); + setWidget(graphicsWidget); + // layouts + layout = new QHBoxLayout(graphicsWidget); + layout->setContentsMargins(1, 1, 1, 1); + iconLabel = new IconLabel(this, debug); + layout->addWidget(iconLabel); + textLabel = new QLabel(graphicsWidget); + layout->addWidget(textLabel); + // read variables + configChanged(); +} + + +QString Netctl::parsePattern(const QString rawLine) +{ + if (debug) qDebug() << PDEBUG; + + QString line = rawLine; + for (int i=0; i Netctl::readDataEngineConfiguration() +{ + if (debug) qDebug() << PDEBUG; + + QMap rawConfig; + rawConfig[QString("EXTIP4")] = QString("false"); + rawConfig[QString("EXTIP4CMD")] = QString("curl ip4.telize.com"); + rawConfig[QString("EXTIP6")] = QString("false"); + rawConfig[QString("EXTIP6CMD")] = QString("curl ip6.telize.com"); + rawConfig[QString("NETCTLCMD")] = QString("/usr/bin/netctl"); + rawConfig[QString("NETCTLAUTOCMD")] = QString("/usr/bin/netctl-auto"); + + QString fileName = KGlobal::dirs()->findResource("config", "netctl.conf"); + if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName; + QFile configFile(fileName); + if (!configFile.open(QIODevice::ReadOnly)) + return updateDataEngineConfiguration(rawConfig); + QString fileStr; + QStringList value; + while (true) { + fileStr = QString(configFile.readLine()).trimmed(); + if ((fileStr.isEmpty()) && (!configFile.atEnd())) continue; + if ((fileStr[0] == QChar('#')) && (!configFile.atEnd())) continue; + if ((fileStr[0] == QChar(';')) && (!configFile.atEnd())) continue; + if (fileStr.contains(QChar('='))) { + value.clear(); + for (int i=1; i settings) +{ + if (debug) qDebug() << PDEBUG; + + QMap config = updateDataEngineConfiguration(settings); + QString fileName = KGlobal::dirs()->locateLocal("config", "netctl.conf"); + if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName; + QFile configFile(fileName); + if (!configFile.open(QIODevice::WriteOnly)) return; + for (int i=0; i Netctl::updateDataEngineConfiguration(const QMap rawConfig) +{ + if (debug) qDebug() << PDEBUG; + + QMap config; + QString key, value; + // remove spaces and copy source map + for (int i=0; isetPixmap(iconPixmap); +} + + +void Netctl::updateInterface(bool setShown) +{ + if (debug) qDebug() << PDEBUG; + if (debug) qDebug() << PDEBUG << ":" << "State" << setShown; + + if (setShown) + layout->addWidget(textLabel); + else + layout->removeWidget(textLabel); + graphicsWidget->adjustSize(); + resize(1, 1); +} + + +// context menu +void Netctl::enableProfileSlot() +{ + if (debug) qDebug() << PDEBUG; + + QString enableStatus = QString(""); + if (info[QString("status")].contains(QString("enabled"))) { + enableStatus = QString(" disable "); + sendNotification(QString("Info"), i18n("Set profile %1 disabled", info[QString("current")])); + } else { + enableStatus = QString(" enable "); + sendNotification(QString("Info"), i18n("Set profile %1 enabled", info[QString("current")])); + } + if (useHelper) { + QList args; + args.append(info[QString("current")]); + sendDBusRequest(QString("Enable"), args); + } else { + QProcess command; + QString commandLine = QString(""); + if (useSudo) + commandLine = paths[QString("sudo")] + QString(" "); + commandLine += paths[QString("netctl")] + enableStatus + info[QString("current")]; + command.startDetached(commandLine); + } +} + + +void Netctl::restartProfileSlot() +{ + if (debug) qDebug() << PDEBUG; + + sendNotification(QString("Info"), i18n("Restart profile %1", info[QString("current")])); + if (useHelper) { + QList args; + args.append(info[QString("current")]); + sendDBusRequest(QString("Restart"), args); + } else { + QProcess command; + QString commandLine = QString(""); + if (useSudo) + commandLine = paths[QString("sudo")] + QString(" "); + commandLine += paths[QString("netctl")] + QString(" restart ") + info[QString("current")]; + command.startDetached(commandLine); + } +} + + +void Netctl::startProfileSlot(QAction *profile) +{ + if (debug) qDebug() << PDEBUG; + if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile->text().remove(QChar('&')); + + sendNotification(QString("Info"), i18n("Start profile %1", profile->text().remove(QChar('&')))); + if (useHelper) { + QList args; + args.append(profile->text().remove(QChar('&'))); + if (status) + sendDBusRequest(QString("SwitchTo"), args); + else + sendDBusRequest(QString("Start"), args); + } else { + QProcess command; + QString commandLine = QString(""); + if (useSudo) + commandLine = paths[QString("sudo")] + QString(" "); + if (status) + commandLine += paths[QString("netctl")] + QString(" switch-to ") + profile->text().remove(QChar('&')); + else + commandLine += paths[QString("netctl")] + QString(" start ") + profile->text().remove(QChar('&')); + command.startDetached(commandLine); + } +} + + +void Netctl::stopProfileSlot() +{ + if (debug) qDebug() << PDEBUG; + + sendNotification(QString("Info"), i18n("Stop profile %1", info[QString("current")])); + if (useHelper) { + QList args; + args.append(info[QString("current")]); + sendDBusRequest(QString("Start"), args); + } else { + QProcess command; + QString commandLine = QString(""); + if (useSudo) + commandLine = paths[QString("sudo")] + QString(" "); + commandLine += paths[QString("netctl")] + QString(" stop ") + info[QString("current")]; + command.startDetached(commandLine); + } +} + + +void Netctl::stopAllProfilesSlot() +{ + if (debug) qDebug() << PDEBUG; + + sendNotification(QString("Info"), i18n("Stop all profiles")); + if (useHelper) + sendDBusRequest(QString("StopAll"), QList()); + else { + QProcess command; + QString commandLine = QString(""); + if (useSudo) + commandLine = paths[QString("sudo")] + QString(" "); + commandLine += paths[QString("netctl")] + QString(" stop-all "); + command.startDetached(commandLine); + } +} + + +void Netctl::switchToProfileSlot(QAction *profile) +{ + if (debug) qDebug() << PDEBUG; + if (debug) qDebug() << PDEBUG << ":" << "Profile" << profile->text().remove(QChar('&')); + + + sendNotification(QString("Info"), i18n("Switch to profile %1", profile->text().remove(QChar('&')))); + if (useHelper) { + QList args; + args.append(profile->text().remove(QChar('&'))); + sendDBusRequest(QString("autoStart"), args); + } else { + QProcess command; + QString commandLine = paths[QString("netctlAuto")] + QString(" switch-to ") + + profile->text().remove(QChar('&')); + command.startDetached(commandLine); + } +} + + +void Netctl::startHelper() +{ + if (debug) qDebug() << PDEBUG; + + QProcess command; + QString commandLine = paths[QString("helper")]; + + command.startDetached(commandLine); +} + + +void Netctl::checkHelperStatus() +{ + if (debug) qDebug() << PDEBUG; + + if (useHelper) + useHelper = !sendDBusRequest(QString("Active"), QList()).isEmpty(); +} + + +QList Netctl::contextualActions() +{ + if (debug) qDebug() << PDEBUG; + + if (status) + contextMenu[QString("title")]->setIcon(QIcon(paths[QString("active")])); + else + contextMenu[QString("title")]->setIcon(QIcon(paths[QString("inactive")])); + contextMenu[QString("title")]->setText(info[QString("current")] + QString(" ") + info[QString("status")]); + + if (info[QString("status")] == QString("(netctl-auto)")) { + contextMenu[QString("start")]->setVisible(false); + contextMenu[QString("stop")]->setVisible(false); + contextMenu[QString("stopall")]->setVisible(false); + contextMenu[QString("switch")]->setVisible(true); + contextMenu[QString("restart")]->setVisible(false); + contextMenu[QString("enable")]->setVisible(false); + switchToProfileMenu->clear(); + for (int i=0; iaddAction(profile); + } + } else { + if (info[QString("current")].contains(QChar('|'))) { + contextMenu[QString("start")]->setVisible(true); + contextMenu[QString("stop")]->setVisible(false); + contextMenu[QString("stopall")]->setVisible(true); + contextMenu[QString("switch")]->setVisible(false); + contextMenu[QString("restart")]->setVisible(false); + contextMenu[QString("enable")]->setVisible(false); + } else { + contextMenu[QString("start")]->setVisible(true); + contextMenu[QString("stop")]->setVisible(status); + contextMenu[QString("stopall")]->setVisible(false); + contextMenu[QString("switch")]->setVisible(false); + contextMenu[QString("restart")]->setVisible(status); + contextMenu[QString("enable")]->setVisible(status); + } + if (status) { + contextMenu[QString("start")]->setText(i18n("Start another profile")); + contextMenu[QString("stop")]->setText(i18n("Stop %1", info[QString("current")])); + contextMenu[QString("restart")]->setText(i18n("Restart %1", info[QString("current")])); + if (info[QString("status")].contains(QString("enabled"))) + contextMenu[QString("enable")]->setText(i18n("Disable %1", info[QString("current")])); + else + contextMenu[QString("enable")]->setText(i18n("Enable %1", info[QString("current")])); + } + else + contextMenu[QString("start")]->setText(i18n("Start profile")); + startProfileMenu->clear(); + for (int i=0; iaddAction(profile); + } + } + + contextMenu[QString("wifi")]->setVisible(useWifi); + + return menuActions; +} + + +void Netctl::createActions() +{ + if (debug) qDebug() << PDEBUG; + + menuActions.clear(); + + contextMenu[QString("title")] = new QAction(QString("netctl-gui"), this); + menuActions.append(contextMenu[QString("title")]); + + contextMenu[QString("start")] = new QAction(i18n("Start profile"), this); + contextMenu[QString("start")]->setIcon(QIcon::fromTheme("dialog-apply")); + startProfileMenu = new QMenu(NULL); + contextMenu[QString("start")]->setMenu(startProfileMenu); + connect(startProfileMenu, SIGNAL(triggered(QAction *)), this, + SLOT(startProfileSlot(QAction *))); + menuActions.append(contextMenu[QString("start")]); + + contextMenu[QString("stop")] = new QAction(i18n("Stop profile"), this); + contextMenu[QString("stop")]->setIcon(QIcon::fromTheme("dialog-close")); + connect(contextMenu[QString("stop")], SIGNAL(triggered(bool)), this, SLOT(stopProfileSlot())); + menuActions.append(contextMenu[QString("stop")]); + + contextMenu[QString("stopall")] = new QAction(i18n("Stop all profiles"), this); + contextMenu[QString("stopall")]->setIcon(QIcon::fromTheme("dialog-close")); + connect(contextMenu[QString("stopall")], SIGNAL(triggered(bool)), this, SLOT(stopAllProfilesSlot())); + menuActions.append(contextMenu[QString("stopall")]); + + contextMenu[QString("switch")] = new QAction(i18n("Switch to profile"), this); + contextMenu[QString("switch")]->setIcon(QIcon::fromTheme("dialog-apply")); + switchToProfileMenu = new QMenu(NULL); + contextMenu[QString("switch")]->setMenu(switchToProfileMenu); + connect(switchToProfileMenu, SIGNAL(triggered(QAction *)), this, + SLOT(switchToProfileSlot(QAction *))); + menuActions.append(contextMenu[QString("switch")]); + + contextMenu[QString("restart")] = new QAction(i18n("Restart profile"), this); + contextMenu[QString("restart")]->setIcon(QIcon::fromTheme("stock-refresh")); + connect(contextMenu[QString("restart")], SIGNAL(triggered(bool)), this, SLOT(restartProfileSlot())); + menuActions.append(contextMenu[QString("restart")]); + + contextMenu[QString("enable")] = new QAction(i18n("Enable profile"), this); + connect(contextMenu[QString("enable")], SIGNAL(triggered(bool)), this, SLOT(enableProfileSlot())); + menuActions.append(contextMenu[QString("enable")]); + + contextMenu[QString("gui")] = new QAction(i18n("Show netctl-gui"), this); + contextMenu[QString("gui")]->setIcon(QIcon(":icon")); + connect(contextMenu[QString("gui")], SIGNAL(triggered(bool)), this, SLOT(showGui())); + menuActions.append(contextMenu[QString("gui")]); + + contextMenu[QString("wifi")] = new QAction(i18n("Show WiFi menu"), this); + contextMenu[QString("wifi")]->setIcon(QIcon(":wifi")); + connect(contextMenu[QString("wifi")], SIGNAL(triggered(bool)), this, SLOT(showWifi())); + menuActions.append(contextMenu[QString("wifi")]); +} + + +// events +void Netctl::sendNotification(const QString eventId, const QString message) +{ + if (debug) qDebug() << PDEBUG; + if (debug) qDebug() << PDEBUG << ":" << "Event" << eventId; + if (debug) qDebug() << PDEBUG << ":" << "Message" << message; + + KNotification *notification = new KNotification(eventId); + notification->setComponentData(KComponentData("plasma_applet_netctl")); + notification->setTitle(QString("Netctl ::: ") + eventId); + notification->setText(message); + notification->sendEvent(); + delete notification; +} + + +void Netctl::showGui() +{ + if (debug) qDebug() << PDEBUG; + + sendNotification(QString("Info"), i18n("Start GUI")); + QProcess command; + + command.startDetached(paths[QString("gui")]); +} + + +void Netctl::showWifi() +{ + if (debug) qDebug() << PDEBUG; + + sendNotification(QString("Info"), i18n("Start WiFi menu")); + QProcess command; + + command.startDetached(paths[QString("wifi")]); +} + + +// data engine interaction +void Netctl::connectToEngine() +{ + if (debug) qDebug() << PDEBUG; + + netctlEngine->connectSource(QString("active"), this, autoUpdateInterval); + netctlEngine->connectSource(QString("current"), this, autoUpdateInterval); + netctlEngine->connectSource(QString("extip4"), this, autoUpdateInterval); + netctlEngine->connectSource(QString("extip6"), this, autoUpdateInterval); + netctlEngine->connectSource(QString("interfaces"), this, autoUpdateInterval); + netctlEngine->connectSource(QString("intip4"), this, autoUpdateInterval); + netctlEngine->connectSource(QString("intip6"), this, autoUpdateInterval); + netctlEngine->connectSource(QString("profiles"), this, autoUpdateInterval); + netctlEngine->connectSource(QString("status"), this, autoUpdateInterval); + updateInterface(bigInterface); +} + + +void Netctl::dataUpdated(const QString &sourceName, const Plasma::DataEngine::Data &data) +{ + if (debug) qDebug() << PDEBUG; + if (debug) qDebug() << PDEBUG << ":" << "Source" << sourceName; + + if (isPopupShowing()) return; + if (isUserConfiguring()) return; + if (data.isEmpty()) return; + QString value = data[QString("value")].toString(); + if (value.isEmpty()) + value = QString("N\\A"); + + if (sourceName == QString("active")) { + if (value == QString("true")) { + if (!status) + sendNotification(QString("Info"), i18n("Network is up")); + status = true; + } else { + if (status) + sendNotification(QString("Info"), i18n("Network is down")); + status = false; + } + updateIcon(); + } else if (sourceName == QString("current")) { + info[QString("current")] = value; + QStringList profiles; + for (int i=0; isetText(formatLine[0] + parsePattern(textPattern) + formatLine[1]); + } else if (sourceName == QString("extip4")) { + info[QString("extip4")] = value; + } else if (sourceName == QString("extip6")) { + info[QString("extip6")] = value; + } else if (sourceName == QString("interfaces")) { + info[QString("interfaces")] = value; + } else if (sourceName == QString("intip4")) { + info[QString("intip4")] = value; + } else if (sourceName == QString("intip6")) { + info[QString("intip6")] = value; + } else if (sourceName == QString("profiles")) { + profileList = value.split(QChar(',')); + info[QString("profiles")] = profileList.join(QChar(',')); + } else if (sourceName == QString("status")) { + info[QString("status")] = value; + } + + update(); +} + + +void Netctl::disconnectFromEngine() +{ + if (debug) qDebug() << PDEBUG; + + netctlEngine->disconnectSource(QString("currentProfile"), this); + netctlEngine->disconnectSource(QString("extIp4"), this); + netctlEngine->disconnectSource(QString("extIp6"), this); + netctlEngine->disconnectSource(QString("interfaces"), this); + netctlEngine->disconnectSource(QString("intIp4"), this); + netctlEngine->disconnectSource(QString("intIp6"), this); + netctlEngine->disconnectSource(QString("profiles"), this); + netctlEngine->disconnectSource(QString("statusBool"), this); + netctlEngine->disconnectSource(QString("statusString"), this); + + updateInterface(false); +} + + +QList Netctl::sendDBusRequest(const QString cmd, const QList args) +{ + if (debug) qDebug() << PDEBUG; + if (debug) qDebug() << PDEBUG << ":" << "cmd" << cmd; + if (debug) qDebug() << PDEBUG << ":" << "args" << args; + + QDBusConnection bus = QDBusConnection::systemBus(); + QDBusMessage request = QDBusMessage::createMethodCall(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH, + DBUS_HELPER_INTERFACE, cmd); + if (!args.isEmpty()) + request.setArguments(args); + QDBusMessage response = bus.call(request, QDBus::BlockWithGui); + QList arguments = response.arguments(); + if (arguments.size() == 0) + if (debug) qDebug() << PDEBUG << ":" << "Error message" << response.errorMessage(); + + return arguments; +} + + +// configuration interface +void Netctl::selectAbstractSomething() +{ + if (debug) qDebug() << PDEBUG; + + QString path = QString("/usr/bin"); + QLineEdit *lineEdit = uiWidConfig.lineEdit_gui; + if (sender() == uiAppConfig.pushButton_activeIcon) { + path = QString("/usr/share/icons"); + lineEdit = uiAppConfig.lineEdit_activeIcon; + } else if (sender() == uiAppConfig.pushButton_inactiveIcon) { + path = QString("/usr/share/icons"); + lineEdit = uiAppConfig.lineEdit_inactiveIcon; + } else if (sender() == uiWidConfig.pushButton_gui) + lineEdit = uiWidConfig.lineEdit_gui; + else if (sender() == uiWidConfig.pushButton_helper) + lineEdit = uiWidConfig.lineEdit_helper; + else if (sender() == uiWidConfig.pushButton_netctl) + lineEdit = uiWidConfig.lineEdit_netctl; + else if (sender() == uiWidConfig.pushButton_netctlAuto) + lineEdit = uiWidConfig.lineEdit_netctlAuto; + else if (sender() == uiWidConfig.pushButton_sudo) + lineEdit = uiWidConfig.lineEdit_sudo; + else if (sender() == uiWidConfig.pushButton_wifi) + lineEdit = uiWidConfig.lineEdit_wifi; + else if (sender() == uiDEConfig.pushButton_extIp4) + lineEdit = uiDEConfig.lineEdit_extIp4; + else if (sender() == uiDEConfig.pushButton_extIp6) + lineEdit = uiDEConfig.lineEdit_extIp6; + else if (sender() == uiDEConfig.pushButton_netctl) + lineEdit = uiDEConfig.lineEdit_netctl; + else if (sender() == uiDEConfig.pushButton_netctlAuto) + lineEdit = uiDEConfig.lineEdit_netctlAuto; + + KUrl url = KFileDialog::getOpenUrl(KUrl(path), "*"); + lineEdit->setText(url.path()); +} + + +void Netctl::createConfigurationInterface(KConfigDialog *parent) +{ + if (debug) qDebug() << PDEBUG; + + QWidget *configWidget = new QWidget; + uiWidConfig.setupUi(configWidget); + QWidget *appWidget = new QWidget; + uiAppConfig.setupUi(appWidget); + QWidget *deWidget = new QWidget; + uiDEConfig.setupUi(deWidget); + QWidget *aboutWidget = new QWidget; + uiAboutConfig.setupUi(aboutWidget); + + uiWidConfig.spinBox_autoUpdate->setValue(autoUpdateInterval); + uiWidConfig.lineEdit_gui->setText(paths[QString("gui")]); + if (useHelper) + uiWidConfig.checkBox_helper->setCheckState(Qt::Checked); + else + uiWidConfig.checkBox_helper->setCheckState(Qt::Unchecked); + uiWidConfig.lineEdit_helper->setText(paths[QString("helper")]); + setHelper(); + uiWidConfig.lineEdit_netctl->setText(paths[QString("netctl")]); + uiWidConfig.lineEdit_netctlAuto->setText(paths[QString("netctlAuto")]); + if (useSudo) + uiWidConfig.checkBox_sudo->setCheckState(Qt::Checked); + else + uiWidConfig.checkBox_sudo->setCheckState(Qt::Unchecked); + uiWidConfig.lineEdit_sudo->setText(paths[QString("sudo")]); + setSudo(); + if (useWifi) + uiWidConfig.checkBox_wifi->setCheckState(Qt::Checked); + else + uiWidConfig.checkBox_wifi->setCheckState(Qt::Unchecked); + uiWidConfig.lineEdit_wifi->setText(paths[QString("wifi")]); + setWifi(); + if (bigInterface) + uiWidConfig.checkBox_showBigInterface->setCheckState(Qt::Checked); + else + uiWidConfig.checkBox_showBigInterface->setCheckState(Qt::Unchecked); + QString pattern = textPattern; + uiWidConfig.textEdit->setPlainText(pattern.replace(QString("
"), QString("\n"))); + setBigInterface(); + + KConfigGroup cg = config(); + QString textAlign = cg.readEntry("textAlign", "center"); + QString fontFamily = cg.readEntry("fontFamily", "Terminus"); + int fontSize = cg.readEntry("fontSize", 10); + QString fontColor = cg.readEntry("fontColor", "#000000"); + int fontWeight = cg.readEntry("fontWeight", 400); + QString fontStyle = cg.readEntry("fontStyle", "normal"); + QFont font = QFont(fontFamily, 12, 400, FALSE); + uiAppConfig.comboBox_textAlign->setCurrentIndex(uiAppConfig.comboBox_textAlign->findText(textAlign)); + uiAppConfig.fontComboBox_font->setCurrentFont(font); + uiAppConfig.spinBox_fontSize->setValue(fontSize); + uiAppConfig.kcolorcombo_fontColor->setColor(fontColor); + uiAppConfig.spinBox_fontWeight->setValue(fontWeight); + uiAppConfig.comboBox_fontStyle->setCurrentIndex(uiAppConfig.comboBox_fontStyle->findText(fontStyle)); + uiAppConfig.lineEdit_activeIcon->setText(paths[QString("active")]); + uiAppConfig.lineEdit_inactiveIcon->setText(paths[QString("inactive")]); + + QMap deSettings = readDataEngineConfiguration(); + uiDEConfig.lineEdit_netctl->setText(deSettings[QString("NETCTLCMD")]); + uiDEConfig.lineEdit_netctlAuto->setText(deSettings[QString("NETCTLAUTOCMD")]); + if (deSettings[QString("EXTIP4")] == QString("true")) + uiDEConfig.checkBox_extIp4->setCheckState(Qt::Checked); + else + uiDEConfig.checkBox_extIp4->setCheckState(Qt::Unchecked); + uiDEConfig.lineEdit_extIp4->setText(deSettings[QString("EXTIP4CMD")]); + setDataEngineExternalIp4(); + if (deSettings[QString("EXTIP6")] == QString("true")) + uiDEConfig.checkBox_extIp6->setCheckState(Qt::Checked); + else + uiDEConfig.checkBox_extIp6->setCheckState(Qt::Unchecked); + uiDEConfig.lineEdit_extIp6->setText(deSettings[QString("EXTIP6CMD")]); + setDataEngineExternalIp6(); + + // 1st tab + uiAboutConfig.label_name->setText(QString(NAME)); + uiAboutConfig.label_version->setText(i18n("Version %1\n(build date %2)", QString(VERSION), QString(BUILD_DATE))); + uiAboutConfig.label_description->setText(i18n("KDE widget which interacts with netctl.")); + uiAboutConfig.label_links->setText(i18n("Links:") + QString("
") + + QString("%2
").arg(QString(HOMEPAGE)).arg(i18n("Homepage")) + + QString("%2
").arg(QString(REPOSITORY)).arg(i18n("Repository")) + + QString("%2
").arg(QString(BUGTRACKER)).arg(i18n("Bugtracker")) + + QString("%2
").arg(QString(TRANSLATION)).arg(i18n("Translation issue")) + + QString("%2").arg(QString(AUR_PACKAGES)).arg(i18n("AUR packages"))); + uiAboutConfig.label_license->setText(QString("© %1 %3
").arg(QString(DATE)).arg(QString(EMAIL)).arg(QString(AUTHOR)) + + i18n("This software is licensed under %1", QString(LICENSE)) + QString("
")); + // 2nd tab + QStringList trdPartyList = QString(TRDPARTY_LICENSE).split(QChar(';'), QString::SkipEmptyParts); + for (int i=0; i%1 (%2 license)") + .arg(trdPartyList[i].split(QChar(','))[0]) + .arg(trdPartyList[i].split(QChar(','))[1]) + .arg(trdPartyList[i].split(QChar(','))[2]); + uiAboutConfig.label_translators->setText(i18n("Translators: %1", QString(TRANSLATORS))); + uiAboutConfig.label_trdparty->setText(i18n("This software uses: %1", trdPartyList.join(QString(", ")))); + + parent->addPage(configWidget, i18n("Netctl plasmoid"), Applet::icon()); + parent->addPage(appWidget, i18n("Appearance"), QString("preferences-desktop-theme")); + parent->addPage(deWidget, i18n("DataEngine"), Applet::icon()); + parent->addPage(aboutWidget, i18n("About"), QString("help-about")); + + connect(uiWidConfig.checkBox_helper, SIGNAL(stateChanged(int)), this, SLOT(setHelper())); + connect(uiWidConfig.checkBox_showBigInterface, SIGNAL(stateChanged(int)), this, + SLOT(setBigInterface())); + connect(uiWidConfig.checkBox_sudo, SIGNAL(stateChanged(int)), this, SLOT(setSudo())); + connect(uiWidConfig.checkBox_wifi, SIGNAL(stateChanged(int)), this, SLOT(setWifi())); + connect(uiDEConfig.checkBox_extIp4, SIGNAL(stateChanged(int)), this, SLOT(setDataEngineExternalIp4())); + connect(uiDEConfig.checkBox_extIp6, SIGNAL(stateChanged(int)), this, SLOT(setDataEngineExternalIp6())); + + connect(uiWidConfig.pushButton_gui, SIGNAL(clicked()), this, SLOT(selectAbstractSomething())); + connect(uiWidConfig.pushButton_helper, SIGNAL(clicked()), this, SLOT(selectAbstractSomething())); + connect(uiWidConfig.pushButton_netctl, SIGNAL(clicked()), this, SLOT(selectAbstractSomething())); + connect(uiWidConfig.pushButton_netctlAuto, SIGNAL(clicked()), this, SLOT(selectAbstractSomething())); + connect(uiWidConfig.pushButton_sudo, SIGNAL(clicked()), this, SLOT(selectAbstractSomething())); + connect(uiWidConfig.pushButton_wifi, SIGNAL(clicked()), this, SLOT(selectAbstractSomething())); + connect(uiAppConfig.pushButton_activeIcon, SIGNAL(clicked()), this, SLOT(selectAbstractSomething())); + connect(uiAppConfig.pushButton_inactiveIcon, SIGNAL(clicked()), this, SLOT(selectAbstractSomething())); + connect(uiDEConfig.pushButton_extIp4, SIGNAL(clicked()), this, SLOT(selectAbstractSomething())); + connect(uiDEConfig.pushButton_extIp6, SIGNAL(clicked()), this, SLOT(selectAbstractSomething())); + connect(uiDEConfig.pushButton_netctl, SIGNAL(clicked()), this, SLOT(selectAbstractSomething())); + connect(uiDEConfig.pushButton_netctlAuto, SIGNAL(clicked()), this, SLOT(selectAbstractSomething())); + + connect(parent, SIGNAL(okClicked()), this, SLOT(configAccepted())); + connect(parent, SIGNAL(applyClicked()), this, SLOT(configAccepted())); +} + + +void Netctl::configAccepted() +{ + if (debug) qDebug() << PDEBUG; + + disconnectFromEngine(); + KConfigGroup cg = config(); + + cg.writeEntry("autoUpdateInterval", uiWidConfig.spinBox_autoUpdate->value()); + cg.writeEntry("guiPath", uiWidConfig.lineEdit_gui->text()); + if (uiWidConfig.checkBox_helper->checkState() == 0) + cg.writeEntry("useHelper", false); + else + cg.writeEntry("useHelper", true); + cg.writeEntry("helperPath", uiWidConfig.lineEdit_helper->text()); + cg.writeEntry("netctlPath", uiWidConfig.lineEdit_netctl->text()); + cg.writeEntry("netctlAutoPath", uiWidConfig.lineEdit_netctlAuto->text()); + if (uiWidConfig.checkBox_sudo->checkState() == 0) + cg.writeEntry("useSudo", false); + else + cg.writeEntry("useSudo", true); + cg.writeEntry("sudoPath", uiWidConfig.lineEdit_sudo->text()); + if (uiWidConfig.checkBox_wifi->checkState() == 0) + cg.writeEntry("useWifi", false); + else + cg.writeEntry("useWifi", true); + cg.writeEntry("wifiPath", uiWidConfig.lineEdit_wifi->text()); + if (uiWidConfig.checkBox_showBigInterface->checkState() == 0) + cg.writeEntry("showBigInterface", false); + else + cg.writeEntry("showBigInterface", true); + QString pattern = uiWidConfig.textEdit->toPlainText(); + pattern.replace(QString("\n"), QString("
")); + cg.writeEntry("textPattern", pattern); + + cg.writeEntry("textAlign", uiAppConfig.comboBox_textAlign->currentText()); + cg.writeEntry("fontFamily", uiAppConfig.fontComboBox_font->currentFont().family()); + cg.writeEntry("fontSize", uiAppConfig.spinBox_fontSize->value()); + cg.writeEntry("fontColor", uiAppConfig.kcolorcombo_fontColor->color().name()); + cg.writeEntry("fontWeight", uiAppConfig.spinBox_fontWeight->value()); + cg.writeEntry("fontStyle", uiAppConfig.comboBox_fontStyle->currentText()); + cg.writeEntry("activeIconPath", uiAppConfig.lineEdit_activeIcon->text()); + cg.writeEntry("inactiveIconPath", uiAppConfig.lineEdit_inactiveIcon->text()); + + QMap deSettings; + deSettings[QString("NETCTLCMD")] = uiDEConfig.lineEdit_netctl->text(); + deSettings[QString("NETCTLAUTOCMD")] = uiDEConfig.lineEdit_netctlAuto->text(); + if (uiDEConfig.checkBox_extIp4->checkState() == 0) + deSettings[QString("EXTIP4")] = QString("false"); + else + deSettings[QString("EXTIP4")] = QString("true"); + deSettings[QString("EXTIP4CMD")] = uiDEConfig.lineEdit_extIp4->text(); + if (uiDEConfig.checkBox_extIp6->checkState() == 0) + deSettings[QString("EXTIP6")] = QString("false"); + else + deSettings[QString("EXTIP6")] = QString("true"); + deSettings[QString("EXTIP6CMD")] = uiDEConfig.lineEdit_extIp6->text(); + writeDataEngineConfiguration(deSettings); +} + + +void Netctl::configChanged() +{ + if (debug) qDebug() << PDEBUG; + + KConfigGroup cg = config(); + + autoUpdateInterval = cg.readEntry("autoUpdateInterval", 1000); + paths[QString("gui")] = cg.readEntry("guiPath", "/usr/bin/netctl-gui"); + paths[QString("helper")] = cg.readEntry("helperPath", "/usr/bin/netctlgui-helper"); + paths[QString("netctl")] = cg.readEntry("netctlPath", "/usr/bin/netctl"); + paths[QString("netctlAuto")] = cg.readEntry("netctlAutoPath", "/usr/bin/netctl-auto"); + paths[QString("sudo")] = cg.readEntry("sudoPath", "/usr/bin/kdesu"); + paths[QString("wifi")] = cg.readEntry("wifiPath", "/usr/bin/netctl-gui -t 3"); + useSudo = cg.readEntry("useSudo", true); + useWifi = cg.readEntry("useWifi", false); + bigInterface = cg.readEntry("showBigInterface", true); + useHelper = cg.readEntry("useHelper", true); + textPattern = cg.readEntry("textPattern", "$info
IPv4: $intip4
IPv6: $intip6"); + + QString textAlign = cg.readEntry("textAlign", "center"); + QString fontFamily = cg.readEntry("fontFamily", "Terminus"); + int fontSize = cg.readEntry("fontSize", 10); + QString fontColor = cg.readEntry("fontColor", "#000000"); + int fontWeight = cg.readEntry("fontWeight", 400); + QString fontStyle = cg.readEntry("fontStyle", "normal"); + paths[QString("active")] = cg.readEntry("activeIconPath", + "/usr/share/icons/hicolor/64x64/apps/netctl-idle.png"); + paths[QString("inactive")] = cg.readEntry("inactiveIconPath", + "/usr/share/icons/hicolor/64x64/apps/netctl-offline.png"); + + formatLine[0] = QString("\ +\ +

") + .arg(textAlign) + .arg(fontFamily) + .arg(QString::number(fontSize)) + .arg(QString::number(fontWeight)) + .arg(fontStyle) + .arg(fontColor); + formatLine[1] = QString("

"); + + if (useHelper) startHelper(); + checkHelperStatus(); + connectToEngine(); +} + + +void Netctl::setBigInterface() +{ + if (debug) qDebug() << PDEBUG; + + if (uiWidConfig.checkBox_showBigInterface->checkState() == 0) + uiWidConfig.textEdit->setDisabled(true); + else if (uiWidConfig.checkBox_showBigInterface->checkState() == 2) + uiWidConfig.textEdit->setDisabled(false); +} + + +void Netctl::setDataEngineExternalIp4() +{ + if (debug) qDebug() << PDEBUG; + + if (uiDEConfig.checkBox_extIp4->checkState() == 0) { + uiDEConfig.lineEdit_extIp4->setDisabled(true); + uiDEConfig.pushButton_extIp4->setDisabled(true); + } else if (uiDEConfig.checkBox_extIp4->checkState() == 2) { + uiDEConfig.lineEdit_extIp4->setEnabled(true); + uiDEConfig.pushButton_extIp4->setEnabled(true); + } +} + + +void Netctl::setDataEngineExternalIp6() +{ + if (debug) qDebug() << PDEBUG; + + if (uiDEConfig.checkBox_extIp6->checkState() == 0) { + uiDEConfig.lineEdit_extIp6->setDisabled(true); + uiDEConfig.pushButton_extIp6->setDisabled(true); + } else if (uiDEConfig.checkBox_extIp6->checkState() == 2) { + uiDEConfig.lineEdit_extIp6->setEnabled(true); + uiDEConfig.pushButton_extIp6->setEnabled(true); + } +} + + +void Netctl::setHelper() +{ + if (uiWidConfig.checkBox_helper->checkState() == 0) { + uiWidConfig.lineEdit_helper->setDisabled(true); + uiWidConfig.pushButton_helper->setDisabled(true); + } else if (uiWidConfig.checkBox_helper->checkState() == 2) { + uiWidConfig.lineEdit_helper->setEnabled(true); + uiWidConfig.pushButton_helper->setEnabled(true); + } +} + + +void Netctl::setSudo() +{ + if (debug) qDebug() << PDEBUG; + + if (uiWidConfig.checkBox_sudo->checkState() == 0) { + uiWidConfig.lineEdit_sudo->setDisabled(true); + uiWidConfig.pushButton_sudo->setDisabled(true); + } else if (uiWidConfig.checkBox_sudo->checkState() == 2) { + uiWidConfig.lineEdit_sudo->setEnabled(true); + uiWidConfig.pushButton_sudo->setEnabled(true); + } +} + + +void Netctl::setWifi() +{ + if (debug) qDebug() << PDEBUG; + + if (uiWidConfig.checkBox_wifi->checkState() == 0) { + uiWidConfig.lineEdit_wifi->setDisabled(true); + uiWidConfig.pushButton_wifi->setDisabled(true); + } else if (uiWidConfig.checkBox_wifi->checkState() == 2) { + uiWidConfig.lineEdit_wifi->setEnabled(true); + uiWidConfig.pushButton_wifi->setEnabled(true); + } +} + + +#include "netctl.moc" diff --git a/sources/plasmoid/netctl.h b/sources/plasmoid-kf5/netctl.h similarity index 100% rename from sources/plasmoid/netctl.h rename to sources/plasmoid-kf5/netctl.h diff --git a/sources/plasmoid-kf5/plasma_applet_netctl.notifyrc b/sources/plasmoid-kf5/plasma_applet_netctl.notifyrc new file mode 100644 index 0000000..9d50894 --- /dev/null +++ b/sources/plasmoid-kf5/plasma_applet_netctl.notifyrc @@ -0,0 +1,14 @@ +[Global] +IconName=netctl-gui-widget +Name=Netctl plasmoid +Comment=Netctl plasmoid popups + +[Event/Error] +Name=Error +Comment=There is an error from netctl plasmoid +Action=Popup + +[Event/Info] +Name=Information +Comment=There is an information from netctl plasmoid +Action=Popup diff --git a/sources/plasmoid/plasmoid/contents/config/config.qml b/sources/plasmoid-kf5/plasmoid/contents/config/config.qml similarity index 100% rename from sources/plasmoid/plasmoid/contents/config/config.qml rename to sources/plasmoid-kf5/plasmoid/contents/config/config.qml diff --git a/sources/plasmoid/plasmoid/contents/config/main.xml b/sources/plasmoid-kf5/plasmoid/contents/config/main.xml similarity index 100% rename from sources/plasmoid/plasmoid/contents/config/main.xml rename to sources/plasmoid-kf5/plasmoid/contents/config/main.xml diff --git a/sources/plasmoid/plasmoid/contents/ui/about.qml b/sources/plasmoid-kf5/plasmoid/contents/ui/about.qml similarity index 100% rename from sources/plasmoid/plasmoid/contents/ui/about.qml rename to sources/plasmoid-kf5/plasmoid/contents/ui/about.qml diff --git a/sources/plasmoid/plasmoid/contents/ui/appearance.qml b/sources/plasmoid-kf5/plasmoid/contents/ui/appearance.qml similarity index 100% rename from sources/plasmoid/plasmoid/contents/ui/appearance.qml rename to sources/plasmoid-kf5/plasmoid/contents/ui/appearance.qml diff --git a/sources/plasmoid/plasmoid/contents/ui/main.qml b/sources/plasmoid-kf5/plasmoid/contents/ui/main.qml similarity index 100% rename from sources/plasmoid/plasmoid/contents/ui/main.qml rename to sources/plasmoid-kf5/plasmoid/contents/ui/main.qml diff --git a/sources/plasmoid/plasmoid/contents/ui/widget.qml b/sources/plasmoid-kf5/plasmoid/contents/ui/widget.qml similarity index 100% rename from sources/plasmoid/plasmoid/contents/ui/widget.qml rename to sources/plasmoid-kf5/plasmoid/contents/ui/widget.qml diff --git a/sources/plasmoid/plasmoid/metadata.desktop b/sources/plasmoid-kf5/plasmoid/metadata.desktop similarity index 91% rename from sources/plasmoid/plasmoid/metadata.desktop rename to sources/plasmoid-kf5/plasmoid/metadata.desktop index 3a816c5..24ac2ea 100644 --- a/sources/plasmoid/plasmoid/metadata.desktop +++ b/sources/plasmoid-kf5/plasmoid/metadata.desktop @@ -11,7 +11,7 @@ X-Plasma-MainScript=ui/main.qml X-Plasma-NotificationArea=true X-Plasma-RemoteLocation= -X-KDE-PluginInfo-Author=Evgeniy Alekseev aka arcanis +X-KDE-PluginInfo-Author=Evgeniy Alekseev X-KDE-PluginInfo-Email=esalexeev@gmail.com X-KDE-PluginInfo-Name=org.kde.plasma.netctl X-KDE-PluginInfo-Version=@PROJECT_VERSION@ diff --git a/sources/plasmoid/plugin/CMakeLists.txt b/sources/plasmoid-kf5/plugin/CMakeLists.txt similarity index 100% rename from sources/plasmoid/plugin/CMakeLists.txt rename to sources/plasmoid-kf5/plugin/CMakeLists.txt diff --git a/sources/plasmoid/plugin/netctl.cpp b/sources/plasmoid-kf5/plugin/netctl.cpp similarity index 100% rename from sources/plasmoid/plugin/netctl.cpp rename to sources/plasmoid-kf5/plugin/netctl.cpp diff --git a/sources/plasmoid/plugin/netctl.h b/sources/plasmoid-kf5/plugin/netctl.h similarity index 100% rename from sources/plasmoid/plugin/netctl.h rename to sources/plasmoid-kf5/plugin/netctl.h diff --git a/sources/plasmoid/plugin/netctladds.cpp b/sources/plasmoid-kf5/plugin/netctladds.cpp similarity index 100% rename from sources/plasmoid/plugin/netctladds.cpp rename to sources/plasmoid-kf5/plugin/netctladds.cpp diff --git a/sources/plasmoid/plugin/netctladds.h b/sources/plasmoid-kf5/plugin/netctladds.h similarity index 100% rename from sources/plasmoid/plugin/netctladds.h rename to sources/plasmoid-kf5/plugin/netctladds.h diff --git a/sources/plasmoid/plugin/qmldir b/sources/plasmoid-kf5/plugin/qmldir similarity index 100% rename from sources/plasmoid/plugin/qmldir rename to sources/plasmoid-kf5/plugin/qmldir diff --git a/sources/plasmoid-kf5/po/CMakeLists.txt b/sources/plasmoid-kf5/po/CMakeLists.txt new file mode 100644 index 0000000..43779b4 --- /dev/null +++ b/sources/plasmoid-kf5/po/CMakeLists.txt @@ -0,0 +1,24 @@ +find_package(KDE4 REQUIRED) +find_package(Gettext REQUIRED) + +if (NOT GETTEXT_MSGFMT_EXECUTABLE) + message(FATAL_ERROR "Please install the msgfmt binary") +endif (NOT GETTEXT_MSGFMT_EXECUTABLE) + +file (GLOB _po_files *.po) + +set (_gmoFiles) + +foreach (_current_PO_FILE ${_po_files}) + get_filename_component (_lang ${_current_PO_FILE} NAME_WE) + set (_gmoFile ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo) + add_custom_command (OUTPUT ${_gmoFile} + COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${_gmoFile} ${_current_PO_FILE} + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + DEPENDS ${_current_PO_FILE} + ) + + install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${_lang}.gmo DESTINATION ${LOCALE_INSTALL_DIR}/${_lang}/LC_MESSAGES/ RENAME plasma_applet_netctl.mo) + list (APPEND _gmoFiles ${_gmoFile}) +endforeach (_current_PO_FILE) +add_custom_target (pofiles ALL DEPENDS ${_gmoFiles}) diff --git a/sources/plasmoid-kf5/po/en.po b/sources/plasmoid-kf5/po/en.po new file mode 100644 index 0000000..976ec93 --- /dev/null +++ b/sources/plasmoid-kf5/po/en.po @@ -0,0 +1,448 @@ +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Evgeniy Alekseev , 2014. +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: https://github.com/arcan1s/netctl-gui/issues\n" +"POT-Creation-Date: 2014-08-24 16:44+0400\n" +"PO-Revision-Date: 2014-08-20 12:00+0400\n" +"Last-Translator: Evgeniy Alekseev \n" +"Language-Team: Russian \n" +"Language: ru\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"X-Generator: Lokalize 1.5\n" + +#: netctl.cpp:270 +msgid "Set profile %1 disabled" +msgstr "Set profile %1 disabled" + +#: netctl.cpp:273 +msgid "Set profile %1 enabled" +msgstr "Set profile %1 enabled" + +#: netctl.cpp:294 +msgid "Restart profile %1" +msgstr "Restart profile %1" + +#: netctl.cpp:315 +msgid "Start profile %1" +msgstr "Start profile %1" + +#: netctl.cpp:341 +msgid "Stop profile %1" +msgstr "Stop profile %1" + +#: netctl.cpp:361 netctl.cpp:499 +msgid "Stop all profiles" +msgstr "Stop all profiles" + +#: netctl.cpp:381 +msgid "Switch to profile %1" +msgstr "Switch to profile %1" + +#: netctl.cpp:454 +msgid "Start another profile" +msgstr "Start another profile" + +#: netctl.cpp:455 +msgid "Stop %1" +msgstr "Stop %1" + +#: netctl.cpp:456 +msgid "Restart %1" +msgstr "Restart %1" + +#: netctl.cpp:458 +msgid "Disable %1" +msgstr "Disable %1" + +#: netctl.cpp:460 +msgid "Enable %1" +msgstr "Enable %1" + +#: netctl.cpp:463 netctl.cpp:486 +msgid "Start profile" +msgstr "Start profile" + +#: netctl.cpp:494 +msgid "Stop profile" +msgstr "Stop profile" + +#: netctl.cpp:504 +msgid "Switch to profile" +msgstr "Switch to profile" + +#: netctl.cpp:512 +msgid "Restart profile" +msgstr "Restart profile" + +#: netctl.cpp:517 +msgid "Enable profile" +msgstr "Enable profile" + +#: netctl.cpp:521 +msgid "Show netctl-gui" +msgstr "Show netctl-gui" + +#: netctl.cpp:526 +msgid "Show WiFi menu" +msgstr "Show WiFi menu" + +#: netctl.cpp:553 +msgid "Start GUI" +msgstr "Start GUI" + +#: netctl.cpp:564 +msgid "Start WiFi menu" +msgstr "Start WiFi menu" + +#: netctl.cpp:604 +msgid "Network is up" +msgstr "Network is up" + +#: netctl.cpp:608 +msgid "Network is down" +msgstr "Network is down" + +#: netctl.cpp:798 +msgid "" +"Version %1\n" +"(build date %2)" +msgstr "" +"Version %1\n" +"(build date %2)" + +#: netctl.cpp:799 +msgid "KDE widget which interacts with netctl." +msgstr "KDE widget which interacts with netctl." + +#: netctl.cpp:800 +msgid "Links:" +msgstr "Links:" + +#: netctl.cpp:801 +msgid "Homepage" +msgstr "Homepage" + +#: netctl.cpp:802 +msgid "Repository" +msgstr "Repository" + +#: netctl.cpp:803 +msgid "Bugtracker" +msgstr "Bugtracker" + +#: netctl.cpp:804 +msgid "Translation issue" +msgstr "Translation issue" + +#: netctl.cpp:805 +msgid "AUR packages" +msgstr "AUR packages" + +#: netctl.cpp:807 +msgid "This software is licensed under %1" +msgstr "This software is licensed under %1" + +#: netctl.cpp:815 +msgid "Translators: %1" +msgstr "Translators: %1" + +#: netctl.cpp:816 +msgid "This software uses: %1" +msgstr "This software uses: %1" + +#: netctl.cpp:818 +msgid "Netctl plasmoid" +msgstr "Netctl plasmoid" + +#: netctl.cpp:819 +msgid "Appearance" +msgstr "Appearance" + +#: netctl.cpp:820 +msgid "DataEngine" +msgstr "DataEngine" + +#: netctl.cpp:821 +msgid "About" +msgstr "About" + +#. i18n: file: appearance.ui:47 +#. i18n: ectx: property (text), widget (QLabel, label_inactiveIcon) +#: po/rc.cpp:3 rc.cpp:3 +msgid "Inactive icon" +msgstr "Inactive icon" + +#. i18n: file: appearance.ui:63 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_inactiveIcon) +#. i18n: file: appearance.ui:391 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_activeIcon) +#. i18n: file: dataengine.ui:50 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctl) +#. i18n: file: dataengine.ui:83 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctlAuto) +#. i18n: file: dataengine.ui:119 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_extIp4) +#. i18n: file: dataengine.ui:155 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_extIp6) +#. i18n: file: widget.ui:108 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_gui) +#. i18n: file: widget.ui:144 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_helper) +#. i18n: file: widget.ui:177 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctl) +#. i18n: file: widget.ui:210 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctlAuto) +#. i18n: file: widget.ui:246 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_sudo) +#. i18n: file: widget.ui:282 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_wifi) +#. i18n: file: appearance.ui:63 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_inactiveIcon) +#. i18n: file: appearance.ui:391 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_activeIcon) +#. i18n: file: dataengine.ui:50 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctl) +#. i18n: file: dataengine.ui:83 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctlAuto) +#. i18n: file: dataengine.ui:119 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_extIp4) +#. i18n: file: dataengine.ui:155 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_extIp6) +#. i18n: file: widget.ui:108 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_gui) +#. i18n: file: widget.ui:144 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_helper) +#. i18n: file: widget.ui:177 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctl) +#. i18n: file: widget.ui:210 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctlAuto) +#. i18n: file: widget.ui:246 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_sudo) +#. i18n: file: widget.ui:282 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_wifi) +#: po/rc.cpp:6 po/rc.cpp:42 po/rc.cpp:54 po/rc.cpp:60 po/rc.cpp:66 +#: po/rc.cpp:72 po/rc.cpp:81 po/rc.cpp:87 po/rc.cpp:93 po/rc.cpp:99 +#: po/rc.cpp:105 po/rc.cpp:111 rc.cpp:6 rc.cpp:42 rc.cpp:54 rc.cpp:60 +#: rc.cpp:66 rc.cpp:72 rc.cpp:81 rc.cpp:87 rc.cpp:93 rc.cpp:99 rc.cpp:105 +#: rc.cpp:111 +msgid "Browse" +msgstr "Browse" + +#. i18n: file: appearance.ui:80 +#. i18n: ectx: property (text), widget (QLabel, label_fontColor) +#: po/rc.cpp:9 rc.cpp:9 +msgid "Font color" +msgstr "Font color" + +#. i18n: file: appearance.ui:112 +#. i18n: ectx: property (toolTip), widget (KColorCombo, kcolorcombo_fontColor) +#: po/rc.cpp:12 rc.cpp:12 +msgid "Set font color" +msgstr "Set font color" + +#. i18n: file: appearance.ui:142 +#. i18n: ectx: property (text), widget (QLabel, label_fontSize) +#: po/rc.cpp:15 rc.cpp:15 +msgid "Font size" +msgstr "Font size" + +#. i18n: file: appearance.ui:174 +#. i18n: ectx: property (toolTip), widget (QSpinBox, spinBox_fontSize) +#: po/rc.cpp:18 rc.cpp:18 +msgid "Set font size" +msgstr "Set font size" + +#. i18n: file: appearance.ui:203 +#. i18n: ectx: property (text), widget (QLabel, label_fontWeight) +#: po/rc.cpp:21 rc.cpp:21 +msgid "Font weight" +msgstr "Font weight" + +#. i18n: file: appearance.ui:235 +#. i18n: ectx: property (toolTip), widget (QSpinBox, spinBox_fontWeight) +#: po/rc.cpp:24 rc.cpp:24 +msgid "Set font weight" +msgstr "Set font weight" + +#. i18n: file: appearance.ui:267 +#. i18n: ectx: property (text), widget (QLabel, label_fontStyle) +#: po/rc.cpp:27 rc.cpp:27 +msgid "Font style" +msgstr "Font style" + +#. i18n: file: appearance.ui:299 +#. i18n: ectx: property (toolTip), widget (QComboBox, comboBox_fontStyle) +#: po/rc.cpp:30 rc.cpp:30 +msgid "Set font style" +msgstr "Set font style" + +#. i18n: file: appearance.ui:326 +#. i18n: ectx: property (text), widget (QLabel, label_font) +#: po/rc.cpp:33 rc.cpp:33 +msgid "Font" +msgstr "Font" + +#. i18n: file: appearance.ui:358 +#. i18n: ectx: property (toolTip), widget (QFontComboBox, fontComboBox_font) +#: po/rc.cpp:36 rc.cpp:36 +msgid "Set font family" +msgstr "Set font family" + +#. i18n: file: appearance.ui:375 +#. i18n: ectx: property (text), widget (QLabel, label_activeIcon) +#: po/rc.cpp:39 rc.cpp:39 +msgid "Active icon" +msgstr "Active icon" + +#. i18n: file: appearance.ui:408 +#. i18n: ectx: property (text), widget (QLabel, label_textAlign) +#: po/rc.cpp:45 rc.cpp:45 +msgid "Text align" +msgstr "Text align" + +#. i18n: file: appearance.ui:440 +#. i18n: ectx: property (toolTip), widget (QComboBox, comboBox_textAlign) +#: po/rc.cpp:48 rc.cpp:48 +msgid "Set text align" +msgstr "Set text align" + +#. i18n: file: dataengine.ui:34 +#. i18n: ectx: property (text), widget (QLabel, label_netctl) +#. i18n: file: widget.ui:161 +#. i18n: ectx: property (text), widget (QLabel, label_netctl) +#. i18n: file: dataengine.ui:34 +#. i18n: ectx: property (text), widget (QLabel, label_netctl) +#. i18n: file: widget.ui:161 +#. i18n: ectx: property (text), widget (QLabel, label_netctl) +#: po/rc.cpp:51 po/rc.cpp:90 rc.cpp:51 rc.cpp:90 +msgid "Path to netctl" +msgstr "Path to netctl" + +#. i18n: file: dataengine.ui:67 +#. i18n: ectx: property (text), widget (QLabel, label_netctlAuto) +#. i18n: file: widget.ui:194 +#. i18n: ectx: property (text), widget (QLabel, label_netctlAuto) +#. i18n: file: dataengine.ui:67 +#. i18n: ectx: property (text), widget (QLabel, label_netctlAuto) +#. i18n: file: widget.ui:194 +#. i18n: ectx: property (text), widget (QLabel, label_netctlAuto) +#: po/rc.cpp:57 po/rc.cpp:96 rc.cpp:57 rc.cpp:96 +msgid "Path to netctl-auto" +msgstr "Path to netctl-auto" + +#. i18n: file: dataengine.ui:100 +#. i18n: ectx: property (text), widget (QCheckBox, checkBox_extIp4) +#: po/rc.cpp:63 rc.cpp:63 +msgid "Check external IPv4" +msgstr "Check external IPv4" + +#. i18n: file: dataengine.ui:136 +#. i18n: ectx: property (text), widget (QCheckBox, checkBox_extIp6) +#: po/rc.cpp:69 rc.cpp:69 +msgid "Check external IPv6" +msgstr "Check external IPv6" + +#. i18n: file: widget.ui:34 +#. i18n: ectx: property (text), widget (QLabel, label_autoUpdate) +#: po/rc.cpp:75 rc.cpp:75 +msgid "Auto update interval, msec" +msgstr "Auto update interval, msec" + +#. i18n: file: widget.ui:92 +#. i18n: ectx: property (text), widget (QLabel, label_gui) +#: po/rc.cpp:78 rc.cpp:78 +msgid "Path to GUI" +msgstr "Path to GUI" + +#. i18n: file: widget.ui:125 +#. i18n: ectx: property (text), widget (QCheckBox, checkBox_helper) +#: po/rc.cpp:84 rc.cpp:84 +msgid "Use helper" +msgstr "Use helper" + +#. i18n: file: widget.ui:227 +#. i18n: ectx: property (text), widget (QCheckBox, checkBox_sudo) +#: po/rc.cpp:102 rc.cpp:102 +msgid "Use sudo for netctl" +msgstr "Use sudo for netctl" + +#. i18n: file: widget.ui:263 +#. i18n: ectx: property (text), widget (QCheckBox, checkBox_wifi) +#: po/rc.cpp:108 rc.cpp:108 +msgid "Show 'Start WiFi menu'" +msgstr "Show 'Start WiFi menu'" + +#. i18n: file: widget.ui:291 +#. i18n: ectx: property (text), widget (QCheckBox, checkBox_showBigInterface) +#: po/rc.cpp:114 rc.cpp:114 +msgid "Show more detailed interface" +msgstr "Show more detailed interface" + +#. i18n: file: widget.ui:309 +#. i18n: ectx: property (toolTip), widget (QPlainTextEdit, textEdit) +#: po/rc.cpp:117 rc.cpp:117 +msgid "" +"$info - active profile information\n" +"$current - current profile name\n" +"$extip4 - external IPv4\n" +"$extip6 - external IPv6\n" +"$interfaces - list of the network interfaces\n" +"$intip4 - internal IPv4\n" +"$intip6 - internal IPv6\n" +"$profiles - list of the netctl profiles\n" +"$status - current profile status (static/enabled)" +msgstr "" +"$info - active profile information\n" +"$current - current profile name\n" +"$extip4 - external IPv4\n" +"$extip6 - external IPv6\n" +"$interfaces - list of the network interfaces\n" +"$intip4 - internal IPv4\n" +"$intip6 - internal IPv6\n" +"$profiles - list of the netctl profiles\n" +"$status - current profile status (static/enabled)" + +#: po/rc.cpp:126 rc.cpp:126 +msgctxt "NAME OF TRANSLATORS" +msgid "Your names" +msgstr "Evgeniy Alekseev" + +#: po/rc.cpp:127 rc.cpp:127 +msgctxt "EMAIL OF TRANSLATORS" +msgid "Your emails" +msgstr "esalexeev@gmail.com" + +#~ msgid "Acknowledgement" +#~ msgstr "Acknowledgement" + +#~ msgid "normal" +#~ msgstr "normal" + +#~ msgid "italic" +#~ msgstr "italic" + +#~ msgid "Path to ip" +#~ msgstr "Path to ip" + +#~ msgid "Path to interface list" +#~ msgstr "Path to interface list" + +#~ msgid "Show network devices" +#~ msgstr "Show network devices" + +#~ msgid "Show external IP" +#~ msgstr "Show external IP" + +#~ msgid "Show internal IP" +#~ msgstr "Show internal IP" + +#~ msgid "Configuration" +#~ msgstr "Configuration" diff --git a/sources/plasmoid-kf5/po/extract_messages.sh b/sources/plasmoid-kf5/po/extract_messages.sh new file mode 100755 index 0000000..e210bd7 --- /dev/null +++ b/sources/plasmoid-kf5/po/extract_messages.sh @@ -0,0 +1,47 @@ +#!/bin/sh +# root of translatable sources +BASEDIR="../" +PROJECT="plasma_applet_netctl" +BUGADDR="https://github.com/arcan1s/netctl-gui/issues" +# working dir +WDIR=`pwd` + + +echo "Preparing rc files" +cd ${BASEDIR} +# we use simple sorting to make sure the lines do not jump around too much from system to system +find . -name '*.rc' -o -name '*.ui' -o -name '*.kcfg' | sort > ${WDIR}/rcfiles.list +xargs --arg-file=${WDIR}/rcfiles.list extractrc > ${WDIR}/rc.cpp +# additional string for KAboutData +echo 'i18nc("NAME OF TRANSLATORS","Your names");' >> ${WDIR}/rc.cpp +echo 'i18nc("EMAIL OF TRANSLATORS","Your emails");' >> ${WDIR}/rc.cpp +cd ${WDIR} +echo "Done preparing rc files" + +echo "Extracting messages" +cd ${BASEDIR} +# see above on sorting +find . -name '*.cpp' -o -name '*.h' -o -name '*.c' | sort > ${WDIR}/infiles.list +echo "rc.cpp" >> ${WDIR}/infiles.list +cd ${WDIR} +xgettext --from-code=UTF-8 -C -kde -ci18n -ki18n:1 -ki18nc:1c,2 -ki18np:1,2 -ki18ncp:1c,2,3 -ktr2i18n:1 \ +-kI18N_NOOP:1 -kI18N_NOOP2:1c,2 -kaliasLocale -kki18n:1 -kki18nc:1c,2 -kki18np:1,2 -kki18ncp:1c,2,3 \ +--msgid-bugs-address="${BUGADDR}" \ +--files-from=infiles.list -D ${BASEDIR} -D ${WDIR} -o ${PROJECT}.pot || { echo "Error while calling xgettext, aborting."; exit 1; } +echo "Done extracting messages" + +echo "Merging translations" +catalogs=`find . -name '*.po'` +for cat in $catalogs; do + echo $cat + msgmerge -o $cat.new $cat ${PROJECT}.pot + mv $cat.new $cat +done +echo "Done merging translations" + + +echo "Cleaning up" +cd ${WDIR} +rm -f rcfiles.list infiles.list rc.cpp +echo "Done" + diff --git a/sources/plasmoid-kf5/po/ja.po b/sources/plasmoid-kf5/po/ja.po new file mode 100644 index 0000000..ec438b7 --- /dev/null +++ b/sources/plasmoid-kf5/po/ja.po @@ -0,0 +1,422 @@ +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# NOGISAKA Sadata , 2014. +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: https://github.com/arcan1s/netctl-gui/issues\n" +"POT-Creation-Date: 2014-08-24 16:44+0400\n" +"PO-Revision-Date: 2014-10-13 16:37+0900\n" +"Last-Translator: NOGISAKA Sadata \n" +"Language-Team: Japanese \n" +"Language: ja\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Lokalize 1.5\n" + +#: netctl.cpp:270 +msgid "Set profile %1 disabled" +msgstr "プロファイル %1 を無効にする" + +#: netctl.cpp:273 +msgid "Set profile %1 enabled" +msgstr "プロファイル %1 を有効にする" + +#: netctl.cpp:294 +msgid "Restart profile %1" +msgstr "プロファイル %1 の利用を再開" + +#: netctl.cpp:315 +msgid "Start profile %1" +msgstr "プロファイル %1 の利用を開始" + +#: netctl.cpp:341 +msgid "Stop profile %1" +msgstr "プロファイル %1 の利用を停止する" + +#: netctl.cpp:361 netctl.cpp:499 +msgid "Stop all profiles" +msgstr "全てのプロファイルの利用を停止する" + +#: netctl.cpp:381 +msgid "Switch to profile %1" +msgstr "プロファイルを %1 へ切り替える" + +#: netctl.cpp:454 +msgid "Start another profile" +msgstr "他のプロファイルの利用を開始" + +#: netctl.cpp:455 +msgid "Stop %1" +msgstr "%1 を停止" + +#: netctl.cpp:456 +msgid "Restart %1" +msgstr "%1 を再開" + +#: netctl.cpp:458 +msgid "Disable %1" +msgstr "%1 を無効にする" + +#: netctl.cpp:460 +msgid "Enable %1" +msgstr "%1 を有効にする" + +#: netctl.cpp:463 netctl.cpp:486 +msgid "Start profile" +msgstr "プロファイルの利用を開始" + +#: netctl.cpp:494 +msgid "Stop profile" +msgstr "プロファイルの利用を停止する" + +#: netctl.cpp:504 +msgid "Switch to profile" +msgstr "プロファイルを切り替える" + +#: netctl.cpp:512 +msgid "Restart profile" +msgstr "プロファイルの利用を再開" + +#: netctl.cpp:517 +msgid "Enable profile" +msgstr "プロファイルを有効にする" + +#: netctl.cpp:521 +msgid "Show netctl-gui" +msgstr "netctl-gui を表示" + +#: netctl.cpp:526 +msgid "Show WiFi menu" +msgstr "WiFi メニューを表示" + +#: netctl.cpp:553 +msgid "Start GUI" +msgstr "GUI を開始" + +#: netctl.cpp:564 +msgid "Start WiFi menu" +msgstr "WiFi メニューを開始" + +#: netctl.cpp:604 +msgid "Network is up" +msgstr "ネットワークは有効です" + +#: netctl.cpp:608 +msgid "Network is down" +msgstr "ネットワークは無効です" + +#: netctl.cpp:798 +msgid "" +"Version %1\n" +"(build date %2)" +msgstr "" +"バージョン:%1\n" +"(ビルド日時:%2)" + +#: netctl.cpp:799 +msgid "KDE widget which interacts with netctl." +msgstr "netctl と連携する KDE ウィジェット" + +#: netctl.cpp:800 +msgid "Links:" +msgstr "リンク:" + +#: netctl.cpp:801 +msgid "Homepage" +msgstr "ホームページ" + +#: netctl.cpp:802 +msgid "Repository" +msgstr "レポジトリ" + +#: netctl.cpp:803 +msgid "Bugtracker" +msgstr "バグトラッカ" + +#: netctl.cpp:804 +msgid "Translation issue" +msgstr "翻訳に関する issue" + +#: netctl.cpp:805 +msgid "AUR packages" +msgstr "AUR パッケージ" + +#: netctl.cpp:807 +msgid "This software is licensed under %1" +msgstr "このソフトウェアは %1 の下で許諾されます" + +#: netctl.cpp:815 +msgid "Translators: %1" +msgstr "翻訳者:%1" + +#: netctl.cpp:816 +msgid "This software uses: %1" +msgstr "このソフトウェアは次を利用しています:%1" + +#: netctl.cpp:818 +msgid "Netctl plasmoid" +msgstr "Netctl plasmoid" + +#: netctl.cpp:819 +msgid "Appearance" +msgstr "外観" + +#: netctl.cpp:820 +msgid "DataEngine" +msgstr "DataEngine" + +#: netctl.cpp:821 +msgid "About" +msgstr "概要" + +#. i18n: file: appearance.ui:47 +#. i18n: ectx: property (text), widget (QLabel, label_inactiveIcon) +#: po/rc.cpp:3 rc.cpp:3 +msgid "Inactive icon" +msgstr "非アクティブ時のアイコン" + +#. i18n: file: appearance.ui:63 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_inactiveIcon) +#. i18n: file: appearance.ui:391 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_activeIcon) +#. i18n: file: dataengine.ui:50 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctl) +#. i18n: file: dataengine.ui:83 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctlAuto) +#. i18n: file: dataengine.ui:119 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_extIp4) +#. i18n: file: dataengine.ui:155 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_extIp6) +#. i18n: file: widget.ui:108 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_gui) +#. i18n: file: widget.ui:144 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_helper) +#. i18n: file: widget.ui:177 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctl) +#. i18n: file: widget.ui:210 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctlAuto) +#. i18n: file: widget.ui:246 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_sudo) +#. i18n: file: widget.ui:282 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_wifi) +#. i18n: file: appearance.ui:63 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_inactiveIcon) +#. i18n: file: appearance.ui:391 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_activeIcon) +#. i18n: file: dataengine.ui:50 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctl) +#. i18n: file: dataengine.ui:83 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctlAuto) +#. i18n: file: dataengine.ui:119 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_extIp4) +#. i18n: file: dataengine.ui:155 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_extIp6) +#. i18n: file: widget.ui:108 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_gui) +#. i18n: file: widget.ui:144 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_helper) +#. i18n: file: widget.ui:177 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctl) +#. i18n: file: widget.ui:210 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctlAuto) +#. i18n: file: widget.ui:246 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_sudo) +#. i18n: file: widget.ui:282 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_wifi) +#: po/rc.cpp:6 po/rc.cpp:42 po/rc.cpp:54 po/rc.cpp:60 po/rc.cpp:66 +#: po/rc.cpp:72 po/rc.cpp:81 po/rc.cpp:87 po/rc.cpp:93 po/rc.cpp:99 +#: po/rc.cpp:105 po/rc.cpp:111 rc.cpp:6 rc.cpp:42 rc.cpp:54 rc.cpp:60 +#: rc.cpp:66 rc.cpp:72 rc.cpp:81 rc.cpp:87 rc.cpp:93 rc.cpp:99 rc.cpp:105 +#: rc.cpp:111 +msgid "Browse" +msgstr "参照" + +#. i18n: file: appearance.ui:80 +#. i18n: ectx: property (text), widget (QLabel, label_fontColor) +#: po/rc.cpp:9 rc.cpp:9 +msgid "Font color" +msgstr "フォントの色" + +#. i18n: file: appearance.ui:112 +#. i18n: ectx: property (toolTip), widget (KColorCombo, kcolorcombo_fontColor) +#: po/rc.cpp:12 rc.cpp:12 +msgid "Set font color" +msgstr "フォントの色を設定する" + +#. i18n: file: appearance.ui:142 +#. i18n: ectx: property (text), widget (QLabel, label_fontSize) +#: po/rc.cpp:15 rc.cpp:15 +msgid "Font size" +msgstr "フォントの大きさ" + +#. i18n: file: appearance.ui:174 +#. i18n: ectx: property (toolTip), widget (QSpinBox, spinBox_fontSize) +#: po/rc.cpp:18 rc.cpp:18 +msgid "Set font size" +msgstr "フォントの大きさを設定する" + +#. i18n: file: appearance.ui:203 +#. i18n: ectx: property (text), widget (QLabel, label_fontWeight) +#: po/rc.cpp:21 rc.cpp:21 +msgid "Font weight" +msgstr "フォントの太さ" + +#. i18n: file: appearance.ui:235 +#. i18n: ectx: property (toolTip), widget (QSpinBox, spinBox_fontWeight) +#: po/rc.cpp:24 rc.cpp:24 +msgid "Set font weight" +msgstr "フォントの太さを設定する" + +#. i18n: file: appearance.ui:267 +#. i18n: ectx: property (text), widget (QLabel, label_fontStyle) +#: po/rc.cpp:27 rc.cpp:27 +msgid "Font style" +msgstr "フォントの字形" + +#. i18n: file: appearance.ui:299 +#. i18n: ectx: property (toolTip), widget (QComboBox, comboBox_fontStyle) +#: po/rc.cpp:30 rc.cpp:30 +msgid "Set font style" +msgstr "フォントの字形を設定する" + +#. i18n: file: appearance.ui:326 +#. i18n: ectx: property (text), widget (QLabel, label_font) +#: po/rc.cpp:33 rc.cpp:33 +msgid "Font" +msgstr "フォント" + +#. i18n: file: appearance.ui:358 +#. i18n: ectx: property (toolTip), widget (QFontComboBox, fontComboBox_font) +#: po/rc.cpp:36 rc.cpp:36 +msgid "Set font family" +msgstr "フォントを設定する" + +#. i18n: file: appearance.ui:375 +#. i18n: ectx: property (text), widget (QLabel, label_activeIcon) +#: po/rc.cpp:39 rc.cpp:39 +msgid "Active icon" +msgstr "アクティブ時のアイコン" + +#. i18n: file: appearance.ui:408 +#. i18n: ectx: property (text), widget (QLabel, label_textAlign) +#: po/rc.cpp:45 rc.cpp:45 +msgid "Text align" +msgstr "テキストの位置" + +#. i18n: file: appearance.ui:440 +#. i18n: ectx: property (toolTip), widget (QComboBox, comboBox_textAlign) +#: po/rc.cpp:48 rc.cpp:48 +msgid "Set text align" +msgstr "テキストの位置を設定する" + +#. i18n: file: dataengine.ui:34 +#. i18n: ectx: property (text), widget (QLabel, label_netctl) +#. i18n: file: widget.ui:161 +#. i18n: ectx: property (text), widget (QLabel, label_netctl) +#. i18n: file: dataengine.ui:34 +#. i18n: ectx: property (text), widget (QLabel, label_netctl) +#. i18n: file: widget.ui:161 +#. i18n: ectx: property (text), widget (QLabel, label_netctl) +#: po/rc.cpp:51 po/rc.cpp:90 rc.cpp:51 rc.cpp:90 +msgid "Path to netctl" +msgstr "netctl へのパス" + +#. i18n: file: dataengine.ui:67 +#. i18n: ectx: property (text), widget (QLabel, label_netctlAuto) +#. i18n: file: widget.ui:194 +#. i18n: ectx: property (text), widget (QLabel, label_netctlAuto) +#. i18n: file: dataengine.ui:67 +#. i18n: ectx: property (text), widget (QLabel, label_netctlAuto) +#. i18n: file: widget.ui:194 +#. i18n: ectx: property (text), widget (QLabel, label_netctlAuto) +#: po/rc.cpp:57 po/rc.cpp:96 rc.cpp:57 rc.cpp:96 +msgid "Path to netctl-auto" +msgstr "netctl-auto へのパス" + +#. i18n: file: dataengine.ui:100 +#. i18n: ectx: property (text), widget (QCheckBox, checkBox_extIp4) +#: po/rc.cpp:63 rc.cpp:63 +msgid "Check external IPv4" +msgstr "外部 IPv4 アドレスを確認" + +#. i18n: file: dataengine.ui:136 +#. i18n: ectx: property (text), widget (QCheckBox, checkBox_extIp6) +#: po/rc.cpp:69 rc.cpp:69 +msgid "Check external IPv6" +msgstr "外部 IPv6 アドレスを確認" + +#. i18n: file: widget.ui:34 +#. i18n: ectx: property (text), widget (QLabel, label_autoUpdate) +#: po/rc.cpp:75 rc.cpp:75 +msgid "Auto update interval, msec" +msgstr "自動更新の間隔(ミリ秒)" + +#. i18n: file: widget.ui:92 +#. i18n: ectx: property (text), widget (QLabel, label_gui) +#: po/rc.cpp:78 rc.cpp:78 +msgid "Path to GUI" +msgstr "GUIへのパス" + +#. i18n: file: widget.ui:125 +#. i18n: ectx: property (text), widget (QCheckBox, checkBox_helper) +#: po/rc.cpp:84 rc.cpp:84 +msgid "Use helper" +msgstr "ヘルパを使用する" + +#. i18n: file: widget.ui:227 +#. i18n: ectx: property (text), widget (QCheckBox, checkBox_sudo) +#: po/rc.cpp:102 rc.cpp:102 +msgid "Use sudo for netctl" +msgstr "netctl に対して sudo を使用する" + +#. i18n: file: widget.ui:263 +#. i18n: ectx: property (text), widget (QCheckBox, checkBox_wifi) +#: po/rc.cpp:108 rc.cpp:108 +msgid "Show 'Start WiFi menu'" +msgstr "「Wifi メニューの開始」を表示" + +#. i18n: file: widget.ui:291 +#. i18n: ectx: property (text), widget (QCheckBox, checkBox_showBigInterface) +#: po/rc.cpp:114 rc.cpp:114 +msgid "Show more detailed interface" +msgstr "インターフェースについての詳細を表示" + +#. i18n: file: widget.ui:309 +#. i18n: ectx: property (toolTip), widget (QPlainTextEdit, textEdit) +#: po/rc.cpp:117 rc.cpp:117 +msgid "" +"$info - active profile information\n" +"$current - current profile name\n" +"$extip4 - external IPv4\n" +"$extip6 - external IPv6\n" +"$interfaces - list of the network interfaces\n" +"$intip4 - internal IPv4\n" +"$intip6 - internal IPv6\n" +"$profiles - list of the netctl profiles\n" +"$status - current profile status (static/enabled)" +msgstr "" +"$info - アクティブなプロファイルの情報\n" +"$current - 現在利用中プロファイルの情報\n" +"$extip4 - 外部 IPv4 アドレス\n" +"$extip6 - 外部 IPv6 アドレス\n" +"$interfaces - ネットワークインターフェースの一覧\n" +"$intip4 - 内部 IPv4 アドレス\n" +"$intip6 - 内部 IPv6 アドレス\n" +"$profiles - プロファイルの一覧\n" +"$status - 現在のプロファイルの状態(静的/有効)" + +#: po/rc.cpp:126 rc.cpp:126 +msgctxt "NAME OF TRANSLATORS" +msgid "Your names" +msgstr "NOGISAKA Sadata" + +#: po/rc.cpp:127 rc.cpp:127 +msgctxt "EMAIL OF TRANSLATORS" +msgid "Your emails" +msgstr "ngsksdt@gmail.com " + + diff --git a/sources/plasmoid-kf5/po/plasma_applet_netctl.pot b/sources/plasmoid-kf5/po/plasma_applet_netctl.pot new file mode 100644 index 0000000..35a438a --- /dev/null +++ b/sources/plasmoid-kf5/po/plasma_applet_netctl.pot @@ -0,0 +1,409 @@ +# SOME DESCRIPTIVE TITLE. +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# FIRST AUTHOR , YEAR. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: https://github.com/arcan1s/netctl-gui/issues\n" +"POT-Creation-Date: 2014-08-24 16:44+0400\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: netctl.cpp:270 +msgid "Set profile %1 disabled" +msgstr "" + +#: netctl.cpp:273 +msgid "Set profile %1 enabled" +msgstr "" + +#: netctl.cpp:294 +msgid "Restart profile %1" +msgstr "" + +#: netctl.cpp:315 +msgid "Start profile %1" +msgstr "" + +#: netctl.cpp:341 +msgid "Stop profile %1" +msgstr "" + +#: netctl.cpp:361 netctl.cpp:499 +msgid "Stop all profiles" +msgstr "" + +#: netctl.cpp:381 +msgid "Switch to profile %1" +msgstr "" + +#: netctl.cpp:454 +msgid "Start another profile" +msgstr "" + +#: netctl.cpp:455 +msgid "Stop %1" +msgstr "" + +#: netctl.cpp:456 +msgid "Restart %1" +msgstr "" + +#: netctl.cpp:458 +msgid "Disable %1" +msgstr "" + +#: netctl.cpp:460 +msgid "Enable %1" +msgstr "" + +#: netctl.cpp:463 netctl.cpp:486 +msgid "Start profile" +msgstr "" + +#: netctl.cpp:494 +msgid "Stop profile" +msgstr "" + +#: netctl.cpp:504 +msgid "Switch to profile" +msgstr "" + +#: netctl.cpp:512 +msgid "Restart profile" +msgstr "" + +#: netctl.cpp:517 +msgid "Enable profile" +msgstr "" + +#: netctl.cpp:521 +msgid "Show netctl-gui" +msgstr "" + +#: netctl.cpp:526 +msgid "Show WiFi menu" +msgstr "" + +#: netctl.cpp:553 +msgid "Start GUI" +msgstr "" + +#: netctl.cpp:564 +msgid "Start WiFi menu" +msgstr "" + +#: netctl.cpp:604 +msgid "Network is up" +msgstr "" + +#: netctl.cpp:608 +msgid "Network is down" +msgstr "" + +#: netctl.cpp:798 +msgid "" +"Version %1\n" +"(build date %2)" +msgstr "" + +#: netctl.cpp:799 +msgid "KDE widget which interacts with netctl." +msgstr "" + +#: netctl.cpp:800 +msgid "Links:" +msgstr "" + +#: netctl.cpp:801 +msgid "Homepage" +msgstr "" + +#: netctl.cpp:802 +msgid "Repository" +msgstr "" + +#: netctl.cpp:803 +msgid "Bugtracker" +msgstr "" + +#: netctl.cpp:804 +msgid "Translation issue" +msgstr "" + +#: netctl.cpp:805 +msgid "AUR packages" +msgstr "" + +#: netctl.cpp:807 +msgid "This software is licensed under %1" +msgstr "" + +#: netctl.cpp:815 +msgid "Translators: %1" +msgstr "" + +#: netctl.cpp:816 +msgid "This software uses: %1" +msgstr "" + +#: netctl.cpp:818 +msgid "Netctl plasmoid" +msgstr "" + +#: netctl.cpp:819 +msgid "Appearance" +msgstr "" + +#: netctl.cpp:820 +msgid "DataEngine" +msgstr "" + +#: netctl.cpp:821 +msgid "About" +msgstr "" + +#. i18n: file: appearance.ui:47 +#. i18n: ectx: property (text), widget (QLabel, label_inactiveIcon) +#: po/rc.cpp:3 rc.cpp:3 +msgid "Inactive icon" +msgstr "" + +#. i18n: file: appearance.ui:63 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_inactiveIcon) +#. i18n: file: appearance.ui:391 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_activeIcon) +#. i18n: file: dataengine.ui:50 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctl) +#. i18n: file: dataengine.ui:83 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctlAuto) +#. i18n: file: dataengine.ui:119 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_extIp4) +#. i18n: file: dataengine.ui:155 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_extIp6) +#. i18n: file: widget.ui:108 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_gui) +#. i18n: file: widget.ui:144 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_helper) +#. i18n: file: widget.ui:177 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctl) +#. i18n: file: widget.ui:210 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctlAuto) +#. i18n: file: widget.ui:246 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_sudo) +#. i18n: file: widget.ui:282 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_wifi) +#. i18n: file: appearance.ui:63 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_inactiveIcon) +#. i18n: file: appearance.ui:391 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_activeIcon) +#. i18n: file: dataengine.ui:50 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctl) +#. i18n: file: dataengine.ui:83 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctlAuto) +#. i18n: file: dataengine.ui:119 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_extIp4) +#. i18n: file: dataengine.ui:155 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_extIp6) +#. i18n: file: widget.ui:108 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_gui) +#. i18n: file: widget.ui:144 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_helper) +#. i18n: file: widget.ui:177 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctl) +#. i18n: file: widget.ui:210 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctlAuto) +#. i18n: file: widget.ui:246 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_sudo) +#. i18n: file: widget.ui:282 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_wifi) +#: po/rc.cpp:6 po/rc.cpp:42 po/rc.cpp:54 po/rc.cpp:60 po/rc.cpp:66 +#: po/rc.cpp:72 po/rc.cpp:81 po/rc.cpp:87 po/rc.cpp:93 po/rc.cpp:99 +#: po/rc.cpp:105 po/rc.cpp:111 rc.cpp:6 rc.cpp:42 rc.cpp:54 rc.cpp:60 +#: rc.cpp:66 rc.cpp:72 rc.cpp:81 rc.cpp:87 rc.cpp:93 rc.cpp:99 rc.cpp:105 +#: rc.cpp:111 +msgid "Browse" +msgstr "" + +#. i18n: file: appearance.ui:80 +#. i18n: ectx: property (text), widget (QLabel, label_fontColor) +#: po/rc.cpp:9 rc.cpp:9 +msgid "Font color" +msgstr "" + +#. i18n: file: appearance.ui:112 +#. i18n: ectx: property (toolTip), widget (KColorCombo, kcolorcombo_fontColor) +#: po/rc.cpp:12 rc.cpp:12 +msgid "Set font color" +msgstr "" + +#. i18n: file: appearance.ui:142 +#. i18n: ectx: property (text), widget (QLabel, label_fontSize) +#: po/rc.cpp:15 rc.cpp:15 +msgid "Font size" +msgstr "" + +#. i18n: file: appearance.ui:174 +#. i18n: ectx: property (toolTip), widget (QSpinBox, spinBox_fontSize) +#: po/rc.cpp:18 rc.cpp:18 +msgid "Set font size" +msgstr "" + +#. i18n: file: appearance.ui:203 +#. i18n: ectx: property (text), widget (QLabel, label_fontWeight) +#: po/rc.cpp:21 rc.cpp:21 +msgid "Font weight" +msgstr "" + +#. i18n: file: appearance.ui:235 +#. i18n: ectx: property (toolTip), widget (QSpinBox, spinBox_fontWeight) +#: po/rc.cpp:24 rc.cpp:24 +msgid "Set font weight" +msgstr "" + +#. i18n: file: appearance.ui:267 +#. i18n: ectx: property (text), widget (QLabel, label_fontStyle) +#: po/rc.cpp:27 rc.cpp:27 +msgid "Font style" +msgstr "" + +#. i18n: file: appearance.ui:299 +#. i18n: ectx: property (toolTip), widget (QComboBox, comboBox_fontStyle) +#: po/rc.cpp:30 rc.cpp:30 +msgid "Set font style" +msgstr "" + +#. i18n: file: appearance.ui:326 +#. i18n: ectx: property (text), widget (QLabel, label_font) +#: po/rc.cpp:33 rc.cpp:33 +msgid "Font" +msgstr "" + +#. i18n: file: appearance.ui:358 +#. i18n: ectx: property (toolTip), widget (QFontComboBox, fontComboBox_font) +#: po/rc.cpp:36 rc.cpp:36 +msgid "Set font family" +msgstr "" + +#. i18n: file: appearance.ui:375 +#. i18n: ectx: property (text), widget (QLabel, label_activeIcon) +#: po/rc.cpp:39 rc.cpp:39 +msgid "Active icon" +msgstr "" + +#. i18n: file: appearance.ui:408 +#. i18n: ectx: property (text), widget (QLabel, label_textAlign) +#: po/rc.cpp:45 rc.cpp:45 +msgid "Text align" +msgstr "" + +#. i18n: file: appearance.ui:440 +#. i18n: ectx: property (toolTip), widget (QComboBox, comboBox_textAlign) +#: po/rc.cpp:48 rc.cpp:48 +msgid "Set text align" +msgstr "" + +#. i18n: file: dataengine.ui:34 +#. i18n: ectx: property (text), widget (QLabel, label_netctl) +#. i18n: file: widget.ui:161 +#. i18n: ectx: property (text), widget (QLabel, label_netctl) +#. i18n: file: dataengine.ui:34 +#. i18n: ectx: property (text), widget (QLabel, label_netctl) +#. i18n: file: widget.ui:161 +#. i18n: ectx: property (text), widget (QLabel, label_netctl) +#: po/rc.cpp:51 po/rc.cpp:90 rc.cpp:51 rc.cpp:90 +msgid "Path to netctl" +msgstr "" + +#. i18n: file: dataengine.ui:67 +#. i18n: ectx: property (text), widget (QLabel, label_netctlAuto) +#. i18n: file: widget.ui:194 +#. i18n: ectx: property (text), widget (QLabel, label_netctlAuto) +#. i18n: file: dataengine.ui:67 +#. i18n: ectx: property (text), widget (QLabel, label_netctlAuto) +#. i18n: file: widget.ui:194 +#. i18n: ectx: property (text), widget (QLabel, label_netctlAuto) +#: po/rc.cpp:57 po/rc.cpp:96 rc.cpp:57 rc.cpp:96 +msgid "Path to netctl-auto" +msgstr "" + +#. i18n: file: dataengine.ui:100 +#. i18n: ectx: property (text), widget (QCheckBox, checkBox_extIp4) +#: po/rc.cpp:63 rc.cpp:63 +msgid "Check external IPv4" +msgstr "" + +#. i18n: file: dataengine.ui:136 +#. i18n: ectx: property (text), widget (QCheckBox, checkBox_extIp6) +#: po/rc.cpp:69 rc.cpp:69 +msgid "Check external IPv6" +msgstr "" + +#. i18n: file: widget.ui:34 +#. i18n: ectx: property (text), widget (QLabel, label_autoUpdate) +#: po/rc.cpp:75 rc.cpp:75 +msgid "Auto update interval, msec" +msgstr "" + +#. i18n: file: widget.ui:92 +#. i18n: ectx: property (text), widget (QLabel, label_gui) +#: po/rc.cpp:78 rc.cpp:78 +msgid "Path to GUI" +msgstr "" + +#. i18n: file: widget.ui:125 +#. i18n: ectx: property (text), widget (QCheckBox, checkBox_helper) +#: po/rc.cpp:84 rc.cpp:84 +msgid "Use helper" +msgstr "" + +#. i18n: file: widget.ui:227 +#. i18n: ectx: property (text), widget (QCheckBox, checkBox_sudo) +#: po/rc.cpp:102 rc.cpp:102 +msgid "Use sudo for netctl" +msgstr "" + +#. i18n: file: widget.ui:263 +#. i18n: ectx: property (text), widget (QCheckBox, checkBox_wifi) +#: po/rc.cpp:108 rc.cpp:108 +msgid "Show 'Start WiFi menu'" +msgstr "" + +#. i18n: file: widget.ui:291 +#. i18n: ectx: property (text), widget (QCheckBox, checkBox_showBigInterface) +#: po/rc.cpp:114 rc.cpp:114 +msgid "Show more detailed interface" +msgstr "" + +#. i18n: file: widget.ui:309 +#. i18n: ectx: property (toolTip), widget (QPlainTextEdit, textEdit) +#: po/rc.cpp:117 rc.cpp:117 +msgid "" +"$info - active profile information\n" +"$current - current profile name\n" +"$extip4 - external IPv4\n" +"$extip6 - external IPv6\n" +"$interfaces - list of the network interfaces\n" +"$intip4 - internal IPv4\n" +"$intip6 - internal IPv6\n" +"$profiles - list of the netctl profiles\n" +"$status - current profile status (static/enabled)" +msgstr "" + +#: po/rc.cpp:126 rc.cpp:126 +msgctxt "NAME OF TRANSLATORS" +msgid "Your names" +msgstr "" + +#: po/rc.cpp:127 rc.cpp:127 +msgctxt "EMAIL OF TRANSLATORS" +msgid "Your emails" +msgstr "" diff --git a/sources/plasmoid-kf5/po/ru.po b/sources/plasmoid-kf5/po/ru.po new file mode 100644 index 0000000..76a0a54 --- /dev/null +++ b/sources/plasmoid-kf5/po/ru.po @@ -0,0 +1,448 @@ +# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER +# This file is distributed under the same license as the PACKAGE package. +# +# Evgeniy Alekseev , 2014. +msgid "" +msgstr "" +"Project-Id-Version: \n" +"Report-Msgid-Bugs-To: https://github.com/arcan1s/netctl-gui/issues\n" +"POT-Creation-Date: 2014-08-24 16:44+0400\n" +"PO-Revision-Date: 2014-08-20 12:00+0400\n" +"Last-Translator: Evgeniy Alekseev \n" +"Language-Team: Russian \n" +"Language: ru\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" +"%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);\n" +"X-Generator: Lokalize 1.5\n" + +#: netctl.cpp:270 +msgid "Set profile %1 disabled" +msgstr "Выключение автозагрузки профиля %1" + +#: netctl.cpp:273 +msgid "Set profile %1 enabled" +msgstr "Включение автозагрузки профиля %1" + +#: netctl.cpp:294 +msgid "Restart profile %1" +msgstr "Перезапуск профиля %1" + +#: netctl.cpp:315 +msgid "Start profile %1" +msgstr "Запуск профиля %1" + +#: netctl.cpp:341 +msgid "Stop profile %1" +msgstr "Остановка профиля %1" + +#: netctl.cpp:361 netctl.cpp:499 +msgid "Stop all profiles" +msgstr "Остановить все профили" + +#: netctl.cpp:381 +msgid "Switch to profile %1" +msgstr "Переключение на профиль %1" + +#: netctl.cpp:454 +msgid "Start another profile" +msgstr "Запустить другой профиль" + +#: netctl.cpp:455 +msgid "Stop %1" +msgstr "Остановить %1" + +#: netctl.cpp:456 +msgid "Restart %1" +msgstr "Перезапустить %1" + +#: netctl.cpp:458 +msgid "Disable %1" +msgstr "Отключить %1" + +#: netctl.cpp:460 +msgid "Enable %1" +msgstr "Включить %1" + +#: netctl.cpp:463 netctl.cpp:486 +msgid "Start profile" +msgstr "Запустить профиль" + +#: netctl.cpp:494 +msgid "Stop profile" +msgstr "Остановить профиль" + +#: netctl.cpp:504 +msgid "Switch to profile" +msgstr "Переключить профиль" + +#: netctl.cpp:512 +msgid "Restart profile" +msgstr "Перезапустить профиль" + +#: netctl.cpp:517 +msgid "Enable profile" +msgstr "Включить профиль" + +#: netctl.cpp:521 +msgid "Show netctl-gui" +msgstr "Показать netctl-gui" + +#: netctl.cpp:526 +msgid "Show WiFi menu" +msgstr "Запустить WiFi-menu" + +#: netctl.cpp:553 +msgid "Start GUI" +msgstr "Запуск GUI" + +#: netctl.cpp:564 +msgid "Start WiFi menu" +msgstr "Запуск WiFi-menu" + +#: netctl.cpp:604 +msgid "Network is up" +msgstr "Сеть работает" + +#: netctl.cpp:608 +msgid "Network is down" +msgstr "Сеть не работает" + +#: netctl.cpp:798 +msgid "" +"Version %1\n" +"(build date %2)" +msgstr "" +"Версия %1\n" +"(дата сборки %2)" + +#: netctl.cpp:799 +msgid "KDE widget which interacts with netctl." +msgstr "Виджет KDE, который взаимодействует с netctl." + +#: netctl.cpp:800 +msgid "Links:" +msgstr "Ссылки:" + +#: netctl.cpp:801 +msgid "Homepage" +msgstr "Домашняя страница" + +#: netctl.cpp:802 +msgid "Repository" +msgstr "Репозиторий" + +#: netctl.cpp:803 +msgid "Bugtracker" +msgstr "Багтрекер" + +#: netctl.cpp:804 +msgid "Translation issue" +msgstr "Тикет перевода" + +#: netctl.cpp:805 +msgid "AUR packages" +msgstr "Пакеты в AUR" + +#: netctl.cpp:807 +msgid "This software is licensed under %1" +msgstr "Данное приложение лицензировано под %1" + +#: netctl.cpp:815 +msgid "Translators: %1" +msgstr "Переводчики: %1" + +#: netctl.cpp:816 +msgid "This software uses: %1" +msgstr "Данное приложение использует: %1" + +#: netctl.cpp:818 +msgid "Netctl plasmoid" +msgstr "Netctl plasmoid" + +#: netctl.cpp:819 +msgid "Appearance" +msgstr "Внешний вид" + +#: netctl.cpp:820 +msgid "DataEngine" +msgstr "DataEngine" + +#: netctl.cpp:821 +msgid "About" +msgstr "О программе" + +#. i18n: file: appearance.ui:47 +#. i18n: ectx: property (text), widget (QLabel, label_inactiveIcon) +#: po/rc.cpp:3 rc.cpp:3 +msgid "Inactive icon" +msgstr "Иконка неактивного подключения" + +#. i18n: file: appearance.ui:63 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_inactiveIcon) +#. i18n: file: appearance.ui:391 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_activeIcon) +#. i18n: file: dataengine.ui:50 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctl) +#. i18n: file: dataengine.ui:83 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctlAuto) +#. i18n: file: dataengine.ui:119 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_extIp4) +#. i18n: file: dataengine.ui:155 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_extIp6) +#. i18n: file: widget.ui:108 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_gui) +#. i18n: file: widget.ui:144 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_helper) +#. i18n: file: widget.ui:177 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctl) +#. i18n: file: widget.ui:210 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctlAuto) +#. i18n: file: widget.ui:246 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_sudo) +#. i18n: file: widget.ui:282 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_wifi) +#. i18n: file: appearance.ui:63 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_inactiveIcon) +#. i18n: file: appearance.ui:391 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_activeIcon) +#. i18n: file: dataengine.ui:50 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctl) +#. i18n: file: dataengine.ui:83 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctlAuto) +#. i18n: file: dataengine.ui:119 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_extIp4) +#. i18n: file: dataengine.ui:155 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_extIp6) +#. i18n: file: widget.ui:108 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_gui) +#. i18n: file: widget.ui:144 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_helper) +#. i18n: file: widget.ui:177 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctl) +#. i18n: file: widget.ui:210 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_netctlAuto) +#. i18n: file: widget.ui:246 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_sudo) +#. i18n: file: widget.ui:282 +#. i18n: ectx: property (text), widget (QPushButton, pushButton_wifi) +#: po/rc.cpp:6 po/rc.cpp:42 po/rc.cpp:54 po/rc.cpp:60 po/rc.cpp:66 +#: po/rc.cpp:72 po/rc.cpp:81 po/rc.cpp:87 po/rc.cpp:93 po/rc.cpp:99 +#: po/rc.cpp:105 po/rc.cpp:111 rc.cpp:6 rc.cpp:42 rc.cpp:54 rc.cpp:60 +#: rc.cpp:66 rc.cpp:72 rc.cpp:81 rc.cpp:87 rc.cpp:93 rc.cpp:99 rc.cpp:105 +#: rc.cpp:111 +msgid "Browse" +msgstr "Обзор" + +#. i18n: file: appearance.ui:80 +#. i18n: ectx: property (text), widget (QLabel, label_fontColor) +#: po/rc.cpp:9 rc.cpp:9 +msgid "Font color" +msgstr "Цвет шрифта" + +#. i18n: file: appearance.ui:112 +#. i18n: ectx: property (toolTip), widget (KColorCombo, kcolorcombo_fontColor) +#: po/rc.cpp:12 rc.cpp:12 +msgid "Set font color" +msgstr "Укажите цвет шрифта" + +#. i18n: file: appearance.ui:142 +#. i18n: ectx: property (text), widget (QLabel, label_fontSize) +#: po/rc.cpp:15 rc.cpp:15 +msgid "Font size" +msgstr "Размер шрифта" + +#. i18n: file: appearance.ui:174 +#. i18n: ectx: property (toolTip), widget (QSpinBox, spinBox_fontSize) +#: po/rc.cpp:18 rc.cpp:18 +msgid "Set font size" +msgstr "Укажите размер шрифта" + +#. i18n: file: appearance.ui:203 +#. i18n: ectx: property (text), widget (QLabel, label_fontWeight) +#: po/rc.cpp:21 rc.cpp:21 +msgid "Font weight" +msgstr "Толщина шрифта" + +#. i18n: file: appearance.ui:235 +#. i18n: ectx: property (toolTip), widget (QSpinBox, spinBox_fontWeight) +#: po/rc.cpp:24 rc.cpp:24 +msgid "Set font weight" +msgstr "Укажите ширину шрифта" + +#. i18n: file: appearance.ui:267 +#. i18n: ectx: property (text), widget (QLabel, label_fontStyle) +#: po/rc.cpp:27 rc.cpp:27 +msgid "Font style" +msgstr "Стиль шрифта" + +#. i18n: file: appearance.ui:299 +#. i18n: ectx: property (toolTip), widget (QComboBox, comboBox_fontStyle) +#: po/rc.cpp:30 rc.cpp:30 +msgid "Set font style" +msgstr "Укажите стиль шрифта" + +#. i18n: file: appearance.ui:326 +#. i18n: ectx: property (text), widget (QLabel, label_font) +#: po/rc.cpp:33 rc.cpp:33 +msgid "Font" +msgstr "Шрифт" + +#. i18n: file: appearance.ui:358 +#. i18n: ectx: property (toolTip), widget (QFontComboBox, fontComboBox_font) +#: po/rc.cpp:36 rc.cpp:36 +msgid "Set font family" +msgstr "Укажите шрифт" + +#. i18n: file: appearance.ui:375 +#. i18n: ectx: property (text), widget (QLabel, label_activeIcon) +#: po/rc.cpp:39 rc.cpp:39 +msgid "Active icon" +msgstr "Иконка активного подключения" + +#. i18n: file: appearance.ui:408 +#. i18n: ectx: property (text), widget (QLabel, label_textAlign) +#: po/rc.cpp:45 rc.cpp:45 +msgid "Text align" +msgstr "Выравнивание текста" + +#. i18n: file: appearance.ui:440 +#. i18n: ectx: property (toolTip), widget (QComboBox, comboBox_textAlign) +#: po/rc.cpp:48 rc.cpp:48 +msgid "Set text align" +msgstr "Установите выравнивание текста" + +#. i18n: file: dataengine.ui:34 +#. i18n: ectx: property (text), widget (QLabel, label_netctl) +#. i18n: file: widget.ui:161 +#. i18n: ectx: property (text), widget (QLabel, label_netctl) +#. i18n: file: dataengine.ui:34 +#. i18n: ectx: property (text), widget (QLabel, label_netctl) +#. i18n: file: widget.ui:161 +#. i18n: ectx: property (text), widget (QLabel, label_netctl) +#: po/rc.cpp:51 po/rc.cpp:90 rc.cpp:51 rc.cpp:90 +msgid "Path to netctl" +msgstr "Путь к netctl" + +#. i18n: file: dataengine.ui:67 +#. i18n: ectx: property (text), widget (QLabel, label_netctlAuto) +#. i18n: file: widget.ui:194 +#. i18n: ectx: property (text), widget (QLabel, label_netctlAuto) +#. i18n: file: dataengine.ui:67 +#. i18n: ectx: property (text), widget (QLabel, label_netctlAuto) +#. i18n: file: widget.ui:194 +#. i18n: ectx: property (text), widget (QLabel, label_netctlAuto) +#: po/rc.cpp:57 po/rc.cpp:96 rc.cpp:57 rc.cpp:96 +msgid "Path to netctl-auto" +msgstr "Путь к netctl-auto" + +#. i18n: file: dataengine.ui:100 +#. i18n: ectx: property (text), widget (QCheckBox, checkBox_extIp4) +#: po/rc.cpp:63 rc.cpp:63 +msgid "Check external IPv4" +msgstr "Проверять внешний IPv4" + +#. i18n: file: dataengine.ui:136 +#. i18n: ectx: property (text), widget (QCheckBox, checkBox_extIp6) +#: po/rc.cpp:69 rc.cpp:69 +msgid "Check external IPv6" +msgstr "Проверять внешний IPv6" + +#. i18n: file: widget.ui:34 +#. i18n: ectx: property (text), widget (QLabel, label_autoUpdate) +#: po/rc.cpp:75 rc.cpp:75 +msgid "Auto update interval, msec" +msgstr "Интервал автообновления, мсек" + +#. i18n: file: widget.ui:92 +#. i18n: ectx: property (text), widget (QLabel, label_gui) +#: po/rc.cpp:78 rc.cpp:78 +msgid "Path to GUI" +msgstr "Путь к GUI" + +#. i18n: file: widget.ui:125 +#. i18n: ectx: property (text), widget (QCheckBox, checkBox_helper) +#: po/rc.cpp:84 rc.cpp:84 +msgid "Use helper" +msgstr "Использовать хелпер" + +#. i18n: file: widget.ui:227 +#. i18n: ectx: property (text), widget (QCheckBox, checkBox_sudo) +#: po/rc.cpp:102 rc.cpp:102 +msgid "Use sudo for netctl" +msgstr "Использовать sudo для netctl" + +#. i18n: file: widget.ui:263 +#. i18n: ectx: property (text), widget (QCheckBox, checkBox_wifi) +#: po/rc.cpp:108 rc.cpp:108 +msgid "Show 'Start WiFi menu'" +msgstr "Показать 'Запустить WiFi-menu'" + +#. i18n: file: widget.ui:291 +#. i18n: ectx: property (text), widget (QCheckBox, checkBox_showBigInterface) +#: po/rc.cpp:114 rc.cpp:114 +msgid "Show more detailed interface" +msgstr "Показать более детальный интерфейс" + +#. i18n: file: widget.ui:309 +#. i18n: ectx: property (toolTip), widget (QPlainTextEdit, textEdit) +#: po/rc.cpp:117 rc.cpp:117 +msgid "" +"$info - active profile information\n" +"$current - current profile name\n" +"$extip4 - external IPv4\n" +"$extip6 - external IPv6\n" +"$interfaces - list of the network interfaces\n" +"$intip4 - internal IPv4\n" +"$intip6 - internal IPv6\n" +"$profiles - list of the netctl profiles\n" +"$status - current profile status (static/enabled)" +msgstr "" +"$info - информация об активном профиле\n" +"$current - имя текущего профиля\n" +"$extip4 - внешний IPv4\n" +"$extip6 - внешний IPv6\n" +"$interfaces - список сетевых интерфейсов\n" +"$intip4 - внутренний IPv4\n" +"$intip6 - внутренний IPv6\n" +"$profiles - список профилей netctl\n" +"$status - статус текущего профиля (static/enabled)" + +#: po/rc.cpp:126 rc.cpp:126 +msgctxt "NAME OF TRANSLATORS" +msgid "Your names" +msgstr "Evgeniy Alekseev" + +#: po/rc.cpp:127 rc.cpp:127 +msgctxt "EMAIL OF TRANSLATORS" +msgid "Your emails" +msgstr "esalexeev@gmail.com" + +#~ msgid "Acknowledgement" +#~ msgstr "Благодарности" + +#~ msgid "normal" +#~ msgstr "normal" + +#~ msgid "italic" +#~ msgstr "italic" + +#~ msgid "Path to ip" +#~ msgstr "Путь к ip" + +#~ msgid "Path to interface list" +#~ msgstr "Путь к интерфейсам" + +#~ msgid "Show network devices" +#~ msgstr "Показать сетевые устройства" + +#~ msgid "Show external IP" +#~ msgstr "Показать внешний IP" + +#~ msgid "Show internal IP" +#~ msgstr "Показать внутренний IP" + +#~ msgid "Configuration" +#~ msgstr "Настройка" diff --git a/sources/version.h.in b/sources/version.h.in index fdf25c9..29fcd1d 100644 --- a/sources/version.h.in +++ b/sources/version.h.in @@ -31,6 +31,7 @@ #define PROJECT_BUILD_HELPER "@BUILD_HELPER@" #define PROJECT_BUILD_LIBRARY "@BUILD_LIBRARY@" #define PROJECT_BUILD_PLASMOID "@BUILD_PLASMOID@" +#cmakedefine BUILD_KDE4 // additional components #define PROJECT_BUILD_DOCS "@BUILD_DOCS@" #define PROJECT_BUILD_TEST "@BUILD_TEST@"