implement binary module

This commit is contained in:
arcan1s 2014-12-28 17:42:08 +03:00
parent f188dea8a7
commit edb386d24e
12 changed files with 183 additions and 414 deletions

View File

@ -5,7 +5,7 @@ message (STATUS "Subproject ${SUBPROJECT}")
# find required libaries # find required libaries
find_package (Qt5 REQUIRED COMPONENTS Widgets Network) find_package (Qt5 REQUIRED COMPONENTS Widgets Network)
find_package (ECM 0.0.11 REQUIRED NO_MODULE) 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) find_package(KF5 REQUIRED COMPONENTS Plasma Service)
include (KDEInstallDirs) include (KDEInstallDirs)
@ -45,7 +45,6 @@ kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${SUBPROJECT_DESKTOP_IN})
# kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${SUBPROJECT_DESKTOP}) # kcoreaddons_desktop_to_json (${PLUGIN_NAME} ${SUBPROJECT_DESKTOP})
# install # 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 ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_INSTALL_DIR})
install (FILES ${SUBPROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR}) install (FILES ${SUBPROJECT_CONF} DESTINATION ${CONFIG_INSTALL_DIR})

View File

@ -40,29 +40,27 @@ message (STATUS "Subproject ${SUBPROJECT}")
# install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${SUBPROJECT_DESKTOP} DESTINATION ${SERVICES_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 ${SUBPROJECT_NOTIFY} DESTINATION ${DATA_INSTALL_DIR}/${PLUGIN_NAME})
# plasma_install_package(plasmoid org.kde.netctl) # plasma_install_package(plasmoid org.kde.netctl)
find_package(ECM 0.0.12 REQUIRED NO_MODULE) find_package (Qt5 REQUIRED COMPONENTS Core Qml Widgets)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) 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 (KDEInstallDirs)
include(KDECMakeSettings) include (KDECMakeSettings)
include(KDECompilerSettings) include (KDECompilerSettings)
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5Qml_DEFINITIONS})
include(ECMPackageConfigHelpers) set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS}
include(ECMOptionalAddSubdirectory) ${Qt5Qml_INCLUDE_DIRS})
include(FeatureSummary) set (Kf5_INCLUDE ${ConfigCore_INCLUDE_DIR}
${CoreAddons_INCLUDE_DIR}
find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS ${I18n_INCLUDE_DIR}
Core ${Notifications_INCLUDE_DIR}
DBus ${Plasma_INCLUDE_DIR}
Network ${Service_INCLUDE_DIR})
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 (PLUGIN_NAME netctlplugin)
add_subdirectory (plugin)
set(dir plasmoid) set(dir plasmoid)
set(component org.kde.netctl) set(component org.kde.netctl)

View File

@ -18,33 +18,6 @@
#ifndef NETCTL_PLASMOID_H #ifndef NETCTL_PLASMOID_H
#define NETCTL_PLASMOID_H #define NETCTL_PLASMOID_H
#include <Plasma/DataEngine>
#include <Plasma/PopupApplet>
#include <QProcess>
#include <ui_about.h>
#include <ui_appearance.h>
#include <ui_dataengine.h>
#include <ui_widget.h>
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 class Netctl : public Plasma::PopupApplet
{ {

View File

@ -18,12 +18,11 @@
import QtQuick 2.0 import QtQuick 2.0
import org.kde.plasma.configuration 2.0 import org.kde.plasma.configuration 2.0
import org.kde.plasma.plasmoid 2.0
ConfigModel { ConfigModel {
ConfigCategory { ConfigCategory {
name: i18n("Netctl plasmoid") name: i18n("Widget")
icon: "/usr/share/pixmaps/netctl-gui-widget.png" icon: "/usr/share/pixmaps/netctl-gui-widget.png"
source: "widget.qml" source: "widget.qml"
} }
@ -33,4 +32,10 @@ ConfigModel {
icon: "preferences-desktop-theme" icon: "preferences-desktop-theme"
source: "appearance.qml" source: "appearance.qml"
} }
ConfigCategory {
name: i18n("About")
icon: "help-about"
source: "about.qml"
}
} }

View File

@ -38,7 +38,9 @@
<default>false</default> <default>false</default>
</entry> </entry>
<entry name="textPattern" type="string"> <entry name="textPattern" type="string">
<default>$info\nIPv4: $intip4\nIPv6: $intip6</default> <default>$info
IPv4: $intip4
IPv6: $intip6</default>
</entry> </entry>
</group> </group>

View File

@ -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")
}
}
}

View File

