From 36c43b1f26b44f5cacbc9d0fe7f841c7fa521349 Mon Sep 17 00:00:00 2001 From: Travis Hunter Date: Thu, 27 Apr 2023 20:36:45 -0600 Subject: [PATCH] Thrustcurve.org fix, motors now load. Also cleanup to not use implicit callbacks, now all signals/slots are explicitly connected --- gui/AboutWindow.cpp | 7 ++++++- gui/AboutWindow.h | 2 +- gui/AboutWindow.ui | 2 +- gui/AnalysisWindow.cpp | 22 ++++++++++++++-------- gui/AnalysisWindow.h | 7 +++---- gui/AnalysisWindow.ui | 19 +------------------ gui/SimOptionsWindow.cpp | 10 ++++++++++ gui/ThrustCurveMotorSelector.cpp | 23 ++++++++++++++++++++--- gui/ThrustCurveMotorSelector.h | 6 +++--- 9 files changed, 59 insertions(+), 39 deletions(-) diff --git a/gui/AboutWindow.cpp b/gui/AboutWindow.cpp index 9c3270a..a8b5a77 100644 --- a/gui/AboutWindow.cpp +++ b/gui/AboutWindow.cpp @@ -9,6 +9,11 @@ AboutWindow::AboutWindow(QWidget *parent) : ui->setupUi(this); setWindowTitle(QString("About QtRocket")); + + connect(ui->okButton, + SIGNAL(clicked()), + this, + SLOT(onButton_okButton_clicked())); } AboutWindow::~AboutWindow() @@ -16,7 +21,7 @@ AboutWindow::~AboutWindow() delete ui; } -void AboutWindow::on_pushButton_clicked() +void AboutWindow::onButton_okButton_clicked() { this->close(); } diff --git a/gui/AboutWindow.h b/gui/AboutWindow.h index 6b886c8..4258144 100644 --- a/gui/AboutWindow.h +++ b/gui/AboutWindow.h @@ -29,7 +29,7 @@ public: ~AboutWindow(); private slots: - void on_pushButton_clicked(); + void onButton_okButton_clicked(); private: Ui::AboutWindow *ui; diff --git a/gui/AboutWindow.ui b/gui/AboutWindow.ui index 9293576..8816d34 100644 --- a/gui/AboutWindow.ui +++ b/gui/AboutWindow.ui @@ -29,7 +29,7 @@ Copyright (c) 2023 by Travis Hunter - + 250 diff --git a/gui/AnalysisWindow.cpp b/gui/AnalysisWindow.cpp index 2976858..3a47076 100644 --- a/gui/AnalysisWindow.cpp +++ b/gui/AnalysisWindow.cpp @@ -14,11 +14,17 @@ AnalysisWindow::AnalysisWindow(QWidget *parent) : this->hide(); this->show(); - connect(ui->plotAltitudeBtn, SIGNAL(clicked()), this, SLOT(plotAltitude())); - //connect(ui->plotAtmosphereBtn, SIGNAL(clicked()), this, SLOT(plotAtmosphere())); - connect(ui->plotVelocityBtn, SIGNAL(clicked()), this, SLOT(plotVelocity())); - connect(ui->plotMotorCurveBtn, SIGNAL(clicked()), this, SLOT(plotMotorCurveBtn())); - + connect(ui->plotAltitudeBtn, + SIGNAL(clicked()), + this, + SLOT(onButton_plotAltitude_clicked())); + connect(ui->plotVelocityBtn, + SIGNAL(clicked()), + this, + SLOT(onButton_plotVelocity_clicked())); + connect(ui->plotMotorCurveBtn, + SIGNAL(clicked()),this, + SLOT(onButton_plotMotorCurve_clicked())); } @@ -27,7 +33,7 @@ AnalysisWindow::~AnalysisWindow() delete ui; } -void AnalysisWindow::plotAltitude() +void AnalysisWindow::onButton_plotAltitude_clicked() { std::shared_ptr rocket = QtRocket::getInstance()->getRocket(); const std::vector>>& res = rocket->getStates(); @@ -54,7 +60,7 @@ void AnalysisWindow::plotAltitude() plot->replot(); } -void AnalysisWindow::plotVelocity() +void AnalysisWindow::onButton_plotVelocity_clicked() { std::shared_ptr rocket = QtRocket::getInstance()->getRocket(); const std::vector>>& res = rocket->getStates(); @@ -83,7 +89,7 @@ void AnalysisWindow::plotVelocity() } -void AnalysisWindow::plotMotorCurveBtn() +void AnalysisWindow::onButton_plotMotorCurve_clicked() { std::shared_ptr rocket = QtRocket::getInstance()->getRocket(); model::MotorModel motor = rocket->getCurrentMotorModel(); diff --git a/gui/AnalysisWindow.h b/gui/AnalysisWindow.h index 7c0747c..db5cdfd 100644 --- a/gui/AnalysisWindow.h +++ b/gui/AnalysisWindow.h @@ -38,10 +38,9 @@ public: private slots: - void plotAltitude(); - //void plotAtmosphere(); - void plotVelocity(); - void plotMotorCurveBtn(); + void onButton_plotAltitude_clicked(); + void onButton_plotVelocity_clicked(); + void onButton_plotMotorCurve_clicked(); private: Ui::AnalysisWindow *ui; diff --git a/gui/AnalysisWindow.ui b/gui/AnalysisWindow.ui index 673bde8..09bc0b9 100644 --- a/gui/AnalysisWindow.ui +++ b/gui/AnalysisWindow.ui @@ -88,24 +88,7 @@ - - - plotAltitudeBtn - clicked() - AnalysisWindow - plotAltitude() - - - 78 - 61 - - - 88 - 17 - - - - + plotAltitude() diff --git a/gui/SimOptionsWindow.cpp b/gui/SimOptionsWindow.cpp index a357db2..ac0d73b 100644 --- a/gui/SimOptionsWindow.cpp +++ b/gui/SimOptionsWindow.cpp @@ -19,6 +19,16 @@ SimOptionsWindow::SimOptionsWindow(QWidget *parent) : { ui->setupUi(this); + connect(ui->buttonBox, + SIGNAL(rejected()), + this, + SLOT(on_buttonBox_rejected())); + + connect(ui->buttonBox, + SIGNAL(accepted()), + this, + SLOT(on_buttonBox_accepted())); + // populate the combo boxes std::shared_ptr options(new sim::SimulationOptions); diff --git a/gui/ThrustCurveMotorSelector.cpp b/gui/ThrustCurveMotorSelector.cpp index 71740f8..488ce82 100644 --- a/gui/ThrustCurveMotorSelector.cpp +++ b/gui/ThrustCurveMotorSelector.cpp @@ -17,6 +17,23 @@ ThrustCurveMotorSelector::ThrustCurveMotorSelector(QWidget *parent) : tcApi(new utils::ThrustCurveAPI) { ui->setupUi(this); + + connect(ui->getMetadata, + SIGNAL(clicked()), + this, + SLOT(onButton_getMetadata_clicked())); + + connect(ui->searchButton, + SIGNAL(clicked()), + this, + SLOT(onButton_searchButton_clicked())); + + connect(ui->setMotor, + SIGNAL(clicked()), + this, + SLOT(onButton_setMotor_clicked())); + + this->setWindowModality(Qt::NonModal); this->hide(); this->show(); @@ -27,7 +44,7 @@ ThrustCurveMotorSelector::~ThrustCurveMotorSelector() delete ui; } -void ThrustCurveMotorSelector::on_getMetadata_clicked() +void ThrustCurveMotorSelector::onButton_getMetadata_clicked() { // When the user clicks "Get Metadata", we want to pull in Metadata from thrustcurve.org // and populate the Manufacturer, Diameter, and Impulse Class combo boxes @@ -50,7 +67,7 @@ void ThrustCurveMotorSelector::on_getMetadata_clicked() } -void ThrustCurveMotorSelector::on_searchButton_clicked() +void ThrustCurveMotorSelector::onButton_searchButton_clicked() { //double diameter = ui->diameter-> @@ -75,7 +92,7 @@ void ThrustCurveMotorSelector::on_searchButton_clicked() } -void ThrustCurveMotorSelector::on_setMotor_clicked() +void ThrustCurveMotorSelector::onButton_setMotor_clicked() { //asdf std::string commonName = ui->motorSelection->currentText().toStdString(); diff --git a/gui/ThrustCurveMotorSelector.h b/gui/ThrustCurveMotorSelector.h index fa07c3b..b2e4e56 100644 --- a/gui/ThrustCurveMotorSelector.h +++ b/gui/ThrustCurveMotorSelector.h @@ -30,11 +30,11 @@ public: ~ThrustCurveMotorSelector(); private slots: - void on_getMetadata_clicked(); + void onButton_getMetadata_clicked(); - void on_searchButton_clicked(); + void onButton_searchButton_clicked(); - void on_setMotor_clicked(); + void onButton_setMotor_clicked(); private: Ui::ThrustCurveMotorSelector *ui;