~mateo-salta/nitroshare/nitroshare

« back to all changes in this revision

Viewing changes to src/file/CFileSender.cpp

  • Committer: Nathan Osman
  • Date: 2012-06-27 21:56:40 UTC
  • Revision ID: admin@quickmediasolutions.com-20120627215640-c6mspvllk1br9vx2
Implemented basic progress bar for uploads (which seems to be broken at the moment) and corrected a bug with the way unique IDs were generated for each machine.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include <util/settings.h>
25
25
 
26
26
CFileSender::CFileSender(QObject * parent, QStringList filenames)
27
 
    : CBasicSocket(parent), m_state(WaitingForConnection)
 
27
    : CBasicSocket(parent), m_state(WaitingForConnection),
 
28
      m_total_uncompressed(0), m_current_uncompressed(0)
28
29
{
29
30
    connect(this, SIGNAL(connected()),      SLOT(OnConnected()));
30
31
    connect(this, SIGNAL(Data(QByteArray)), SLOT(OnData(QByteArray)));
126
127
        header->SetChecksum(checksum);
127
128
 
128
129
        m_headers.append(header);
 
130
 
 
131
        /* Add the uncompressed size to our running total. */
 
132
        m_total_uncompressed += info.size();
129
133
    }
130
134
}
131
135
 
168
172
 
169
173
            /* Actually send the [compressed] contents [and] CRC over the wire. */
170
174
            SendData(contents);
 
175
 
 
176
            /* Emit the progress signal. */
 
177
            m_current_uncompressed += file.size();
 
178
            emit Progress((double)m_current_uncompressed / (double)m_total_uncompressed * 100.0);
171
179
        }
172
180
        else
173
181
            qDebug() << "Unable to open" << header->GetFullFilename() << "for reading. Skipping.";