From 1321168cb22a76df96d747194fcb91863e4e0659 Mon Sep 17 00:00:00 2001 From: Joshua Drake Date: Sat, 19 Nov 2022 04:04:00 -0600 Subject: Added Wire Class. Program now has some functionality! --- mainwindow.cpp | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) (limited to 'mainwindow.cpp') diff --git a/mainwindow.cpp b/mainwindow.cpp index 6fb2bf5..44a3a2e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -8,6 +8,12 @@ MainWindow::MainWindow(QWidget *parent) { ui->setupUi(this); initializeGraphics(); + + connect(&m_wire,&Wire::calculation, [&]() { + ui->lineEditWireGauge->setText(m_wire.gauge()); + ui->lineEditWireWeight->setText(QString::number(m_wire.weight())); + ui->lineEditPeakCurrent->setText(QString::number(m_wire.peakCurrent())); + }); } MainWindow::~MainWindow() @@ -18,12 +24,15 @@ MainWindow::~MainWindow() void MainWindow::on_spinBoxPeakSystemPower_valueChanged(double arg1) { - + m_wire.setPeakSystemPower(arg1); + m_wire.calculate(); + m_battery.setPeakSystemPower(arg1); } void MainWindow :: initializeGraphics() { for(auto entry : batteries)ui->comboBoxBatteryChemistry->addItem(entry.name); + for(auto entry : wireMaterials)ui->comboBoxWireMaterial->addItem(entry); } void MainWindow::on_comboBoxBatteryChemistry_currentIndexChanged(int index) @@ -37,3 +46,23 @@ void MainWindow::on_actionactionSettings_triggered() } +void MainWindow::on_comboBoxWireMaterial_currentIndexChanged(int index) +{ + m_wire.setActiveWireType(index); + m_wire.calculate(); +} + +void MainWindow::on_doubleSpinBoxSystemVoltage_valueChanged(double arg1) +{ + m_wire.setSystemVoltage(arg1); + m_wire.calculate(); + m_battery.setSystemVoltage(arg1); +} + + +void MainWindow::on_doubleSpinBoxEstimatedWireLength_valueChanged(double arg1) +{ + m_wire.setWireLength(arg1); + m_wire.calculate(); +} + -- cgit v1.2.3