diff --git a/src/main_window.cc b/src/main_window.cc index 49c4180..1c37f72 100644 --- a/src/main_window.cc +++ b/src/main_window.cc @@ -80,7 +80,7 @@ void MainWindow::open(const QString &path) { slider->setEnabled(true); // Settings pane - connect(settings_pane, &SettingsPane::collisionClicked, + connect(settings_pane, &SettingsPane::bookmarkClicked, slider, &QSlider::setValue); connect(dc, &DroneController::collision, settings_pane, &SettingsPane::addCollision); connect(settings_pane, &SettingsPane::sphereRadiusChanged, diff --git a/src/settings_pane.cc b/src/settings_pane.cc index 281cd79..76de98f 100644 --- a/src/settings_pane.cc +++ b/src/settings_pane.cc @@ -5,6 +5,7 @@ #include #include #include +#include SettingsPane::SettingsPane(QWidget *parent) @@ -14,6 +15,7 @@ SettingsPane::SettingsPane(QWidget *parent) QCheckBox *show_trajectories = new QCheckBox(); QCheckBox *show_guides = new QCheckBox(); collisions = new QListWidget(); + speeding_violations = new QListWidget(); connect(sphere_radius, QOverload::of(&QDoubleSpinBox::valueChanged), this, &SettingsPane::sphereRadiusChanged); @@ -22,28 +24,27 @@ SettingsPane::SettingsPane(QWidget *parent) connect(show_guides, &QCheckBox::stateChanged, this, &SettingsPane::toggledGuides); connect(collisions, &QListWidget::itemClicked, - [&](QListWidgetItem *item) { emit collisionClicked(((CollisionItem *) item)->getFrame()); }); + [&](QListWidgetItem *item) { emit bookmarkClicked(((BookmarkItem *) item)->getFrame()); }); + + QTabWidget *tabs = new QTabWidget(); QFormLayout *layout = new QFormLayout; layout->addRow("Taille de la sphère de collision", sphere_radius); layout->addRow("Afficher les trajectoires", show_trajectories); layout->addRow("Afficher les guides", show_guides); - QGroupBox *box = new QGroupBox(); - box->setTitle("Collisions"); - box->setFlat(true); - box->setAlignment(Qt::AlignHCenter); - QVBoxLayout *box_layout = new QVBoxLayout(); - box_layout->addWidget(collisions); - box->setLayout(box_layout); - layout->addRow(box); + + tabs->addTab(collisions, "Collisions"); + tabs->addTab(speeding_violations, "Excès de vitesse"); + layout->addRow(tabs); + setLayout(layout); } void SettingsPane::addCollision(int idA, int idB, int frame) { - CollisionItem *item = new CollisionItem("Frame " + QString::number(frame) + ": #" - + QString::number(idA) + " et #" + QString::number(idB), - frame); + BookmarkItem *item = new BookmarkItem("Frame " + QString::number(frame) + ": #" + + QString::number(idA) + " et #" + QString::number(idB), + frame); item->setFlags(Qt::ItemIsEnabled | Qt::ItemNeverHasChildren); collisions->addItem(item); } diff --git a/src/settings_pane.hh b/src/settings_pane.hh index def73ae..6b6f198 100644 --- a/src/settings_pane.hh +++ b/src/settings_pane.hh @@ -5,11 +5,11 @@ #include -class CollisionItem : public QListWidgetItem { +class BookmarkItem : public QListWidgetItem { const int frame; public: - CollisionItem(QString text, int frame) + BookmarkItem(QString text, int frame) :QListWidgetItem(text), frame(frame) {} @@ -21,6 +21,7 @@ class SettingsPane : public QWidget { Q_OBJECT QListWidget *collisions = nullptr; + QListWidget *speeding_violations = nullptr; public: SettingsPane(QWidget *parent=nullptr); @@ -33,7 +34,7 @@ signals: void sphereRadiusChanged(double sqRadius); void toggledTrajectories(int shown); void toggledGuides(int shown); - void collisionClicked(int frame); + void bookmarkClicked(int frame); };