MCPcopy Create free account
hub / github.com/QNapi/qnapi / showOpenDialog

Method showOpenDialog

gui/src/qnapiapp.cpp:178–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178bool 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
228bool QNapiApp::showScanDialog(QString init_dir) {
229 if (!f_scan) f_scan = new frmScan();

Callers 1

mainFunction · 0.80

Calls 9

lastOpenedDirMethod · 0.80
selectFilesMethod · 0.80
selectedFilesMethod · 0.80
setLastOpenedDirMethod · 0.80
clearSpecificEngineMethod · 0.80
enqueueFilesMethod · 0.80
isBatchModeMethod · 0.80
setSpecificEngineMethod · 0.45
downloadMethod · 0.45

Tested by

no test coverage detected