summaryrefslogtreecommitdiff
path: root/plugins/Listener
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Listener')
-rw-r--r--plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ClientCatchcopy.cpp558
-rw-r--r--plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ExtraSocketCatchcopy.cpp6
-rw-r--r--plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ExtraSocketCatchcopy.h3
-rw-r--r--plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ServerCatchcopy.cpp172
-rw-r--r--plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ServerCatchcopy.h112
-rw-r--r--plugins/Listener/catchcopy-v0002/documentation.dox3
-rw-r--r--plugins/Listener/catchcopy-v0002/informations.xml2
-rw-r--r--plugins/Listener/catchcopy-v0002/listener.cpp47
-rw-r--r--plugins/Listener/catchcopy-v0002/listener.h26
-rw-r--r--plugins/Listener/catchcopy-v0002/listener.pro29
-rw-r--r--plugins/Listener/dbus/Catchcopy.cpp17
-rw-r--r--plugins/Listener/dbus/Catchcopy.h20
-rw-r--r--plugins/Listener/dbus/DebugEngineMacro.h28
-rw-r--r--plugins/Listener/dbus/Environment.h10
-rw-r--r--plugins/Listener/dbus/StructEnumDefinition.h1
-rw-r--r--plugins/Listener/dbus/Variable.h15
-rw-r--r--plugins/Listener/dbus/documentation.dox37
-rw-r--r--plugins/Listener/dbus/informations.xml26
-rw-r--r--plugins/Listener/dbus/listener.cpp85
-rw-r--r--plugins/Listener/dbus/listener.h49
-rw-r--r--plugins/Listener/dbus/listener.pro13
-rw-r--r--plugins/Listener/dbus/plugin.json1
22 files changed, 502 insertions, 758 deletions
diff --git a/plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ClientCatchcopy.cpp b/plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ClientCatchcopy.cpp
index d7492d0..c466630 100644
--- a/plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ClientCatchcopy.cpp
+++ b/plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ClientCatchcopy.cpp
@@ -10,370 +10,370 @@
ClientCatchcopy::ClientCatchcopy()
{
- disconnectedFromSocket();
- error_string="Unknown error";
- detectTimeOut.setSingleShot(true);
- detectTimeOut.setInterval(CATCHCOPY_COMMUNICATION_TIMEOUT); // the max time to without send packet
- connect(&socket, SIGNAL(connected()), this, SIGNAL(connected()));
- connect(&socket, SIGNAL(disconnected()), this, SIGNAL(disconnected()));
- connect(&socket, SIGNAL(disconnected()), this, SLOT(disconnectedFromSocket()));
- connect(&socket, SIGNAL(stateChanged(QLocalSocket::LocalSocketState)), this, SIGNAL(stateChanged(QLocalSocket::LocalSocketState)));
- connect(&socket, SIGNAL(error(QLocalSocket::LocalSocketError)), this, SIGNAL(errorSocket(QLocalSocket::LocalSocketError)));
- connect(&socket, SIGNAL(readyRead()), this, SLOT(readyRead()));
- connect(&detectTimeOut, SIGNAL(timeout()), this, SLOT(checkTimeOut()));
- connect(&socket, SIGNAL(connected()), this, SLOT(socketIsConnected()));
+ disconnectedFromSocket();
+ error_string="Unknown error";
+ detectTimeOut.setSingleShot(true);
+ detectTimeOut.setInterval(CATCHCOPY_COMMUNICATION_TIMEOUT); // the max time to without send packet
+ connect(&socket, SIGNAL(connected()), this, SIGNAL(connected()));
+ connect(&socket, SIGNAL(disconnected()), this, SIGNAL(disconnected()));
+ connect(&socket, SIGNAL(disconnected()), this, SLOT(disconnectedFromSocket()));
+ connect(&socket, SIGNAL(stateChanged(QLocalSocket::LocalSocketState)), this, SIGNAL(stateChanged(QLocalSocket::LocalSocketState)));
+ connect(&socket, SIGNAL(error(QLocalSocket::LocalSocketError)), this, SIGNAL(errorSocket(QLocalSocket::LocalSocketError)));
+ connect(&socket, SIGNAL(readyRead()), this, SLOT(readyRead()));
+ connect(&detectTimeOut, SIGNAL(timeout()), this, SLOT(checkTimeOut()));
+ connect(&socket, SIGNAL(connected()), this, SLOT(socketIsConnected()));
}
void ClientCatchcopy::checkTimeOut()
{
- if(haveData)
- {
- error_string="The server is too long to send the next part of the reply";
- emit error(error_string);
- disconnectFromServer();
- }
+ if(haveData)
+ {
+ error_string="The server is too long to send the next part of the reply";
+ emit error(error_string);
+ disconnectFromServer();
+ }
}
const QString ClientCatchcopy::errorString()
{
- return error_string;
+ return error_string;
}
void ClientCatchcopy::socketIsConnected()
{
- orderIdFirstSendProtocol=sendProtocol();
+ orderIdFirstSendProtocol=sendProtocol();
}
void ClientCatchcopy::connectToServer()
{
- socket.connectToServer(ExtraSocketCatchcopy::pathSocket());
+ socket.connectToServer(QString::fromStdString(ExtraSocketCatchcopy::pathSocket()));
}
void ClientCatchcopy::disconnectFromServer()
{
- socket.abort();
- socket.disconnectFromServer();
+ socket.abort();
+ socket.disconnectFromServer();
}
const QString ClientCatchcopy::errorStringSocket()
{
- return socket.errorString();
+ return socket.errorString();
}
/// \brief to send stream of string list
quint32 ClientCatchcopy::sendRawOrderList(const QStringList & order)
{
- if(!socket.isValid())
- {
- error_string="Socket is not valid, try send: "+order.join(";");
- emit error(error_string);
- return -1;
- }
- if(socket.state()!=QLocalSocket::ConnectedState)
- {
- error_string="Socket is not connected "+QString::number(socket.state());
- emit error(error_string);
- return -1;
- }
- do
- {
- idNextOrder++;
- if(idNextOrder>2000000000)
- idNextOrder=0;
- } while(notRepliedQuery.contains(idNextOrder));
- notRepliedQuery << idNextOrder;
- QByteArray block;
- QDataStream out(&block, QIODevice::WriteOnly);
- out.setVersion(QDataStream::Qt_4_4);
- out << int(0);
- out << idNextOrder;
- out << order;
- out.device()->seek(0);
- out << block.size();
- if(idNextOrder!=1) // drop if internal protocol send
- {
- emit dataSend(idNextOrder,block);
- emit dataSend(idNextOrder,order);
- }
- do //cut string list and send it as block of 32KB
- {
- QByteArray blockToSend;
- int byteWriten;
- blockToSend=block.left(32*1024);//32KB
- block.remove(0,blockToSend.size());
- byteWriten = socket.write(blockToSend);
- if(!socket.isValid())
- {
- error_string="Socket is not valid";
- emit error(error_string);
- return -1;
- }
- if(socket.errorString()!="Unknown error" && socket.errorString()!="")
- {
- error_string=socket.errorString();
- emit error(error_string);
- return -1;
- }
- if(blockToSend.size()!=byteWriten)
- {
- error_string="All the bytes have not be written";
- emit error(error_string);
- return -1;
- }
- }
- while(block.size());
- return idNextOrder;
+ if(!socket.isValid())
+ {
+ error_string="Socket is not valid, try send: "+order.join(";");
+ emit error(error_string);
+ return -1;
+ }
+ if(socket.state()!=QLocalSocket::ConnectedState)
+ {
+ error_string="Socket is not connected "+QString::number(socket.state());
+ emit error(error_string);
+ return -1;
+ }
+ do
+ {
+ idNextOrder++;
+ if(idNextOrder>2000000000)
+ idNextOrder=0;
+ } while(notRepliedQuery.contains(idNextOrder));
+ notRepliedQuery << idNextOrder;
+ QByteArray block;
+ QDataStream out(&block, QIODevice::WriteOnly);
+ out.setVersion(QDataStream::Qt_4_4);
+ out << int(0);
+ out << idNextOrder;
+ out << order;
+ out.device()->seek(0);
+ out << block.size();
+ if(idNextOrder!=1) // drop if internal protocol send
+ {
+ emit dataSend(idNextOrder,block);
+ emit dataSend(idNextOrder,order);
+ }
+ do //cut string list and send it as block of 32KB
+ {
+ QByteArray blockToSend;
+ int byteWriten;
+ blockToSend=block.left(32*1024);//32KB
+ block.remove(0,blockToSend.size());
+ byteWriten = socket.write(blockToSend);
+ if(!socket.isValid())
+ {
+ error_string="Socket is not valid";
+ emit error(error_string);
+ return -1;
+ }
+ if(socket.errorString()!="Unknown error" && socket.errorString()!="")
+ {
+ error_string=socket.errorString();
+ emit error(error_string);
+ return -1;
+ }
+ if(blockToSend.size()!=byteWriten)
+ {
+ error_string="All the bytes have not be written";
+ emit error(error_string);
+ return -1;
+ }
+ }
+ while(block.size());
+ return idNextOrder;
}
void ClientCatchcopy::readyRead()
{
- while(socket.bytesAvailable()>0)
- {
- if(!haveData)
- {
- if(socket.bytesAvailable()<(int)sizeof(int))//int of size cuted
- {
- /* error_string="Bytes available is not sufficient to do a int";
- emit error(error_string);
- disconnectFromServer();*/
- return;
- }
- QDataStream in(&socket);
- in.setVersion(QDataStream::Qt_4_4);
- in >> dataSize;
- dataSize-=sizeof(int);
- if(dataSize>64*1024*1024) // 64MB
- {
- error_string="Reply size is >64MB, seam corrupted";
- emit error(error_string);
- disconnectFromServer();
- return;
- }
- if(dataSize<(int)(sizeof(int) //orderId
- + sizeof(quint32) //returnCode
- + sizeof(quint32) //string list size
- ))
- {
- error_string="Reply size is too small to have correct code";
- emit error(error_string);
- disconnectFromServer();
- return;
- }
- }
- if(dataSize<(data.size()+socket.bytesAvailable()))
- data.append(socket.read(dataSize-data.size()));
- else
- data.append(socket.readAll());
- if(dataSize==data.size())
- {
- if(!checkDataIntegrity(data))
- {
- data.clear();
- qWarning() << "Data of the reply is wrong";
- return;
- }
- QStringList returnList;
- quint32 orderId;
- quint32 returnCode;
- QDataStream in(data);
- in.setVersion(QDataStream::Qt_4_4);
- in >> orderId;
- in >> returnCode;
- in >> returnList;
- data.clear();
- if(orderId!=orderIdFirstSendProtocol)
- {
- if(!notRepliedQuery.contains(orderId))
- qWarning() << "Unknown query not replied:" << orderId;
- else
- {
- if(!parseReply(orderId,returnCode,returnList))
- emit unknowReply(orderId);
- emit newReply(orderId,returnCode,returnList);
- }
- }
- else
- {
- if(!sendProtocolReplied)
- {
- sendProtocolReplied=true;
- if(returnCode!=1000)
- {
- error_string="Protocol not supported";
- emit error(error_string);
- disconnectFromServer();
- return;
- }
- }
- else
- {
- error_string=QStringLiteral("First send protocol send with the query id %1 have been already previously replied").arg(orderIdFirstSendProtocol);
- emit error(error_string);
- disconnectFromServer();
- return;
- }
- }
- }
- }
- if(haveData)
- detectTimeOut.start();
- else
- detectTimeOut.stop();
+ while(socket.bytesAvailable()>0)
+ {
+ if(!haveData)
+ {
+ if(socket.bytesAvailable()<(int)sizeof(int))//int of size cuted
+ {
+ /* error_string="Bytes available is not sufficient to do a int";
+ emit error(error_string);
+ disconnectFromServer();*/
+ return;
+ }
+ QDataStream in(&socket);
+ in.setVersion(QDataStream::Qt_4_4);
+ in >> dataSize;
+ dataSize-=sizeof(int);
+ if(dataSize>64*1024*1024) // 64MB
+ {
+ error_string="Reply size is >64MB, seam corrupted";
+ emit error(error_string);
+ disconnectFromServer();
+ return;
+ }
+ if(dataSize<(int)(sizeof(int) //orderId
+ + sizeof(quint32) //returnCode
+ + sizeof(quint32) //string list size
+ ))
+ {
+ error_string="Reply size is too small to have correct code";
+ emit error(error_string);
+ disconnectFromServer();
+ return;
+ }
+ }
+ if(dataSize<(data.size()+socket.bytesAvailable()))
+ data.append(socket.read(dataSize-data.size()));
+ else
+ data.append(socket.readAll());
+ if(dataSize==data.size())
+ {
+ if(!checkDataIntegrity(data))
+ {
+ data.clear();
+ qWarning() << "Data of the reply is wrong";
+ return;
+ }
+ QStringList returnList;
+ quint32 orderId;
+ quint32 returnCode;
+ QDataStream in(data);
+ in.setVersion(QDataStream::Qt_4_4);
+ in >> orderId;
+ in >> returnCode;
+ in >> returnList;
+ data.clear();
+ if(orderId!=orderIdFirstSendProtocol)
+ {
+ if(!notRepliedQuery.contains(orderId))
+ qWarning() << "Unknown query not replied:" << orderId;
+ else
+ {
+ if(!parseReply(orderId,returnCode,returnList))
+ emit unknowReply(orderId);
+ emit newReply(orderId,returnCode,returnList);
+ }
+ }
+ else
+ {
+ if(!sendProtocolReplied)
+ {
+ sendProtocolReplied=true;
+ if(returnCode!=1000)
+ {
+ error_string="Protocol not supported";
+ emit error(error_string);
+ disconnectFromServer();
+ return;
+ }
+ }
+ else
+ {
+ error_string=QStringLiteral("First send protocol send with the query id %1 have been already previously replied").arg(orderIdFirstSendProtocol);
+ emit error(error_string);
+ disconnectFromServer();
+ return;
+ }
+ }
+ }
+ }
+ if(haveData)
+ detectTimeOut.start();
+ else
+ detectTimeOut.stop();
}
bool ClientCatchcopy::checkDataIntegrity(QByteArray data)
{
- quint32 orderId;
- qint32 replyCode;
- qint32 listSize;
- QDataStream in(data);
- in.setVersion(QDataStream::Qt_4_4);
- in >> orderId;
- in >> replyCode;
- in >> listSize;
- if(listSize>65535)
- {
- emit error("List size is wrong");
- qWarning() << "List size is wrong";
- return false;
- }
- int index=0;
- while(index<listSize)
- {
- qint32 stringSize;
- in >> stringSize;
- if(stringSize>65535)
- {
- emit error("String size is wrong");
- qWarning() << "String size is wrong";
- return false;
- }
- if(stringSize>(in.device()->size()-in.device()->pos()))
- {
- emit error(QStringLiteral("String size is greater than the data: %1>(%2-%3)").arg(stringSize).arg(in.device()->size()).arg(in.device()->pos()));
- qWarning() << QStringLiteral("String size is greater than the data: %1>(%2-%3)").arg(stringSize).arg(in.device()->size()).arg(in.device()->pos());
- return false;
- }
- in.device()->seek(in.device()->pos()+stringSize);
- index++;
- }
- if(in.device()->size()!=in.device()->pos())
- {
- emit error("Remaining data after string list parsing");
- qWarning() << "Remaining data after string list parsing";
- return false;
- }
- return true;
+ quint32 orderId;
+ qint32 replyCode;
+ qint32 listSize;
+ QDataStream in(data);
+ in.setVersion(QDataStream::Qt_4_4);
+ in >> orderId;
+ in >> replyCode;
+ in >> listSize;
+ if(listSize>65535)
+ {
+ emit error("List size is wrong");
+ qWarning() << "List size is wrong";
+ return false;
+ }
+ int index=0;
+ while(index<listSize)
+ {
+ qint32 stringSize;
+ in >> stringSize;
+ if(stringSize>65535)
+ {
+ emit error("String size is wrong");
+ qWarning() << "String size is wrong";
+ return false;
+ }
+ if(stringSize>(in.device()->size()-in.device()->pos()))
+ {
+ emit error(QStringLiteral("String size is greater than the data: %1>(%2-%3)").arg(stringSize).arg(in.device()->size()).arg(in.device()->pos()));
+ qWarning() << QStringLiteral("String size is greater than the data: %1>(%2-%3)").arg(stringSize).arg(in.device()->size()).arg(in.device()->pos());
+ return false;
+ }
+ in.device()->seek(in.device()->pos()+stringSize);
+ index++;
+ }
+ if(in.device()->size()!=in.device()->pos())
+ {
+ emit error("Remaining data after string list parsing");
+ qWarning() << "Remaining data after string list parsing";
+ return false;
+ }
+ return true;
}
QLocalSocket::LocalSocketState ClientCatchcopy::state()
{
- return socket.state();
+ return socket.state();
}
void ClientCatchcopy::disconnectedFromSocket()
{
- haveData = false;
- orderIdFirstSendProtocol= 0;
- idNextOrder = 0;
- sendProtocolReplied = false;
- notRepliedQuery.clear();
+ haveData = false;
+ orderIdFirstSendProtocol= 0;
+ idNextOrder = 0;
+ sendProtocolReplied = false;
+ notRepliedQuery.clear();
}
/// \brief to send the protocol version used
quint32 ClientCatchcopy::sendProtocol()
{
- return sendRawOrderList(QStringList() << "protocol" << CATCHCOPY_PROTOCOL_VERSION);
+ return sendRawOrderList(QStringList() << "protocol" << CATCHCOPY_PROTOCOL_VERSION);
}
quint32 ClientCatchcopy::askServerName()
{
- return sendRawOrderList(QStringList() << "server" << "name?");
+ return sendRawOrderList(QStringList() << "server" << "name?");
}
quint32 ClientCatchcopy::setClientName(const QString & name)
{
- return sendRawOrderList(QStringList() << "client" << name);
+ return sendRawOrderList(QStringList() << "client" << name);
}
quint32 ClientCatchcopy::checkProtocolExtension(const QString & name)
{
- return sendRawOrderList(QStringList() << "protocol extension" << name);
+ return sendRawOrderList(QStringList() << "protocol extension" << name);
}
quint32 ClientCatchcopy::checkProtocolExtension(const QString & name,const QString & version)
{
- return sendRawOrderList(QStringList() << "protocol extension" << name << version);
+ return sendRawOrderList(QStringList() << "protocol extension" << name << version);
}
quint32 ClientCatchcopy::addCopyWithDestination(const QStringList & sources,const QString & destination)
{
- return sendRawOrderList(QStringList() << "cp" << sources << destination);
+ return sendRawOrderList(QStringList() << "cp" << sources << destination);
}
quint32 ClientCatchcopy::addCopyWithoutDestination(const QStringList & sources)
{
- return sendRawOrderList(QStringList() << "cp-?" << sources);
+ return sendRawOrderList(QStringList() << "cp-?" << sources);
}
quint32 ClientCatchcopy::addMoveWithDestination(const QStringList & sources,const QString & destination)
{
- return sendRawOrderList(QStringList() << "mv" << sources << destination);
+ return sendRawOrderList(QStringList() << "mv" << sources << destination);
}
quint32 ClientCatchcopy::addMoveWithoutDestination(const QStringList & sources)
{
- return sendRawOrderList(QStringList() << "mv-?" << sources);
+ return sendRawOrderList(QStringList() << "mv-?" << sources);
}
bool ClientCatchcopy::parseReply(quint32 orderId,quint32 returnCode,QStringList returnList)
{
- switch(returnCode)
- {
- case 1000:
- emit protocolSupported(orderId);
- break;
- case 1001:
- case 1002:
- if(returnCode==1001)
- emit protocolExtensionSupported(orderId,true);
- else
- emit protocolExtensionSupported(orderId,false);
- break;
- case 1003:
- emit clientRegistered(orderId);
- break;
- case 1004:
- if(returnList.size()!=1)
- emit unknowOrder(orderId);
- else
- emit serverName(orderId,returnList.last());
- break;
- case 1005:
- case 1006:
- if(returnCode==1005)
- emit copyFinished(orderId,false);
- else
- emit copyFinished(orderId,true);
- break;
- case 1007:
- emit copyCanceled(orderId);
- break;
- case 5000:
- emit incorrectArgumentListSize(orderId);
- break;
- case 5001:
- emit incorrectArgument(orderId);
- break;
- case 5002:
- emit unknowOrder(orderId); //the server have not understand the order
- break;
- case 5003:
- emit protocolNotSupported(orderId);
- break;
- default:
- return false;
- }
- return true;
+ switch(returnCode)
+ {
+ case 1000:
+ emit protocolSupported(orderId);
+ break;
+ case 1001:
+ case 1002:
+ if(returnCode==1001)
+ emit protocolExtensionSupported(orderId,true);
+ else
+ emit protocolExtensionSupported(orderId,false);
+ break;
+ case 1003:
+ emit clientRegistered(orderId);
+ break;
+ case 1004:
+ if(returnList.size()!=1)
+ emit unknowOrder(orderId);
+ else
+ emit serverName(orderId,returnList.last());
+ break;
+ case 1005:
+ case 1006:
+ if(returnCode==1005)
+ emit copyFinished(orderId,false);
+ else
+ emit copyFinished(orderId,true);
+ break;
+ case 1007:
+ emit copyCanceled(orderId);
+ break;
+ case 5000:
+ emit incorrectArgumentListSize(orderId);
+ break;
+ case 5001:
+ emit incorrectArgument(orderId);
+ break;
+ case 5002:
+ emit unknowOrder(orderId); //the server have not understand the order
+ break;
+ case 5003:
+ emit protocolNotSupported(orderId);
+ break;
+ default:
+ return false;
+ }
+ return true;
}
diff --git a/plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ExtraSocketCatchcopy.cpp b/plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ExtraSocketCatchcopy.cpp
index 5330492..9cd8373 100644
--- a/plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ExtraSocketCatchcopy.cpp
+++ b/plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ExtraSocketCatchcopy.cpp
@@ -6,17 +6,17 @@
#include <stdio.h>
-const QString ExtraSocketCatchcopy::pathSocket()
+const std::string ExtraSocketCatchcopy::pathSocket()
{
#ifdef Q_OS_UNIX
- return "advanced-copier-"+QString::number(getuid());
+ return "advanced-copier-"+std::to_string(getuid());
#else
QString userName;
char uname[1024];
DWORD len=1023;
if(GetUserNameA(uname, &len)!=FALSE)
userName=QString::fromLatin1(toHex(uname));
- return "advanced-copier-"+userName;
+ return "advanced-copier-"+userName.toStdString();
#endif
}
diff --git a/plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ExtraSocketCatchcopy.h b/plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ExtraSocketCatchcopy.h
index 59c8f93..fb4201c 100644
--- a/plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ExtraSocketCatchcopy.h
+++ b/plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ExtraSocketCatchcopy.h
@@ -6,6 +6,7 @@
#ifndef EXTRASOCKETCATCHCOPY_H
#define EXTRASOCKETCATCHCOPY_H
+#include <string>
#include <QString>
#ifdef Q_OS_UNIX
@@ -23,7 +24,7 @@ class ExtraSocketCatchcopy
{
public:
/// \brief to get the socket path
- static const QString pathSocket();
+ static const std::string pathSocket();
static char * toHex(const char *str);
};
diff --git a/plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ServerCatchcopy.cpp b/plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ServerCatchcopy.cpp
index 83c8790..6fd1172 100644
--- a/plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ServerCatchcopy.cpp
+++ b/plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ServerCatchcopy.cpp
@@ -8,6 +8,22 @@
#include <QFile>
#include <QDataStream>
+#include <queue>
+#include <vector>
+#include <string>
+
+std::string stringimplode2(const std::vector<std::string>& elems, const std::string &delim)
+{
+ std::string newString;
+ for (std::vector<std::string>::const_iterator ii = elems.begin(); ii != elems.cend(); ++ii)
+ {
+ newString += (*ii);
+ if ( ii + 1 != elems.end() ) {
+ newString += delim;
+ }
+ }
+ return newString;
+}
ServerCatchcopy::ServerCatchcopy()
{
@@ -27,25 +43,25 @@ bool ServerCatchcopy::isListening() const
return server.isListening();
}
-void ServerCatchcopy::setName(const QString & name)
+void ServerCatchcopy::setName(const std::string & name)
{
this->name=name;
}
-QString ServerCatchcopy::getName() const
+std::string ServerCatchcopy::getName() const
{
return name;
}
/// \brief to get a client list
-QStringList ServerCatchcopy::clientsList() const
+std::vector<std::string> ServerCatchcopy::clientsList() const
{
- QStringList clients;
+ std::vector<std::string> clients;
int index=0;
int size=clientList.size();
while(index<size)
{
- clients << clientList[index].name;
+ clients.push_back(clientList[index].name);
index++;
}
return clients;
@@ -55,7 +71,7 @@ bool ServerCatchcopy::listen()
{
QLocalSocket socketTestConnection;
pathSocket=ExtraSocketCatchcopy::pathSocket();
- socketTestConnection.connectToServer(pathSocket);
+ socketTestConnection.connectToServer(QString::fromStdString(pathSocket));
if(socketTestConnection.waitForConnected(CATCHCOPY_COMMUNICATION_TIMEOUT))
{
error_string="Other server is listening";
@@ -64,7 +80,7 @@ bool ServerCatchcopy::listen()
}
else
{
- if(!server.removeServer(pathSocket))
+ if(!server.removeServer(QString::fromStdString(pathSocket)))
{
error_string="Unable to remove the old server";
emit error(error_string);
@@ -72,11 +88,11 @@ bool ServerCatchcopy::listen()
#ifndef Q_OS_MAC
server.setSocketOptions(QLocalServer::UserAccessOption);
#endif
- if(server.listen(pathSocket))
+ if(server.listen(QString::fromStdString(pathSocket)))
return true;
else
{
- error_string=QStringLiteral("Unable to listen %1: %2").arg(pathSocket).arg(server.errorString());
+ error_string=QStringLiteral("Unable to listen %1: %2").arg(QString::fromStdString(pathSocket)).arg(server.errorString()).toStdString();
emit error(error_string);
return false;
}
@@ -94,7 +110,7 @@ void ServerCatchcopy::close()
index++;
}
server.close();
- if(!server.removeServer(pathSocket))
+ if(!server.removeServer(QString::fromStdString(pathSocket)))
{
error_string="Unable to remove the old server";
emit error(error_string);
@@ -102,12 +118,12 @@ void ServerCatchcopy::close()
}
}
-const QString ServerCatchcopy::errorStringServer() const
+const std::string ServerCatchcopy::errorStringServer() const
{
- return server.errorString();
+ return server.errorString().toStdString();
}
-const QString ServerCatchcopy::errorString() const
+const std::string ServerCatchcopy::errorString() const
{
return error_string;
}
@@ -145,7 +161,7 @@ void ServerCatchcopy::newConnection()
}
}
-bool ServerCatchcopy::clientIdFound(const quint32 &id) const
+bool ServerCatchcopy::clientIdFound(const uint32_t &id) const
{
int index=0;
while(index<clientList.size())
@@ -195,7 +211,7 @@ void ServerCatchcopy::disconnected()
{
if(clientList.at(index).socket==socket)
{
- const quint32 &id=clientList.at(index).id;
+ const uint32_t &id=clientList.at(index).id;
//ClientList.at(index).socket->disconnectFromServer();//already disconnected
delete clientList.at(index).detectTimeOut;
clientList.at(index).socket->deleteLater();
@@ -208,7 +224,7 @@ void ServerCatchcopy::disconnected()
qWarning() << "Unlocated client!";
}
-void ServerCatchcopy::disconnectClient(const quint32 &id)
+void ServerCatchcopy::disconnectClient(const uint32_t &id)
{
int index=0;
while(index<clientList.size())
@@ -259,8 +275,8 @@ void ServerCatchcopy::readyRead()
return;
}
if(clientList.at(index).dataSize<(int)(sizeof(int) //orderId
- + sizeof(quint32) //returnCode
- + sizeof(quint32) //string list size
+ + sizeof(uint32_t) //returnCode
+ + sizeof(uint32_t) //string list size
))
{
error_string="Reply size is too small to have correct code";
@@ -274,22 +290,31 @@ void ServerCatchcopy::readyRead()
clientList[index].data.append(socket->read(clientList.at(index).dataSize-clientList.at(index).data.size()));
else
clientList[index].data.append(socket->readAll());
- if(clientList.at(index).dataSize==(quint32)clientList.at(index).data.size())
+ if(clientList.at(index).dataSize==(uint32_t)clientList.at(index).data.size())
{
if(!checkDataIntegrity(clientList.at(index).data))
{
- emit communicationError("Data integrity wrong: "+QString(clientList.at(index).data.toHex()));
+ emit communicationError("Data integrity wrong: "+QString(clientList.at(index).data.toHex()).toStdString());
clientList[index].data.clear();
clientList[index].haveData=false;
qWarning() << "Data integrity wrong";
return;
}
- QStringList returnList;
- quint32 orderId;
+ std::vector<std::string> returnList;
+ QStringList returnListQt;
+ uint32_t orderId;
QDataStream in(clientList.at(index).data);
in.setVersion(QDataStream::Qt_4_4);
in >> orderId;
- in >> returnList;
+ in >> returnListQt;
+ {
+ int index=0;
+ while(index<returnListQt.size())
+ {
+ returnList.push_back(returnListQt.at(index).toStdString());
+ index++;
+ }
+ }
clientList[index].data.clear();
clientList[index].haveData=false;
if(clientList.at(index).queryNoReplied.contains(orderId))
@@ -299,10 +324,10 @@ void ServerCatchcopy::readyRead()
return;
}
clientList[index].queryNoReplied << orderId;
- if(!clientList.at(index).firstProtocolReplied && returnList.size()==2 && returnList.first()=="protocol")
+ if(!clientList.at(index).firstProtocolReplied && returnList.size()==2 && returnList.front()=="protocol")
{
clientList[index].firstProtocolReplied=true;
- protocolSupported(clientList.at(index).id,orderId,(returnList.last()==CATCHCOPY_PROTOCOL_VERSION));
+ protocolSupported(clientList.at(index).id,orderId,(returnList.back()==CATCHCOPY_PROTOCOL_VERSION));
}
else
parseInput(clientList.at(index).id,orderId,returnList);
@@ -322,7 +347,7 @@ void ServerCatchcopy::readyRead()
bool ServerCatchcopy::checkDataIntegrity(const QByteArray &data)
{
- quint32 orderId;
+ uint32_t orderId;
qint32 listSize;
QDataStream in(data);
in.setVersion(QDataStream::Qt_4_4);
@@ -346,7 +371,7 @@ bool ServerCatchcopy::checkDataIntegrity(const QByteArray &data)
}
if(stringSize>(in.device()->size()-in.device()->pos()))
{
- emit error(QStringLiteral("String size is greater than the data: %1>(%2-%3)").arg(stringSize).arg(in.device()->size()).arg(in.device()->pos()));
+ emit error(QStringLiteral("String size is greater than the data: %1>(%2-%3)").arg(stringSize).arg(in.device()->size()).arg(in.device()->pos()).toStdString());
return false;
}
in.device()->seek(in.device()->pos()+stringSize);
@@ -360,7 +385,7 @@ bool ServerCatchcopy::checkDataIntegrity(const QByteArray &data)
return true;
}
-void ServerCatchcopy::parseInput(const quint32 &client,const quint32 &orderId,const QStringList &returnList)
+void ServerCatchcopy::parseInput(const uint32_t &client,const uint32_t &orderId,const std::vector<std::string> &returnList)
{
const ServerCatchcopy::inputReturnType returnVal=parseInputCurrentProtocol(client,orderId,returnList);
switch(returnVal)
@@ -380,24 +405,24 @@ void ServerCatchcopy::parseInput(const quint32 &client,const quint32 &orderId,co
incorrectArgumentListSize(client,orderId);
break;
case UnknowOrder:
- emit error("Unknown query: "+QString::number(returnVal)+", with client: "+QString::number(client)+", orderId: "+QString::number(orderId)+", returnList: "+returnList.join(", "));
+ emit error("Unknown query: "+std::to_string(returnVal)+", with client: "+std::to_string(client)+", orderId: "+std::to_string(orderId)+", returnList: "+stringimplode2(returnList,", "));
qWarning() << "Unknown query";
unknowOrder(client,orderId);
break;
}
}
-ServerCatchcopy::inputReturnType ServerCatchcopy::parseInputCurrentProtocol(const quint32 &client,const quint32 &orderId,const QStringList &returnList)
+ServerCatchcopy::inputReturnType ServerCatchcopy::parseInputCurrentProtocol(const uint32_t &client,const uint32_t &orderId,const std::vector<std::string> &returnList)
{
if(returnList.size()==0)
return WrongArgumentListSize;
//if is supported
- QString firstArgument=returnList.first();
+ std::string firstArgument=returnList.front();
if(firstArgument=="protocol")
{
if(returnList.size()!=2)
return WrongArgumentListSize;
- emit askProtocolCompatibility(client,orderId,returnList.last());
+ emit askProtocolCompatibility(client,orderId,returnList.back());
return Ok;
}
else if(firstArgument=="protocol extension")
@@ -416,12 +441,12 @@ ServerCatchcopy::inputReturnType ServerCatchcopy::parseInputCurrentProtocol(cons
{
if(clientList.at(index).id==client)
{
- clientList[index].name=returnList.last();
+ clientList[index].name=returnList.back();
break;
}
index++;
}
- emit clientName(client,returnList.last());
+ emit clientName(client,returnList.back());
clientRegistered(client,orderId);
return Replied;
}
@@ -429,7 +454,7 @@ ServerCatchcopy::inputReturnType ServerCatchcopy::parseInputCurrentProtocol(cons
{
if(returnList.size()!=2)
return WrongArgumentListSize;
- if(returnList.last()!="name?")
+ if(returnList.back()!="name?")
return WrongArgument;
serverName(client,orderId,name);
return Replied;
@@ -438,18 +463,18 @@ ServerCatchcopy::inputReturnType ServerCatchcopy::parseInputCurrentProtocol(cons
{
if(returnList.size()<3)
return WrongArgumentListSize;
- QStringList sourceList=returnList;
- sourceList.removeFirst();
- sourceList.removeLast();
- emitNewCopy(client,orderId,sourceList,returnList.last());
+ std::vector<std::string> sourceList=returnList;
+ sourceList.erase(sourceList.cbegin());
+ sourceList.pop_back();
+ emitNewCopy(client,orderId,sourceList,returnList.back());
return Ok;
}
else if(firstArgument=="cp-?")
{
if(returnList.size()<2)
return WrongArgumentListSize;
- QStringList sourceList=returnList;
- sourceList.removeFirst();
+ std::vector<std::string> sourceList=returnList;
+ sourceList.erase(sourceList.cbegin());
emitNewCopyWithoutDestination(client,orderId,sourceList);
return Ok;
}
@@ -457,18 +482,18 @@ ServerCatchcopy::inputReturnType ServerCatchcopy::parseInputCurrentProtocol(cons
{
if(returnList.size()<3)
return WrongArgumentListSize;
- QStringList sourceList=returnList;
- sourceList.removeFirst();
- sourceList.removeLast();
- emitNewMove(client,orderId,sourceList,returnList.last());
+ std::vector<std::string> sourceList=returnList;
+ sourceList.erase(sourceList.cbegin());
+ sourceList.pop_back();
+ emitNewMove(client,orderId,sourceList,returnList.back());
return Ok;
}
else if(firstArgument=="mv-?")
{
if(returnList.size()<2)
return WrongArgumentListSize;
- QStringList sourceList=returnList;
- sourceList.removeFirst();
+ std::vector<std::string> sourceList=returnList;
+ sourceList.erase(sourceList.cbegin());
emitNewMoveWithoutDestination(client,orderId,sourceList);
return Ok;
}
@@ -476,7 +501,7 @@ ServerCatchcopy::inputReturnType ServerCatchcopy::parseInputCurrentProtocol(cons
return UnknowOrder;
}
-void ServerCatchcopy::emitNewCopyWithoutDestination(const quint32 &client,const quint32 &orderId,const QStringList &sources)
+void ServerCatchcopy::emitNewCopyWithoutDestination(const uint32_t &client,const uint32_t &orderId,const std::vector<std::string> &sources)
{
LinkGlobalToLocalClient newAssociation;
newAssociation.idClient=client;
@@ -486,7 +511,7 @@ void ServerCatchcopy::emitNewCopyWithoutDestination(const quint32 &client,const
emit newCopyWithoutDestination(newAssociation.globalOrderId,sources);
}
-void ServerCatchcopy::emitNewCopy(const quint32 &client,const quint32 &orderId,const QStringList &sources,const QString &destination)
+void ServerCatchcopy::emitNewCopy(const uint32_t &client,const uint32_t &orderId,const std::vector<std::string> &sources,const std::string &destination)
{
LinkGlobalToLocalClient newAssociation;
newAssociation.idClient=client;
@@ -496,7 +521,7 @@ void ServerCatchcopy::emitNewCopy(const quint32 &client,const quint32 &orderId,c
emit newCopy(newAssociation.globalOrderId,sources,destination);
}
-void ServerCatchcopy::emitNewMoveWithoutDestination(const quint32 &client,const quint32 &orderId,const QStringList &sources)
+void ServerCatchcopy::emitNewMoveWithoutDestination(const uint32_t &client,const uint32_t &orderId,const std::vector<std::string> &sources)
{
LinkGlobalToLocalClient newAssociation;
newAssociation.idClient=client;
@@ -506,7 +531,7 @@ void ServerCatchcopy::emitNewMoveWithoutDestination(const quint32 &client,const
emit newMoveWithoutDestination(newAssociation.globalOrderId,sources);
}
-void ServerCatchcopy::emitNewMove(const quint32 &client,const quint32 &orderId,const QStringList &sources,const QString &destination)
+void ServerCatchcopy::emitNewMove(const uint32_t &client,const uint32_t &orderId,const std::vector<std::string> &sources,const std::string &destination)
{
LinkGlobalToLocalClient newAssociation;
newAssociation.idClient=client;
@@ -516,7 +541,7 @@ void ServerCatchcopy::emitNewMove(const quint32 &client,const quint32 &orderId,c
emit newMove(newAssociation.globalOrderId,sources,destination);
}
-void ServerCatchcopy::copyFinished(const quint32 &globalOrderId,const bool &withError)
+void ServerCatchcopy::copyFinished(const uint32_t &globalOrderId,const bool &withError)
{
int index=0;
while(index<LinkGlobalToLocalClientList.size())
@@ -532,7 +557,7 @@ void ServerCatchcopy::copyFinished(const quint32 &globalOrderId,const bool &with
}
}
-void ServerCatchcopy::copyCanceled(const quint32 &globalOrderId)
+void ServerCatchcopy::copyCanceled(const uint32_t &globalOrderId)
{
int index=0;
while(index<LinkGlobalToLocalClientList.size())
@@ -548,12 +573,14 @@ void ServerCatchcopy::copyCanceled(const quint32 &globalOrderId)
}
}
-void ServerCatchcopy::reply(const quint32 &client,const quint32 &orderId,const quint32 &returnCode,const QString &returnString)
+void ServerCatchcopy::reply(const uint32_t &client,const uint32_t &orderId,const uint32_t &returnCode,const std::string &returnString)
{
- reply(client,orderId,returnCode,QStringList() << returnString);
+ std::vector<std::string> returnList;
+ returnList.push_back(returnString);
+ reply(client,orderId,returnCode,returnList);
}
-void ServerCatchcopy::reply(const quint32 &client,const quint32 &orderId,const quint32 &returnCode,const QStringList &returnList)
+void ServerCatchcopy::reply(const uint32_t &client,const uint32_t &orderId,const uint32_t &returnCode,const std::vector<std::string> &returnList)
{
int index=0;
while(index<clientList.size())
@@ -575,7 +602,16 @@ void ServerCatchcopy::reply(const quint32 &client,const quint32 &orderId,const q
out << int(0);
out << orderId;
out << returnCode;
- out << returnList;
+ QStringList returnListQt;
+ {
+ unsigned int index=0;
+ while(index<returnList.size())
+ {
+ returnListQt << QString::fromStdString(returnList.at(index));
+ index++;
+ }
+ }
+ out << returnListQt;
out.device()->seek(0);
out << block.size();
do
@@ -593,7 +629,7 @@ void ServerCatchcopy::reply(const quint32 &client,const quint32 &orderId,const q
}
if(clientList[index].socket->error()!=QLocalSocket::UnknownSocketError && clientList[index].socket->error()!=QLocalSocket::PeerClosedError)
{
- error_string="Error with socket: "+clientList[index].socket->errorString();
+ error_string="Error with socket: "+clientList[index].socket->errorString().toStdString();
emit error(error_string);
return;
}
@@ -618,7 +654,7 @@ void ServerCatchcopy::reply(const quint32 &client,const quint32 &orderId,const q
qWarning() << "Client id not found:" << client;
}
-void ServerCatchcopy::protocolSupported(const quint32 &client,const quint32 &orderId,const bool &value)
+void ServerCatchcopy::protocolSupported(const uint32_t &client,const uint32_t &orderId,const bool &value)
{
if(value)
reply(client,orderId,1000,"protocol supported");
@@ -626,27 +662,27 @@ void ServerCatchcopy::protocolSupported(const quint32 &client,const quint32 &ord
reply(client,orderId,5003,"protocol not supported");
}
-void ServerCatchcopy::incorrectArgumentListSize(const quint32 &client,const quint32 &orderId)
+void ServerCatchcopy::incorrectArgumentListSize(const uint32_t &client,const uint32_t &orderId)
{
reply(client,orderId,5000,"incorrect argument list size");
}
-void ServerCatchcopy::incorrectArgument(const quint32 &client,const quint32 &orderId)
+void ServerCatchcopy::incorrectArgument(const uint32_t &client,const uint32_t &orderId)
{
reply(client,orderId,5001,"incorrect argument");
}
-void ServerCatchcopy::clientRegistered(const quint32 &client,const quint32 &orderId)
+void ServerCatchcopy::clientRegistered(const uint32_t &client,const uint32_t &orderId)
{
reply(client,orderId,1003,"client registered");
}
-void ServerCatchcopy::serverName(const quint32 &client,const quint32 &orderId,const QString &name)
+void ServerCatchcopy::serverName(const uint32_t &client,const uint32_t &orderId,const std::string &name)
{
reply(client,orderId,1004,name);
}
-void ServerCatchcopy::copyFinished(const quint32 &client,const quint32 &orderId,const bool &withError)
+void ServerCatchcopy::copyFinished(const uint32_t &client,const uint32_t &orderId,const bool &withError)
{
if(!withError)
reply(client,orderId,1005,"finished");
@@ -654,12 +690,12 @@ void ServerCatchcopy::copyFinished(const quint32 &client,const quint32 &orderId,
reply(client,orderId,1006,"finished with error(s)");
}
-void ServerCatchcopy::copyCanceled(const quint32 &client,const quint32 &orderId)
+void ServerCatchcopy::copyCanceled(const uint32_t &client,const uint32_t &orderId)
{
reply(client,orderId,1007,"canceled");
}
-void ServerCatchcopy::unknowOrder(const quint32 &client,const quint32 &orderId)
+void ServerCatchcopy::unknowOrder(const uint32_t &client,const uint32_t &orderId)
{
reply(client,orderId,5002,"unknown order");
}
@@ -680,7 +716,7 @@ void ServerCatchcopy::checkTimeOut()
clientList.at(index).detectTimeOut->stop();
if(clientList.at(index).haveData)
{
- error_string="The client is too long to send the next part of the reply: "+clientList.at(index).data;
+ error_string="The client is too long to send the next part of the reply: "+QString(clientList.at(index).data.toHex()).toStdString();
clientList[index].haveData=false;
clientList[index].data.clear();
clientList.at(index).socket->disconnectFromServer();
@@ -692,7 +728,7 @@ void ServerCatchcopy::checkTimeOut()
}
}
-quint32 ServerCatchcopy::incrementOrderId()
+uint32_t ServerCatchcopy::incrementOrderId()
{
do
{
diff --git a/plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ServerCatchcopy.h b/plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ServerCatchcopy.h
index 1314d73..85acff9 100644
--- a/plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ServerCatchcopy.h
+++ b/plugins/Listener/catchcopy-v0002/catchcopy-api-0002/ServerCatchcopy.h
@@ -9,8 +9,8 @@
#include <QObject>
#include <QLocalSocket>
#include <QLocalServer>
-#include <QStringList>
-#include <QString>
+#include <vector>
+#include <string>
#include <QByteArray>
#include <QTimer>
@@ -28,54 +28,54 @@ class ServerCatchcopy : public QObject
/// \brief try close the server
void close();
/// \brief get the error string on the QLocalServer
- const QString errorStringServer() const;
+ const std::string errorStringServer() const;
/// \brief get the general error string
- const QString errorString() const;
+ const std::string errorString() const;
/// \brief set the name of the server
- void setName(const QString & name);
+ void setName(const std::string & name);
/// \brief get the name
- QString getName() const;
+ std::string getName() const;
/// \brief to get a client list
- QStringList clientsList() const;
+ std::vector<std::string> clientsList() const;
private:
- QString pathSocket;
- QString name;
- QString error_string;
+ std::string pathSocket;
+ std::string name;
+ std::string error_string;
QLocalServer server;
- quint32 idNextClient;
+ uint32_t idNextClient;
struct Client
{
- quint32 id;
+ uint32_t id;
QLocalSocket *socket;
QByteArray data;
bool haveData;
- quint32 dataSize;
+ uint32_t dataSize;
bool firstProtocolReplied;
- QList<quint32> queryNoReplied;
+ QList<uint32_t> queryNoReplied;
QTimer *detectTimeOut;
- QString name;
+ std::string name;
};
QList<Client> clientList;
struct LinkGlobalToLocalClient
{
- quint32 idClient;
- quint32 orderId;
- quint32 globalOrderId;
+ uint32_t idClient;
+ uint32_t orderId;
+ uint32_t globalOrderId;
};
QList<LinkGlobalToLocalClient> LinkGlobalToLocalClientList;
enum inputReturnType{Ok,Replied,ExtensionWrong,WrongArgument,WrongArgumentListSize,UnknowOrder};
- inputReturnType parseInputCurrentProtocol(const quint32 &client,const quint32 &orderId,const QStringList &returnList);
- bool clientIdFound(const quint32 &id) const;
- quint32 nextOrderId;
- QList<quint32> orderList;
- quint32 incrementOrderId();
- void emitNewCopyWithoutDestination(const quint32 &client,const quint32 &orderId,const QStringList &sources);
- void emitNewCopy(const quint32 &client,const quint32 &orderId,const QStringList &sources,const QString &destination);
- void emitNewMoveWithoutDestination(const quint32 &client,const quint32 &orderId,const QStringList &sources);
- void emitNewMove(const quint32 &client,const quint32 &orderId,const QStringList &sources,const QString &destination);
+ inputReturnType parseInputCurrentProtocol(const uint32_t &client,const uint32_t &orderId,const std::vector<std::string> &returnList);
+ bool clientIdFound(const uint32_t &id) const;
+ uint32_t nextOrderId;
+ QList<uint32_t> orderList;
+ uint32_t incrementOrderId();
+ void emitNewCopyWithoutDestination(const uint32_t &client,const uint32_t &orderId,const std::vector<std::string> &sources);
+ void emitNewCopy(const uint32_t &client,const uint32_t &orderId,const std::vector<std::string> &sources,const std::string &destination);
+ void emitNewMoveWithoutDestination(const uint32_t &client,const uint32_t &orderId,const std::vector<std::string> &sources);
+ void emitNewMove(const uint32_t &client,const uint32_t &orderId,const std::vector<std::string> &sources,const std::string &destination);
bool checkDataIntegrity(const QByteArray &data);
protected:
- void parseInput(const quint32 &client,const quint32 &orderId,const QStringList &returnList);
+ void parseInput(const uint32_t &client,const uint32_t &orderId,const std::vector<std::string> &returnList);
private slots:
void newConnection();
void connectionError(const QLocalSocket::LocalSocketError &error);
@@ -84,61 +84,61 @@ class ServerCatchcopy : public QObject
void checkTimeOut();
public slots:
/// \brief disconnect one client
- void disconnectClient(const quint32 &id);
- /// \brief reply to a client with QStringList
- void reply(const quint32 &client,const quint32 &orderId,const quint32 &returnCode,const QStringList &returnList);
+ void disconnectClient(const uint32_t &id);
+ /// \brief reply to a client with std::vector<std::string>
+ void reply(const uint32_t &client,const uint32_t &orderId,const uint32_t &returnCode,const std::vector<std::string> &returnList);
/// \brief reply to a client
- void reply(const quint32 &client,const quint32 &orderId,const quint32 &returnCode,const QString &returnString);
+ void reply(const uint32_t &client,const uint32_t &orderId,const uint32_t &returnCode,const std::string &returnString);
//reply
/// \brief send if the protocol is supported
- void protocolSupported(const quint32 &client,const quint32 &orderId,const bool &value);
+ void protocolSupported(const uint32_t &client,const uint32_t &orderId,const bool &value);
/// \brief send incorrect arguement list size
- void incorrectArgumentListSize(const quint32 &client,const quint32 &orderId);
+ void incorrectArgumentListSize(const uint32_t &client,const uint32_t &orderId);
/// \brief send incorrect arguement
- void incorrectArgument(const quint32 &client,const quint32 &orderId);
+ void incorrectArgument(const uint32_t &client,const uint32_t &orderId);
/// \brief the client is registred
- void clientRegistered(const quint32 &client,const quint32 &orderId);
+ void clientRegistered(const uint32_t &client,const uint32_t &orderId);
/// \brief send the server name
- void serverName(const quint32 &client,const quint32 &orderId,const QString &name);
+ void serverName(const uint32_t &client,const uint32_t &orderId,const std::string &name);
/// \brief send the copy is finished
- void copyFinished(const quint32 &client,const quint32 &orderId,const bool &withError);
+ void copyFinished(const uint32_t &client,const uint32_t &orderId,const bool &withError);
/// \brief send the copy is canceled
- void copyCanceled(const quint32 &client,const quint32 &orderId);
+ void copyCanceled(const uint32_t &client,const uint32_t &orderId);
/// \brief send the copy is finished by global is order
- void copyFinished(const quint32 &globalOrderId,const bool &withError);
+ void copyFinished(const uint32_t &globalOrderId,const bool &withError);
/// \brief send copy cancel by global is order
- void copyCanceled(const quint32 &globalOrderId);
+ void copyCanceled(const uint32_t &globalOrderId);
/// \brief send the unknow order
- void unknowOrder(const quint32 &client,const quint32 &orderId);
+ void unknowOrder(const uint32_t &client,const uint32_t &orderId);
signals:
/// \brief send connected client
- void connectedClient(const quint32 &id);
+ void connectedClient(const uint32_t &id);
/// \brief send disconnect client
- void disconnectedClient(const quint32 &id);
+ void disconnectedClient(const uint32_t &id);
/// \brief have new query
- void newQuery(const quint32 &client,const quint32 &orderId,const QStringList &returnList);
+ void newQuery(const uint32_t &client,const uint32_t &orderId,const std::vector<std::string> &returnList);
/// \brief have new error
- void error(const QString &error);
- void communicationError(const QString &error);
+ void error(const std::string &error);
+ void communicationError(const std::string &error);
//query
/// \brief ask the protocol compatility
- void askProtocolCompatibility(const quint32 &client,const quint32 &orderId,const QString &version);
+ void askProtocolCompatibility(const uint32_t &client,const uint32_t &orderId,const std::string &version);
/// \brief ask protocol extension
- void askProtocolExtension(const quint32 &client,const quint32 &orderId,const QString &extension);
+ void askProtocolExtension(const uint32_t &client,const uint32_t &orderId,const std::string &extension);
/// \brief ask protocol extension with version
- void askProtocolExtension(const quint32 &client,const quint32 &orderId,const QString &extension,const QString &version);
+ void askProtocolExtension(const uint32_t &client,const uint32_t &orderId,const std::string &extension,const std::string &version);
/// \brief send the client name, without query id
- void clientName(const quint32 &client,const QString &name);
+ void clientName(const uint32_t &client,const std::string &name);
/// \brief send the client have ask the server name
- void askServerName(const quint32 &client,const quint32 &orderId);
+ void askServerName(const uint32_t &client,const uint32_t &orderId);
/// \brief copy is send, by globalOrderId, without destination
- void newCopyWithoutDestination(const quint32 &globalOrderId,const QStringList &sources);
+ void newCopyWithoutDestination(const uint32_t &globalOrderId,const std::vector<std::string> &sources);
/// \brief copy is send, by globalOrderId, with destination
- void newCopy(const quint32 &globalOrderId,const QStringList &sources,const QString &destination);
+ void newCopy(const uint32_t &globalOrderId,const std::vector<std::string> &sources,const std::string &destination);
/// \brief move is send, by globalOrderId, without destination
- void newMoveWithoutDestination(const quint32 &globalOrderId,const QStringList &sources);
+ void newMoveWithoutDestination(const uint32_t &globalOrderId,const std::vector<std::string> &sources);
/// \brief move is send, by globalOrderId, with destination
- void newMove(const quint32 &globalOrderId,const QStringList &sources,const QString &destination);
+ void newMove(const uint32_t &globalOrderId,const std::vector<std::string> &sources,const std::string &destination);
};
#endif // SERVERCATCHCOPY_H
diff --git a/plugins/Listener/catchcopy-v0002/documentation.dox b/plugins/Listener/catchcopy-v0002/documentation.dox
index b143ecc..51aa937 100644
--- a/plugins/Listener/catchcopy-v0002/documentation.dox
+++ b/plugins/Listener/catchcopy-v0002/documentation.dox
@@ -20,7 +20,7 @@
\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, ...
+ You can find the link on <a href="http://ultracopier.first-world.info/">Ultracopier</a> project page, via git, snapshot sources, ...
\section mainpage_algorithm Protocol
@@ -30,4 +30,3 @@
The code source is under GPL3. The image is extacted from Oxygen icon pack of KDE4.
*/
-
diff --git a/plugins/Listener/catchcopy-v0002/informations.xml b/plugins/Listener/catchcopy-v0002/informations.xml
index bc0efc6..b98adc2 100644
--- a/plugins/Listener/catchcopy-v0002/informations.xml
+++ b/plugins/Listener/catchcopy-v0002/informations.xml
@@ -17,7 +17,7 @@
<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>1.2.3.6</version>
+ <version>1.4.0.3</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. -->
diff --git a/plugins/Listener/catchcopy-v0002/listener.cpp b/plugins/Listener/catchcopy-v0002/listener.cpp
index 55c254b..e45a08b 100644
--- a/plugins/Listener/catchcopy-v0002/listener.cpp
+++ b/plugins/Listener/catchcopy-v0002/listener.cpp
@@ -1,9 +1,10 @@
#include "listener.h"
#include "catchcopy-api-0002/ExtraSocketCatchcopy.h"
+#include "../../../cpp11addition.h"
Listener::Listener()
{
- server.setName(tr("Ultracopier"));
+ server.setName(tr("Ultracopier").toStdString());
connect(&server,&ServerCatchcopy::newCopyWithoutDestination, this,&Listener::copyWithoutDestination);
connect(&server,&ServerCatchcopy::newCopy, this,&Listener::copy);
connect(&server,&ServerCatchcopy::newMoveWithoutDestination, this,&Listener::moveWithoutDestination);
@@ -19,7 +20,7 @@ Listener::Listener()
void Listener::listen()
{
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,QStringLiteral("start: %1").arg(ExtraSocketCatchcopy::pathSocket()));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start: "+ExtraSocketCatchcopy::pathSocket());
if(server.listen())
emit newState(Ultracopier::FullListening);
else
@@ -32,12 +33,12 @@ void Listener::close()
emit newState(Ultracopier::NotListening);
}
-const QString Listener::errorString() const
+const std::string Listener::errorString() const
{
return server.errorString();
}
-void Listener::setResources(OptionInterface * options,const QString &writePath,const QString &pluginPath,const bool &portableVersion)
+void Listener::setResources(OptionInterface * options, const std::string &writePath, const std::string &pluginPath, const bool &portableVersion)
{
Q_UNUSED(options);
Q_UNUSED(writePath);
@@ -52,20 +53,20 @@ QWidget * Listener::options()
}
/// \brief to get a client list
-QStringList Listener::clientsList() const
+std::vector<std::string> Listener::clientsList() const
{
return server.clientsList();
}
-void Listener::transferFinished(const quint32 &orderId,const bool &withError)
+void Listener::transferFinished(const uint32_t &orderId, const bool &withError)
{
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, orderId: "+QString::number(orderId)+", withError: "+QString::number(withError));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, orderId: "+std::to_string(orderId)+", withError: "+std::to_string(withError));
server.copyFinished(orderId,withError);
}
-void Listener::transferCanceled(const quint32 &orderId)
+void Listener::transferCanceled(const uint32_t &orderId)
{
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, orderId: "+QString::number(orderId));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"start, orderId: "+std::to_string(orderId));
server.copyCanceled(orderId);
}
@@ -74,45 +75,49 @@ void Listener::newLanguageLoaded()
{
}
-void Listener::errorInternal(const QString &string)
+void Listener::errorInternal(const std::string &string)
{
Q_UNUSED(string);
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"warning emited from Catchcopy lib: "+string);
}
-void Listener::communicationErrorInternal(const QString &string)
+void Listener::communicationErrorInternal(const std::string &string)
{
ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Warning,"warning emited from Catchcopy lib: "+string);
emit error(string);
}
-void Listener::clientName(quint32 client,QString name)
+void Listener::clientName(uint32_t client,std::string name)
{
Q_UNUSED(client);
Q_UNUSED(name);
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("clientName: %1, for the id: %2").arg(name).arg(client));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("clientName: %1, for the id: %2").arg(QString::fromStdString(name)).arg(client).toStdString());
}
-void Listener::copyWithoutDestination(const quint32 &orderId,const QStringList &sources)
+void Listener::copyWithoutDestination(const uint32_t &orderId,const std::vector<std::string> &sources)
{
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("copyWithoutDestination(%1,%2)").arg(orderId).arg(sources.join(";")));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("copyWithoutDestination(%1,%2)")
+ .arg(orderId)
+ .arg(QString::fromStdString(stringimplode(sources,";")))
+ .toStdString()
+ );
emit newCopyWithoutDestination(orderId,sources);
}
-void Listener::copy(const quint32 &orderId,const QStringList &sources,const QString &destination)
+void Listener::copy(const uint32_t &orderId,const std::vector<std::string> &sources,const std::string &destination)
{
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("copy(%1,%2,%3)").arg(orderId).arg(sources.join(";")).arg(destination));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("copy(%1,%2,%3)").arg(orderId).arg(QString::fromStdString(stringimplode(sources,";")).arg(QString::fromStdString(destination))).toStdString());
emit newCopy(orderId,sources,destination);
}
-void Listener::moveWithoutDestination(const quint32 &orderId,const QStringList &sources)
+void Listener::moveWithoutDestination(const uint32_t &orderId,const std::vector<std::string> &sources)
{
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("moveWithoutDestination(%1,%2)").arg(orderId).arg(sources.join(";")));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("moveWithoutDestination(%1,%2)").arg(orderId).arg(QString::fromStdString(stringimplode(sources,";"))).toStdString());
emit newMoveWithoutDestination(orderId,sources);
}
-void Listener::move(const quint32 &orderId,const QStringList &sources,const QString &destination)
+void Listener::move(const uint32_t &orderId,const std::vector<std::string> &sources,const std::string &destination)
{
- ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("move(%1,%2,%3)").arg(orderId).arg(sources.join(";")).arg(destination));
+ ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Information,QStringLiteral("move(%1,%2,%3)").arg(orderId).arg(QString::fromStdString(stringimplode(sources,";")).arg(QString::fromStdString(destination))).toStdString());
emit newMove(orderId,sources,destination);
}
diff --git a/plugins/Listener/catchcopy-v0002/listener.h b/plugins/Listener/catchcopy-v0002/listener.h
index 8956abc..8cab248 100644
--- a/plugins/Listener/catchcopy-v0002/listener.h
+++ b/plugins/Listener/catchcopy-v0002/listener.h
@@ -6,7 +6,7 @@
#ifndef SERVER_H
#define SERVER_H
-#include <QString>
+#include <string>
#ifndef ULTRACOPIER_PLUGIN_ALL_IN_ONE_DIRECT
#include <QtPlugin>
#endif
@@ -30,30 +30,30 @@ public:
/// \brief stop listen to copy/move
void close();
/// \brief return the error strong
- const QString errorString() const;
+ const std::string errorString() const;
/// \brief set resources for this plugins
- void setResources(OptionInterface * options,const QString &writePath,const QString &pluginPath,const bool &portableVersion);
+ void setResources(OptionInterface * options,const std::string &writePath,const std::string &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;
+ std::vector<std::string> clientsList() const;
public slots:
/// \brief say to the client that's the copy/move is finished
- void transferFinished(const quint32 &orderId,const bool &withError);
+ void transferFinished(const uint32_t &orderId,const bool &withError);
/// \brief say to the client that's the copy/move is finished
- void transferCanceled(const quint32 &orderId);
+ void transferCanceled(const uint32_t &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);
+ void errorInternal(const std::string &string);
+ void communicationErrorInternal(const std::string &string);
+ void clientName(uint32_t client,std::string name);
+ void copyWithoutDestination(const uint32_t &orderId,const std::vector<std::string> &sources);
+ void copy(const uint32_t &orderId,const std::vector<std::string> &sources,const std::string &destination);
+ void moveWithoutDestination(const uint32_t &orderId,const std::vector<std::string> &sources);
+ void move(const uint32_t &orderId,const std::vector<std::string> &sources,const std::string &destination);
};
#endif // SERVER_H
diff --git a/plugins/Listener/catchcopy-v0002/listener.pro b/plugins/Listener/catchcopy-v0002/listener.pro
index f1706c5..b21289a 100644
--- a/plugins/Listener/catchcopy-v0002/listener.pro
+++ b/plugins/Listener/catchcopy-v0002/listener.pro
@@ -6,16 +6,21 @@ TEMPLATE = lib
CONFIG += plugin
QT += network
win32:LIBS += -ladvapi32
-HEADERS = listener.h \
- catchcopy-api-0002/VariablesCatchcopy.h \
- catchcopy-api-0002/ServerCatchcopy.h \
- catchcopy-api-0002/ExtraSocketCatchcopy.h \
- Environment.h \
- Variable.h \
- DebugEngineMacro.h \
- StructEnumDefinition.h \
- ../../../interface/PluginInterface_Listener.h
-SOURCES = listener.cpp \
- catchcopy-api-0002/ServerCatchcopy.cpp \
- catchcopy-api-0002/ExtraSocketCatchcopy.cpp
+HEADERS = \
+ $$PWD/listener.h \
+ $$PWD/catchcopy-api-0002/VariablesCatchcopy.h \
+ $$PWD/catchcopy-api-0002/ServerCatchcopy.h \
+ $$PWD/catchcopy-api-0002/ExtraSocketCatchcopy.h \
+ $$PWD/Environment.h \
+ $$PWD/Variable.h \
+ $$PWD/DebugEngineMacro.h \
+ $$PWD/StructEnumDefinition.h \
+ $$PWD/../../../interface/PluginInterface_Listener.h \
+ $$PWD/../../../cpp11addition.h
+SOURCES = \
+ $$PWD/listener.cpp \
+ $$PWD/catchcopy-api-0002/ServerCatchcopy.cpp \
+ $$PWD/catchcopy-api-0002/ExtraSocketCatchcopy.cpp \
+ $$PWD/../../../cpp11addition.cpp \
+ $$PWD/../../../cpp11additionstringtointcpp.cpp
TARGET = $$qtLibraryTarget(listener)
diff --git a/plugins/Listener/dbus/Catchcopy.cpp b/plugins/Listener/dbus/Catchcopy.cpp
deleted file mode 100644
index 6c46af2..0000000
--- a/plugins/Listener/dbus/Catchcopy.cpp
+++ /dev/null
@@ -1,17 +0,0 @@
-#include "Catchcopy.h"
-
-#include <QCoreApplication>
-
-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/Listener/dbus/Catchcopy.h b/plugins/Listener/dbus/Catchcopy.h
deleted file mode 100644
index d28a253..0000000
--- a/plugins/Listener/dbus/Catchcopy.h
+++ /dev/null
@@ -1,20 +0,0 @@
-#ifndef CATCHCOPY_H
-#define CATCHCOPY_H
-
-#include <QObject>
-#include <QStringList>
-
-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/Listener/dbus/DebugEngineMacro.h b/plugins/Listener/dbus/DebugEngineMacro.h
deleted file mode 100644
index 4582010..0000000
--- a/plugins/Listener/dbus/DebugEngineMacro.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/** \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/Listener/dbus/Environment.h b/plugins/Listener/dbus/Environment.h
deleted file mode 100644
index 265a5a6..0000000
--- a/plugins/Listener/dbus/Environment.h
+++ /dev/null
@@ -1,10 +0,0 @@
-/** \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/Listener/dbus/StructEnumDefinition.h b/plugins/Listener/dbus/StructEnumDefinition.h
deleted file mode 100644
index c1758f4..0000000
--- a/plugins/Listener/dbus/StructEnumDefinition.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../StructEnumDefinition.h"
diff --git a/plugins/Listener/dbus/Variable.h b/plugins/Listener/dbus/Variable.h
deleted file mode 100644
index 963d0c8..0000000
--- a/plugins/Listener/dbus/Variable.h
+++ /dev/null
@@ -1,15 +0,0 @@
-/** \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/Listener/dbus/documentation.dox b/plugins/Listener/dbus/documentation.dox
deleted file mode 100644
index 3cda8ec..0000000
--- a/plugins/Listener/dbus/documentation.dox
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- 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 <a href="http://ultracopier-wiki.first-world.info/">the wiki of ultracopier</a>.
-
- \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 found link on <a href="http://ultracopier.first-world.info/">Ultracopier (Supercopier/Teracopy)</a> project page, via git, snapshot sources, ...
-
- \section mainpage_algorithm Dbus method
-
- you have this method exported to dbus:
- <ul>
- <li>void copy(const QStringList &sources,const QString &destination)</li>
- <li>void move(const QStringList &sources,const QString &destination)</li>
- </ul>
-
- \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
deleted file mode 100644
index 0b836ed..0000000
--- a/plugins/Listener/dbus/informations.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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>1.2.3.6</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[
- ]]></dependencies>
-</package> \ No newline at end of file
diff --git a/plugins/Listener/dbus/listener.cpp b/plugins/Listener/dbus/listener.cpp
deleted file mode 100644
index 50ed196..0000000
--- a/plugins/Listener/dbus/listener.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-#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/Listener/dbus/listener.h b/plugins/Listener/dbus/listener.h
deleted file mode 100644
index fcb95cd..0000000
--- a/plugins/Listener/dbus/listener.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/** \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 <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 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/Listener/dbus/listener.pro b/plugins/Listener/dbus/listener.pro
deleted file mode 100644
index 59abd12..0000000
--- a/plugins/Listener/dbus/listener.pro
+++ /dev/null
@@ -1,13 +0,0 @@
-TEMPLATE = lib
-CONFIG += plugin
-QT += network dbus
-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)
diff --git a/plugins/Listener/dbus/plugin.json b/plugins/Listener/dbus/plugin.json
deleted file mode 100644
index 9e26dfe..0000000
--- a/plugins/Listener/dbus/plugin.json
+++ /dev/null
@@ -1 +0,0 @@
-{} \ No newline at end of file