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);
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();
}

View File

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

View File

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

View File

@ -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> rocket = QtRocket::getInstance()->getRocket();
const std::vector<std::pair<double, std::vector<double>>>& res = rocket->getStates();
@ -54,7 +60,7 @@ void AnalysisWindow::plotAltitude()
plot->replot();
}
void AnalysisWindow::plotVelocity()
void AnalysisWindow::onButton_plotVelocity_clicked()
{
std::shared_ptr<Rocket> rocket = QtRocket::getInstance()->getRocket();
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();
model::MotorModel motor = rocket->getCurrentMotorModel();

View File

@ -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;

View File

@ -88,24 +88,7 @@
</customwidget>
</customwidgets>
<resources/>
<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>
<connections/>
<slots>
<slot>plotAltitude()</slot>
</slots>

View File

@ -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<sim::SimulationOptions> options(new sim::SimulationOptions);

View File

@ -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();

View File

@ -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;