54 |
|
int size = ui->twSoundFiles->selectionModel()->selectedRows().size(); |
55 |
|
|
56 |
|
if(size==0){ |
57 |
< |
Util::showPopUp("Select a row first."); |
57 |
> |
Util::Dialogs::showInfo("Select a row first."); |
58 |
|
return; |
59 |
|
} |
60 |
|
|
61 |
< |
if(Util::showQuestionPopUp(this,"Are you sure you want to delete the selected rows?")){ |
61 |
> |
if(Util::Dialogs::showQuestion(this,"Are you sure you want to delete the selected rows?")){ |
62 |
|
for(int i=0; i<size; i++){ |
63 |
|
ui->twSoundFiles->removeRow(ui->twSoundFiles->selectionModel()->selectedRows().at(size-i-1).row()); |
64 |
|
} |
70 |
|
bool fileExtValid=false; |
71 |
|
|
72 |
|
//Pre-processing (check if received only folders) |
73 |
< |
foreach(QString myFile, resources){ |
73 |
> |
for(const QString &myFile : resources){ |
74 |
|
QString currFileExt="."+QFileInfo(myFile).completeSuffix(); |
75 |
|
if(QDir(myFile).exists()){ |
76 |
< |
Util::showErrorPopUp("Only files are allowed for this operation."); |
76 |
> |
Util::Dialogs::showError("Only files are allowed for this operation."); |
77 |
|
return; |
78 |
|
} |
79 |
|
|
80 |
< |
foreach(QString vext, this->allowedFiles){ |
80 |
> |
for(QString vext : this->allowedFiles){ |
81 |
|
vext.remove("*"); |
82 |
|
if(currFileExt.endsWith(vext)){ |
83 |
|
fileExtValid=true; |
86 |
|
} |
87 |
|
|
88 |
|
if(!fileExtValid){ |
89 |
< |
Util::showErrorPopUp("Files must be in the follow formats:\n" + |
89 |
> |
Util::Dialogs::showError("Files must be in the follow formats:\n" + |
90 |
|
this->allowedFiles.join(" ")); |
91 |
|
return; |
92 |
|
} |
93 |
|
} |
94 |
|
|
95 |
< |
foreach(QString currentFile, resources){ |
95 |
> |
for(const QString ¤tFile : resources){ |
96 |
|
|
97 |
|
//Get actual number rows |
98 |
|
int twSize=myTable->rowCount(); |
102 |
|
|
103 |
|
//Add to table and list to |
104 |
|
QTableWidgetItem *newName = new QTableWidgetItem(QFileInfo(currentFile).baseName()); |
105 |
< |
QTableWidgetItem *newFileLocation = new QTableWidgetItem(Util::normalizePath(currentFile)); |
105 |
> |
QTableWidgetItem *newFileLocation = new QTableWidgetItem(Util::FileSystem::normalizePath(currentFile)); |
106 |
|
|
107 |
|
myTable->setItem(twSize,0,newName); |
108 |
|
myTable->setItem(twSize,1,newFileLocation); |
124 |
|
QStringList namesList; |
125 |
|
|
126 |
|
if(ui->twSoundFiles->rowCount()==0){ |
127 |
< |
Util::showErrorPopUp("You need to add some sound files first!"); |
127 |
> |
Util::Dialogs::showError("You need to add some sound files first!"); |
128 |
|
return false; |
129 |
|
} |
130 |
|
|
132 |
|
namesList << ui->twSoundFiles->item(i,0)->text(); |
133 |
|
} |
134 |
|
|
135 |
< |
if(ui->rbOther->isChecked() && Util::checkEmptySpaces(QStringList() << ui->leOtherLocation->text())){ |
136 |
< |
Util::showErrorPopUp("Please input a directory to output the files."); |
135 |
> |
if(ui->rbOther->isChecked() && Util::Validation::checkEmptySpaces(QStringList() << ui->leOtherLocation->text())){ |
136 |
> |
Util::Dialogs::showError("Please input a directory to output the files."); |
137 |
|
return false; |
138 |
|
} |
139 |
|
|
140 |
|
if(ui->rbOther->isChecked() && !QDir(ui->leOtherLocation->text()).exists()){ |
141 |
< |
Util::showErrorPopUp("Invalid directory specified in other location. Please fix it."); |
141 |
> |
Util::Dialogs::showError("Invalid directory specified in other location. Please fix it."); |
142 |
|
return false; |
143 |
|
} |
144 |
|
|