equal
deleted
inserted
replaced
232 } |
232 } |
233 |
233 |
234 // get file size as string |
234 // get file size as string |
235 static QString FileSizeStr(const QString & path) |
235 static QString FileSizeStr(const QString & path) |
236 { |
236 { |
237 quint64 size = QFileInfo(path).size(); |
237 qint64 size = QFileInfo(path).size(); |
238 |
238 return QLocale().formattedDataSize(size); |
239 quint64 KiB = 1024; |
|
240 quint64 MiB = 1024*KiB; |
|
241 quint64 GiB = 1024*MiB; |
|
242 QString sizeStr; |
|
243 if (size >= GiB) |
|
244 return QString("%1 GiB").arg(QString::number(float(size)/GiB, 'f', 2)); |
|
245 if (size >= MiB) |
|
246 return QString("%1 MiB").arg(QString::number(float(size)/MiB, 'f', 2)); |
|
247 if (size >= KiB) |
|
248 return QString("%1 KiB").arg(QString::number(float(size)/KiB, 'f', 2)); |
|
249 return PageVideos::tr("%1 bytes", "", size).arg(QString::number(size)); |
|
250 } |
239 } |
251 |
240 |
252 // set file size in file list in specified row |
241 // set file size in file list in specified row |
253 void PageVideos::updateSize(int row) |
242 void PageVideos::updateSize(int row) |
254 { |
243 { |
317 |
306 |
318 void PageVideos::setProgress(int row, VideoItem* item, float value) |
307 void PageVideos::setProgress(int row, VideoItem* item, float value) |
319 { |
308 { |
320 QProgressBar * progressBar = (QProgressBar*)filesTable->cellWidget(row, vcProgress); |
309 QProgressBar * progressBar = (QProgressBar*)filesTable->cellWidget(row, vcProgress); |
321 progressBar->setValue(value*10000); |
310 progressBar->setValue(value*10000); |
322 progressBar->setFormat(QString("%1%").arg(value*100, 0, 'f', 2)); |
311 //: Video encoding progress. %1 = number |
|
312 progressBar->setFormat(QString(tr("%1%")).arg(QLocale().toString(value*100, 'f', 2))); |
323 item->progress = value; |
313 item->progress = value; |
324 } |
314 } |
325 |
315 |
326 void PageVideos::updateProgress(float value) |
316 void PageVideos::updateProgress(float value) |
327 { |
317 { |
692 int count = filesTable->rowCount(); |
682 int count = filesTable->rowCount(); |
693 for (int i = 0; i < count; i++) |
683 for (int i = 0; i < count; i++) |
694 { |
684 { |
695 VideoItem * item = nameItem(i); |
685 VideoItem * item = nameItem(i); |
696 QString process; |
686 QString process; |
697 if (!item->ready()) |
687 if (item->ready()) |
698 process = tr("encoding"); |
|
699 else |
|
700 continue; |
688 continue; |
701 float progress = 100*item->progress; |
689 float progress = 100*item->progress; |
702 if (progress > 99.99) |
690 if (progress > 99.99) |
703 progress = 99.99; // displaying 100% may be confusing |
691 progress = 99.99; // displaying 100% may be confusing |
704 list += item->name + " (" + QString::number(progress, 'f', 2) + "% - " + process + ")\n"; |
692 //: Video encoding list entry. %1 = file name, %2 = percent complete, %3 = video operation type (e.g. “encoding”) |
|
693 list += QString(tr("%1 (%2%) - %3")) |
|
694 .arg(item->name) |
|
695 .arg(QLocale().toString(progress, 'f', 2)) |
|
696 .arg(tr("encoding")) |
|
697 + "\n"; |
705 } |
698 } |
706 return list; |
699 return list; |
707 } |
700 } |
708 |
701 |
709 void PageVideos::startEncoding(const QByteArray & record) |
702 void PageVideos::startEncoding(const QByteArray & record) |