From bd56579c7d9de94c17287adefa118290e6b7ba33 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Fri, 23 Feb 2018 23:49:48 +0000 Subject: New upstream version 1.4.0.3 --- plugins-alternative/Listener/dbus/Catchcopy.cpp | 17 +++++ plugins-alternative/Listener/dbus/Catchcopy.h | 20 +++++ .../Listener/dbus/DebugEngineMacro.h | 28 +++++++ plugins-alternative/Listener/dbus/Environment.h | 10 +++ .../Listener/dbus/StructEnumDefinition.h | 1 + plugins-alternative/Listener/dbus/Variable.h | 15 ++++ .../Listener/dbus/documentation.dox | 36 +++++++++ plugins-alternative/Listener/dbus/informations.xml | 26 +++++++ plugins-alternative/Listener/dbus/listener.cpp | 85 ++++++++++++++++++++++ plugins-alternative/Listener/dbus/listener.h | 49 +++++++++++++ plugins-alternative/Listener/dbus/listener.pro | 19 +++++ plugins-alternative/Listener/dbus/plugin.json | 1 + 12 files changed, 307 insertions(+) create mode 100644 plugins-alternative/Listener/dbus/Catchcopy.cpp create mode 100644 plugins-alternative/Listener/dbus/Catchcopy.h create mode 100644 plugins-alternative/Listener/dbus/DebugEngineMacro.h create mode 100644 plugins-alternative/Listener/dbus/Environment.h create mode 100644 plugins-alternative/Listener/dbus/StructEnumDefinition.h create mode 100644 plugins-alternative/Listener/dbus/Variable.h create mode 100644 plugins-alternative/Listener/dbus/documentation.dox create mode 100644 plugins-alternative/Listener/dbus/informations.xml create mode 100644 plugins-alternative/Listener/dbus/listener.cpp create mode 100644 plugins-alternative/Listener/dbus/listener.h create mode 100644 plugins-alternative/Listener/dbus/listener.pro create mode 100644 plugins-alternative/Listener/dbus/plugin.json (limited to 'plugins-alternative/Listener') diff --git a/plugins-alternative/Listener/dbus/Catchcopy.cpp b/plugins-alternative/Listener/dbus/Catchcopy.cpp new file mode 100644 index 0000000..6c46af2 --- /dev/null +++ b/plugins-alternative/Listener/dbus/Catchcopy.cpp @@ -0,0 +1,17 @@ +#include "Catchcopy.h" + +#include + +Catchcopy::Catchcopy() +{ +} + +void Catchcopy::copy(const QStringList &sources,const QString &destination) +{ + emit newCopy(0,sources,destination); +} + +void Catchcopy::move(const QStringList &sources,const QString &destination) +{ + emit newMove(0,sources,destination); +} diff --git a/plugins-alternative/Listener/dbus/Catchcopy.h b/plugins-alternative/Listener/dbus/Catchcopy.h new file mode 100644 index 0000000..d28a253 --- /dev/null +++ b/plugins-alternative/Listener/dbus/Catchcopy.h @@ -0,0 +1,20 @@ +#ifndef CATCHCOPY_H +#define CATCHCOPY_H + +#include +#include + +class Catchcopy : public QObject +{ + Q_OBJECT +public: + explicit Catchcopy(); +signals: + void newCopy(const quint32 &id,const QStringList &sources,const QString &destination); + void newMove(const quint32 &id,const QStringList &sources,const QString &destination); +public slots: + Q_SCRIPTABLE void copy(const QStringList &sources,const QString &destination); + Q_SCRIPTABLE void move(const QStringList &sources,const QString &destination); +}; + +#endif // CATCHCOPY_H diff --git a/plugins-alternative/Listener/dbus/DebugEngineMacro.h b/plugins-alternative/Listener/dbus/DebugEngineMacro.h new file mode 100644 index 0000000..4582010 --- /dev/null +++ b/plugins-alternative/Listener/dbus/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/Listener/dbus/Environment.h b/plugins-alternative/Listener/dbus/Environment.h new file mode 100644 index 0000000..265a5a6 --- /dev/null +++ b/plugins-alternative/Listener/dbus/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/Listener/dbus/StructEnumDefinition.h b/plugins-alternative/Listener/dbus/StructEnumDefinition.h new file mode 100644 index 0000000..c1758f4 --- /dev/null +++ b/plugins-alternative/Listener/dbus/StructEnumDefinition.h @@ -0,0 +1 @@ +#include "../../../StructEnumDefinition.h" diff --git a/plugins-alternative/Listener/dbus/Variable.h b/plugins-alternative/Listener/dbus/Variable.h new file mode 100644 index 0000000..963d0c8 --- /dev/null +++ b/plugins-alternative/Listener/dbus/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/Listener/dbus/documentation.dox b/plugins-alternative/Listener/dbus/documentation.dox new file mode 100644 index 0000000..2eb3c87 --- /dev/null +++ b/plugins-alternative/Listener/dbus/documentation.dox @@ -0,0 +1,36 @@ +/* -*- mode: C++ ; c-file-style: "stroustrup" -*- **/ + +/* + This file contains NO source code, just some documentation for doxygen to + parse. +*/ + +/*! + \mainpage dbus + + \section mainpage_overview Overview + + It's alternative listener for linux, it's very more simpler. You send just your copy/move, no more. No return.\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 Dbus method + + you have this method exported to dbus: +
    +
  • void copy(const QStringList &sources,const QString &destination)
  • +
  • void move(const QStringList &sources,const QString &destination)
  • +
