* @brief Sends the next binary block from the file. */
| 619 | * @brief Sends the next binary block from the file. |
| 620 | */ |
| 621 | void IO::FileTransmission::sendRawBlock() |
| 622 | { |
| 623 | if (!IO::ConnectionManager::instance().isConnected()) |
| 624 | return; |
| 625 | |
| 626 | if (m_file.atEnd()) { |
| 627 | stopTransmission(); |
| 628 | m_statusText = tr("Transmission complete"); |
| 629 | Q_EMIT statusTextChanged(); |
| 630 | appendLog(tr("Raw binary transmission complete (%1 bytes)").arg(m_bytesSent)); |
| 631 | return; |
| 632 | } |
| 633 | |
| 634 | QByteArray block = m_file.read(m_blockSize); |
| 635 | if (!block.isEmpty()) { |
| 636 | (void)IO::ConnectionManager::instance().writeData(block); |
| 637 | m_bytesSent += block.size(); |
| 638 | Q_EMIT progressChanged(); |
| 639 | } |
| 640 | } |
| 641 | |
| 642 | //-------------------------------------------------------------------------------------------------- |
| 643 | // Protocol callbacks |