diff options
author | Thomas Preud'homme <robotux@debian.org> | 2018-03-01 22:42:01 +0000 |
---|---|---|
committer | Thomas Preud'homme <robotux@debian.org> | 2018-03-01 22:42:01 +0000 |
commit | 3958fa914c8a524ed4b6a5b035b794e12708fa1d (patch) | |
tree | 417868397f3c2c7386773f55096a9aa5f8856990 /interface |
Import ultracopier_1.4.0.4.orig.tar.xz
[dgit import orig ultracopier_1.4.0.4.orig.tar.xz]
Diffstat (limited to 'interface')
-rw-r--r-- | interface/FacilityInterface.h | 44 | ||||
-rw-r--r-- | interface/OptionInterface.h | 36 | ||||
-rw-r--r-- | interface/PluginInterface_CopyEngine.h | 208 | ||||
-rw-r--r-- | interface/PluginInterface_Listener.h | 56 | ||||
-rw-r--r-- | interface/PluginInterface_PluginLoader.h | 39 | ||||
-rw-r--r-- | interface/PluginInterface_SessionLoader.h | 39 | ||||
-rw-r--r-- | interface/PluginInterface_Themes.h | 115 |
7 files changed, 537 insertions, 0 deletions
diff --git a/interface/FacilityInterface.h b/interface/FacilityInterface.h new file mode 100644 index 0000000..f9b000d --- /dev/null +++ b/interface/FacilityInterface.h @@ -0,0 +1,44 @@ +/** \file FacilityInterface.h +\brief Define the class of the facility engine +\author alpha_one_x86 +\licence GPL3, see the file COPYING */ + +#ifndef FACILITY_INTERFACE_H +#define FACILITY_INTERFACE_H + +#include <string> +#include <vector> +#include <QObject> + +#include "../StructEnumDefinition.h" + +/// \brief To define the interface, to pass the facility object from Ultracopier to the plugins without compatibility problem +//not possible to be static, because in the plugin it's not resolved +class FacilityInterface : public QObject +{ + public: + /// \brief To force the text re-translation + virtual void retranslate() = 0; + /// \brief convert size in Byte to String + virtual std::string sizeToString(const double &size) const = 0; + /// \brief convert size unit to String + virtual std::string sizeUnitToString(const Ultracopier::SizeUnit &sizeUnit) const = 0; + /// \brief translate the text + virtual std::string translateText(const std::string &text) const = 0; + /// \brief speed to string in byte per seconds + virtual std::string speedToString(const double &speed) const = 0; + /// \brief Decompose the time in second + virtual Ultracopier::TimeDecomposition secondsToTimeDecomposition(const uint32_t &seconds) const = 0; + /// \brief have the fonctionnality + virtual bool haveFunctionality(const std::string &fonctionnality) const = 0; + /// \brief call the fonctionnality + virtual std::string callFunctionality(const std::string &fonctionnality,const std::vector<std::string> &args=std::vector<std::string>()) = 0; + /// \brief Do the simplified time + virtual std::string simplifiedRemainingTime(const uint32_t &seconds) const = 0; + /// \brief Do the simplified time + virtual std::string ultimateUrl() const = 0; + /// \brief Return the software name + virtual std::string softwareName() const = 0; +}; + +#endif // FACILITY_INTERFACE_H diff --git a/interface/OptionInterface.h b/interface/OptionInterface.h new file mode 100644 index 0000000..034b49d --- /dev/null +++ b/interface/OptionInterface.h @@ -0,0 +1,36 @@ +/** \file OptionInterface.h +\brief Define the class of the option engine +\author alpha_one_x86 +\licence GPL3, see the file COPYING */ + +#ifndef OPTION_INTERFACE_H +#define OPTION_INTERFACE_H + +#include <string> +#include <vector> +#include <utility> +#include <QObject> + +#include "../StructEnumDefinition.h" + +/** \brief to pass the options to the plugin, the instance is created into Ultracopier from the class LocalPluginOptions() + * \see LocalPluginOptions() + * **/ +class OptionInterface : public QObject +{ + Q_OBJECT + public: + /// \brief To add option group to options + virtual bool addOptionGroup(const std::vector<std::pair<std::string, std::string> > &KeysList) = 0; + /*/// \brief To remove option group to options, removed to the load plugin + virtual bool removeOptionGroup() = 0;*/ + /// \brief To get option value + virtual std::string getOptionValue(const std::string &variableName) const = 0; + /// \brief To set option value + virtual void setOptionValue(const std::string &variableName,const std::string &value) = 0; + signals: + //void newOptionValue(std::string,std::string);-> disabled because the value will not externally changed, then useless notification + void resetOptions() const; +}; + +#endif // OPTION_INTERFACE_H diff --git a/interface/PluginInterface_CopyEngine.h b/interface/PluginInterface_CopyEngine.h new file mode 100644 index 0000000..eb5b6bc --- /dev/null +++ b/interface/PluginInterface_CopyEngine.h @@ -0,0 +1,208 @@ +/** \file PluginInterface_CopyEngine.h +\brief Define the interface of the plugin of type: copy engine +\author alpha_one_x86 +\licence GPL3, see the file COPYING */ + +#ifndef PLUGININTERFACE_COPYENGINE_H +#define PLUGININTERFACE_COPYENGINE_H + +#include <QObject> +#include <QWidget> +#include <string> +#include <vector> + +#include "OptionInterface.h" +#include "FacilityInterface.h" +#include "../StructEnumDefinition.h" + +/** \brief To define the interface between Ultracopier and the copy engine + * This interface support: + * - Multiple transfer and multiple transfer progression + * - Only the copy mode (source as read only) + * - Only manipulation of folder, file, file + folder + * - Change on live file size + * - Speed is calculated by ultracopier in using the size \see getGeneralProgression() + * - Support speed limitation if the engine provide it, else inform Ultracopier + * - File/Folder can be added interactively or not + * - The collision and error is managed by the plug-in to have useful information (like preview, size, date, ...) + * **/ +class PluginInterface_CopyEngine : public QObject +{ + Q_OBJECT + public: + /** \brief to send the options panel + * \return return false if have not the options + * \param tempWidget the widget to generate on it the options */ + virtual bool getOptionsEngine(QWidget * tempWidget) = 0; + /** \brief to have interface widget to do modal dialog + * \param interface to have the widget of the interface, useful for modal dialog */ + virtual void setInterfacePointer(QWidget * interface) = 0; + /** \brief compare the current sources of the copy, with the passed arguments + * \param sources the sources list to compares with the current sources list + * \return true if have same sources, else false (or empty) */ + virtual bool haveSameSource(const std::vector<std::string> &sources) = 0; + /** \brief compare the current destination of the copy, with the passed arguments + * \param destination the destination to compares with the current destination + * \return true if have same destination, else false (or empty) */ + virtual bool haveSameDestination(const std::string &destination) = 0; + + + //external soft like file browser have send copy/move list to do + /** \brief send copy without destination, ask the destination + * \param sources the sources list to copy + * \return true if the copy have been accepted */ + virtual bool newCopy(const std::vector<std::string> &sources) = 0; + /** \brief send copy with destination + * \param sources the sources list to copy + * \param destination the destination to copy + * \return true if the copy have been accepted */ + virtual bool newCopy(const std::vector<std::string> &sources,const std::string &destination) = 0; + /** \brief send move without destination, ask the destination + * \param sources the sources list to move + * \return true if the move have been accepted */ + virtual bool newMove(const std::vector<std::string> &sources) = 0; + /** \brief send move without destination, ask the destination + * \param sources the sources list to move + * \param destination the destination to move + * \return true if the move have been accepted */ + virtual bool newMove(const std::vector<std::string> &sources,const std::string &destination) = 0; + /** \brief send the new transfer list + * \param file the transfer list */ + virtual void newTransferList(const std::string &file) = 0; + + + /** \brief to get byte read, use by Ultracopier for the speed calculation + * real size transfered to right speed calculation */ + virtual uint64_t realByteTransfered() = 0; + + + /** \brief support speed limitation */ + virtual bool supportSpeedLimitation() const = 0; + + //transfer list + /** \brief to sync the transfer list + * Used when the interface is changed, useful to minimize the memory size */ + virtual void syncTransferList() = 0; + public slots: + //user ask ask to add folder (add it with interface ask source/destination) + /** \brief add folder called on the interface + * Used by manual adding */ + virtual bool userAddFolder(const Ultracopier::CopyMode &mode) = 0; + /** \brief add file called on the interface + * Used by manual adding */ + virtual bool userAddFile(const Ultracopier::CopyMode &mode) = 0; + + + //action on the transfer + /// \brief put the transfer in pause + virtual void pause() = 0; + /// \brief resume the transfer + virtual void resume() = 0; + /** \brief skip one transfer entry + * \param id id of the file to remove */ + virtual void skip(const uint64_t &id) = 0; + /// \brief cancel all the transfer + virtual void cancel() = 0; + + + //edit the transfer list + /** \brief remove the selected item + * \param ids ids is the id list of the selected items */ + virtual void removeItems(const std::vector<uint64_t> &ids) = 0; + /** \brief move on top of the list the selected item + * \param ids ids is the id list of the selected items */ + virtual void moveItemsOnTop(const std::vector<uint64_t> &ids) = 0; + /** \brief move up the list the selected item + * \param ids ids is the id list of the selected items */ + virtual void moveItemsUp(const std::vector<uint64_t> &ids) = 0; + /** \brief move down the list the selected item + * \param ids ids is the id list of the selected items */ + virtual void moveItemsDown(const std::vector<uint64_t> &ids) = 0; + /** \brief move on bottom of the list the selected item + * \param ids ids is the id list of the selected items */ + virtual void moveItemsOnBottom(const std::vector<uint64_t> &ids) = 0; + + + /** \brief give the forced mode, to export/import transfer list */ + virtual void forceMode(const Ultracopier::CopyMode &mode) = 0; + /// \brief export the transfer list into a file + virtual void exportTransferList() = 0; + /// \brief export the transfer list into a file + virtual void exportErrorIntoTransferList() = 0; + /// \brief import the transfer list into a file + virtual void importTransferList() = 0; + + + /** \brief to set the speed limitation + * -1 if not able, 0 if disabled */ + virtual bool setSpeedLimitation(const int64_t &speedLimitation) = 0; + // signal to implement + signals: + //send information about the copy + void actionInProgess(const Ultracopier::EngineActionInProgress &engineActionInProgress) const; //should update interface information on this event + + void newFolderListing(const std::string &path) const; + void isInPause(const bool &isInPause) const; + + void newActionOnList(const std::vector<Ultracopier::ReturnActionOnCopyList>&) const;///very important, need be temporized to group the modification to do and not flood the interface + void doneTime(const std::vector<std::pair<uint64_t,uint32_t> >&) const; + void syncReady() const; + + /** \brief to get the progression for a specific file + * \param id the id of the transfer, id send during population the transfer list + * first = current transfered byte, second = byte to transfer */ + void pushFileProgression(const std::vector<Ultracopier::ProgressionItem> &progressionList) const; + //get information about the copy + /** \brief to get the general progression + * first = current transfered byte, second = byte to transfer */ + void pushGeneralProgression(const uint64_t &,const uint64_t &) const; + + //when the cancel is clicked on copy engine dialog + void cancelAll() const; + + //when can be deleted + void canBeDeleted() const; + + //send error occurred + void error(const std::string &path,const uint64_t &size,const uint64_t &mtime,const std::string &error) const; + void errorToRetry(const std::string &source,const std::string &destination,const std::string &error) const; + //for the extra logging + void rmPath(const std::string &path) const; + void mkPath(const std::string &path) const; +}; + +/// \brief To define the interface for the factory to do copy engine instance +class PluginInterface_CopyEngineFactory : public QObject +{ + Q_OBJECT + public: + /// \brief to get one instance + virtual PluginInterface_CopyEngine * getInstance() = 0; + /// \brief to set resources, writePath can be empty if read only mode + virtual void setResources(OptionInterface * options,const std::string &writePath,const std::string &pluginPath,FacilityInterface * facilityInterface,const bool &portableVersion) = 0; + //get mode allowed + /// \brief define if can copy file, folder or both + virtual Ultracopier::CopyType getCopyType() = 0; + /// \brief define if can import/export or nothing + virtual Ultracopier::TransferListOperation getTransferListOperation() = 0; + /// \brief define if can only copy, or copy and move + virtual bool canDoOnlyCopy() const = 0; + /// \brief to get the supported protocols for the source + virtual std::vector<std::string> supportedProtocolsForTheSource() const = 0; + /// \brief to get the supported protocols for the destination + virtual std::vector<std::string> supportedProtocolsForTheDestination() const = 0; + /// \brief to get the options of the copy engine + virtual QWidget * options() = 0; + public slots: + /// \brief to reset the options + virtual void resetOptions() = 0; + /// \brief to reload the translation, because the new language have been loaded + virtual void newLanguageLoaded() = 0; + signals: + /// \brief To debug source + void debugInformation(const Ultracopier::DebugLevel &level,const std::string &fonction,const std::string &text,const std::string &file,const int &ligne) const; +}; + +Q_DECLARE_INTERFACE(PluginInterface_CopyEngineFactory,"first-world.info.ultracopier.PluginInterface.CopyEngineFactory/1.2.4.0"); + +#endif // PLUGININTERFACE_COPYENGINE_H diff --git a/interface/PluginInterface_Listener.h b/interface/PluginInterface_Listener.h new file mode 100644 index 0000000..61acb2f --- /dev/null +++ b/interface/PluginInterface_Listener.h @@ -0,0 +1,56 @@ +/** \file PluginInterface_Listener.h +\brief Define the interface of the plugin of type: listener +\author alpha_one_x86 +\licence GPL3, see the file COPYING */ + +#ifndef PLUGININTERFACE_LISTENER_H +#define PLUGININTERFACE_LISTENER_H + +#include <QObject> +#include <string> +#include <vector> + +#include "OptionInterface.h" + +#include "../StructEnumDefinition.h" + +/** \brief To define the interface between Ultracopier and the listener + * */ +class PluginInterface_Listener : public QObject +{ + Q_OBJECT + public: + /// \brief put this plugin in listen mode + virtual void listen() = 0; + /// \brief put close the listen + virtual void close() = 0; + /// \brief to get the error string + virtual const std::string errorString() const = 0; + /// \brief set the resources for the plugin + virtual void setResources(OptionInterface * options,const std::string &writePath,const std::string &pluginPath,const bool &portableVersion) = 0; + /// \brief to get the options widget, NULL if not have + virtual QWidget * options() = 0; + /// \brief to get a client list + virtual std::vector<std::string> clientsList() const = 0; + public slots: + /// \brief send when copy is finished + virtual void transferFinished(const uint32_t &orderId,const bool &withError) = 0; + /// \brief send when copy is canceled + virtual void transferCanceled(const uint32_t &orderId) = 0; + /// \brief to reload the translation, because the new language have been loaded + virtual void newLanguageLoaded() = 0; + signals: + void newState(const Ultracopier::ListeningState &state) const; + void newCopyWithoutDestination(const uint32_t &orderId,const std::vector<std::string> &sources) const; + void newCopy(const uint32_t &orderId,const std::vector<std::string> &sources,const std::string &destination) const; + void newMoveWithoutDestination(const uint32_t &orderId,const std::vector<std::string> &sources) const; + void newMove(const uint32_t &orderId,const std::vector<std::string> &sources,const std::string &destination) const; + void error(const std::string &error) const; + void newClientList() const; + /// \brief To debug source + void debugInformation(const Ultracopier::DebugLevel &level,const std::string &fonction,const std::string &text,const std::string &file,const int &ligne) const; +}; + +Q_DECLARE_INTERFACE(PluginInterface_Listener,"first-world.info.ultracopier.PluginInterface.Listener/1.2.4.0"); + +#endif // PLUGININTERFACE_LISTENER_H diff --git a/interface/PluginInterface_PluginLoader.h b/interface/PluginInterface_PluginLoader.h new file mode 100644 index 0000000..c702003 --- /dev/null +++ b/interface/PluginInterface_PluginLoader.h @@ -0,0 +1,39 @@ +/** \file PluginInterface_PluginLoader.h +\brief Define the interface of the plugin of type: plugin loader +\author alpha_one_x86 +\licence GPL3, see the file COPYING */ + +#ifndef PLUGININTERFACE_PLUGINLOADER_H +#define PLUGININTERFACE_PLUGINLOADER_H + +#include <string> + +#include "OptionInterface.h" + +#include "../StructEnumDefinition.h" + +/** \brief To define the interface between Ultracopier and the plugin loader + * */ +class PluginInterface_PluginLoader : public QObject +{ + Q_OBJECT + public: + /// \brief try enable/disable the catching + virtual void setEnabled(const bool &enabled) = 0; + /// \brief to set resources, writePath can be empty if read only mode + virtual void setResources(OptionInterface * options,const std::string &writePath,const std::string &pluginPath,const bool &portableVersion) = 0; + /// \brief to get the options widget, NULL if not have + virtual QWidget * options() = 0; + public slots: + /// \brief to reload the translation, because the new language have been loaded + virtual void newLanguageLoaded() = 0; + // signal to implement + signals: + void newState(const Ultracopier::CatchState &catchstate) const; + /// \brief To debug source + void debugInformation(const Ultracopier::DebugLevel &level,const std::string &fonction,const std::string &text,const std::string &file,const int &ligne) const; +}; + +Q_DECLARE_INTERFACE(PluginInterface_PluginLoader,"first-world.info.ultracopier.PluginInterface.PluginLoader/1.2.4.0"); + +#endif // PLUGININTERFACE_PLUGINLOADER_H diff --git a/interface/PluginInterface_SessionLoader.h b/interface/PluginInterface_SessionLoader.h new file mode 100644 index 0000000..d0cd366 --- /dev/null +++ b/interface/PluginInterface_SessionLoader.h @@ -0,0 +1,39 @@ +/** \file PluginInterface_SessionLoader.h +\brief Define the interface of the plugin of type: session loader +\author alpha_one_x86 +\licence GPL3, see the file COPYING */ + +#ifndef PLUGININTERFACE_SESSIONLOADER_H +#define PLUGININTERFACE_SESSIONLOADER_H + +#include <string> + +#include "OptionInterface.h" + +#include "../StructEnumDefinition.h" + +/** \brief To define the interface between Ultracopier and the session loader + * */ +class PluginInterface_SessionLoader : public QObject +{ + Q_OBJECT + public: + /// \brief set enabled/disabled + virtual void setEnabled(const bool &enabled) = 0; + /// \brief get if is enabled + virtual bool getEnabled() const = 0; + /// \brief set the resources + virtual void setResources(OptionInterface * options,const std::string &writePath,const std::string &pluginPath,const bool &portableVersion) = 0; + /// \brief to get the options widget, NULL if not have + virtual QWidget * options() = 0; + public slots: + /// \brief to reload the translation, because the new language have been loaded + virtual void newLanguageLoaded() = 0; + signals: + /// \brief To debug source + void debugInformation(const Ultracopier::DebugLevel &level,const std::string &fonction,const std::string &text,const std::string &file,const int &ligne) const; +}; + +Q_DECLARE_INTERFACE(PluginInterface_SessionLoader,"first-world.info.ultracopier.PluginInterface.SessionLoader/1.2.4.0"); + +#endif // PLUGININTERFACE_SESSIONLOADER_H diff --git a/interface/PluginInterface_Themes.h b/interface/PluginInterface_Themes.h new file mode 100644 index 0000000..7272c79 --- /dev/null +++ b/interface/PluginInterface_Themes.h @@ -0,0 +1,115 @@ +/** \file PluginInterface_Themes.h +\brief Define the interface of the plugin of type: copy engine +\author alpha_one_x86 +\licence GPL3, see the file COPYING */ + +#ifndef PLUGININTERFACE_THEMES_H +#define PLUGININTERFACE_THEMES_H + +#include <vector> +#include <string> +#include <QObject> +#include <QWidget> +#include <utility> +#include <QIcon> + +#include "OptionInterface.h" +#include "FacilityInterface.h" +#include "../StructEnumDefinition.h" + +/** \brief To define the interface between Ultracopier and the interface + * */ +class PluginInterface_Themes : public QWidget +{ + Q_OBJECT + public slots: + //send information about the copy + /// \brief to set the action in progress + virtual void actionInProgess(const Ultracopier::EngineActionInProgress&) = 0; + + /// \brief the new folder is listing + virtual void newFolderListing(const std::string &path) = 0; + /** \brief show the detected speed + * in byte per seconds */ + virtual void detectedSpeed(const uint64_t &speed) = 0; + /** \brief show the remaining time + * time in seconds */ + virtual void remainingTime(const int &remainingSeconds) = 0; + /// \brief set one error is detected + virtual void errorDetected() = 0; + /// \brief new error + virtual void errorToRetry(const std::string &source,const std::string &destination,const std::string &error) = 0; + /** \brief support speed limitation */ + virtual void setSupportSpeedLimitation(const bool &supportSpeedLimitationBool) = 0; + /// \brief get action on the transfer list (add/move/remove) + virtual void getActionOnList(const std::vector<Ultracopier::ReturnActionOnCopyList> &returnActions) = 0; + /// \brief show the general progression + virtual void setGeneralProgression(const uint64_t ¤t,const uint64_t &total) = 0; + /// \brief show the file progression + virtual void setFileProgression(const std::vector<Ultracopier::ProgressionItem> &progressionList) = 0; + public: + /// \brief get the widget for the copy engine + virtual QWidget * getOptionsEngineWidget() = 0; + /// \brief to set if the copy engine is found + virtual void getOptionsEngineEnabled(const bool &isEnabled) = 0; + /// \brief set the copyType -> file or folder + virtual void setCopyType(const Ultracopier::CopyType&) = 0; + /// \brief set the copyMove -> copy or move, to force in copy or move, else support both + virtual void forceCopyMode(const Ultracopier::CopyMode&) = 0; + /// \brief set if transfer list is exportable/importable + virtual void setTransferListOperation(const Ultracopier::TransferListOperation &transferListOperation) = 0; + /** \brief set if the order is external (like file manager copy) + * to notify the interface, which can hide add folder/filer button */ + virtual void haveExternalOrder() = 0; + /// \brief set if is in pause + virtual void isInPause(const bool &isInPause) = 0; + // signal to implement + signals: + //set the transfer list + void removeItems(const std::vector<uint64_t> &ids) const; + void moveItemsOnTop(const std::vector<uint64_t> &ids) const; + void moveItemsUp(const std::vector<uint64_t> &ids) const; + void moveItemsDown(const std::vector<uint64_t> &ids) const; + void moveItemsOnBottom(const std::vector<uint64_t> &ids) const; + void exportTransferList() const; + void importTransferList() const; + void exportErrorIntoTransferList() const; + //user ask ask to add folder (add it with interface ask source/destination) + void userAddFolder(const Ultracopier::CopyMode &mode) const; + void userAddFile(const Ultracopier::CopyMode &mode) const; + void urlDropped(const std::vector<std::string> &urls) const; + //action on the copy + void pause() const; + void resume() const; + void skip(const uint64_t &id) const; + void cancel() const; + //edit the action + void newSpeedLimitation(const uint64_t &speedLimitation) const;///< -1 if not able, 0 if disabled +}; + +/// \brief To define the interface for the factory to do themes instance +class PluginInterface_ThemesFactory : public QObject +{ + Q_OBJECT + public: + /// \brief to get one instance + virtual PluginInterface_Themes * getInstance() = 0; + /// \brief to set resources, writePath can be empty if read only mode + virtual void setResources(OptionInterface * options,const std::string &writePath,const std::string &pluginPath,FacilityInterface * facilityInterface,const bool &portableVersion) = 0; + /// \brief to get the default options widget + virtual QWidget * options() = 0; + /// \brief to get a resource icon + virtual QIcon getIcon(const std::string &fileName) const = 0; + public slots: + /// \brief to reset as default the local options + virtual void resetOptions() = 0; + /// \brief retranslate the language because the language have changed + virtual void newLanguageLoaded() = 0; + signals: + /// \brief To debug source + void debugInformation(const Ultracopier::DebugLevel &level,const std::string &fonction,const std::string &text,const std::string &file,const int &ligne) const; +}; + +Q_DECLARE_INTERFACE(PluginInterface_ThemesFactory,"first-world.info.ultracopier.PluginInterface.ThemesFactory/1.2.4.0"); + +#endif // PLUGININTERFACE_THEMES_H |