diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index d179c35a..a3c125ac 100755 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2767,6 +2767,59 @@ void MainWindow::on_udptcpComboBox_currentIndexChanged(const QString &arg1) ui->genPostDataButton->setVisible(isPost); } + + +void MainWindow::on_actionWake_On_LAN_Magic_Packet_triggered() +{ + static QString previousMAC = ""; + static int previousPortIndex = 0; + 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.setModal(true); + msgBox.exec(); + + on_actionWake_On_LAN_Magic_Packet_triggered(); + wol->deleteLater(); + return; + } + + if(wol->generatedPacket.toIP.isEmpty()) { + wol->deleteLater(); + return; + } + + previousMAC = wol->mac; + previousPortIndex = wol->portIndex; + + 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); + on_packetHexEdit_editingFinished(); + on_udptcpComboBox_currentIndexChanged(""); + + if(ui->packetNameEdit->text().isEmpty()) { + ui->packetNameEdit->setFocus(); + } + wol->deleteLater(); +} + + void MainWindow::on_cipherCb_currentIndexChanged(){ QSettings settings(SETTINGSFILE, QSettings::IniFormat); settings.setValue("cipher", cipherCb->currentText()); diff --git a/src/packetsender.qrc b/src/packetsender.qrc index 4e776e5c..c1ee0ecd 100755 --- a/src/packetsender.qrc +++ b/src/packetsender.qrc @@ -52,6 +52,7 @@ packetsender.css iris_and_marigold.jpg ps_panels.json + icons/outline_lightbulb_white_24dp.png icons/tx_dtls.png icons/rx_dtls.png diff --git a/src/persistentconnection.cpp b/src/persistentconnection.cpp index db8270f3..5c38f472 100755 --- a/src/persistentconnection.cpp +++ b/src/persistentconnection.cpp @@ -32,8 +32,8 @@ PersistentConnection::PersistentConnection(QWidget *parent) : QDEBUG(); sendPacket.clear(); - QDEBUG() /*<< ": refreshTimer Connection attempt " << - connect(&refreshTimer, SIGNAL(timeout()), this, SLOT(refreshTimerTimeout()))*/ + QDEBUG() << ": refreshTimer Connection attempt " << + connect(&refreshTimer, SIGNAL(timeout()), this, SLOT(refreshTimerTimeout())) << connect(this, SIGNAL(rejected()), this, SLOT(aboutToClose())) << connect(this, SIGNAL(accepted()), this, SLOT(aboutToClose())) << connect(this, SIGNAL(dialogIsClosing()), this, SLOT(aboutToClose())); @@ -218,7 +218,7 @@ void PersistentConnection::cancelResends() void PersistentConnection::refreshTimerTimeout() { -// QDEBUG(); + //QDEBUG(); qint64 diff = startTime.msecsTo(QDateTime::currentDateTime()); @@ -351,8 +351,6 @@ void PersistentConnection::socketDisconnected() statusReceiver("not connected"); } -//connect(pcWindow, SIGNAL(persistentPacketSend(Packet)), thread, SLOT(sendPersistant(Packet))) - void PersistentConnection::on_asciiSendButton_clicked() { QString ascii = ui->asciiLineEdit->text();