UI: only show chapter button when chapter info available

This commit is contained in:
2025-07-21 00:03:26 +08:00
parent 094a83512e
commit af38103c0d
2 changed files with 10 additions and 5 deletions

View File

@ -61,6 +61,7 @@ MainWindow::MainWindow(QWidget *parent)
m_mediaPlayer->setLoops(QMediaPlayer::Infinite);
ui->playlistView->setModel(m_playlistManager->model());
ui->chapterNameBtn->setVisible(false);
ui->chapterlistView->setModel(ui->playbackProgressIndicator->chapterModel());
ui->chapterlistView->setRootIsDecorated(false);
@ -527,9 +528,13 @@ void MainWindow::initConnections()
ui->chapterNameBtn->setText(currentChapterName);
lastChapterName = currentChapterName;
}
} else if (!lastChapterName.isEmpty()) {
ui->chapterNameBtn->setText("");
lastChapterName.clear();
ui->chapterNameBtn->setVisible(true);
} else {
if (!lastChapterName.isEmpty()) {
ui->chapterNameBtn->setText("");
lastChapterName.clear();
}
ui->chapterNameBtn->setVisible(false);
}
});