author | zecke <zecke> | 2002-10-12 00:30:06 (UTC) |
---|---|---|
committer | zecke <zecke> | 2002-10-12 00:30:06 (UTC) |
commit | 0a3ffe7e5657bed4cb77d9bc23457755e2d02591 (patch) (unidiff) | |
tree | a1b83e61035433668ca5c9e3af31586880535c98 /noncore/apps/opie-console/filetransfer.cpp | |
parent | ffa7f45a2100b7c438a437fce2d3a47608bd36e3 (diff) | |
download | opie-0a3ffe7e5657bed4cb77d9bc23457755e2d02591.zip opie-0a3ffe7e5657bed4cb77d9bc23457755e2d02591.tar.gz opie-0a3ffe7e5657bed4cb77d9bc23457755e2d02591.tar.bz2 |
This is targetted to the people telling
in computer science classes that I'm
toolkit dependant
This is a Process Controller which will be used
to work around the limit of only beeing able to do
one FileTransfer at a Time
Diffstat (limited to 'noncore/apps/opie-console/filetransfer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/apps/opie-console/filetransfer.cpp | 3 |
1 files changed, 0 insertions, 3 deletions
diff --git a/noncore/apps/opie-console/filetransfer.cpp b/noncore/apps/opie-console/filetransfer.cpp index 7b75d35..7fd9f37 100644 --- a/noncore/apps/opie-console/filetransfer.cpp +++ b/noncore/apps/opie-console/filetransfer.cpp | |||
@@ -191,55 +191,52 @@ void FileTransfer::slotRead() { | |||
191 | 191 | ||
192 | 192 | ||
193 | } | 193 | } |
194 | /* | 194 | /* |
195 | * find the progress | 195 | * find the progress |
196 | */ | 196 | */ |
197 | void FileTransfer::slotProgress( const QStringList& list ) { | 197 | void FileTransfer::slotProgress( const QStringList& list ) { |
198 | bool complete = true; | 198 | bool complete = true; |
199 | int min, sec; | 199 | int min, sec; |
200 | int bps; | 200 | int bps; |
201 | unsigned long sent, total; | 201 | unsigned long sent, total; |
202 | 202 | ||
203 | min = sec = bps = -1; | 203 | min = sec = bps = -1; |
204 | sent = total = 0; | 204 | sent = total = 0; |
205 | 205 | ||
206 | // Data looks like this | 206 | // Data looks like this |
207 | // 0 1 2 3 4 5 | 207 | // 0 1 2 3 4 5 |
208 | // Bytes Sent 65536/11534336 BPS:7784 ETA 24:33 | 208 | // Bytes Sent 65536/11534336 BPS:7784 ETA 24:33 |
209 | QStringList progi = QStringList::split('/', list[2].simplifyWhiteSpace() ); | 209 | QStringList progi = QStringList::split('/', list[2].simplifyWhiteSpace() ); |
210 | sent = progi[0].toULong(&complete ); | 210 | sent = progi[0].toULong(&complete ); |
211 | if (!complete ) return; | 211 | if (!complete ) return; |
212 | 212 | ||
213 | total = progi[1].toULong(&complete ); | 213 | total = progi[1].toULong(&complete ); |
214 | if (!complete || total == 0) { | 214 | if (!complete || total == 0) { |
215 | qWarning("returning!!"); | ||
216 | return; | 215 | return; |
217 | } | 216 | } |
218 | 217 | ||
219 | qWarning("%s, %d, %d", progi.join("/").latin1(), sent, total ); | 218 | qWarning("%s, %d, %d", progi.join("/").latin1(), sent, total ); |
220 | 219 | ||
221 | double pro = (double)sent/total; | 220 | double pro = (double)sent/total; |
222 | int prog = pro * 100; | 221 | int prog = pro * 100; |
223 | 222 | ||
224 | // speed | 223 | // speed |
225 | progi = QStringList::split(':', list[3].simplifyWhiteSpace() ); | 224 | progi = QStringList::split(':', list[3].simplifyWhiteSpace() ); |
226 | bps = progi[1].toInt(); | 225 | bps = progi[1].toInt(); |
227 | 226 | ||
228 | // time | 227 | // time |
229 | progi = QStringList::split(':', list[5].simplifyWhiteSpace() ); | 228 | progi = QStringList::split(':', list[5].simplifyWhiteSpace() ); |
230 | min = progi[0].toInt(); | 229 | min = progi[0].toInt(); |
231 | sec = progi[1].toInt(); | 230 | sec = progi[1].toInt(); |
232 | 231 | ||
233 | 232 | ||
234 | qWarning("Prog!:%d", prog ); | ||
235 | if ( prog > m_prog ) { | 233 | if ( prog > m_prog ) { |
236 | m_prog = prog; | 234 | m_prog = prog; |
237 | emit progress(m_file, m_prog, bps, -1, min , sec ); | 235 | emit progress(m_file, m_prog, bps, -1, min , sec ); |
238 | qWarning("Progress: %s, %d\%, %d, %d:%d", m_file.latin1(), m_prog, bps, min, sec ); | ||
239 | } | 236 | } |
240 | 237 | ||
241 | } | 238 | } |
242 | void FileTransfer::cancel() { | 239 | void FileTransfer::cancel() { |
243 | ::kill(m_pid,9 ); | 240 | ::kill(m_pid,9 ); |
244 | delete m_not; | 241 | delete m_not; |
245 | } | 242 | } |