Thrustcurve.org fix, motors now load. Also cleanup to not use implicit callbacks, now all signals/slots are explicitly connected

This commit is contained in:
Travis Hunter 2023-04-27 20:36:45 -06:00
parent 6f033c3a55
commit 36c43b1f26
9 changed files with 59 additions and 39 deletions

View File

@ -9,6 +9,11 @@ AboutWindow::AboutWindow(QWidget *parent) :
ui->setupUi(this); ui->setupUi(this);
setWindowTitle(QString("About QtRocket")); setWindowTitle(QString("About QtRocket"));
connect(ui->okButton,
SIGNAL(clicked()),
this,
SLOT(onButton_okButton_clicked()));
} }
AboutWindow::~AboutWindow() AboutWindow::~AboutWindow()
@ -16,7 +21,7 @@ AboutWindow::~AboutWindow()
delete ui; delete ui;
} }
void AboutWindow::on_pushButton_clicked() void AboutWindow::onButton_okButton_clicked()
{ {
this->close(); this->close();
} }

View File

@ -29,7 +29,7 @@ public:
~AboutWindow(); ~AboutWindow();
private slots: private slots:
void on_pushButton_clicked(); void onButton_okButton_clicked();
private: private:
Ui::AboutWindow *ui; Ui::AboutWindow *ui;

View File

@ -29,7 +29,7 @@
<string>Copyright (c) 2023 by Travis Hunter</string> <string>Copyright (c) 2023 by Travis Hunter</string>
</property> </property>
</widget> </widget>
<widget class="QPushButton" name="pushButton"> <widget class="QPushButton" name="okButton">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>250</x> <x>250</x>

View File

@ -14,11 +14,17 @@ AnalysisWindow::AnalysisWindow(QWidget *parent) :
this->hide(); this->hide();
this->show(); this->show();
connect(ui->plotAltitudeBtn, SIGNAL(clicked()), this, SLOT(plotAltitude())); connect(ui->plotAltitudeBtn,
//connect(ui->plotAtmosphereBtn, SIGNAL(clicked()), this, SLOT(plotAtmosphere())); SIGNAL(clicked()),
connect(ui->plotVelocityBtn, SIGNAL(clicked()), this, SLOT(plotVelocity())); this,
connect(ui->plotMotorCurveBtn, SIGNAL(clicked()), this, SLOT(plotMotorCurveBtn())); 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; delete ui;
} }
void AnalysisWindow::plotAltitude() void AnalysisWindow::onButton_plotAltitude_clicked()
{ {
std::shared_ptr<Rocket> rocket = QtRocket::getInstance()->getRocket(); std::shared_ptr<Rocket> rocket = QtRocket::getInstance()->getRocket();
const std::vector<std::pair<double, std::vector<double>>>& res = rocket->getStates(); const std::vector<std::pair<double, std::vector<double>>>& res = rocket->getStates();
@ -54,7 +60,7 @@ void AnalysisWindow::plotAltitude()
plot->replot(); plot->replot();
} }
void AnalysisWindow::plotVelocity() void AnalysisWindow::onButton_plotVelocity_clicked()
{ {
std::shared_ptr<Rocket> rocket = QtRocket::getInstance()->getRocket(); std::shared_ptr<Rocket> rocket = QtRocket::getInstance()->getRocket();
const std::vector<std::pair<double, std::vector<double>>>& res = rocket->getStates(); const std::vector<std::pair<double, std::vector<double>>>& res = rocket->getStates();
@ -83,7 +89,7 @@ void AnalysisWindow::plotVelocity()
} }
void AnalysisWindow::plotMotorCurveBtn() void AnalysisWindow::onButton_plotMotorCurve_clicked()
{ {
std::shared_ptr<Rocket> rocket = QtRocket::getInstance()->getRocket(); std::shared_ptr<Rocket> rocket = QtRocket::getInstance()->getRocket();
model::MotorModel motor = rocket->getCurrentMotorModel(); model::MotorModel motor = rocket->getCurrentMotorModel();

View File

@ -38,10 +38,9 @@ public:
private slots: private slots:
void plotAltitude(); void onButton_plotAltitude_clicked();
//void plotAtmosphere(); void onButton_plotVelocity_clicked();
void plotVelocity(); void onButton_plotMotorCurve_clicked();
void plotMotorCurveBtn();
private: private:
Ui::AnalysisWindow *ui; Ui::AnalysisWindow *ui;

View File

@ -88,24 +88,7 @@
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>
<connections> <connections/>
<connection>
<sender>plotAltitudeBtn</sender>
<signal>clicked()</signal>
<receiver>AnalysisWindow</receiver>
<slot>plotAltitude()</slot>
<hints>
<hint type="sourcelabel">
<x>78</x>
<y>61</y>
</hint>
<hint type="destinationlabel">
<x>88</x>
<y>17</y>
</hint>
</hints>
</connection>
</connections>
<slots> <slots>
<slot>plotAltitude()</slot> <slot>plotAltitude()</slot>
</slots> </slots>

View File

@ -19,6 +19,16 @@ SimOptionsWindow::SimOptionsWindow(QWidget *parent) :
{ {
ui->setupUi(this); 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 // populate the combo boxes
std::shared_ptr<sim::SimulationOptions> options(new sim::SimulationOptions); std::shared_ptr<sim::SimulationOptions> options(new sim::SimulationOptions);

View File

@ -17,6 +17,23 @@ ThrustCurveMotorSelector::ThrustCurveMotorSelector(QWidget *parent) :
tcApi(new utils::ThrustCurveAPI) tcApi(new utils::ThrustCurveAPI)
{ {
ui->setupUi(this); 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->setWindowModality(Qt::NonModal);
this->hide(); this->hide();
this->show(); this->show();
@ -27,7 +44,7 @@ ThrustCurveMotorSelector::~ThrustCurveMotorSelector()
delete ui; 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 // 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 // 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-> //double diameter = ui->diameter->
@ -75,7 +92,7 @@ void ThrustCurveMotorSelector::on_searchButton_clicked()
} }
void ThrustCurveMotorSelector::on_setMotor_clicked() void ThrustCurveMotorSelector::onButton_setMotor_clicked()
{ {
//asdf //asdf
std::string commonName = ui->motorSelection->currentText().toStdString(); std::string commonName = ui->motorSelection->currentText().toStdString();

View File

@ -30,11 +30,11 @@ public:
~ThrustCurveMotorSelector(); ~ThrustCurveMotorSelector();
private slots: 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: private:
Ui::ThrustCurveMotorSelector *ui; Ui::ThrustCurveMotorSelector *ui;