Skip to content

Commit

Permalink
Enable all buttons if selecting "No" when asking if you're sure you w…
Browse files Browse the repository at this point in the history
…ant to switch Wifi/Ethernet on Create3Widget page
  • Loading branch information
erinharrington-12 committed Feb 5, 2024
1 parent 5d5cdcf commit b73663f
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions src/Create3Widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Create3Widget::Create3Widget(Device *device, QWidget *parent)
// connect(ui->ResetServerButton, SIGNAL(clicked()), SLOT(resetServer()));
connect(ui->Create3SensorListButton, SIGNAL(clicked()), SLOT(sensorList()));
connect(ui->Create3ExampleProgramButton, SIGNAL(clicked()), SLOT(exampleList()));

ui->create3IP->setText(getIP());

QStringList arguments;
Expand All @@ -67,8 +67,6 @@ Create3Widget::Create3Widget(Device *device, QWidget *parent)
ui->toggleSwitch->setChecked(true);
}



connect(ui->toggleSwitch, SIGNAL(stateChanged(int)), this, SLOT(toggleChanged()));
}

Expand Down Expand Up @@ -98,14 +96,19 @@ void Create3Widget::toggleChanged()

qDebug() << "IP OUTPUT: " << ipOutput; // Get current IP output


if (ipOutput.contains("192.168.125.1"))
{

if (QMessageBox::question(this, "Change Interface?",
QString("You are about to change your Create 3 connection from Wifi to Ethernet. \nThe Wombat will reboot once you make this change. \n Do you want to continue? \n (Be sure to change the Fast DDS discovery server IP address to 192.168.186.3)"),
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
{

StandardWidget::enableMenuBar();
ui->CreateConnectButton->setEnabled(true);
ui->toggleSwitch->setEnabled(true);
ui->Create3SensorListButton->setEnabled(true);
ui->Create3ExampleProgramButton->setEnabled(true);
return;
}
else
Expand All @@ -114,15 +117,19 @@ void Create3Widget::toggleChanged()
process.startDetached("/bin/sh", QStringList() << "/home/kipr/wombat-os/configFiles/create3_interface_swap.sh"
<< "eth");
}


}
else if (ipOutput.contains("192.168.186.3"))
{
if (QMessageBox::question(this, "Change Interface?",
QString("You are about to change your Create 3 connection from Ethernet to Wifi. \n The Wombat will reboot once you make this change. \nDo you want to continue? \n (Be sure to change the Fast DDS discovery server IP address to 192.168.125.1)"),
QMessageBox::Yes | QMessageBox::No) != QMessageBox::Yes)
{

StandardWidget::enableMenuBar();
ui->CreateConnectButton->setEnabled(true);
ui->toggleSwitch->setEnabled(true);
ui->Create3SensorListButton->setEnabled(true);
ui->Create3ExampleProgramButton->setEnabled(true);
return;
}
else
Expand All @@ -131,8 +138,6 @@ void Create3Widget::toggleChanged()
process.startDetached("/bin/sh", QStringList() << "/home/kipr/wombat-os/configFiles/create3_interface_swap.sh"
<< "wifi");
}


}
}

Expand Down

0 comments on commit b73663f

Please sign in to comment.