159 partRegex += "\\.dat$"; |
159 partRegex += "\\.dat$"; |
160 subpartRegex += "\\.dat$"; |
160 subpartRegex += "\\.dat$"; |
161 |
161 |
162 if (QRegExp (subpartRegex).exactMatch (dest)) |
162 if (QRegExp (subpartRegex).exactMatch (dest)) |
163 dest.prepend ("parts/s/"); |
163 dest.prepend ("parts/s/"); |
164 |
|
165 elif (QRegExp (partRegex).exactMatch (dest)) |
164 elif (QRegExp (partRegex).exactMatch (dest)) |
166 dest.prepend ("parts/"); |
165 dest.prepend ("parts/"); |
167 elif (dest.left (6) != "parts/" && dest.left (2) != "p/") |
166 elif (dest.left (6) != "parts/" && dest.left (2) != "p/") |
168 dest.prepend ("p/"); |
167 dest.prepend ("p/"); |
169 } |
168 } |
170 |
169 |
171 // ============================================================================= |
170 // ============================================================================= |
172 // ----------------------------------------------------------------------------- |
171 // ----------------------------------------------------------------------------- |
173 PartDownloader::Source PartDownloader::getSource() const |
172 PartDownloader::Source PartDownloader::getSource() const |
286 { typedef QDialogButtonBox QDBB; |
285 { typedef QDialogButtonBox QDBB; |
287 alias btnbox = ui->buttonBox; |
286 alias btnbox = ui->buttonBox; |
288 |
287 |
289 switch (i) |
288 switch (i) |
290 { case Download: |
289 { case Download: |
291 return m_downloadButton; |
290 { return m_downloadButton; |
|
291 } |
292 |
292 |
293 case Abort: |
293 case Abort: |
294 return qobject_cast<QPushButton*> (btnbox->button (QDBB::Abort)); |
294 { return qobject_cast<QPushButton*> (btnbox->button (QDBB::Abort)); |
|
295 } |
295 |
296 |
296 case Close: |
297 case Close: |
297 return qobject_cast<QPushButton*> (btnbox->button (QDBB::Close)); |
298 { return qobject_cast<QPushButton*> (btnbox->button (QDBB::Close)); |
|
299 } |
298 } |
300 } |
299 |
301 |
300 return null; |
302 return null; |
301 } |
303 } |
302 |
304 |
345 QProgressBar* prog; |
347 QProgressBar* prog; |
346 |
348 |
347 switch (m_state) |
349 switch (m_state) |
348 { case Requesting: |
350 { case Requesting: |
349 case Downloading: |
351 case Downloading: |
350 prog = qobject_cast<QProgressBar*> (table->cellWidget (tableRow(), progcol)); |
352 { prog = qobject_cast<QProgressBar*> (table->cellWidget (tableRow(), progcol)); |
351 |
353 |
352 if (!prog) |
354 if (!prog) |
353 { prog = new QProgressBar; |
355 { prog = new QProgressBar; |
354 table->setCellWidget (tableRow(), progcol, prog); |
356 table->setCellWidget (tableRow(), progcol, prog); |
355 } |
357 } |
356 |
358 |
357 prog->setRange (0, m_bytesTotal); |
359 prog->setRange (0, m_bytesTotal); |
358 prog->setValue (m_bytesRead); |
360 prog->setValue (m_bytesRead); |
359 break; |
361 } break; |
360 |
362 |
361 case Finished: |
363 case Finished: |
362 case Failed: |
364 case Failed: |
363 { QLabel* lb = new QLabel ( (m_state == Finished) ? "<b><span style=\"color: #080\">FINISHED</span></b>" : |
365 { QLabel* lb = new QLabel ((m_state == Finished) ? "<b><span style=\"color: #080\">FINISHED</span></b>" : |
364 "<b><span style=\"color: #800\">FAILED</span></b>"); |
366 "<b><span style=\"color: #800\">FAILED</span></b>"); |
365 lb->setAlignment (Qt::AlignCenter); |
367 lb->setAlignment (Qt::AlignCenter); |
366 table->setCellWidget (tableRow(), progcol, lb); |
368 table->setCellWidget (tableRow(), progcol, lb); |
367 } |
369 } break; |
368 break; |
|
369 } |
370 } |
370 |
371 |
371 QLabel* lb = qobject_cast<QLabel*> (table->cellWidget (tableRow(), labelcol)); |
372 QLabel* lb = qobject_cast<QLabel*> (table->cellWidget (tableRow(), labelcol)); |
372 |
373 |
373 if (m_firstUpdate) |
374 if (m_firstUpdate) |