18 |
|
|
19 |
|
ui->lbComplete->setText("<html>The wizard is now complete. The sounds have been converted. " |
20 |
|
"You can view all converted files clicking <a href=' '>here.</a><br />" |
21 |
< |
"<br />Click restart to create more sounds from the wizard beggining," |
21 |
> |
"<br />Click restart to create more sounds from the wizard beggining, " |
22 |
|
"otherwise click finish.</html>"); // Don't use rich text in qtdesigner because it generates platform dependent code |
23 |
|
|
24 |
|
connectSlots(); |
147 |
|
//######################################################### Starting xml processing |
148 |
|
|
149 |
|
// Clean tmp dir |
150 |
< |
if(!Util::rmDir(GlobalVars::VagoTemporaryDir)){ |
151 |
< |
QString message="Couldn't clean vago temp dir for complete sound wizard. Aborting.\n"+GlobalVars::VagoTemporaryDir; |
152 |
< |
this->myLogger->writeString(message); |
153 |
< |
Util::showErrorLogPopUp(message); |
150 |
> |
if(!Util::rmDir(GlobalVars::VagoTemporaryDir)){ |
151 |
> |
UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, "Couldn't clean vago temp dir for complete sound wizard. Aborting.\n"+GlobalVars::VagoTemporaryDir); |
152 |
|
return; |
153 |
|
} |
154 |
|
|
155 |
|
if(!QDir(QDir::tempPath()).mkpath("VagoTemp")){ |
156 |
< |
QString message="Couldn't reconstruct vago temp dir for complete sound wizard. Aborting.\n"+GlobalVars::VagoTemporaryDir; |
159 |
< |
this->myLogger->writeString(message); |
160 |
< |
Util::showErrorLogPopUp(message); |
156 |
> |
UtilVago::showAndLogErrorPopUpLogButton(this->myLogger, "Couldn't reconstruct vago temp dir for complete sound wizard. Aborting.\n"+GlobalVars::VagoTemporaryDir); |
157 |
|
} |
158 |
|
|
159 |
|
// Copy sample xml files to tmp dir |
162 |
|
QFile::setPermissions(ambFileLocation, QFile::ReadOwner | QFile::WriteOwner); //remove read only attribute that come from resources |
163 |
|
QFile::setPermissions(grpFileLocation, QFile::ReadOwner | QFile::WriteOwner); |
164 |
|
|
165 |
< |
(*this->xmlCommands) << "replaceall -element:Priority -value:"+priority+" -filename:"+ambFileLocation+" -nobackups" |
166 |
< |
<< "replaceall -element:Flags -value:"+flags.join(" ")+" -filename:"+ambFileLocation+" -nobackups" |
167 |
< |
<< "replaceall -element:SphereRadius -value:"+sphereRadious+" -filename:"+ambFileLocation+" -nobackups" |
168 |
< |
<< "replaceall -element:Treshold -value:"+treshold+" -filename:"+ambFileLocation+" -nobackups" |
169 |
< |
<< "replaceall -element:MinOcclusion -value:"+minOcclusion+" -filename:"+ambFileLocation+" -nobackups" |
170 |
< |
<< "replaceall -parelement:ElapsedTime -element:Min -value:"+minElapsedTime+" -filename:"+ambFileLocation+" -nobackups" |
171 |
< |
<< "replaceall -parelement:Distance -element:Max -value:"+maxVolumeDistance+" -filename:"+ambFileLocation+" -nobackups" |
172 |
< |
<< "replaceall -parelement:Distance -element:Min -value:"+minVolumeDistance+" -filename:"+ambFileLocation+" -nobackups" |
173 |
< |
<< "replaceall -parelement:SoundGroup -element:Volume -value:"+volume+" -filename:"+grpFileLocation+" -nobackups" |
174 |
< |
<< "replaceall -parelement:SoundGroup -element:Pitch -value:"+pitch+" -filename:"+grpFileLocation+" -nobackups" |
175 |
< |
<< "replaceall -parelement:SoundGroup -element:NumberOfChannels -value:"+numberChannels+" -filename:"+grpFileLocation+" -nobackups" |
176 |
< |
<< "replaceall -parelement:Volume -element:Min -value:"+minVolume+" -filename:"+grpFileLocation+" -nobackups" |
177 |
< |
<< "replaceall -parelement:Volume -element:Max -value:"+maxVolume+" -filename:"+grpFileLocation+" -nobackups" |
178 |
< |
<< "replaceall -parelement:Pitch -element:Min -value:"+minPitch+" -filename:"+grpFileLocation+" -nobackups" |
179 |
< |
<< "replaceall -parelement:Pitch -element:Max -value:"+maxPitch+" -filename:"+grpFileLocation+" -nobackups" |
180 |
< |
<< "replaceall -element:Weight -value:"+weight+" -filename:"+grpFileLocation+" -nobackups"; |
165 |
> |
(*this->xmlCommands) |
166 |
> |
<< "--replace-all-values -e Priority -n "+Util::insertQuotes(priority)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose" |
167 |
> |
<< "--replace-all-values -e Flags -n "+(flags.join(" ").isEmpty() ? "\" \"" : Util::insertQuotes(flags.join(" ")))+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose" |
168 |
> |
<< "--replace-all-values -e SphereRadius -n "+Util::insertQuotes(sphereRadious)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose" |
169 |
> |
<< "--replace-all-values -e Treshold -n "+Util::insertQuotes(treshold)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose" |
170 |
> |
<< "--replace-all-values -e MinOcclusion -n "+Util::insertQuotes(minOcclusion)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose" |
171 |
> |
<< "--replace-all-values --parent-element-name ElapsedTime -e Min -n "+Util::insertQuotes(minElapsedTime)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose" |
172 |
> |
<< "--replace-all-values --parent-element-name Distance -e Max -n "+Util::insertQuotes(maxVolumeDistance)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose" |
173 |
> |
<< "--replace-all-values --parent-element-name Distance -e Min -n "+Util::insertQuotes(minVolumeDistance)+" -f "+Util::insertQuotes(ambFileLocation)+" --no-backups --no-verbose" |
174 |
> |
<< "--replace-all-values --parent-element-name SoundGroup -e Volume -n "+Util::insertQuotes(volume)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose" |
175 |
> |
<< "--replace-all-values --parent-element-name SoundGroup -e Pitch -n "+Util::insertQuotes(pitch)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose" |
176 |
> |
<< "--replace-all-values --parent-element-name SoundGroup -e NumberOfChannels -n "+Util::insertQuotes(numberChannels)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose" |
177 |
> |
<< "--replace-all-values --parent-element-name Volume -e Min -n "+Util::insertQuotes(minVolume)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose" |
178 |
> |
<< "--replace-all-values --parent-element-name Volume -e Max -n "+Util::insertQuotes(maxVolume)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose" |
179 |
> |
<< "--replace-all-values --parent-element-name Pitch -e Min -n "+Util::insertQuotes(minPitch)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose" |
180 |
> |
<< "--replace-all-values --parent-element-name Pitch -e Max -n "+Util::insertQuotes(maxPitch)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose" |
181 |
> |
<< "--replace-all-values -e Weight -n "+Util::insertQuotes(weight)+" -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"; |
182 |
|
|
183 |
|
if(preventRepeat){ |
184 |
< |
(*this->xmlCommands) << "replaceall -parelement:SoundGroup -element:Flags -value:PreventRepeat -filename:"+grpFileLocation+" -nobackups"; |
184 |
> |
(*this->xmlCommands) << "--replace-all-values --parent-element-name SoundGroup -e Flags -n PreventRepeat -f "+Util::insertQuotes(grpFileLocation)+" --no-backups --no-verbose"; |
185 |
|
} |
186 |
|
|
187 |
|
myXmlProcessor->start(); |
202 |
|
QFile::copy(ambFileLocation, currAmbFileLocation); // make a copy of the sample files that will be the real files |
203 |
|
QFile::copy(grpFileLocation, currGrpFileLocation); |
204 |
|
|
205 |
< |
(*this->xmlCommands) << "replaceall -element:BaseTrack1 -value:"+currFileName+" -filename:"+currAmbFileLocation+" -nobackups" // process the xml |
206 |
< |
<< "replaceall -element:Sound -value:"+currFileName+" -filename:"+currGrpFileLocation+" -nobackups"; |
205 |
> |
(*this->xmlCommands) << "--replace-all-values -e BaseTrack1 -n "+Util::insertQuotes(currFileName)+" -f "+Util::insertQuotes(currAmbFileLocation)+" --no-backups --no-verbose" // process the xml |
206 |
> |
<< "--replace-all-values -e Sound -n "+Util::insertQuotes(currFileName)+" -f "+Util::insertQuotes(currGrpFileLocation)+" --no-backups --no-verbose"; |
207 |
|
|
208 |
|
myXmlProcessor->start(); |
209 |
|
myXmlProcessor->wait(); // Wait until all xml is edited |
224 |
|
if(numErrors!=0){ |
225 |
|
QString sNumErrors=QString::number(numErrors); |
226 |
|
if(numErrors>1){ |
227 |
< |
Util::showErrorLogPopUp(result+"\n This is the last of "+sNumErrors+" Errors."); |
227 |
> |
UtilVago::showErrorPopUpLogButton(result+"\n This is the last of " + sNumErrors + " Errors."); |
228 |
|
} |
229 |
|
else{ |
230 |
< |
Util::showErrorLogPopUp(result); |
230 |
> |
UtilVago::showErrorPopUpLogButton(result); |
231 |
|
} |
232 |
|
} |
233 |
|
} |