implement datetime logging feature

This commit is contained in:
arcan1s 2015-06-19 02:23:44 +03:00
parent 168a270c98
commit 7dc1a5eda3
11 changed files with 61 additions and 11 deletions

View File

@ -8,7 +8,7 @@ ProjectRootRelative=./
[CMake][CMake Build Directory 0]
Build Directory Path=file:///home/arcanis/Documents/github/netctl-gui/build
Build Type=Debug
Build Type=Release
CMake Binary=file:///usr/bin/cmake
Environment Profile=
Extra Arguments=

@ -1 +1 @@
Subproject commit 9be4fe36819cc48a574b5f649ddb210b432e2097
Subproject commit 75e4a0df83478802bba53345486b42c56713fe09

View File

@ -39,7 +39,12 @@ include_directories (${CMAKE_SOURCE_DIR}
set (PLUGIN_NAME ${SUBPROJECT})
file (GLOB SUBPROJECT_DESKTOP_IN *.desktop)
file (RELATIVE_PATH SUBPROJECT_DESKTOP ${CMAKE_SOURCE_DIR} ${SUBPROJECT_DESKTOP_IN})
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp)
if (BUILD_KDE4)
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp)
else ()
file (GLOB_RECURSE SUBPROJECT_SOURCE *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
${PROJECT_TRDPARTY_DIR}/pdebug/*.cpp)
endif ()
set (TASK_HEADER ${PROJECT_TRDPARTY_DIR}/task/task.h)
file (GLOB SUBPROJECT_CONF *.conf)

View File

@ -36,6 +36,7 @@
#include <KStandardDirs>
#else
#include <QStandardPaths>
#include <pdebug/pdebug-time.h>
#endif /* BUILD_KDE4 */
@ -44,6 +45,9 @@ Netctl::Netctl(QObject *parent, const QVariantList &args)
{
Q_UNUSED(args)
#if QT_VERSION >= 0x050000
qInstallMessageHandler(debugString);
#endif /* QT_VERSION >= 0x050000 */
// debug
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));

View File

@ -1,7 +1,14 @@
# set files
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
${PROJECT_TRDPARTY_DIR}/language/*.cpp
${PROJECT_TRDPARTY_DIR}/listmap/*.cpp)
if (USE_QT5)
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
${PROJECT_TRDPARTY_DIR}/language/*.cpp
${PROJECT_TRDPARTY_DIR}/listmap/*.cpp
${PROJECT_TRDPARTY_DIR}/pdebug/*.cpp)
else ()
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
${PROJECT_TRDPARTY_DIR}/language/*.cpp
${PROJECT_TRDPARTY_DIR}/listmap/*.cpp)
endif ()
file (GLOB_RECURSE HEADERS *.h ${PROJECT_TRDPARTY_DIR}/task/*.h
${PROJECT_TRDPARTY_DIR}/language/*.h)
file (GLOB_RECURSE FORMS *.ui ${PROJECT_TRDPARTY_DIR}/about/*.ui)

View File

@ -32,6 +32,10 @@
#include "messages.h"
#include "version.h"
#if QT_VERSION >= 0x050000
#include <pdebug/pdebug-time.h>
#endif /* QT_VERSION >= 0x050000 */
using namespace std;
@ -157,6 +161,9 @@ int main(int argc, char *argv[])
// detach from console
if (args[QString("detached")].toBool())
daemon(0, 0);
#if QT_VERSION >= 0x050000
qInstallMessageHandler(debugString);
#endif
QApplication a(argc, argv);
QApplication::setQuitOnLastWindowClosed(false);
// reread translations according to flags

View File

@ -1,7 +1,14 @@
# set files
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
${PROJECT_TRDPARTY_DIR}/language/*.cpp
${PROJECT_TRDPARTY_DIR}/listmap/*.cpp)
if (USE_QT5)
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
${PROJECT_TRDPARTY_DIR}/language/*.cpp
${PROJECT_TRDPARTY_DIR}/listmap/*.cpp
${PROJECT_TRDPARTY_DIR}/pdebug/*.cpp)
else ()
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
${PROJECT_TRDPARTY_DIR}/language/*.cpp
${PROJECT_TRDPARTY_DIR}/listmap/*.cpp)
endif ()
file (GLOB_RECURSE HEADERS *.h ${PROJECT_TRDPARTY_DIR}/task/*.h
${PROJECT_TRDPARTY_DIR}/language/*.h)

View File

@ -32,6 +32,10 @@
#include "netctlhelper.h"
#include "version.h"
#if QT_VERSION >= 0x050000
#include <pdebug/pdebug-time.h>
#endif /* QT_VERSION >= 0x050000 */
using namespace std;
@ -115,6 +119,7 @@ int main(int argc, char *argv[])
#if QT_VERSION >= 0x050000
QCoreApplication::setSetuidAllowed(true);
qInstallMessageHandler(debugString);
#endif
QCoreApplication a(argc, argv);
// reread translations according to flags

View File

@ -1,5 +1,10 @@
# set files
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp)
if (USE_QT5)
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp
${PROJECT_TRDPARTY_DIR}/pdebug/*.cpp)
else ()
file (GLOB_RECURSE SOURCES *.cpp ${PROJECT_TRDPARTY_DIR}/task/*.cpp)
endif ()
file (GLOB_RECURSE HEADERS *.h ${SUBPROJECT_INCLUDE_DIR}/*h
${PROJECT_TRDPARTY_DIR}/task/*.h)

View File

@ -21,7 +21,8 @@ include_directories (${CMAKE_SOURCE_DIR}
${Qt_INCLUDE}
${Kf5_INCLUDE})
file (GLOB SUBPROJECT_SOURCE *.cpp)
file (GLOB_RECURSE SUBPROJECT_SOURCE ${PROJECT_TRDPARTY_DIR}/pdebug/*.cpp
*.cpp)
file (GLOB SUBPROJECT_NOTIFY *.notifyrc)
add_library (${PLUGIN_NAME} SHARED ${SUBPROJECT_SOURCE})

View File

@ -27,6 +27,7 @@
#include <QStandardPaths>
#include <pdebug/pdebug.h>
#include <pdebug/pdebug-time.h>
#include "netctladds.h"
#include "version.h"
@ -35,6 +36,7 @@
NetctlAdds::NetctlAdds(QObject *parent)
: QObject(parent)
{
qInstallMessageHandler(debugString);
// debug
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
@ -169,6 +171,13 @@ void NetctlAdds::setDataBySource(const QString sourceName, const QVariantMap dat
void NetctlAdds::sendNotification(const QString eventId, const QString message)
{
QProcessEnvironment environment = QProcessEnvironment::systemEnvironment();
QString debugEnv = environment.value(QString("DEBUG"), QString("no"));
bool debugLocal = (debugEnv == QString("yes"));
if (debugLocal) qDebug() << PDEBUG;
if (debugLocal) qDebug() << PDEBUG << ":" << "Event" << eventId;
if (debugLocal) qDebug() << PDEBUG << ":" << "Message" << message;
KNotification *notification = KNotification::event(eventId, QString("Netctl ::: %1").arg(eventId), message);
notification->setComponentName(QString("plasma-applet-org.kde.plasma.netctl"));
}