rename CollisionItem to BookmarkItem, change settings pane layout
This commit is contained in:
parent
0f06601bc6
commit
d48a05212b
@ -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,
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include <QFormLayout>
|
||||
#include <QGroupBox>
|
||||
#include <QVBoxLayout>
|
||||
#include <QTabWidget>
|
||||
|
||||
|
||||
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<double>::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);
|
||||
}
|
||||
|
@ -5,11 +5,11 @@
|
||||
#include <QListWidget>
|
||||
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user