Skip to content

Commit

Permalink
swich to pointer for wakeonlan generation. also clear out the resend
Browse files Browse the repository at this point in the history
  • Loading branch information
dannagle committed Dec 21, 2023
1 parent fb38ab0 commit b10bdc6
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2790,46 +2790,49 @@ void MainWindow::on_actionWake_On_LAN_Magic_Packet_triggered()
{
static QString previousMAC = "";
static int previousPortIndex = 0;
WakeOnLAN wol = WakeOnLAN();
wol.setTarget(previousMAC, previousPortIndex);
wol.setModal(true);
wol.exec();
if(!wol.generatedPacket.errorString.isEmpty()) {
WakeOnLAN * wol = new WakeOnLAN(this);
wol->setTarget(previousMAC, previousPortIndex);
wol->setModal(true);
wol->exec();
if(!wol->generatedPacket.errorString.isEmpty()) {

QMessageBox msgBox;
msgBox.setWindowIcon(QIcon(":pslogo.png"));
msgBox.setWindowTitle(tr("Invalid MAC Address."));
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setDefaultButton(QMessageBox::Ok);
msgBox.setIcon(QMessageBox::Critical);
msgBox.setText(wol.generatedPacket.errorString);
msgBox.setText(wol->generatedPacket.errorString);
msgBox.setModal(true);
msgBox.exec();

on_actionWake_On_LAN_Magic_Packet_triggered();
wol->deleteLater();
return;
}

if(wol.generatedPacket.toIP.isEmpty()) {
if(wol->generatedPacket.toIP.isEmpty()) {
wol->deleteLater();
return;
}

previousMAC = wol.mac;
previousPortIndex = wol.portIndex;
previousMAC = wol->mac;
previousPortIndex = wol->portIndex;

ui->packetIPEdit->setText(wol.generatedPacket.toIP);
ui->packetPortEdit->setText(QString::number(wol.generatedPacket.port));
int findtext = ui->udptcpComboBox->findText(wol.generatedPacket.tcpOrUdp);
ui->packetIPEdit->setText(wol->generatedPacket.toIP);
ui->packetPortEdit->setText(QString::number(wol->generatedPacket.port));
ui->resendEdit->setText("0");
int findtext = ui->udptcpComboBox->findText(wol->generatedPacket.tcpOrUdp);
if (findtext > -1) {
ui->udptcpComboBox->setCurrentIndex(findtext);
}
ui->packetHexEdit->setText(wol.generatedPacket.hexString);
ui->packetHexEdit->setText(wol->generatedPacket.hexString);
on_packetHexEdit_editingFinished();
on_udptcpComboBox_currentIndexChanged("");

if(ui->packetNameEdit->text().isEmpty()) {
ui->packetNameEdit->setFocus();
}

wol->deleteLater();
}

0 comments on commit b10bdc6

Please sign in to comment.