@ -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.components 2.0 as PlasmaComponents
import org.kde.plasma.plasmoid 2.0 import org.kde.plasma.plasmoid 2.0
import org.kde.plasma.private.netctl 1.0
Item { Item {
id: main id: main
// variables // variables
Text { property variant info: {
id: info "current": "N\\A",
property string current: "N\\A" "extip4": "127.0.0.1",
property string extip4: "127.0.0.1" "extip6": "::1",
property string extip6: "::1" "intip4": "127.0.0.1",
property string intip4: "127.0.0.1" "intip6": "::1",
property string intip6: "::1" "interfaces": "lo",
property var interfaces: ["lo"] "profiles": "",
property var profiles: [] "status": "N\\A"
property string status: "N\\A"
} }
Text { Text {
id: iconPath id: iconPath
@ -64,22 +65,25 @@ Item {
icon.source = iconPath.inactive icon.source = iconPath.inactive
} }
} else if (sourceName == "current") { } else if (sourceName == "current") {
info.current= data.value info["current"] = data.value
// text update // text update
for (var prop in info) {
console.log(prop + " = " + info[prop])
}
} else if (sourceName == "extip4") { } else if (sourceName == "extip4") {
info.extip4 = data.value info["extip4"] = data.value
} else if (sourceName == "extip6") { } else if (sourceName == "extip6") {
info.extip6 = data.value info["extip6"] = data.value
} else if (sourceName == "interfaces") { } else if (sourceName == "interfaces") {
info.interfaces = data.value info["interfaces"] = data.value
} else if (sourceName == "intip4") { } else if (sourceName == "intip4") {
info.intip4 = data.value info["intip4"] = data.value
} else if (sourceName == "intip6") { } else if (sourceName == "intip6") {
info.intip6 = data.value info["intip6"] = data.value
} else if (sourceName == "profiles") { } else if (sourceName == "profiles") {
info.profiles = data.value info["profiles"] = data.value
} else if (sourceName == "status") { } else if (sourceName == "status") {
info.status = data.value info["status"] = data.value
} }
} }
} }

View File

@ -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)

View File

@ -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 <QtQml>
#include <pdebug/pdebug.h>
#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<ProcessRunner>(uri, 1, 0, "ProcessRunner");
// qmlRegisterType<TimeZoneModel>(uri, 1, 0, "TimeZoneModel");
// qmlRegisterSingletonType<TimezonesI18n>(uri, 1, 0, "TimezonesI18n", timezonesi18n_singletontype_provider);
}

View File

@ -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 <QQmlExtensionPlugin>
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 */

View File

@ -0,0 +1,3 @@
module org.kde.plasma.private.netctl
plugin netctlplugin

View File

@ -1,343 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ConfigWindow</class>
<widget class="QWidget" name="ConfigWindow">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>480</width>
<height>340</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>480</width>
<height>320</height>
</size>
</property>
<property name="windowTitle">
<string notr="true">Configuration Window</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="layout_autoUpdate">
<item>
<widget class="QLabel" name="label_autoUpdate">
<property name="minimumSize">
<size>
<width>150</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>Auto update interval, msec</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_autoUpdate">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QSpinBox" name="spinBox_autoUpdate">
<property name="minimumSize">
<size>
<width>100</width>
<height>0</height>
</size>
</property>
<property name="layoutDirection">
<enum>Qt::LeftToRight</enum>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="minimum">
<number>333</number>
</property>
<property name="maximum">
<number>10000</number>
</property>
<property name="singleStep">
<number>500</number>
</property>
<property name="value">
<number>1000</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layout_gui">
<item>
<widget class="QLabel" name="label_gui">
<property name="minimumSize">
<size>
<width>150</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>Path to GUI</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_gui"/>
</item>
<item>
<widget class="QPushButton" name="pushButton_gui">
<property name="minimumSize">
<size>
<width>100</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layout_helper">
<item>
<widget class="QCheckBox" name="checkBox_helper">
<property name="minimumSize">
<size>
<width>150</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>Use helper</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_helper"/>
</item>
<item>
<widget class="QPushButton" name="pushButton_helper">
<property name="minimumSize">
<size>
<width>100</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layout_netctl">
<item>
<widget class="QLabel" name="label_netctl">
<property name="minimumSize">
<size>
<width>150</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>Path to netctl</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_netctl"/>
</item>
<item>
<widget class="QPushButton" name="pushButton_netctl">
<property name="minimumSize">
<size>
<width>100</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layout_netctlAuto">
<item>
<widget class="QLabel" name="label_netctlAuto">
<property name="minimumSize">
<size>
<width>150</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>Path to netctl-auto</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_netctlAuto"/>
</item>
<item>
<widget class="QPushButton" name="pushButton_netctlAuto">
<property name="minimumSize">
<size>
<width>100</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layout_sudo">
<item>
<widget class="QCheckBox" name="checkBox_sudo">
<property name="minimumSize">
<size>
<width>150</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>Use sudo for netctl</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_sudo"/>
</item>
<item>
<widget class="QPushButton" name="pushButton_sudo">
<property name="minimumSize">
<size>
<width>100</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="layout_wifi">
<item>
<widget class="QCheckBox" name="checkBox_wifi">
<property name="minimumSize">
<size>
<width>150</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>Show 'Start WiFi menu'</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_wifi"/>
</item>
<item>
<widget class="QPushButton" name="pushButton_wifi">
<property name="minimumSize">
<size>
<width>100</width>
<height>23</height>
</size>
</property>
<property name="text">
<string>Browse</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBox_showBigInterface">
<property name="text">
<string>Show more detailed interface</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPlainTextEdit" name="textEdit">
<property name="toolTip">
<string>$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)</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_configuration">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<tabstops>
<tabstop>spinBox_autoUpdate</tabstop>
<tabstop>lineEdit_gui</tabstop>
<tabstop>pushButton_gui</tabstop>
<tabstop>lineEdit_netctl</tabstop>
<tabstop>pushButton_netctl</tabstop>
<tabstop>checkBox_sudo</tabstop>
<tabstop>lineEdit_sudo</tabstop>
<tabstop>pushButton_sudo</tabstop>
<tabstop>checkBox_wifi</tabstop>
<tabstop>lineEdit_wifi</tabstop>
<tabstop>pushButton_wifi</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>