| 176 | } |
| 177 | |
| 178 | bool QNapiApp::showOpenDialog(QString engine) { |
| 179 | QStringList fileList; |
| 180 | |
| 181 | if (!openDialog) { |
| 182 | QString initDir = LibQNapi::loadConfig().lastOpenedDir(); |
| 183 | |
| 184 | if (!QFileInfo(initDir).isDir()) { |
| 185 | initDir = QDir::homePath(); |
| 186 | } |
| 187 | |
| 188 | openDialog = new QNapiOpenDialog( |
| 189 | 0, tr("Select one or more video files to download subtitles for"), |
| 190 | initDir, QNapiOpenDialog::Movies); |
| 191 | } else if (openDialog) { |
| 192 | openDialog->raise(); |
| 193 | return true; |
| 194 | } else if (f_progress) { |
| 195 | f_progress->raise(); |
| 196 | return true; |
| 197 | } |
| 198 | |
| 199 | if (openDialog->selectFiles()) { |
| 200 | fileList = openDialog->selectedFiles(); |
| 201 | |
| 202 | if (!fileList.isEmpty()) { |
| 203 | QString dialogPath = QFileInfo(fileList.first()).absolutePath(); |
| 204 | auto newConfig = LibQNapi::loadConfig().setLastOpenedDir(dialogPath); |
| 205 | LibQNapi::writeConfig(newConfig); |
| 206 | } |
| 207 | } |
| 208 | |
| 209 | delete openDialog; |
| 210 | openDialog = 0; |
| 211 | |
| 212 | if (!fileList.isEmpty()) { |
| 213 | if (!engine.isEmpty()) { |
| 214 | progress()->setSpecificEngine(engine); |
| 215 | } else { |
| 216 | progress()->clearSpecificEngine(); |
| 217 | } |
| 218 | |
| 219 | progress()->enqueueFiles(fileList); |
| 220 | progress()->download(); |
| 221 | } else if (progress()->isBatchMode()) { |
| 222 | return false; |
| 223 | } |
| 224 | |
| 225 | return true; |
| 226 | } |
| 227 | |
| 228 | bool QNapiApp::showScanDialog(QString init_dir) { |
| 229 | if (!f_scan) f_scan = new frmScan(); |
no test coverage detected