mirror of
https://github.com/arcan1s/netctl-gui.git
synced 2025-07-09 20:05:53 +00:00
update ChangeLog
update CmakeLists update PKGBUILDs fix GUI building
This commit is contained in:
@ -2,28 +2,15 @@
|
||||
set (SUBPROJECT plasma_applet_netctl)
|
||||
message (STATUS "Subproject ${SUBPROJECT}")
|
||||
|
||||
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 COMPONENTS I18n Service WidgetsAddons KIO CoreAddons Notifications Plasma)
|
||||
find_package(KF5I18n CONFIG REQUIRED)
|
||||
|
||||
find_package (Qt5 REQUIRED COMPONENTS Core DBus Qml Quick)
|
||||
find_package (KF5 REQUIRED COMPONENTS I18n Notifications Plasma)
|
||||
|
||||
include (KDEInstallDirs)
|
||||
include (KDECMakeSettings)
|
||||
include (KDECompilerSettings)
|
||||
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})
|
||||
|
||||
set (PLUGIN_NAME netctlplugin)
|
||||
add_subdirectory (plugin)
|
||||
plasma_install_package (plasmoid org.kde.plasma.netctl)
|
||||
plasma_install_package (package org.kde.plasma.netctl)
|
||||
|
@ -133,8 +133,7 @@ Item {
|
||||
plasmoid.setAction("switchToProfile", i18n("Switch to profile"))
|
||||
plasmoid.setAction("restartProfile", i18n("Restart profile"), "stock-refresh")
|
||||
plasmoid.setAction("enableProfile", i18n("Enable profile"))
|
||||
// FIXME: icon from resources
|
||||
plasmoid.setAction("startWifi", i18n("Show WiFi menu"))
|
||||
plasmoid.setAction("startWifi", i18n("Show WiFi menu"), "image://netctl/wifi.png")
|
||||
// helper
|
||||
if (plasmoid.configuration.useHelper) {
|
||||
NetctlAdds.runCmd(plasmoid.configuration.helperPath)
|
@ -1,3 +1,19 @@
|
||||
set (PLUGIN_NAME netctlplugin)
|
||||
|
||||
add_definitions (${Qt5Core_DEFINITIONS} ${Qt5DBus_DEFINITIONS} ${Qt5Qml_DEFINITIONS})
|
||||
set (Qt_INCLUDE ${Qt5Core_INCLUDE_DIRS}
|
||||
${Qt5DBus_INCLUDE_DIRS}
|
||||
${Qt5Qml_INCLUDE_DIRS}
|
||||
${Qt5Quick_INCLUDE_DIRS})
|
||||
set (Qt_LIBRARIES ${Qt5Core_LIBRARIES}
|
||||
${Qt5DBus_LIBRARIES}
|
||||
${Qt5Qml_LIBRARIES}
|
||||
${Qt5Quick_LIBRARIES})
|
||||
set (Kf5_INCLUDE ${I18n_INCLUDE_DIR}
|
||||
${Notifications_INCLUDE_DIR})
|
||||
set (Kf5_LIBRARIES KF5::I18n
|
||||
KF5::Notifications)
|
||||
|
||||
include_directories (${CMAKE_SOURCE_DIR}
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
@ -8,10 +24,11 @@ include_directories (${CMAKE_SOURCE_DIR}
|
||||
|
||||
file (GLOB SUBPROJECT_SOURCE *.cpp)
|
||||
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
|
||||
set (RESOURCES ${PROJECT_RESOURCE_DIR}/resources-plasmoid.qrc)
|
||||
|
||||
add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE})
|
||||
target_link_libraries (${PLUGIN_NAME} ${Qt5Core_LIBRARIES} ${Qt5DBus_LIBRARIES} ${Qt5Qml_LIBRARIES} ${I18n_LIBRARIES} ${Plasma_LIBRARIES}
|
||||
KF5::I18n KF5::Notifications)
|
||||
qt5_add_resources (QRC_SOURCES ${RESOURCES})
|
||||
add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE} ${QRC_SOURCES})
|
||||
target_link_libraries (${PLUGIN_NAME} ${Qt_LIBRARIES} ${Kf5_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)
|
||||
|
@ -23,13 +23,21 @@
|
||||
|
||||
static QObject *netctl_singletontype_provider(QQmlEngine *engine, QJSEngine *scriptEngine)
|
||||
{
|
||||
Q_UNUSED(engine)
|
||||
Q_UNUSED(scriptEngine)
|
||||
Q_UNUSED(engine);
|
||||
Q_UNUSED(scriptEngine);
|
||||
|
||||
return new NetctlAdds();
|
||||
}
|
||||
|
||||
|
||||
void NetctlPlugin::initializeEngine(QQmlEngine *engine, const char *uri)
|
||||
{
|
||||
Q_UNUSED(uri);
|
||||
|
||||
engine->addImageProvider("netctl", new NetctlAddsIconProvider());
|
||||
}
|
||||
|
||||
|
||||
void NetctlPlugin::registerTypes(const char *uri)
|
||||
{
|
||||
Q_ASSERT(uri == QLatin1String("org.kde.plasma.private.netctl"));
|
||||
|
@ -30,6 +30,7 @@ class NetctlPlugin : public QQmlExtensionPlugin
|
||||
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
|
||||
|
||||
public:
|
||||
void initializeEngine(QQmlEngine *engine, const char *uri);
|
||||
void registerTypes(const char *uri);
|
||||
};
|
||||
|
||||
|
@ -32,12 +32,27 @@
|
||||
#include "version.h"
|
||||
|
||||
|
||||
NetctlAddsIconProvider::NetctlAddsIconProvider()
|
||||
: QQuickImageProvider(QQmlImageProviderBase::Pixmap)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
QPixmap NetctlAddsIconProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
|
||||
{
|
||||
Q_UNUSED(size);
|
||||
Q_UNUSED(requestedSize);
|
||||
|
||||
return QPixmap(QString("qrc:/") + id);
|
||||
}
|
||||
|
||||
|
||||
NetctlAdds::NetctlAdds(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
// debug
|
||||
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
|
||||
QString debugEnv = environment.value(QString("NETCTLGUI_DEBUG"), QString("no"));
|
||||
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
|
||||
debug = (debugEnv == QString("yes"));
|
||||
}
|
||||
|
||||
@ -311,14 +326,16 @@ QMap<QString, QVariant> NetctlAdds::readDataEngineConfiguration()
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QMap<QString, QVariant> configuration;
|
||||
QString fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString("netctl.conf"));
|
||||
QString fileName = QStandardPaths::locate(QStandardPaths::ConfigLocation, QString("plasma-dataengine-netctl.conf"));
|
||||
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << fileName;
|
||||
QSettings settings(fileName, QSettings::IniFormat);
|
||||
|
||||
settings.beginGroup(QString("Netctl commands"));
|
||||
configuration[QString("NETCTLCMD")] = settings.value(QString("NETCTLCMD"), QString("/usr/bin/netctl"));
|
||||
configuration[QString("NETCTLAUTOCMD")] = settings.value(QString("NETCTLAUTOCMD"), QString("/usr/bin/netctl-auto"));
|
||||
settings.endGroup();
|
||||
|
||||
settings.beginGroup(QString("External IP"));
|
||||
configuration[QString("EXTIP4")] = settings.value(QString("EXTIP4"), QString("false"));
|
||||
configuration[QString("EXTIP4CMD")] = settings.value(QString("EXTIP4CMD"), QString("curl ip4.telize.com"));
|
||||
@ -334,7 +351,7 @@ void NetctlAdds::writeDataEngineConfiguration(const QMap<QString, QVariant> conf
|
||||
{
|
||||
if (debug) qDebug() << PDEBUG;
|
||||
|
||||
QString fileName = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QString("/netctl.conf");
|
||||
QString fileName = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation) + QString("/plasma-dataengine-netctl.conf");
|
||||
QSettings settings(fileName, QSettings::IniFormat);
|
||||
if (debug) qDebug() << PDEBUG << ":" << "Configuration file" << settings.fileName();
|
||||
|
||||
|
@ -19,11 +19,22 @@
|
||||
#ifndef NETCTLADDS_H
|
||||
#define NETCTLADDS_H
|
||||
|
||||
#include <QImage>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
#include <QQuickImageProvider>
|
||||
#include <QVariant>
|
||||
|
||||
|
||||
class NetctlAddsIconProvider : public QQuickImageProvider
|
||||
{
|
||||
public:
|
||||
NetctlAddsIconProvider();
|
||||
|
||||
virtual QPixmap requestPixmap(const QString &id, QSize *size, const QSize &requestedSize);
|
||||
};
|
||||
|
||||
|
||||
class NetctlAdds : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
Reference in New Issue
Block a user