Updated MainWindow to use explicit slots instead of implicit ones
This commit is contained in:
parent
2d64a95b17
commit
5172dbab4f
@ -31,6 +31,54 @@ MainWindow::MainWindow(QtRocket* _qtRocket, QWidget *parent)
|
|||||||
qtRocket(_qtRocket)
|
qtRocket(_qtRocket)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
// Menu signal/slot connections
|
||||||
|
////////////////////////////////
|
||||||
|
|
||||||
|
// File Menu Actions
|
||||||
|
connect(ui->actionQuit,
|
||||||
|
SIGNAL(triggered()),
|
||||||
|
this,
|
||||||
|
SLOT(onMenu_File_Quit_triggered()));
|
||||||
|
|
||||||
|
// Edit Menu Actions
|
||||||
|
connect(ui->actionSimulation_Options,
|
||||||
|
SIGNAL(triggered()),
|
||||||
|
this,
|
||||||
|
SLOT(onMenu_Edit_SimulationOptions_triggered()));
|
||||||
|
|
||||||
|
// Tools Menu Actions
|
||||||
|
|
||||||
|
// Help Menu Actions
|
||||||
|
connect(ui->actionAbout,
|
||||||
|
SIGNAL(triggered()),
|
||||||
|
this,
|
||||||
|
SLOT(onMenu_Help_About_triggered()));
|
||||||
|
|
||||||
|
////////////////////////////////
|
||||||
|
// Button signal/slot connections
|
||||||
|
////////////////////////////////
|
||||||
|
connect(ui->calculateTrajectory_btn,
|
||||||
|
SIGNAL(clicked()),
|
||||||
|
this,
|
||||||
|
SLOT(onButton_calculateTrajectory_clicked()));
|
||||||
|
|
||||||
|
connect(ui->loadRSE_btn,
|
||||||
|
SIGNAL(clicked()),
|
||||||
|
this,
|
||||||
|
SLOT(onButton_loadRSE_button_clicked()));
|
||||||
|
|
||||||
|
connect(ui->setMotor_btn,
|
||||||
|
SIGNAL(clicked()),
|
||||||
|
this,
|
||||||
|
SLOT(onButton_setMotor_clicked()));
|
||||||
|
|
||||||
|
connect(ui->getTCMotorData_btn,
|
||||||
|
SIGNAL(clicked()),
|
||||||
|
this,
|
||||||
|
SLOT(onButton_getTCMotorData_clicked()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
@ -39,7 +87,7 @@ MainWindow::~MainWindow()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::on_actionAbout_triggered()
|
void MainWindow::onMenu_Help_About_triggered()
|
||||||
{
|
{
|
||||||
AboutWindow about;
|
AboutWindow about;
|
||||||
about.setModal(true);
|
about.setModal(true);
|
||||||
@ -48,32 +96,7 @@ void MainWindow::on_actionAbout_triggered()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::on_testButton1_clicked()
|
void MainWindow::onButton_calculateTrajectory_clicked()
|
||||||
{
|
|
||||||
auto& plot = ui->plotWindow;
|
|
||||||
// generate some data:
|
|
||||||
QVector<double> x(101), y(101); // initialize with entries 0..100
|
|
||||||
for (int i=0; i<101; ++i)
|
|
||||||
{
|
|
||||||
x[i] = i/50.0 - 1; // x goes from -1 to 1
|
|
||||||
y[i] = x[i]*x[i]; // let's plot a quadratic function
|
|
||||||
}
|
|
||||||
// create graph and assign data to it:
|
|
||||||
plot->addGraph();
|
|
||||||
plot->graph(0)->setData(x, y);
|
|
||||||
// give the axes some labels:
|
|
||||||
plot->xAxis->setLabel("x");
|
|
||||||
plot->yAxis->setLabel("y");
|
|
||||||
// set axes ranges, so we see all data:
|
|
||||||
plot->xAxis->setRange(-1, 1);
|
|
||||||
plot->yAxis->setRange(0, 1);
|
|
||||||
plot->replot();
|
|
||||||
|
|
||||||
utils::RSEDatabaseLoader("Aerotech.rse");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::on_testButton2_clicked()
|
|
||||||
{
|
{
|
||||||
// Get the initial conditions
|
// Get the initial conditions
|
||||||
double initialVelocity =
|
double initialVelocity =
|
||||||
@ -103,13 +126,15 @@ void MainWindow::on_testButton2_clicked()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_loadRSE_button_clicked()
|
void MainWindow::onButton_loadRSE_button_clicked()
|
||||||
{
|
{
|
||||||
QString rseFile = QFileDialog::getOpenFileName(this,
|
QString rseFile = QFileDialog::getOpenFileName(this,
|
||||||
tr("Import RSE Database File"),
|
tr("Import RSE Database File"),
|
||||||
"/home",
|
"/home",
|
||||||
tr("Rocksim Engine Files (*.rse)"));
|
tr("Rocksim Engine Files (*.rse)"));
|
||||||
|
|
||||||
|
if(!rseFile.isEmpty())
|
||||||
|
{
|
||||||
rseDatabase.reset(new utils::RSEDatabaseLoader(rseFile.toStdString()));
|
rseDatabase.reset(new utils::RSEDatabaseLoader(rseFile.toStdString()));
|
||||||
|
|
||||||
ui->rocketPartButtons->findChild<QLineEdit*>(QString("databaseFileLine"))->setText(rseFile);
|
ui->rocketPartButtons->findChild<QLineEdit*>(QString("databaseFileLine"))->setText(rseFile);
|
||||||
@ -123,10 +148,11 @@ void MainWindow::on_loadRSE_button_clicked()
|
|||||||
std::cout << "Adding: " << motor.data.commonName << std::endl;
|
std::cout << "Adding: " << motor.data.commonName << std::endl;
|
||||||
engineSelector->addItem(QString(motor.data.commonName.c_str()));
|
engineSelector->addItem(QString(motor.data.commonName.c_str()));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::on_getTCMotorData_clicked()
|
void MainWindow::onButton_getTCMotorData_clicked()
|
||||||
{
|
{
|
||||||
ThrustCurveMotorSelector window;
|
ThrustCurveMotorSelector window;
|
||||||
window.setModal(false);
|
window.setModal(false);
|
||||||
@ -135,7 +161,7 @@ void MainWindow::on_getTCMotorData_clicked()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::on_actionSimulation_Options_triggered()
|
void MainWindow::onMenu_Edit_SimulationOptions_triggered()
|
||||||
{
|
{
|
||||||
if(!simOptionsWindow)
|
if(!simOptionsWindow)
|
||||||
{
|
{
|
||||||
@ -146,7 +172,7 @@ void MainWindow::on_actionSimulation_Options_triggered()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MainWindow::on_setMotor_clicked()
|
void MainWindow::onButton_setMotor_clicked()
|
||||||
{
|
{
|
||||||
QString motorName = ui->engineSelectorComboBox->currentText();
|
QString motorName = ui->engineSelectorComboBox->currentText();
|
||||||
model::MotorModel mm = rseDatabase->getMotorModelByName(motorName.toStdString());
|
model::MotorModel mm = rseDatabase->getMotorModelByName(motorName.toStdString());
|
||||||
@ -155,3 +181,7 @@ void MainWindow::on_setMotor_clicked()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::onMenu_File_Quit_triggered()
|
||||||
|
{
|
||||||
|
this->close();
|
||||||
|
}
|
@ -37,19 +37,19 @@ public:
|
|||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void on_actionAbout_triggered();
|
void onMenu_Help_About_triggered();
|
||||||
|
|
||||||
void on_testButton1_clicked();
|
void onButton_calculateTrajectory_clicked();
|
||||||
|
|
||||||
void on_testButton2_clicked();
|
void onButton_loadRSE_button_clicked();
|
||||||
|
|
||||||
void on_loadRSE_button_clicked();
|
void onButton_getTCMotorData_clicked();
|
||||||
|
|
||||||
void on_getTCMotorData_clicked();
|
void onMenu_Edit_SimulationOptions_triggered();
|
||||||
|
|
||||||
void on_actionSimulation_Options_triggered();
|
void onButton_setMotor_clicked();
|
||||||
|
|
||||||
void on_setMotor_clicked();
|
void onMenu_File_Quit_triggered();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MainWindow* ui;
|
Ui::MainWindow* ui;
|
||||||
|
@ -61,29 +61,7 @@
|
|||||||
<verstretch>0</verstretch>
|
<verstretch>0</verstretch>
|
||||||
</sizepolicy>
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QPushButton" name="testButton1">
|
<widget class="QPushButton" name="calculateTrajectory_btn">
|
||||||
<property name="enabled">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>30</x>
|
|
||||||
<y>20</y>
|
|
||||||
<width>80</width>
|
|
||||||
<height>25</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>TestButton1</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QPushButton" name="testButton2">
|
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>240</x>
|
<x>240</x>
|
||||||
@ -201,7 +179,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QPushButton" name="loadRSE_button">
|
<widget class="QPushButton" name="loadRSE_btn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Load RSE Database File</string>
|
<string>Load RSE Database File</string>
|
||||||
</property>
|
</property>
|
||||||
@ -218,7 +196,7 @@
|
|||||||
<widget class="QComboBox" name="engineSelectorComboBox"/>
|
<widget class="QComboBox" name="engineSelectorComboBox"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="1" column="1">
|
||||||
<widget class="QPushButton" name="setMotor">
|
<widget class="QPushButton" name="setMotor_btn">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Set Motor</string>
|
<string>Set Motor</string>
|
||||||
</property>
|
</property>
|
||||||
@ -226,7 +204,7 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QPushButton" name="getTCMotorData">
|
<widget class="QPushButton" name="getTCMotorData_btn">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>240</x>
|
<x>240</x>
|
||||||
@ -298,6 +276,9 @@
|
|||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionNew">
|
<action name="actionNew">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset theme="document-new">
|
<iconset theme="document-new">
|
||||||
<normaloff>.</normaloff>.</iconset>
|
<normaloff>.</normaloff>.</iconset>
|
||||||
@ -307,6 +288,9 @@
|
|||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionOpen">
|
<action name="actionOpen">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset theme="document-open">
|
<iconset theme="document-open">
|
||||||
<normaloff>.</normaloff>.</iconset>
|
<normaloff>.</normaloff>.</iconset>
|
||||||
@ -316,6 +300,9 @@
|
|||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionSave">
|
<action name="actionSave">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset theme="document-save">
|
<iconset theme="document-save">
|
||||||
<normaloff>.</normaloff>.</iconset>
|
<normaloff>.</normaloff>.</iconset>
|
||||||
@ -325,6 +312,9 @@
|
|||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionClose">
|
<action name="actionClose">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Close</string>
|
<string>Close</string>
|
||||||
</property>
|
</property>
|
||||||
@ -339,6 +329,9 @@
|
|||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="actionSave_As">
|
<action name="actionSave_As">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset theme="document-save-as">
|
<iconset theme="document-save-as">
|
||||||
<normaloff>.</normaloff>.</iconset>
|
<normaloff>.</normaloff>.</iconset>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user