Browse Source

UI: Fix slide counter with no slides

When a slideshow is created with no slides, the slide counter
shows value of "1 / 0". Now it shows "- / -".
cg2121 2 years ago
parent
commit
a18f07d49c
1 changed files with 7 additions and 2 deletions
  1. 7 2
      UI/media-controls.cpp

+ 7 - 2
UI/media-controls.cpp

@@ -510,6 +510,11 @@ void MediaControls::UpdateSlideCounter()
 	int total = calldata_int(&cd, "total_files");
 	calldata_free(&cd);
 
-	ui->timerLabel->setText(QString::number(slide + 1));
-	ui->durationLabel->setText(QString::number(total));
+	if (total > 0) {
+		ui->timerLabel->setText(QString::number(slide + 1));
+		ui->durationLabel->setText(QString::number(total));
+	} else {
+		ui->timerLabel->setText("-");
+		ui->durationLabel->setText("-");
+	}
 }