7 |
|
this->myData=myData; |
8 |
|
} |
9 |
|
|
10 |
+ |
#ifdef Q_OS_WIN |
11 |
+ |
Converter::Converter(QString AppDir, Logger *myLogger, QStringList *myData, QWinTaskbarProgress *win7TaskBarProgress) |
12 |
+ |
: Converter(AppDir, myLogger, myData) |
13 |
+ |
{ |
14 |
+ |
this->win7TaskBarProgress = win7TaskBarProgress; |
15 |
+ |
} |
16 |
+ |
#endif |
17 |
+ |
|
18 |
|
void Converter::run() |
19 |
|
{ |
20 |
|
this->processHasKilled=false; |
23 |
|
QString errorMessage = ""; |
24 |
|
int numErrors=0; |
25 |
|
|
26 |
< |
this->myLogger->writeString("Setting working dir. to "+this->AppDir+"."); |
26 |
> |
this->myLogger->writeString("Setting working dir to "+this->AppDir+"."); |
27 |
|
myProcess->setWorkingDirectory(this->AppDir); // Set working directory (for work with AEI2/Mac OS) |
28 |
|
|
29 |
+ |
#ifdef Q_OS_WIN |
30 |
+ |
if(this->win7TaskBarProgress){ |
31 |
+ |
this->win7TaskBarProgress->reset(); |
32 |
+ |
this->win7TaskBarProgress->show(); |
33 |
+ |
} |
34 |
+ |
#endif |
35 |
+ |
|
36 |
|
if(this->myData->size()!=1){ |
37 |
+ |
#ifdef Q_OS_WIN |
38 |
+ |
if(this->win7TaskBarProgress){ |
39 |
+ |
this->win7TaskBarProgress->setRange(0,this->myData->size()); |
40 |
+ |
} |
41 |
+ |
#endif |
42 |
|
emit setupPB(this->myData->size()); |
43 |
|
} |
44 |
|
else{ |
45 |
+ |
#ifdef Q_OS_WIN |
46 |
+ |
if(this->win7TaskBarProgress){ |
47 |
+ |
this->win7TaskBarProgress->setRange(0,0); |
48 |
+ |
} |
49 |
+ |
#endif |
50 |
|
emit setupPB(0); //Intermitent bar, we don't have any estimation when the task is done |
51 |
|
} |
52 |
|
|
61 |
|
nextIndex=commands.indexOf(GlobalVars::OniSplitProcSeparator,currentIndex+1); |
62 |
|
|
63 |
|
commandToExec=commands.mid(currentIndex,(nextIndex-currentIndex)); |
64 |
< |
this->myProcess->start(Util::getOniSplitExeName() +" "+commandToExec); |
64 |
> |
this->myProcess->start(UtilVago::getOniSplitExeAbsolutePath() + " " + commandToExec); |
65 |
|
this->myProcess->waitForFinished(-1); |
66 |
|
|
67 |
|
if(this->processHasKilled){ // If the process has killed there's no need to proceed with reading output or process more commands |
68 |
+ |
|
69 |
+ |
#ifdef Q_OS_WIN |
70 |
+ |
if(this->win7TaskBarProgress){ |
71 |
+ |
this->win7TaskBarProgress->hide(); |
72 |
+ |
} |
73 |
+ |
#endif |
74 |
+ |
|
75 |
|
delete this->myProcess; //delete object and make pointer invalid |
76 |
|
this->myData->clear(); //clean list |
77 |
|
emit conversionAborted(); |
78 |
+ |
|
79 |
|
return; |
80 |
|
} |
81 |
|
|
94 |
|
currentIndex=nextIndex+1; //update currentIndex +1 for start after the separator |
95 |
|
} |
96 |
|
|
97 |
+ |
#ifdef Q_OS_WIN |
98 |
+ |
if(this->win7TaskBarProgress){ |
99 |
+ |
this->win7TaskBarProgress->setValue(win7TaskBarProgress->value()+1); |
100 |
+ |
} |
101 |
+ |
#endif |
102 |
+ |
|
103 |
|
emit taskDone(); |
104 |
|
} |
105 |
|
|
106 |
+ |
#ifdef Q_OS_WIN |
107 |
+ |
if(this->win7TaskBarProgress){ |
108 |
+ |
this->win7TaskBarProgress->hide(); |
109 |
+ |
} |
110 |
+ |
#endif |
111 |
+ |
|
112 |
|
delete this->myProcess; //delete object and make pointer invalid |
113 |
|
this->myData->clear(); //clean list |
114 |
|
|