summaryrefslogtreecommitdiff
path: root/plugins/Listener/catchcopy-v0002/listener.h
blob: 8956abcae83012b5565ee95481aa50f21223dedf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/** \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 <QString>
#ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT
#include <QtPlugin>
#endif

#include "Environment.h"
#include "../../../interface/PluginInterface_Listener.h"
#include "catchcopy-api-0002/ServerCatchcopy.h"

/// \brief Define the server compatible with Ultracopier interface
class Listener : public PluginInterface_Listener
{
    Q_OBJECT
    #ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT
    Q_PLUGIN_METADATA(IID "first-world.info.ultracopier.PluginInterface.Listener/1.0.0.0" FILE "plugin.json")
    Q_INTERFACES(PluginInterface_Listener)
    #endif
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();
    /// \brief to get a client list
    QStringList clientsList() const;
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:
    ServerCatchcopy server;
private slots:
    void errorInternal(const QString &string);
    void communicationErrorInternal(const QString &string);
    void clientName(quint32 client,QString name);
    void copyWithoutDestination(const quint32 &orderId,const QStringList &sources);
    void copy(const quint32 &orderId,const QStringList &sources,const QString &destination);
    void moveWithoutDestination(const quint32 &orderId,const QStringList &sources);
    void move(const quint32 &orderId,const QStringList &sources,const QString &destination);
};

#endif // SERVER_H