ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/s10k/Vago/soundWizard/soundpagefinal.cpp
(Generate patch)

Comparing Vago/trunk/Vago/soundWizard/soundpagefinal.cpp (file contents):
Revision 771 by s10k, Sun Mar 31 19:02:16 2013 UTC vs.
Revision 1047 by s10k, Fri Sep 16 22:51:26 2016 UTC

# Line 1 | Line 1
1   #include "soundpagefinal.h"
2   #include "ui_soundpagefinal.h"
3  
4 < SoundPageFinal::SoundPageFinal(QString soundsLocation, DropTableWidget *page2Table, Logger *myLogger, QHash<QString, QString> *commandMap, QWidget *parent) :
4 > SoundPageFinal::SoundPageFinal(QString AppDir, QString soundsLocation, DropTableWidget *page2Table, Logger *myLogger, QHash<QString, QString> *commandMap, QWidget *parent) :
5      QWizardPage(parent),
6      ui(new Ui::soundpagefinal)
7   {
# Line 13 | Line 13 | SoundPageFinal::SoundPageFinal(QString s
13  
14      this->xmlCommands = new QStringList();
15      this->oniSplitCommands = new QStringList();
16 <    this->myXmlProcessor = new XmlProcessor(this->myLogger,this->xmlCommands);
17 <    this->myConverter = new Converter(this->myLogger,this->oniSplitCommands);
16 >    this->myXmlProcessor = new XmlProcessor(AppDir, this->myLogger,this->xmlCommands);
17 >    this->myConverter = new Converter(AppDir, this->myLogger,this->oniSplitCommands);
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, "
22 >                            "otherwise click finish.</html>"); // Don't use rich text in qtdesigner because it generates platform dependent code
23  
24      connectSlots();
25   }
# Line 142 | Line 147 | void SoundPageFinal::startProcessing(){
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;
147 <        this->myLogger->writeString(message);
148 <        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;
154 <        this->myLogger->writeString(message);
155 <        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
# Line 161 | Line 162 | void SoundPageFinal::startProcessing(){
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();
# Line 191 | Line 193 | void SoundPageFinal::startProcessing(){
193  
194      for(int i=0; i<this->page2Table->rowCount(); i++){
195  
196 <        (*this->oniSplitCommands) << this->commandMap->value("general->XML->ONI")+" "+outputFolder+" "+Util::insertQuotes(this->page2Table->item(i,1)->text()); // add location of sound file to convert
196 >        (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+outputFolder+" "+Util::insertQuotes(this->page2Table->item(i,1)->text()); // add location of sound file to convert
197  
198          currFileName=this->page2Table->item(i,0)->text(); // get current file name
199          currAmbFileLocation = QString(ambFileLocation).replace("sample_file",currFileName); // get the new files, filenames
# Line 200 | Line 202 | void SoundPageFinal::startProcessing(){
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
210      }
211  
212 <    (*this->oniSplitCommands) << this->commandMap->value("general->XML->ONI")+" "+outputFolder+" "+Util::insertQuotes(GlobalVars::VagoTemporaryDir+"/*.xml");
212 >    (*this->oniSplitCommands) << this->commandMap->value("xml->XML->ONI")+" "+outputFolder+" "+Util::insertQuotes(GlobalVars::VagoTemporaryDir+"/*.xml");
213  
214      this->myConverter->start(); // finally process the onisplit commands
215      this->myConverter->wait(); // wait for it to complete
# Line 222 | Line 224 | void SoundPageFinal::catchXmlAndOSplitPr
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   }

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)