From 3958fa914c8a524ed4b6a5b035b794e12708fa1d Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Thu, 1 Mar 2018 22:42:01 +0000 Subject: Import ultracopier_1.4.0.4.orig.tar.xz [dgit import orig ultracopier_1.4.0.4.orig.tar.xz] --- .../SessionLoader/KDE4/DebugEngineMacro.h | 28 +++++++++++ .../SessionLoader/KDE4/Environment.h | 10 ++++ .../SessionLoader/KDE4/StructEnumDefinition.h | 1 + plugins-alternative/SessionLoader/KDE4/Variable.h | 15 ++++++ .../SessionLoader/KDE4/documentation.dox | 32 ++++++++++++ .../SessionLoader/KDE4/informations.xml | 26 ++++++++++ plugins-alternative/SessionLoader/KDE4/plugin.json | 1 + .../SessionLoader/KDE4/sessionLoader.cpp | 58 ++++++++++++++++++++++ .../SessionLoader/KDE4/sessionLoader.h | 33 ++++++++++++ .../SessionLoader/KDE4/sessionLoader.pro | 15 ++++++ 10 files changed, 219 insertions(+) create mode 100644 plugins-alternative/SessionLoader/KDE4/DebugEngineMacro.h create mode 100644 plugins-alternative/SessionLoader/KDE4/Environment.h create mode 100644 plugins-alternative/SessionLoader/KDE4/StructEnumDefinition.h create mode 100644 plugins-alternative/SessionLoader/KDE4/Variable.h create mode 100644 plugins-alternative/SessionLoader/KDE4/documentation.dox create mode 100644 plugins-alternative/SessionLoader/KDE4/informations.xml create mode 100644 plugins-alternative/SessionLoader/KDE4/plugin.json create mode 100644 plugins-alternative/SessionLoader/KDE4/sessionLoader.cpp create mode 100644 plugins-alternative/SessionLoader/KDE4/sessionLoader.h create mode 100644 plugins-alternative/SessionLoader/KDE4/sessionLoader.pro (limited to 'plugins-alternative/SessionLoader') diff --git a/plugins-alternative/SessionLoader/KDE4/DebugEngineMacro.h b/plugins-alternative/SessionLoader/KDE4/DebugEngineMacro.h new file mode 100644 index 0000000..4582010 --- /dev/null +++ b/plugins-alternative/SessionLoader/KDE4/DebugEngineMacro.h @@ -0,0 +1,28 @@ +/** \file DebugEngineMacro.h +\brief Define the macro for the debug +\author alpha_one_x86 +\licence GPL3, see the file COPYING */ + +#ifndef DEBUGENGINEMACRO_H +#define DEBUGENGINEMACRO_H + +#ifdef WIN32 +# define __func__ __FUNCTION__ +#endif + +/// \brief Macro for the debug log +#ifdef ULTRACOPIER_PLUGIN_DEBUG + #if defined (__FILE__) && defined (__LINE__) + #define ULTRACOPIER_DEBUGCONSOLE(a,b) emit debugInformation(a,__func__,b,__FILE__,__LINE__) + #else + #define ULTRACOPIER_DEBUGCONSOLE(a,b) emit debugInformation(a,__func__,b) + #endif +#else // ULTRACOPIER_DEBUG + #define ULTRACOPIER_DEBUGCONSOLE(a,b) void() +#endif // ULTRACOPIER_DEBUG + +#endif // DEBUGENGINEMACRO_H + + + + diff --git a/plugins-alternative/SessionLoader/KDE4/Environment.h b/plugins-alternative/SessionLoader/KDE4/Environment.h new file mode 100644 index 0000000..265a5a6 --- /dev/null +++ b/plugins-alternative/SessionLoader/KDE4/Environment.h @@ -0,0 +1,10 @@ +/** \file Environment.h +\brief Define the environment variable and global function +\author alpha_one_x86 +\licence GPL3, see the file COPYING */ + +#include "Variable.h" +/// \brief The global include +#include "StructEnumDefinition.h" +#include "DebugEngineMacro.h" + diff --git a/plugins-alternative/SessionLoader/KDE4/StructEnumDefinition.h b/plugins-alternative/SessionLoader/KDE4/StructEnumDefinition.h new file mode 100644 index 0000000..c1758f4 --- /dev/null +++ b/plugins-alternative/SessionLoader/KDE4/StructEnumDefinition.h @@ -0,0 +1 @@ +#include "../../../StructEnumDefinition.h" diff --git a/plugins-alternative/SessionLoader/KDE4/Variable.h b/plugins-alternative/SessionLoader/KDE4/Variable.h new file mode 100644 index 0000000..963d0c8 --- /dev/null +++ b/plugins-alternative/SessionLoader/KDE4/Variable.h @@ -0,0 +1,15 @@ +/** \file Variable.h +\brief Define the environment variable +\author alpha_one_x86 +\licence GPL3, see the file COPYING */ + +#ifndef VARIABLE_H +#define VARIABLE_H + +//Un-comment this next line to put ultracopier plugin in debug mode +#define ULTRACOPIER_PLUGIN_DEBUG + +#endif // VARIABLE_H + + + diff --git a/plugins-alternative/SessionLoader/KDE4/documentation.dox b/plugins-alternative/SessionLoader/KDE4/documentation.dox new file mode 100644 index 0000000..cf5f3e4 --- /dev/null +++ b/plugins-alternative/SessionLoader/KDE4/documentation.dox @@ -0,0 +1,32 @@ +/* -*- mode: C++ ; c-file-style: "stroustrup" -*- **/ + +/* + This file contains NO source code, just some documentation for doxygen to + parse. +*/ + +/*! + \mainpage KDE4 + + \section mainpage_overview Overview + + It control if it loaded with the session.\n + More informations on the wiki of ultracopier. + + \section mainpage_platforms Platforms + + Ultracopier might be usable in all environments where you find Qt 5.\n + Ultracopier requires Qt 5.0 or newer. Tested on Qt 5.0. + + \section mainpage_downloads Downloads + + You can find the link on Ultracopier project page, via git, snapshot sources, ... + + \section mainpage_algorithm Method + + It pass by ~/.kde4/Autostart/ultracopier.sh to set/get it. + + \section license GPL Version 3 + The code source is under GPL3. The image is extacted from Oxygen icon pack of KDE4. + +*/ diff --git a/plugins-alternative/SessionLoader/KDE4/informations.xml b/plugins-alternative/SessionLoader/KDE4/informations.xml new file mode 100644 index 0000000..14f8bea --- /dev/null +++ b/plugins-alternative/SessionLoader/KDE4/informations.xml @@ -0,0 +1,26 @@ + + + <![CDATA[Session loader for test]]> + <![CDATA[Chargeur de session pour des testes]]> + + SessionLoader + + + + + + + 1287496800 + + windows-x86 + + + + + 1.4.0.4 + + KDE4 + + + \ No newline at end of file diff --git a/plugins-alternative/SessionLoader/KDE4/plugin.json b/plugins-alternative/SessionLoader/KDE4/plugin.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/plugins-alternative/SessionLoader/KDE4/plugin.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/plugins-alternative/SessionLoader/KDE4/sessionLoader.cpp b/plugins-alternative/SessionLoader/KDE4/sessionLoader.cpp new file mode 100644 index 0000000..8024264 --- /dev/null +++ b/plugins-alternative/SessionLoader/KDE4/sessionLoader.cpp @@ -0,0 +1,58 @@ +/** \file session-loader.cpp +\brief Define the session plugin loader test +\author alpha_one_x86 +*/ + +#include +#include +#include + +#include "sessionLoader.h" +void KDESessionLoader::setEnabled(const bool &enabled) +{ + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, enabled: "+QString::number(enabled)); + QFile link(QDir::homePath()+"/.kde4/Autostart/ultracopier.sh"); + if(!enabled) + { + if(link.exists() && !link.remove()) + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"unable to remove from the startup: "+link.errorString()); + } + else + { + if(link.open(QIODevice::WriteOnly)) + { + link.write(QStringLiteral("#!/bin/bash\n").toLocal8Bit()); + link.write(QString(QCoreApplication::applicationFilePath()).toLocal8Bit()); + link.close(); + if(!link.setPermissions(QFile::ExeOwner|QFile::WriteOwner|QFile::ReadOwner)) + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"unable to set permissions: "+link.errorString()); + } + else + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Critical,"unable to open in writing the file: "+link.errorString()); + } +} + +bool KDESessionLoader::getEnabled() const +{ + //return the value into the variable + return QFile::exists(QDir::homePath()+"/.kde4/Autostart/ultracopier.sh"); +} + +void KDESessionLoader::setResources(OptionInterface * options,const QString &writePath,const QString &pluginPath,const bool &portableVersion) +{ + Q_UNUSED(options); + Q_UNUSED(writePath); + Q_UNUSED(pluginPath); + Q_UNUSED(portableVersion); +} + +/// \brief to get the options widget, NULL if not have +QWidget * KDESessionLoader::options() +{ + return NULL; +} + +/// \brief to reload the translation, because the new language have been loaded +void KDESessionLoader::newLanguageLoaded() +{ +} diff --git a/plugins-alternative/SessionLoader/KDE4/sessionLoader.h b/plugins-alternative/SessionLoader/KDE4/sessionLoader.h new file mode 100644 index 0000000..b037da7 --- /dev/null +++ b/plugins-alternative/SessionLoader/KDE4/sessionLoader.h @@ -0,0 +1,33 @@ +/** \file sessionLoader.h +\brief Define the session loader +\author alpha_one_x86 +\licence GPL3, see the file COPYING */ + +#ifndef SESSION_LOADER_PLUGIN_H +#define SESSION_LOADER_PLUGIN_H + +#include +#include "Environment.h" +#include "../../../interface/PluginInterface_SessionLoader.h" + +/// \brief Define the session loader +class KDESessionLoader : public PluginInterface_SessionLoader +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "first-world.info.ultracopier.PluginInterface.SessionLoader/1.0.0.0" FILE "plugin.json") + Q_INTERFACES(PluginInterface_SessionLoader) +public: + /// \brief to set if it's enabled or not + void setEnabled(const bool &enabled); + /// \brief to get if is enabled + bool getEnabled() const; + /// \brief set the resources for the plugins + void setResources(OptionInterface * options,const QString &writePath,const QString &pluginPath,const bool &portableVersion); + /// \brief to get the options widget, NULL if not have + QWidget * options(); +public slots: + /// \brief to reload the translation, because the new language have been loaded + void newLanguageLoaded(); +}; + +#endif // SESSION_LOADER_PLUGIN_H diff --git a/plugins-alternative/SessionLoader/KDE4/sessionLoader.pro b/plugins-alternative/SessionLoader/KDE4/sessionLoader.pro new file mode 100644 index 0000000..4ac69b4 --- /dev/null +++ b/plugins-alternative/SessionLoader/KDE4/sessionLoader.pro @@ -0,0 +1,15 @@ +CONFIG += c++11 +QMAKE_CXXFLAGS+="-std=c++0x -Wall -Wextra" +mac:QMAKE_CXXFLAGS+="-stdlib=libc++" + +TEMPLATE = lib +CONFIG += plugin +HEADERS = \ + $$PWD/sessionLoader.h \ + $$PWD/StructEnumDefinition.h \ + $$PWD/Variable.h \ + $$PWD/Environment.h \ + $$PWD/DebugEngineMacro.h \ + $$PWD/../../../interface/PluginInterface_SessionLoader.h +SOURCES = sessionLoader.cpp +TARGET = $$qtLibraryTarget(sessionLoader) -- cgit v1.2.3