-
Notifications
You must be signed in to change notification settings - Fork 1
/
libpar2.cpp
94 lines (85 loc) · 2.14 KB
/
libpar2.cpp
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
#include "libpar2.h"
LibPar2::LibPar2(CommandLine* commandline) {
commandLine = commandline;
switch (commandLine->GetVersion())
{
case CommandLine::verPar1:
{
par1Repairer = new Par1Repairer;
/* repairer->sig_filename.connect( sigc::mem_fun(*this,&MainWindow::signal_filename));
repairer->sig_progress.connect( sigc::mem_fun(*this,&MainWindow::signal_progress));*/
}
break;
case CommandLine::verPar2:
{
par2Repairer = new Par2Repairer;
par2Repairer->sig_filename.
connect( sigc::mem_fun(*this, &LibPar2::signal_filename));
par2Repairer->sig_progress.
connect( sigc::mem_fun(*this,&LibPar2::signal_progress));
par2Repairer->sig_headers.
connect( sigc::mem_fun(*this,&LibPar2::signal_headers));
par2Repairer->sig_done.
connect( sigc::mem_fun(*this,&LibPar2::signal_done));
//par2Repairer->
}
break;
case CommandLine::opNone:
break;
}
}
LibPar2::~LibPar2(void) {
//delete par1Repairer;
//delete par2Repairer;
}
Result LibPar2::PreProcess() {
Result result;
switch (commandLine->GetVersion())
{
case CommandLine::verPar1:
{
//result = par1Repairer->PreProcess(*commandLine);
}
break;
case CommandLine::verPar2:
{
result = par2Repairer->PreProcess(*commandLine);
}
break;
case CommandLine::opNone:
break;
}
return result;
}
Result LibPar2::Process(bool dorepair) {
Result result;
switch (commandLine->GetVersion())
{
case CommandLine::verPar1:
{
result = par1Repairer->Process(*commandLine, dorepair);
}
break;
case CommandLine::verPar2:
{
result = par2Repairer->Process(*commandLine, dorepair);
}
break;
case CommandLine::opNone:
break;
}
return result;
}
void LibPar2::signal_filename(std::string str) {
sig_filename.emit(str);
};
void LibPar2::signal_progress(double value) {
sig_progress.emit(value);
};
void LibPar2::signal_headers(ParHeaders* headers) {
sig_headers.emit(headers);
}
void LibPar2::signal_done(std::string filename, int blocks_available,
int blocks_total) {
sig_done.emit(filename, blocks_available, blocks_total);
}