--- Vago/trunk/Vago/soundWizard/soundpage2.cpp 2013/03/31 19:02:16 771 +++ s10k/Vago/soundWizard/soundpage2.cpp 2017/12/30 13:57:32 1093 @@ -2,16 +2,21 @@ #include "ui_soundpage2.h" const QStringList SoundPage2::allowedFiles = QStringList() << "*.wav" << "*.aif" << "*.aifc" << "*.afc"; -const QString SoundPage2::codecLocalHelpFile=GlobalVars::HelpLocation + "/XMLSNDD.html#Source_file_creation"; -SoundPage2::SoundPage2(QWidget *parent) : +SoundPage2::SoundPage2(QString appLocation, QWidget *parent) : QWizardPage(parent), ui(new Ui::soundpage2) { ui->setupUi(this); this->soundTable=ui->twSoundFiles; + this->codecLocalHelpFile=appLocation+"/"+GlobalVars::HelpDir + "/XMLSNDD.html#Source_file_creation"; ui->twSoundFiles->removeColumn(2); // Only two columns + ui->label->setText("Add here the files you want to convert. " + "All the files will have the same properties applied.
" + "Don't forget to first convert the files to an oni compatible codec. " + "More information here."); // Don't use rich text in qtdesigner because it generates platform dependent code + // Drop signal for Packages table connect(ui->twSoundFiles, SIGNAL(dropped(DropTableWidget*,QStringList)), this, SLOT(addResourcesSounds(DropTableWidget*,QStringList))); // Signal for click in label (display local help) @@ -49,11 +54,11 @@ void SoundPage2::on_tbRemoveFiles_clicke int size = ui->twSoundFiles->selectionModel()->selectedRows().size(); if(size==0){ - Util::showPopUp("Select a row first."); + Util::Dialogs::showInfo("Select a row first."); return; } - if(Util::showQuestionPopUp(this,"Are you sure you want to delete the selected rows?")){ + if(Util::Dialogs::showQuestion(this,"Are you sure you want to delete the selected rows?")){ for(int i=0; itwSoundFiles->removeRow(ui->twSoundFiles->selectionModel()->selectedRows().at(size-i-1).row()); } @@ -65,29 +70,29 @@ void SoundPage2::addResourcesSounds(Drop bool fileExtValid=false; //Pre-processing (check if received only folders) - foreach(QString myFile, resources){ - QString currFileExt=QFileInfo(myFile).completeSuffix(); + for(const QString &myFile : resources){ + QString currFileExt="."+QFileInfo(myFile).completeSuffix(); if(QDir(myFile).exists()){ - Util::showErrorPopUp("Only files are allowed for this operation."); + Util::Dialogs::showError("Only files are allowed for this operation."); return; } - foreach(QString vext, this->allowedFiles){ - vext.remove("*."); - if(vext==currFileExt){ + for(QString vext : this->allowedFiles){ + vext.remove("*"); + if(currFileExt.endsWith(vext)){ fileExtValid=true; break; } } if(!fileExtValid){ - Util::showErrorPopUp("Files must be in the follow formats:\n" + + Util::Dialogs::showError("Files must be in the follow formats:\n" + this->allowedFiles.join(" ")); return; } } - foreach(QString currentFile, resources){ + for(const QString ¤tFile : resources){ //Get actual number rows int twSize=myTable->rowCount(); @@ -97,7 +102,7 @@ void SoundPage2::addResourcesSounds(Drop //Add to table and list to QTableWidgetItem *newName = new QTableWidgetItem(QFileInfo(currentFile).baseName()); - QTableWidgetItem *newFileLocation = new QTableWidgetItem(Util::normalizePath(currentFile)); + QTableWidgetItem *newFileLocation = new QTableWidgetItem(Util::FileSystem::normalizePath(currentFile)); myTable->setItem(twSize,0,newName); myTable->setItem(twSize,1,newFileLocation); @@ -119,7 +124,7 @@ bool SoundPage2::validatePage(){ QStringList namesList; if(ui->twSoundFiles->rowCount()==0){ - Util::showErrorPopUp("You need to add some sound files first!"); + Util::Dialogs::showError("You need to add some sound files first!"); return false; } @@ -127,13 +132,13 @@ bool SoundPage2::validatePage(){ namesList << ui->twSoundFiles->item(i,0)->text(); } - if(ui->rbOther->isChecked() && Util::checkEmptySpaces(QStringList() << ui->leOtherLocation->text())){ - Util::showErrorPopUp("Please input a directory to output the files."); + if(ui->rbOther->isChecked() && Util::Validation::checkEmptySpaces(QStringList() << ui->leOtherLocation->text())){ + Util::Dialogs::showError("Please input a directory to output the files."); return false; } if(ui->rbOther->isChecked() && !QDir(ui->leOtherLocation->text()).exists()){ - Util::showErrorPopUp("Invalid directory specified in other location. Please fix it."); + Util::Dialogs::showError("Invalid directory specified in other location. Please fix it."); return false; }