@@ -93,12 +93,12 @@ void CoverterDialogue::on_runCvt_clicked()
9393 else // Otherwise, just write down as-is
9494 {
9595 m_phase = PHASE_CONVERSION ;
96+ }
9697
97- if (!m_cvt.openOutFile (ui->fileOut ->text ().toStdString (), ui->dstFormat ->currentData ().toInt (), m_dstSpec))
98- {
99- qWarning () << " Failed to open output file" << ui->fileOut ->text () << QString::fromStdString (m_cvt.getLastError ());
100- return ;
101- }
98+ if (!m_cvt.openOutFile (ui->fileOut ->text ().toStdString (), ui->dstFormat ->currentData ().toInt (), m_dstSpec))
99+ {
100+ qWarning () << " Failed to open output file" << ui->fileOut ->text () << QString::fromStdString (m_cvt.getLastError ());
101+ return ;
102102 }
103103
104104 m_runner = QtConcurrent::run<void >(this , &CoverterDialogue::runner);
@@ -137,7 +137,12 @@ void CoverterDialogue::runner()
137137 switch (m_phase)
138138 {
139139 case PHASE_LENGHT_MEASURE :
140- m_cvt.runChunk (true );
140+ if (!m_cvt.runChunk (true ))
141+ {
142+ qWarning () << " Conversion failed: (Phase Measure) can't read source file" ;
143+ emit workFinished ();
144+ return ;
145+ }
141146
142147 if (prev_progress != m_cvt.curChunk ())
143148 {
@@ -161,7 +166,7 @@ void CoverterDialogue::runner()
161166
162167 m_cvt.rewindRead ();
163168
164- if (!m_cvt.openOutFile (ui->fileOut ->text ().toStdString (), FORMAT_OGG_VORBIS , m_dstSpec))
169+ if (!m_cvt.openOutFile (ui->fileOut ->text ().toStdString (), ui-> dstFormat -> currentData (). toInt () , m_dstSpec))
165170 {
166171 qWarning () << " Failed to open output file" << ui->fileOut ->text ();
167172 emit workFinished ();
@@ -173,7 +178,12 @@ void CoverterDialogue::runner()
173178
174179 break ;
175180 case PHASE_CONVERSION :
176- m_cvt.runChunk (false );
181+ if (!m_cvt.runChunk (false ))
182+ {
183+ qWarning () << " Conversion failed: (Phase Conversion) can't read source file" ;
184+ emit workFinished ();
185+ return ;
186+ }
177187
178188 if (prev_progress != m_cvt.curChunk ())
179189 {
@@ -187,7 +197,13 @@ void CoverterDialogue::runner()
187197 }
188198 else
189199 {
190- m_cvt.runChunk ();
200+ if (!m_cvt.runChunk ())
201+ {
202+ qWarning () << " Conversion failed: can't read source file" ;
203+ emit workFinished ();
204+ return ;
205+ }
206+
191207 emit updateProgress (m_cvt.curChunk ());
192208 }
193209 }
0 commit comments