diff options
Diffstat (limited to 'plugins/Listener')
-rw-r--r-- | plugins/Listener/catchcopy-v0002/informations.xml | 6 | ||||
-rwxr-xr-x | plugins/Listener/catchcopy-v0002/listener.cpp | 11 | ||||
-rwxr-xr-x | plugins/Listener/catchcopy-v0002/listener.h | 4 | ||||
-rw-r--r-- | plugins/Listener/catchcopy-v0002/listener.pro | 2 | ||||
-rw-r--r-- | plugins/Listener/dbus/Catchcopy.cpp | 15 | ||||
-rw-r--r-- | plugins/Listener/dbus/Catchcopy.h | 20 | ||||
-rw-r--r-- | plugins/Listener/dbus/DebugEngineMacro.h | 25 | ||||
-rw-r--r-- | plugins/Listener/dbus/Environment.h | 11 | ||||
-rw-r--r-- | plugins/Listener/dbus/StructEnumDefinition.h | 1 | ||||
-rw-r--r-- | plugins/Listener/dbus/Variable.h | 16 | ||||
-rwxr-xr-x | plugins/Listener/dbus/documentation.dox | 33 | ||||
-rw-r--r-- | plugins/Listener/dbus/informations.xml | 27 | ||||
-rwxr-xr-x | plugins/Listener/dbus/listener.cpp | 86 | ||||
-rwxr-xr-x | plugins/Listener/dbus/listener.h | 64 | ||||
-rw-r--r-- | plugins/Listener/dbus/listener.pro | 14 |
15 files changed, 331 insertions, 4 deletions
diff --git a/plugins/Listener/catchcopy-v0002/informations.xml b/plugins/Listener/catchcopy-v0002/informations.xml index 65b4ca1..e465da8 100644 --- a/plugins/Listener/catchcopy-v0002/informations.xml +++ b/plugins/Listener/catchcopy-v0002/informations.xml @@ -12,16 +12,16 @@ <!-- the date-time format should be in timestamps format --> <pubDate>1287496800</pubDate> <!-- the architecture code of this plugin, found PlatformMacro.h into ultracopier source --> - <architecture>linux-x86_64-pc</architecture> + <architecture>windows-x86</architecture> <!-- Detailed description --> <description xml:lang="en"><![CDATA[Listener for catchcopy v0002. Allow to receive copy list from plugin/explorer compatible with catchcopy.]]></description> <description xml:lang="fr"><![CDATA[Écouteur pour catchcopy v0002. Permet de recevoir un liste de copie venant d'un plugin/explorateur avec catchcopy.]]></description> <!-- Version of this release of this plugin, need be like that's: A.B.C.D, where A, B, C and D is number --> - <version>0.3.0.5</version> + <version>0.3.1.0</version> <!-- This internal name should never change, because it is used to detect when a particular plugin is updated. It must comprise only lower case ASCII characters (a-z), numerical digits (0-9), "-", "." or "_", and it must be be unique within the category. And have size lower than 64 char. --> <name>catchcopy-v0002</name> <!-- Dependency checking. This is used to check when a plugin may not be compatible with an updated version of either Ultracopier or another plugin. This example only checks Ultracopier. --> <dependencies><![CDATA[ - >=ultracopier-0.3.0.5 + >=ultracopier-0.3.1.0 ]]></dependencies> </package>
\ No newline at end of file diff --git a/plugins/Listener/catchcopy-v0002/listener.cpp b/plugins/Listener/catchcopy-v0002/listener.cpp index 13dc66a..51f204e 100755 --- a/plugins/Listener/catchcopy-v0002/listener.cpp +++ b/plugins/Listener/catchcopy-v0002/listener.cpp @@ -44,6 +44,12 @@ void CatchCopyPlugin::setResources(OptionInterface * options,QString writePath,Q Q_UNUSED(portableVersion); } +/// \brief to get the options widget, NULL if not have +QWidget * CatchCopyPlugin::options() +{ + return NULL; +} + Q_EXPORT_PLUGIN2(listener, CatchCopyPlugin); void CatchCopyPlugin::transferFinished(quint32 orderId,bool withError) @@ -58,6 +64,11 @@ void CatchCopyPlugin::transferCanceled(quint32 orderId) server.copyCanceled(orderId); } +/// \brief to reload the translation, because the new language have been loaded +void CatchCopyPlugin::newLanguageLoaded() +{ +} + void CatchCopyPlugin::error(QString error) { Q_UNUSED(error); diff --git a/plugins/Listener/catchcopy-v0002/listener.h b/plugins/Listener/catchcopy-v0002/listener.h index 9eca405..0ef0dc7 100755 --- a/plugins/Listener/catchcopy-v0002/listener.h +++ b/plugins/Listener/catchcopy-v0002/listener.h @@ -28,11 +28,15 @@ public: const QString errorString(); /// \brief set resources for this plugins void setResources(OptionInterface * options,QString writePath,QString pluginPath,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(quint32 orderId,bool withError); /// \brief say to the client that's the copy/move is finished void transferCanceled(quint32 orderId); + /// \brief to reload the translation, because the new language have been loaded + void newLanguageLoaded(); private: ServerCatchcopy server; private slots: diff --git a/plugins/Listener/catchcopy-v0002/listener.pro b/plugins/Listener/catchcopy-v0002/listener.pro index 0cd7fa4..5903fa4 100644 --- a/plugins/Listener/catchcopy-v0002/listener.pro +++ b/plugins/Listener/catchcopy-v0002/listener.pro @@ -14,4 +14,4 @@ SOURCES = listener.cpp \ catchcopy-api-0002/ServerCatchcopy.cpp \ catchcopy-api-0002/ExtraSocketCatchcopy.cpp TARGET = $$qtLibraryTarget(listener) -TRANSLATIONS += Languages/fr/translation.ts + diff --git a/plugins/Listener/dbus/Catchcopy.cpp b/plugins/Listener/dbus/Catchcopy.cpp new file mode 100644 index 0000000..792563a --- /dev/null +++ b/plugins/Listener/dbus/Catchcopy.cpp @@ -0,0 +1,15 @@ +#include "Catchcopy.h" + +Catchcopy::Catchcopy() +{ +} + +void Catchcopy::copy(QStringList sources,QString destination) +{ + emit newCopy(0,sources,destination); +} + +void Catchcopy::move(QStringList sources,QString destination) +{ + emit newMove(0,sources,destination); +} diff --git a/plugins/Listener/dbus/Catchcopy.h b/plugins/Listener/dbus/Catchcopy.h new file mode 100644 index 0000000..6151ebd --- /dev/null +++ b/plugins/Listener/dbus/Catchcopy.h @@ -0,0 +1,20 @@ +#ifndef CATCHCOPY_H +#define CATCHCOPY_H + +#include <QObject> +#include <QStringList> + +class Catchcopy : public QObject +{ + Q_OBJECT +public: + explicit Catchcopy(); +signals: + void newCopy(quint32 id,QStringList sources,QString destination); + void newMove(quint32 id,QStringList sources,QString destination); +public slots: + Q_SCRIPTABLE void copy(QStringList sources,QString destination); + Q_SCRIPTABLE void move(QStringList sources,QString destination); +}; + +#endif // CATCHCOPY_H diff --git a/plugins/Listener/dbus/DebugEngineMacro.h b/plugins/Listener/dbus/DebugEngineMacro.h new file mode 100644 index 0000000..a3dd648 --- /dev/null +++ b/plugins/Listener/dbus/DebugEngineMacro.h @@ -0,0 +1,25 @@ +/** \file DebugEngineMacro.h +\brief Define the macro for the debug +\author alpha_one_x86 +\version 0.3 +\date 2010 */ + +#ifndef DEBUGENGINEMACRO_H +#define DEBUGENGINEMACRO_H + +/// \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/Listener/dbus/Environment.h b/plugins/Listener/dbus/Environment.h new file mode 100644 index 0000000..94fd104 --- /dev/null +++ b/plugins/Listener/dbus/Environment.h @@ -0,0 +1,11 @@ +/** \file Environment.h
+\brief Define the environment variable and global function
+\author alpha_one_x86
+\version 0.3
+\date 2010 */
+
+#include "Variable.h"
+/// \brief The global include
+#include "StructEnumDefinition.h"
+#include "DebugEngineMacro.h"
+
diff --git a/plugins/Listener/dbus/StructEnumDefinition.h b/plugins/Listener/dbus/StructEnumDefinition.h new file mode 100644 index 0000000..c1758f4 --- /dev/null +++ b/plugins/Listener/dbus/StructEnumDefinition.h @@ -0,0 +1 @@ +#include "../../../StructEnumDefinition.h" diff --git a/plugins/Listener/dbus/Variable.h b/plugins/Listener/dbus/Variable.h new file mode 100644 index 0000000..8179c93 --- /dev/null +++ b/plugins/Listener/dbus/Variable.h @@ -0,0 +1,16 @@ +/** \file Variable.h
+\brief Define the environment variable
+\author alpha_one_x86
+\version 0.3
+\date 2010 */
+
+#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/Listener/dbus/documentation.dox b/plugins/Listener/dbus/documentation.dox new file mode 100755 index 0000000..a15792a --- /dev/null +++ b/plugins/Listener/dbus/documentation.dox @@ -0,0 +1,33 @@ +/* -*- mode: C++ ; c-file-style: "stroustrup" -*- **/ + +/* + This file contains NO source code, just some documentation for doxygen to + parse. +*/ + +/*! + \mainpage catchcopy-v0002 + + \section mainpage_overview Overview + + Is the default listener to wait a copy/move. It use the catchcopy protocol.\n + More informations on <a href="http://ultracopier-wiki.first-world.info/">the wiki of ultracopier</a>. Is part of Ultracopier 0.3 project. + + \section mainpage_platforms Platforms + + This plugin might be usable in all environments where you find Qt 4.\n + To be compatible with the official Ultracopier plugins, you need compil it with Gcc, Qt4.8, and same env as Ultracopier have been compiled, see the documentation. + + \section mainpage_downloads Downloads + + You can found link on <a href="http://ultracopier.first-world.info/">Ultracopier (Supercopier/Teracopy)</a> project page, via git, snapshot sources, ... + + \section mainpage_algorithm Protocol + + The protocol in version 0.0.0.2 is used, you can see the documentation on <a href="http://catchcopy.first-world.info/">Catchcopy web site</a> + + \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/Listener/dbus/informations.xml b/plugins/Listener/dbus/informations.xml new file mode 100644 index 0000000..846cd36 --- /dev/null +++ b/plugins/Listener/dbus/informations.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<package> + <title xml:lang="en"><![CDATA[Listener for catchcopy in dbus]]></title><!-- english is required --> + <title xml:lang="fr"><![CDATA[Écouteur pour catchcopy en dbus]]></title> + <!-- What kind of plugin this is --> + <category>Listener</category> + <!-- Who wrote this plugin --> + <author><![CDATA[BRULE Herman, alpha_one_x86 (alpha_one_x86@first-world.info)]]></author> + <!-- URL of page or site for this plugin (may provide additional information, bug reports, feature requests). --> + <website xml:lang="en"><![CDATA[http://ultracopier.first-world.info/]]></website><!-- not required --> + <website xml:lang="fr"><![CDATA[http://ultracopier-fr.first-world.info/]]></website><!-- not required --> + <!-- the date-time format should be in timestamps format --> + <pubDate>1287496800</pubDate> + <!-- the architecture code of this plugin, found PlatformMacro.h into ultracopier source --> + <architecture>windows-x86</architecture> + <!-- Detailed description --> + <description xml:lang="en"><![CDATA[Listener for catchcopy in dbus. Allow to receive copy list from plugin/explorer compatible with catchcopy.]]></description> + <description xml:lang="fr"><![CDATA[Écouteur pour catchcopy en dbus. Permet de recevoir un liste de copie venant d'un plugin/explorateur avec catchcopy.]]></description> + <!-- Version of this release of this plugin, need be like that's: A.B.C.D, where A, B, C and D is number --> + <version>0.3.1.0</version> + <!-- This internal name should never change, because it is used to detect when a particular plugin is updated. It must comprise only lower case ASCII characters (a-z), numerical digits (0-9), "-", "." or "_", and it must be be unique within the category. And have size lower than 64 char. --> + <name>dbus</name> + <!-- Dependency checking. This is used to check when a plugin may not be compatible with an updated version of either Ultracopier or another plugin. This example only checks Ultracopier. --> + <dependencies><![CDATA[ + >=ultracopier-0.3.1.0 + ]]></dependencies> +</package>
\ No newline at end of file diff --git a/plugins/Listener/dbus/listener.cpp b/plugins/Listener/dbus/listener.cpp new file mode 100755 index 0000000..2f23638 --- /dev/null +++ b/plugins/Listener/dbus/listener.cpp @@ -0,0 +1,86 @@ +#include <QtCore> +#include <QMessageBox> + +#include "listener.h" + +CatchCopyPlugin::CatchCopyPlugin() +{ + connect(&catchcopy,SIGNAL(newCopy(quint32,QStringList,QString)), this,SIGNAL(newCopy(quint32,QStringList,QString))); + connect(&catchcopy,SIGNAL(newMove(quint32,QStringList,QString)), this,SIGNAL(newMove(quint32,QStringList,QString))); +} + +void CatchCopyPlugin::listen() +{ + ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start"); + if (!QDBusConnection::sessionBus().isConnected()) + { + ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start"); + emit newState(NotListening); + return; + } + if (!QDBusConnection::sessionBus().registerService("info.first-world.catchcopy")) + { + ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,QDBusConnection::sessionBus().lastError().message()); + emit newState(NotListening); + return; + } + emit newState(FullListening); + QDBusConnection::sessionBus().registerObject("/", &catchcopy, QDBusConnection::ExportAllSlots); +} + +void CatchCopyPlugin::close() +{ + ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start"); + QDBusConnection::sessionBus().unregisterObject("/"); + QDBusConnection::sessionBus().unregisterService("info.first-world.catchcopy"); + emit newState(NotListening); +} + +const QString CatchCopyPlugin::errorString() +{ + ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start"); + return "Unknow error"; +} + +void CatchCopyPlugin::setResources(OptionInterface * options,QString writePath,QString pluginPath,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 * CatchCopyPlugin::options() +{ + return NULL; +} + +Q_EXPORT_PLUGIN2(listener, CatchCopyPlugin); + +void CatchCopyPlugin::transferFinished(quint32 orderId,bool withError) +{ + ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start, orderId: "+QString::number(orderId)+", withError: "+QString::number(withError)); +} + +void CatchCopyPlugin::transferCanceled(quint32 orderId) +{ + ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Notice,"start, orderId: "+QString::number(orderId)); +} + +/// \brief to reload the translation, because the new language have been loaded +void CatchCopyPlugin::newLanguageLoaded() +{ +} + +void CatchCopyPlugin::error(QString error) +{ + Q_UNUSED(error); +} + +void CatchCopyPlugin::clientName(quint32 client,QString name) +{ + Q_UNUSED(client); + Q_UNUSED(name); + ULTRACOPIER_DEBUGCONSOLE(DebugLevel_Information,QString("clientName: %1, for the id: %2").arg(name).arg(client)); +} diff --git a/plugins/Listener/dbus/listener.h b/plugins/Listener/dbus/listener.h new file mode 100755 index 0000000..fd3db2e --- /dev/null +++ b/plugins/Listener/dbus/listener.h @@ -0,0 +1,64 @@ +/** \file listener.h +\brief Define the server compatible with Ultracopier interface +\author alpha_one_x86 +\version 0.3 +\date 2010 */ + +#ifndef SERVER_H +#define SERVER_H + +#include <QObject> +#include <QtDBus/QtDBus> +#include <QtDBus/QDBusConnection> + +#include "Catchcopy.h" +#include "Environment.h" +#include "../../../interface/PluginInterface_Listener.h" + +/// \brief Define the server compatible with Ultracopier interface +class CatchCopyPlugin : public PluginInterface_Listener +{ + Q_OBJECT + Q_INTERFACES(PluginInterface_Listener) +public: + CatchCopyPlugin(); + /// \brief try listen the copy/move + void listen(); + /// \brief stop listen to copy/move + void close(); + /// \brief return the error strong + const QString errorString(); + /// \brief set resources for this plugins + void setResources(OptionInterface * options,QString writePath,QString pluginPath,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(quint32 orderId,bool withError); + /// \brief say to the client that's the copy/move is finished + void transferCanceled(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); +signals: + #ifdef ULTRACOPIER_PLUGIN_DEBUG + /// \brief To debug source + void debugInformation(DebugLevel level,QString fonction,QString text,QString file,int ligne); + #endif + /// \brief new state + void newState(ListeningState state); + /// \brief new copy is incoming + void newCopy(quint32 orderId,QStringList sources); + /// \brief new copy is incoming, with destination + void newCopy(quint32 orderId,QStringList sources,QString destination); + /// \brief new move is incoming + void newMove(quint32 orderId,QStringList sources); + /// \brief new move is incoming, with destination + void newMove(quint32 orderId,QStringList sources,QString destination); +}; + +#endif // SERVER_H diff --git a/plugins/Listener/dbus/listener.pro b/plugins/Listener/dbus/listener.pro new file mode 100644 index 0000000..304d8d2 --- /dev/null +++ b/plugins/Listener/dbus/listener.pro @@ -0,0 +1,14 @@ +TEMPLATE = lib +CONFIG += plugin qdbus +QT += network +HEADERS = listener.h \ + Environment.h \ + Variable.h \ + DebugEngineMacro.h \ + StructEnumDefinition.h \ + ../../../interface/PluginInterface_Listener.h \ + Catchcopy.h +SOURCES = listener.cpp \ + Catchcopy.cpp +TARGET = $$qtLibraryTarget(listener) + |