diff options
author | ccolin | 2021-01-02 01:51:52 +0100 |
---|---|---|
committer | ccolin | 2021-01-02 01:51:52 +0100 |
commit | a23067c1811576654bc8482748c8b1e3c6247dc2 (patch) | |
tree | 6ce0c0860a7711d49c6ef1cee00733ca24a5b1e3 /src/main_window.cc | |
parent | bb0da810d945d98b25390c65ab3f34e695914fd6 (diff) |
add clicking to a collision to seek to it
Diffstat (limited to 'src/main_window.cc')
-rw-r--r-- | src/main_window.cc | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/main_window.cc b/src/main_window.cc index e63bf0e..26d9601 100644 --- a/src/main_window.cc +++ b/src/main_window.cc @@ -30,6 +30,7 @@ MainWindow::MainWindow(QWidget *parent) { QDockWidget *dock = new QDockWidget("Outils", this); dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); settings_pane = new SettingsPane(); + settings_pane->setEnabled(false); dock->setWidget(settings_pane); addDockWidget(Qt::RightDockWidgetArea, dock); } @@ -62,9 +63,13 @@ void MainWindow::open(const QString &path) { if (dc) delete dc; glw.meshes.clear(); dc = new DroneController(json_doc.object()); - playpause_action->setEnabled(true); + + // Play/Pause button connect(dc, &DroneController::playing, this, &MainWindow::play); connect(dc, &DroneController::pausing, this, &MainWindow::pause); + playpause_action->setEnabled(true); + + // Seekbar slider slider->setMinimum(0); slider->setMaximum(dc->getDuration()); slider->setValue(0); @@ -72,10 +77,19 @@ void MainWindow::open(const QString &path) { connect(slider, &QSlider::sliderReleased, dc, &DroneController::resume); connect(slider, &QSlider::valueChanged, dc, &DroneController::seek); connect(dc, &DroneController::frameChanged, slider, &QSlider::setValue); + connect(settings_pane, &SettingsPane::collisionClicked, + slider, &QSlider::setValue); + slider->setEnabled(true); + connect(dc, &DroneController::collision, settings_pane, &SettingsPane::addCollision); - dc->computeCollisions(10); + connect(settings_pane, &SettingsPane::sphereRadiusChanged, + [&](double _) { settings_pane->clearCollisions(); }); + connect(settings_pane, &SettingsPane::sphereRadiusChanged, + dc, &DroneController::computeCollisions); + settings_pane->setEnabled(true); + + dc->computeCollisions(.1); pause(); - slider->setEnabled(true); } |