diff options
Diffstat (limited to 'src/settings_pane.cc')
-rw-r--r-- | src/settings_pane.cc | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/src/settings_pane.cc b/src/settings_pane.cc index e580d37..856c45c 100644 --- a/src/settings_pane.cc +++ b/src/settings_pane.cc @@ -10,18 +10,24 @@ SettingsPane::SettingsPane(QWidget *parent) :QWidget(parent) { - QDoubleSpinBox *sphere_radius = new QDoubleSpinBox(); - sphere_radius->setSingleStep(.1); - QDoubleSpinBox *speed_limit = new QDoubleSpinBox(); - speed_limit->setSingleStep(.1); + QDoubleSpinBox *sphere_radius_input = new QDoubleSpinBox(); + sphere_radius_input->setSingleStep(.1); + sphere_radius_input->setValue(sphere_radius); + QDoubleSpinBox *speed_limit_input = new QDoubleSpinBox(); + speed_limit_input->setSingleStep(.1); + speed_limit_input->setValue(speed_limit); QCheckBox *show_trajectories = new QCheckBox(); QCheckBox *show_guides = new QCheckBox(); collisions = new QListWidget(); speeding_violations = new QListWidget(); - connect(sphere_radius, QOverload<double>::of(&QDoubleSpinBox::valueChanged), + connect(sphere_radius_input, QOverload<double>::of(&QDoubleSpinBox::valueChanged), + [&](double radius) { sphere_radius = radius; }); + connect(sphere_radius_input, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &SettingsPane::sphereRadiusChanged); - connect(speed_limit, QOverload<double>::of(&QDoubleSpinBox::valueChanged), + connect(speed_limit_input, QOverload<double>::of(&QDoubleSpinBox::valueChanged), + [&](double speed) { speed_limit = speed; }); + connect(speed_limit_input, QOverload<double>::of(&QDoubleSpinBox::valueChanged), this, &SettingsPane::speedLimitChanged); connect(show_trajectories, &QCheckBox::stateChanged, this, &SettingsPane::toggledTrajectories); @@ -35,8 +41,8 @@ SettingsPane::SettingsPane(QWidget *parent) QTabWidget *tabs = new QTabWidget(); QFormLayout *layout = new QFormLayout; - layout->addRow("Taille de la sphère de collision", sphere_radius); - layout->addRow("Limite de vitesse", speed_limit); + layout->addRow("Taille de la sphère de collision", sphere_radius_input); + layout->addRow("Limite de vitesse", speed_limit_input); layout->addRow("Afficher les trajectoires", show_trajectories); layout->addRow("Afficher les guides", show_guides); @@ -48,6 +54,15 @@ SettingsPane::SettingsPane(QWidget *parent) } +double SettingsPane::getSphereRadius() const { + return sphere_radius; +} + +double SettingsPane::getSpeedLimit() const { + return speed_limit; +} + + void SettingsPane::addCollision(int idA, int idB, int frame) { BookmarkItem *item = new BookmarkItem("Frame " + QString::number(frame) + ": #" + QString::number(idA) + " et #" + QString::number(idB), |