| 68 |
|
void PackagePage4::addResourcesPackage(DropTableWidget *myTable, QStringList resources){ |
| 69 |
|
|
| 70 |
|
//Pre-processing (check if received only folders) |
| 71 |
< |
foreach(QString myFile, resources){ |
| 71 |
> |
for(const QString &myFile : resources){ |
| 72 |
|
if(!QDir(myFile).exists()){ |
| 73 |
< |
Util::showErrorPopUp("Only folders are allowed for this operation."); |
| 73 |
> |
Util::Dialogs::showError("Only folders are allowed for this operation."); |
| 74 |
|
return; |
| 75 |
|
} |
| 76 |
|
} |
| 77 |
|
|
| 78 |
|
QString type=ui->pbSwitchFiles->text().replace(" files",""); |
| 79 |
|
|
| 80 |
< |
foreach(QString currentFolder, resources){ |
| 80 |
> |
for(QString currentFolder: resources){ |
| 81 |
|
|
| 82 |
< |
currentFolder=Util::normalizePath(currentFolder); //normalize path |
| 82 |
> |
currentFolder=Util::FileSystem::normalizePath(currentFolder); //normalize path |
| 83 |
|
|
| 84 |
|
//Get actual number rows |
| 85 |
|
int twSize=myTable->rowCount(); |
| 88 |
|
myTable->setRowCount(twSize+1); |
| 89 |
|
|
| 90 |
|
//Add to table and list to |
| 91 |
< |
QTableWidgetItem *newFolder = new QTableWidgetItem(Util::cutName(currentFolder)); |
| 91 |
> |
QTableWidgetItem *newFolder = new QTableWidgetItem(Util::FileSystem::cutName(currentFolder)); |
| 92 |
|
QTableWidgetItem *newType = new QTableWidgetItem(type); |
| 93 |
|
QTableWidgetItem *newFullPath = new QTableWidgetItem(currentFolder); |
| 94 |
|
|
| 138 |
|
|
| 139 |
|
void PackagePage4::addTableContents(DropTableWidget *myTable){ |
| 140 |
|
if(ui->pbSwitchFiles->text()==".oni files"){ |
| 141 |
< |
addResourcesPackage(myTable,Util::multipleDirDialog("Choose folders with .oni files...")); |
| 141 |
> |
addResourcesPackage(myTable,Util::Dialogs::multipleDirSelection("Choose folders with .oni files...")); |
| 142 |
|
} |
| 143 |
|
else if(ui->pbSwitchFiles->text()==".bsl files"){ |
| 144 |
< |
addResourcesPackage(myTable,Util::multipleDirDialog("Choose folders with .bsl files...")); |
| 144 |
> |
addResourcesPackage(myTable,Util::Dialogs::multipleDirSelection("Choose folders with .bsl files...")); |
| 145 |
|
} |
| 146 |
|
else{ |
| 147 |
< |
addResourcesPackage(myTable,Util::multipleDirDialog("Choose folders with .oni-patch files...")); |
| 147 |
> |
addResourcesPackage(myTable,Util::Dialogs::multipleDirSelection("Choose folders with .oni-patch files...")); |
| 148 |
|
} |
| 149 |
|
} |
| 150 |
|
|
| 152 |
|
int size = myTable->selectionModel()->selectedRows().size(); |
| 153 |
|
|
| 154 |
|
if(size==0){ |
| 155 |
< |
Util::showPopUp("Select a row first."); |
| 155 |
> |
Util::Dialogs::showInfo("Select a row first."); |
| 156 |
|
return; |
| 157 |
|
} |
| 158 |
|
|
| 159 |
< |
if(Util::showQuestionPopUp(this,"Are you sure you want to delete the selected rows?")){ |
| 159 |
> |
if(Util::Dialogs::showQuestion(this,"Are you sure you want to delete the selected rows?")){ |
| 160 |
|
for(int i=0; i<size; i++){ |
| 161 |
|
myTable->removeRow(myTable->selectionModel()->selectedRows().at(size-i-1).row()); |
| 162 |
|
} |
| 165 |
|
|
| 166 |
|
bool PackagePage4::validatePage(){ |
| 167 |
|
if(ui->twCommon->rowCount()==0 && ui->twWindows->rowCount()==0 && ui->twMac->rowCount()==0){ |
| 168 |
< |
Util::showErrorPopUp("You need to add some folders with resources first!"); |
| 168 |
> |
Util::Dialogs::showError("You need to add some folders with resources first!"); |
| 169 |
|
return false; |
| 170 |
|
} |
| 171 |
|
|