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

Method download

gui/src/forms/frmprogress.cpp:77–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77bool frmProgress::download() {
78 if (summary.isVisible()) {
79 summary.close();
80 }
81
82 auto config = LibQNapi::loadConfig();
83 auto config1 = config;
84 if (!targetFormatOverride.isEmpty()) {
85 config1 = config1.setPostProcessingConfig(
86 config1.postProcessingConfig().setSubFormat(targetFormatOverride));
87 }
88 auto config2 = config1;
89 if (!targetExtOverride.isEmpty()) {
90 config2 = config2.setPostProcessingConfig(
91 config2.postProcessingConfig().setSubExtension(targetExtOverride));
92 }
93
94 QNapi napi(config2);
95
96 // TODO: perform these checks earlier
97 if (!napi.checkP7ZipPath()) {
98 QMessageBox::warning(0, tr("Can not find p7zip!"),
99 tr("The path to the program p7zip is incorrect!"));
100 return false;
101 }
102
103 if (!napi.checkTmpPath()) {
104 QMessageBox::warning(
105 0, tr("Invalid temporary directory!"),
106 tr("Unable to write to the temporary directory! Check your settings."));
107 return false;
108 }
109
110 if (getThread.queue.isEmpty()) {
111 QMessageBox::warning(
112 0, tr("No files!"),
113 tr("Can't download subtitles as no movie files specified!"));
114 return false;
115 }
116
117 if (!isVisible()) {
118 QRect position = frameGeometry();
119 position.moveCenter(QDesktopWidget().availableGeometry().center());
120 move(position.topLeft());
121 show();
122 }
123
124 showSummary = true;
125 closeRequested = false;
126 ui.pbCancel->setEnabled(true);
127
128 getThread.setConfig(config2);
129 getThread.start();
130 return true;
131}
132
133void frmProgress::updateProgress(int current, int all, float stageProgress) {
134 static int lastCurrent, lastAll;

Callers 1

runMethod · 0.45

Calls 9

setSubFormatMethod · 0.80
postProcessingConfigMethod · 0.80
setSubExtensionMethod · 0.80
checkP7ZipPathMethod · 0.80
checkTmpPathMethod · 0.80
setEnabledMethod · 0.80
setConfigMethod · 0.80
closeMethod · 0.45

Tested by

no test coverage detected