~mateo-salta/nitroshare/nitroshare

« back to all changes in this revision

Viewing changes to src/file/CFileSender.cpp

  • Committer: Nathan Osman
  • Date: 2012-06-28 00:44:25 UTC
  • Revision ID: admin@quickmediasolutions.com-20120628004425-k7sozkt1raz215qh
Added progress display in the share box for multiple file transfers.

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
        SendFile(header);
100
100
        delete header;
101
101
    }
102
 
    /* Otherwise we're done! Disconnect from the server. */
 
102
    /* Otherwise we're done! Emit the signal and disconnect from the server. */
103
103
    else
 
104
    {
 
105
        emit Progress(ProgressComplete);
104
106
        disconnectFromHost();
 
107
    }
105
108
}
106
109
 
107
110
void CFileSender::PrepareHeaders(QStringList filenames)
135
138
 
136
139
    /* Now we actually begin the transmission of the file. */
137
140
    QByteArray contents;
138
 
    if(header->GetContents(contents))
 
141
    qint64 uncompressed_size;
 
142
 
 
143
    if(header->GetContents(contents, uncompressed_size))
139
144
    {
140
145
        /* Calculate the checksum if requested. */
141
146
        if(header->GetChecksum())
148
153
 
149
154
        /* Send the actual data. */
150
155
        SendData(contents);
 
156
 
 
157
        /* Emit a signal indicating progress. */
 
158
        m_current_uncompressed += uncompressed_size;
 
159
        emit Progress((double)m_current_uncompressed / (double)m_total_uncompressed * 100.0);
151
160
    }
152
161
    else
153
162
        disconnectFromHost();