* @brief Sends the next line from the file (plain text mode). */
| 585 | * @brief Sends the next line from the file (plain text mode). |
| 586 | */ |
| 587 | void IO::FileTransmission::sendLine() |
| 588 | { |
| 589 | if (!active()) |
| 590 | return; |
| 591 | |
| 592 | if (!IO::ConnectionManager::instance().isConnected()) |
| 593 | return; |
| 594 | |
| 595 | if (m_stream && !m_stream->atEnd()) { |
| 596 | auto line = m_stream->readLine(); |
| 597 | if (!line.isEmpty()) { |
| 598 | if (!line.endsWith("\n")) |
| 599 | line.append("\n"); |
| 600 | |
| 601 | auto data = line.toUtf8(); |
| 602 | (void)IO::ConnectionManager::instance().writeData(data); |
| 603 | m_bytesSent = m_stream->pos(); |
| 604 | Q_EMIT progressChanged(); |
| 605 | } |
| 606 | } else { |
| 607 | stopTransmission(); |
| 608 | m_statusText = tr("Transmission complete"); |
| 609 | Q_EMIT statusTextChanged(); |
| 610 | appendLog(tr("Plain text transmission complete")); |
| 611 | } |
| 612 | } |
| 613 | |
| 614 | //-------------------------------------------------------------------------------------------------- |
| 615 | // Raw binary transmission |