mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-06-26 16:32:06 +08:00
cabana: add button to skip to the end of stream (#29953)
This commit is contained in:
@@ -35,13 +35,24 @@ VideoWidget::VideoWidget(QWidget *parent) : QFrame(parent) {
|
||||
}
|
||||
|
||||
// btn controls
|
||||
QButtonGroup *group = new QButtonGroup(this);
|
||||
group->setExclusive(true);
|
||||
|
||||
QHBoxLayout *control_layout = new QHBoxLayout();
|
||||
play_btn = new QPushButton();
|
||||
play_btn->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
|
||||
control_layout->addWidget(play_btn);
|
||||
if (can->liveStreaming()) {
|
||||
control_layout->addWidget(skip_to_end_btn = new QPushButton(utils::icon("skip-end-fill"), {}));
|
||||
skip_to_end_btn->setToolTip(tr("Skip to the end"));
|
||||
QObject::connect(skip_to_end_btn, &QPushButton::clicked, [group]() {
|
||||
// set speed to 1.0
|
||||
group->buttons()[2]->click();
|
||||
can->pause(false);
|
||||
can->seekTo(can->totalSeconds() + 1);
|
||||
});
|
||||
}
|
||||
|
||||
QButtonGroup *group = new QButtonGroup(this);
|
||||
group->setExclusive(true);
|
||||
for (float speed : {0.1, 0.5, 1., 2.}) {
|
||||
QPushButton *btn = new QPushButton(QString("%1x").arg(speed), this);
|
||||
btn->setCheckable(true);
|
||||
@@ -121,7 +132,10 @@ void VideoWidget::setMaximumTime(double sec) {
|
||||
}
|
||||
|
||||
void VideoWidget::updateTimeRange(double min, double max, bool is_zoomed) {
|
||||
if (can->liveStreaming()) return;
|
||||
if (can->liveStreaming()) {
|
||||
skip_to_end_btn->setEnabled(!is_zoomed);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!is_zoomed) {
|
||||
min = 0;
|
||||
|
||||
@@ -81,6 +81,7 @@ protected:
|
||||
QLabel *end_time_label;
|
||||
QLabel *time_label;
|
||||
QPushButton *play_btn;
|
||||
QPushButton *skip_to_end_btn = nullptr;
|
||||
InfoLabel *alert_label;
|
||||
Slider *slider;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user