From 61d814d9a253869954835577d4da722797c7121e Mon Sep 17 00:00:00 2001 From: arcan1s Date: Mon, 11 Aug 2014 21:51:50 +0400 Subject: [PATCH] add Pony() call <3 helper and library refatoring --- sources/gui/docs/netctl-gui-dbus-api.html | 10 ++++++ sources/gui/src/netctlguiadaptor.cpp | 15 +++++++++ sources/gui/src/netctlguiadaptor.h | 1 + sources/helper/src/CMakeLists.txt | 4 +-- sources/helper/src/controladaptor.cpp | 15 +++++++++ sources/helper/src/controladaptor.h | 1 + sources/helper/src/main.cpp | 37 +++++++++-------------- sources/helper/src/netctlhelper.cpp | 2 -- sources/netctlgui/src/netctlinteract.cpp | 16 ++++++---- sources/netctlgui/src/netctlprofile.cpp | 3 +- sources/resources/pinkiepie | 21 +++++++++++++ sources/resources/resources-helper.qrc | 2 ++ sources/resources/resources.qrc | 2 ++ sources/version.h.in | 2 +- 14 files changed, 95 insertions(+), 36 deletions(-) create mode 100644 sources/resources/pinkiepie diff --git a/sources/gui/docs/netctl-gui-dbus-api.html b/sources/gui/docs/netctl-gui-dbus-api.html index 497d535..ed25164 100644 --- a/sources/gui/docs/netctl-gui-dbus-api.html +++ b/sources/gui/docs/netctl-gui-dbus-api.html @@ -76,6 +76,11 @@ th.sub { returns path to the library documentation no + + QString Pony() + prints Pinkie Pie to stdout. Really, just try + no + QString SecurityDocs() returns path to the security documentation @@ -272,6 +277,11 @@ th.sub { opens the library documentation no + + QString Pony() + prints Pinkie Pie to stdout. Really, just try + no + bool Restore() true and restores the application diff --git a/sources/gui/src/netctlguiadaptor.cpp b/sources/gui/src/netctlguiadaptor.cpp index 4b67220..1a5a992 100644 --- a/sources/gui/src/netctlguiadaptor.cpp +++ b/sources/gui/src/netctlguiadaptor.cpp @@ -17,6 +17,8 @@ #include "netctlguiadaptor.h" +#include + #include "mainwindow.h" @@ -57,6 +59,19 @@ void NetctlGuiAdaptor::LibraryDocs() } +QString NetctlGuiAdaptor::Pony() +{ + QString pony; + QFile ponyFile(QString(":pinkiepie")); + if (!ponyFile.open(QIODevice::ReadOnly)) + return pony; + pony = QTextCodec::codecForMib(106)->toUnicode(ponyFile.readAll()); + ponyFile.close(); + + return pony; +} + + bool NetctlGuiAdaptor::Restore() { mainWindow->show(); diff --git a/sources/gui/src/netctlguiadaptor.h b/sources/gui/src/netctlguiadaptor.h index b9c992d..20b5fe6 100644 --- a/sources/gui/src/netctlguiadaptor.h +++ b/sources/gui/src/netctlguiadaptor.h @@ -38,6 +38,7 @@ public slots: bool Close(); QStringList Information(); void LibraryDocs(); + QString Pony(); bool Restore(); void SecurityDocs(); QStringList Settings(); diff --git a/sources/helper/src/CMakeLists.txt b/sources/helper/src/CMakeLists.txt index 3f22a58..945051a 100644 --- a/sources/helper/src/CMakeLists.txt +++ b/sources/helper/src/CMakeLists.txt @@ -24,7 +24,7 @@ if (USE_QT5) set (QT_NEEDED_LIBS ${Qt5Core_LIBRARIES} ${Qt5DBus_LIBRARIES}) qt5_wrap_cpp (MOC_SOURCES ${HEADERS}) qt5_add_resources (QRC_SOURCES ${RESOURCES}) - + foreach (LANGUAGE ${LANGUAGES}) set (TS ${LANGUAGE}) string (REPLACE ".ts" ".qm" QM ${TS}) @@ -40,7 +40,7 @@ else () set (QT_NEEDED_LIBS ${QT_QTCORE_LIBRARY} ${QT_QTDBUS_LIBRARY}) qt4_wrap_cpp (MOC_SOURCES ${HEADERS}) qt4_add_resources (QRC_SOURCES ${RESOURCES}) - + foreach (LANGUAGE ${LANGUAGES}) set (TS ${LANGUAGE}) string (REPLACE ".ts" ".qm" QM ${TS}) diff --git a/sources/helper/src/controladaptor.cpp b/sources/helper/src/controladaptor.cpp index 1813558..874a311 100644 --- a/sources/helper/src/controladaptor.cpp +++ b/sources/helper/src/controladaptor.cpp @@ -17,6 +17,8 @@ #include "controladaptor.h" +#include + #include "netctlhelper.h" #include "version.h" @@ -66,6 +68,19 @@ QString ControlAdaptor::LibraryDocs() } +QString ControlAdaptor::Pony() +{ + QString pony; + QFile ponyFile(QString(":pinkiepie")); + if (!ponyFile.open(QIODevice::ReadOnly)) + return pony; + pony = QTextCodec::codecForMib(106)->toUnicode(ponyFile.readAll()); + ponyFile.close(); + + return pony; +} + + QString ControlAdaptor::SecurityDocs() { return (QString(DOCS_PATH) + QString("netctl-gui-security-notes.html")); diff --git a/sources/helper/src/controladaptor.h b/sources/helper/src/controladaptor.h index 40f6d97..8f7eede 100644 --- a/sources/helper/src/controladaptor.h +++ b/sources/helper/src/controladaptor.h @@ -41,6 +41,7 @@ public slots: QString ApiDocs(); bool Close(); QString LibraryDocs(); + QString Pony(); QString SecurityDocs(); QStringList Settings(); bool Update(); diff --git a/sources/helper/src/main.cpp b/sources/helper/src/main.cpp index 2a4da5a..56aeb9f 100644 --- a/sources/helper/src/main.cpp +++ b/sources/helper/src/main.cpp @@ -37,10 +37,8 @@ using namespace std; bool checkExistSession() { QDBusConnection bus = QDBusConnection::systemBus(); - QDBusMessage request = QDBusMessage::createMethodCall(DBUS_HELPER_SERVICE, - DBUS_CTRL_PATH, - DBUS_HELPER_INTERFACE, - QString("Active")); + QDBusMessage request = QDBusMessage::createMethodCall(DBUS_HELPER_SERVICE, DBUS_CTRL_PATH, + DBUS_HELPER_INTERFACE, QString("Active")); QDBusMessage response = bus.call(request); QList arguments = response.arguments(); return !arguments.isEmpty(); @@ -52,33 +50,26 @@ int main(int argc, char *argv[]) QMap args = getArgs(); // reading for (int i=1; i translations-helper/en.qm translations-helper/ru.qm + + pinkiepie diff --git a/sources/resources/resources.qrc b/sources/resources/resources.qrc index 3db93ce..3b01b52 100644 --- a/sources/resources/resources.qrc +++ b/sources/resources/resources.qrc @@ -8,5 +8,7 @@ wifi.png network-idle-64x64.png network-offline-64x64.png + + pinkiepie diff --git a/sources/version.h.in b/sources/version.h.in index e3854fb..9b6d562 100644 --- a/sources/version.h.in +++ b/sources/version.h.in @@ -7,7 +7,7 @@ #define TRANSLATORS "" #define EMAIL "@PROJECT_CONTACT@" #define LICENSE "@PROJECT_LICENSE@" -#define TRDPARTY_LICENSE "tasks,BSD,https://github.com/mhogomchungu/tasks;" +#define TRDPARTY_LICENSE "tasks,BSD,https://github.com/mhogomchungu/tasks;ponysay,GPLv3,http://erkin.co/ponysay" #define HOMEPAGE "http://arcanis.name/projects/netctl-gui/" #define REPOSITORY "https://github.com/arcan1s/netctl-gui"