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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
|
/** \file copyEngine.cpp
\brief Define the copy engine
\author alpha_one_x86 */
#include "CopyEngine.h"
#include "../../../interface/PluginInterface_CopyEngine.h"
#include <QCoreApplication>
CopyEngine::CopyEngine()
{
timer=new QTimer();
connect(timer,&QTimer::timeout,this,&CopyEngine::timerSlot);
timer->start(1000);
send=false;
}
CopyEngine::~CopyEngine()
{
}
//to send the options panel
bool CopyEngine::getOptionsEngine(QWidget * tempWidget)
{
(void)tempWidget;
return true;
}
//to have interface widget to do modal dialog
void CopyEngine::setInterfacePointer(QWidget * uiinterface)
{
(void)uiinterface;
syncTransferList();
}
bool CopyEngine::haveSameSource(const std::vector<std::string> &)
{
return false;
}
bool CopyEngine::haveSameDestination(const std::string &)
{
return false;
}
bool CopyEngine::newCopy(const std::vector<std::string> &sources)
{
(void)sources;
return true;
}
bool CopyEngine::newCopy(const std::vector<std::string> &sources,const std::string &destination)
{
(void)sources;
(void)destination;
return true;
}
bool CopyEngine::newMove(const std::vector<std::string> &sources)
{
(void)sources;
return true;
}
bool CopyEngine::newMove(const std::vector<std::string> &sources,const std::string &destination)
{
(void)sources;
(void)destination;
return true;
}
void CopyEngine::newTransferList(const std::string &file)
{
(void)file;
}
//because direct access to list thread into the main thread can't be do
uint64_t CopyEngine::realByteTransfered()
{
return rand()%200000000;
}
void CopyEngine::timerSlot()
{
emit pushGeneralProgression(rand()%200000000,200000000);
{
std::vector<std::pair<uint64_t,uint32_t> > progressionList;
progressionList.push_back(std::pair<uint64_t,uint32_t>(100, 2));
progressionList.push_back(std::pair<uint64_t,uint32_t>(1000, 2));
progressionList.push_back(std::pair<uint64_t,uint32_t>(10000, 2+ rand()%2));
progressionList.push_back(std::pair<uint64_t,uint32_t>(100000, 5+ rand()%3));
progressionList.push_back(std::pair<uint64_t,uint32_t>(1000000, 15+ rand()%3));
progressionList.push_back(std::pair<uint64_t,uint32_t>(10000000, 50+ rand()%10));
progressionList.push_back(std::pair<uint64_t,uint32_t>(100000000, 800+ rand()%100));
progressionList.push_back(std::pair<uint64_t,uint32_t>(1000000000, 6000+ rand()%500));
progressionList.push_back(std::pair<uint64_t,uint32_t>(10000000000, 50000+ rand()%1000));
emit doneTime(progressionList);
}
{
std::vector<Ultracopier::ProgressionItem> progressionList;
Ultracopier::ProgressionItem entry;
entry.currentRead=60*1024*1024+rand()%20*1024*1024;
entry.currentWrite=40*1024*1024+rand()%20*1024*1024;
entry.id=1;
entry.total=100*1024*1024;
progressionList.push_back(entry);
emit pushFileProgression(progressionList);
}
}
//speed limitation
bool CopyEngine::supportSpeedLimitation() const
{
return false;
}
/** \brief to sync the transfer list
* Used when the interface is changed, useful to minimize the memory size */
void CopyEngine::syncTransferList()
{
emit syncReady();
if(send)
return;
send=true;
emit actionInProgess(Ultracopier::Copying);
std::vector<Ultracopier::ReturnActionOnCopyList> actionsList;
Ultracopier::ReturnActionOnCopyList newAction;
newAction.type = Ultracopier::AddingItem;
newAction.addAction.id = 1;
newAction.addAction.sourceFullPath = "/folder1/file.iso";
newAction.addAction.sourceFileName = "file.iso";
newAction.addAction.destinationFullPath = "/dest/folder1/file.iso";
newAction.addAction.destinationFileName = "file.iso";
newAction.addAction.size = 100*1024*1024;
newAction.addAction.mode = Ultracopier::CopyMode::Copy;
actionsList.push_back(newAction);
newAction.addAction.id = 2;
newAction.addAction.sourceFullPath = "/file.mp3";
newAction.addAction.sourceFileName = "file.mp3";
newAction.addAction.destinationFullPath = "/dest/file.mp3";
newAction.addAction.destinationFileName = "file.mp3";
newAction.addAction.size = 10*1024*1024;
newAction.addAction.mode = Ultracopier::CopyMode::Copy;
actionsList.push_back(newAction);
newAction.addAction.id = 3;
newAction.addAction.sourceFullPath = "/file.mp4";
newAction.addAction.sourceFileName = "file.mp4";
newAction.addAction.destinationFullPath = "/dest/file.mp4";
newAction.addAction.destinationFileName = "file.mp4";
newAction.addAction.size = 50*1024*1024;
newAction.addAction.mode = Ultracopier::CopyMode::Copy;
actionsList.push_back(newAction);
newAction.addAction.id = 1;
newAction.addAction.sourceFullPath = "/folder1/file.iso";
newAction.addAction.sourceFileName = "file.iso";
newAction.addAction.destinationFullPath = "/dest/folder1/file.iso";
newAction.addAction.destinationFileName = "file.iso";
newAction.addAction.size = 100*1024*1024;
newAction.addAction.mode = Ultracopier::CopyMode::Copy;
newAction.type = Ultracopier::PreOperation;
actionsList.push_back(newAction);
newAction.type = Ultracopier::Transfer;
actionsList.push_back(newAction);
emit newActionOnList(actionsList);
}
bool CopyEngine::userAddFolder(const Ultracopier::CopyMode &mode)
{
(void)mode;
return true;
}
bool CopyEngine::userAddFile(const Ultracopier::CopyMode &mode)
{
(void)mode;
return true;
}
void CopyEngine::pause()
{
}
void CopyEngine::resume()
{
}
void CopyEngine::skip(const uint64_t &id)
{
(void)id;
}
void CopyEngine::cancel()
{
emit canBeDeleted();
}
void CopyEngine::removeItems(const std::vector<uint64_t> &ids)
{
(void)ids;
}
void CopyEngine::moveItemsOnTop(const std::vector<uint64_t> &ids)
{
(void)ids;
}
void CopyEngine::moveItemsUp(const std::vector<uint64_t> &ids)
{
(void)ids;
}
void CopyEngine::moveItemsDown(const std::vector<uint64_t> &ids)
{
(void)ids;
}
void CopyEngine::moveItemsOnBottom(const std::vector<uint64_t> &ids)
{
(void)ids;
}
/** \brief give the forced mode, to export/import transfer list */
void CopyEngine::forceMode(const Ultracopier::CopyMode &mode)
{
(void)mode;
}
void CopyEngine::exportTransferList()
{
}
void CopyEngine::importTransferList()
{
}
bool CopyEngine::setSpeedLimitation(const int64_t &speedLimitation)
{
(void)speedLimitation;
//ULTRACOPIER_DEBUGCONSOLE(Ultracopier::DebugLevel_Notice,"maxSpeed: "+std::to_string(speedLimitation));
return false;
}
void CopyEngine::exportErrorIntoTransferList()
{
}
|