+ + \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/Listener/dbus/informations.xml b/plugins-alternative/Listener/dbus/informations.xml new file mode 100644 index 0000000..77cba57 --- /dev/null +++ b/plugins-alternative/Listener/dbus/informations.xml @@ -0,0 +1,26 @@ + + + <![CDATA[Listener for catchcopy in dbus]]> + <![CDATA[Écouteur pour catchcopy en dbus]]> + + Listener + + + + + + + 1287496800 + + windows-x86 + + + + + 1.4.0.3 + + dbus + + + \ No newline at end of file diff --git a/plugins-alternative/Listener/dbus/listener.cpp b/plugins-alternative/Listener/dbus/listener.cpp new file mode 100644 index 0000000..50ed196 --- /dev/null +++ b/plugins-alternative/Listener/dbus/listener.cpp @@ -0,0 +1,85 @@ +#include "listener.h" + +Listener::Listener() +{ + connect(&catchcopy,&Catchcopy::newCopy, this,&Listener::newCopy); + connect(&catchcopy,&Catchcopy::newMove, this,&Listener::newMove); +} + +void Listener::listen() +{ + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + if (!QDBusConnection::sessionBus().isConnected()) + { + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + emit newState(Ultracopier::NotListening); + return; + } + if (!QDBusConnection::sessionBus().registerService("info.first-world.catchcopy")) + { + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QDBusConnection::sessionBus().lastError().message()); + emit newState(Ultracopier::NotListening); + return; + } + if(!QDBusConnection::sessionBus().registerObject("/", &catchcopy, QDBusConnection::ExportAllSlots)) + { + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QDBusConnection::sessionBus().lastError().message()); + emit newState(Ultracopier::NotListening); + return; + } + emit newState(Ultracopier::FullListening); +} + +void Listener::close() +{ + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start"); + QDBusConnection::sessionBus().unregisterObject("/"); + QDBusConnection::sessionBus().unregisterService("info.first-world.catchcopy"); + emit newState(Ultracopier::NotListening); +} + +const QString Listener::errorString() const +{ + return "Unknow error"; +} + +void Listener::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 * Listener::options() +{ + return NULL; +} + +void Listener::transferFinished(const quint32 &orderId,const bool &withError) +{ + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, orderId: "+QString::number(orderId)+", withError: "+QString::number(withError)); +} + +void Listener::transferCanceled(const quint32 &orderId) +{ + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, orderId: "+QString::number(orderId)); +} + +/// \brief to reload the translation, because the new language have been loaded +void Listener::newLanguageLoaded() +{ +} + +void Listener::error(QString error) +{ + Q_UNUSED(error); +} + +void Listener::clientName(quint32 client,QString name) +{ + Q_UNUSED(client); + Q_UNUSED(name); + ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("clientName: %1, for the id: %2").arg(name).arg(client)); +} diff --git a/plugins-alternative/Listener/dbus/listener.h b/plugins-alternative/Listener/dbus/listener.h new file mode 100644 index 0000000..fcb95cd --- /dev/null +++ b/plugins-alternative/Listener/dbus/listener.h @@ -0,0 +1,49 @@ +/** \file listener.h +\brief Define the server compatible with Ultracopier interface +\author alpha_one_x86 +\licence GPL3, see the file COPYING */ + +#ifndef SERVER_H +#define SERVER_H + +#include +#include +#include + +#include "Catchcopy.h" +#include "Environment.h" +#include "../../../interface/PluginInterface_Listener.h" + +/// \brief Define the server compatible with Ultracopier interface +class Listener : public PluginInterface_Listener +{ + Q_OBJECT + Q_PLUGIN_METADATA(IID "first-world.info.ultracopier.PluginInterface.Listener/1.0.0.0" FILE "plugin.json") + Q_INTERFACES(PluginInterface_Listener) +public: + Listener(); + /// \brief try listen the copy/move + void listen(); + /// \brief stop listen to copy/move + void close(); + /// \brief return the error strong + const QString errorString() const; + /// \brief set resources for this 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 say to the client that's the copy/move is finished + void transferFinished(const quint32 &orderId,const bool &withError); + /// \brief say to the client that's the copy/move is finished + void transferCanceled(const quint32 &orderId); + /// \brief to reload the translation, because the new language have been loaded + void newLanguageLoaded(); +private: + Catchcopy catchcopy; +private slots: + void error(QString error); + void clientName(quint32 client,QString name); +}; + +#endif // SERVER_H diff --git a/plugins-alternative/Listener/dbus/listener.pro b/plugins-alternative/Listener/dbus/listener.pro new file mode 100644 index 0000000..16cd3d3 --- /dev/null +++ b/plugins-alternative/Listener/dbus/listener.pro @@ -0,0 +1,19 @@ +CONFIG += c++11 +QMAKE_CXXFLAGS+="-std=c++0x -Wall -Wextra" +mac:QMAKE_CXXFLAGS+="-stdlib=libc++" + +TEMPLATE = lib +CONFIG += plugin +QT += network dbus +HEADERS = \ + $$PWD/listener.h \ + $$PWD/Environment.h \ + $$PWD/Variable.h \ + $$PWD/DebugEngineMacro.h \ + $$PWD/StructEnumDefinition.h \ + $$PWD/../../../interface/PluginInterface_Listener.h \ + $$PWD/Catchcopy.h +SOURCES = \ + $$PWD/listener.cpp \ + $$PWD/Catchcopy.cpp +TARGET = $$qtLibraryTarget(listener) diff --git a/plugins-alternative/Listener/dbus/plugin.json b/plugins-alternative/Listener/dbus/plugin.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/plugins-alternative/Listener/dbus/plugin.json @@ -0,0 +1 @@ +{} \ No newline at end of file -- cgit v1.2.3