-void LoadingWidget::bufferStatus(int percent) {
- // qDebug() << percent;
-
- /*
- if (progressBar->isHidden() && percent > 0) {
- progressBar->show();
- QPropertyAnimation *animation = new QPropertyAnimation(progressBar, "opacity");
- animation->setDuration(1000);
- animation->setStartValue(0.0);
- animation->setEndValue(1.0);
- animation->start();
- }*/
- // progressBar->setShown(percent > 0);
- if (startTime.elapsed() < 1000) return;
- if (progressBar->value() == 0 && percent > 80) return;
- progressBar->setValue(percent);
+void LoadingWidget::bufferStatus(qreal value) {
+ int percent = value * 100.;
+ if (startTime.elapsed() > 1000 && percent > progressBar->value())
+ progressBar->setValue(percent);
+}
+
+void LoadingWidget::adjustFontSize() {
+ QFont f = titleLabel->font();
+ int smallerDimension = qMin(height(), width());
+ f.setPixelSize(smallerDimension / 12);
+ QFontMetrics fm(f);
+ int textHeightInPixels = fm.height();
+ int spacing = textHeightInPixels / 2;
+ layout()->setSpacing(spacing);
+ layout()->setMargin(spacing);
+ titleLabel->setFont(f);
+
+ QFont descFont = descriptionLabel->font();
+ descFont.setPixelSize(f.pixelSize() / 2);
+ descriptionLabel->setFont(descFont);