From 5c8dca22d0d4aa0a9af5edaefd685f17f485f4de Mon Sep 17 00:00:00 2001 From: arcan1s Date: Wed, 13 Aug 2014 07:12:32 +0400 Subject: [PATCH] rewrite gui to use pdebug --- CHANGELOG | 4 + sources/3rdparty/pdebug/pdebug.h | 45 ++++++ .../gui/docs/netctl-gui-security-notes.html | 16 +-- sources/gui/src/aboutwindow.cpp | 9 +- sources/gui/src/dbusoperation.cpp | 22 +-- sources/gui/src/errorwindow.cpp | 22 +-- sources/gui/src/mainprivateslots.cpp | 131 +++++++++--------- sources/gui/src/mainpublicslots.cpp | 63 ++++----- sources/gui/src/mainwindow.cpp | 86 ++++++------ sources/gui/src/netctlautowindow.cpp | 41 +++--- sources/gui/src/pdebug.h | 1 + sources/gui/src/settingswindow.cpp | 49 +++---- sources/gui/src/trayicon.cpp | 27 ++-- sources/helper/src/controladaptor.cpp | 15 +- sources/helper/src/controladaptor.h | 8 +- sources/helper/src/netctladaptor.cpp | 17 +-- sources/helper/src/netctladaptor.h | 8 +- sources/helper/src/netctlhelper.cpp | 4 +- 18 files changed, 315 insertions(+), 253 deletions(-) create mode 100644 sources/3rdparty/pdebug/pdebug.h create mode 120000 sources/gui/src/pdebug.h diff --git a/CHANGELOG b/CHANGELOG index 0217931..1107d76 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ Ver.1.3.0 --------- * all: + + add processes error messages * some bug fixes and refactoring * dataengine: + add new sources: intIp6, extIp6, netctlAutoStatus @@ -27,6 +28,9 @@ Ver.1.3.0 + add custom structures netctlWifiInfo and netctlProfileInfo + add methods getActiveProfile(), autoGetActiveProfile() + add slot switchToProfile() + + add slot stopAllProfiles() + + add slot reenableProfile() + + add double quotes to profile names * rewrite to use [tasks](https://github.com/mhogomchungu/tasks) (see #7) * rename getInterfaceList() to getWirelessInterfaceList() - remove functions getProfileDescriptions() and getProfileStatuses() diff --git a/sources/3rdparty/pdebug/pdebug.h b/sources/3rdparty/pdebug/pdebug.h new file mode 100644 index 0000000..06e6afd --- /dev/null +++ b/sources/3rdparty/pdebug/pdebug.h @@ -0,0 +1,45 @@ +/*************************************************************************** + * 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 PRETTY_DEBUG_H +#define PRETTY_DEBUG_H + + +inline const char *pDebug(const std::string prettyFunction) +{ + return prettyFunction.c_str(); +} + + +inline std::string pFuncInfo(const std::string prettyFunction) +{ + size_t colons = prettyFunction.find("::"); + // workaround for functions which are not belong to any class + if (colons == std::string::npos) + colons = prettyFunction.rfind("("); + size_t begin = prettyFunction.substr(0, colons).rfind(" ") + 1; + size_t end = prettyFunction.rfind("(") - begin; + + return "[" + prettyFunction.substr(begin, end) + "]"; +} + + +#define PDEBUG pDebug(pFuncInfo(__PRETTY_FUNCTION__)) + + +#endif /* PRETTY_DEBUG_H */ diff --git a/sources/gui/docs/netctl-gui-security-notes.html b/sources/gui/docs/netctl-gui-security-notes.html index 5c3c418..91e9ab2 100644 --- a/sources/gui/docs/netctl-gui-security-notes.html +++ b/sources/gui/docs/netctl-gui-security-notes.html @@ -10,10 +10,10 @@
  1. Description
  2. Architecture
  3. -
  4. Library security
  5. -
  6. Helper security
  7. -
  8. Graphical interface security
  9. -
  10. KDE components security
  11. +
  12. Library
  13. +
  14. Helper
  15. +
  16. Graphical interface
  17. +
  18. KDE components
  19. External links
@@ -25,7 +25,7 @@

Architecture

architecture -

Library security

+

Library

According to the scheme the library gets information from netctl and can control it. Also it provides some additional functions such as a profile creation and removal and access to wpa_supplicant functions. Some functions do not require additional permissions, but other ones do it. All dynamic arguments including profile names and paths are in double quotes to avoid white spaces problem. The functions which require root privileges are: