diff --git a/libretroshare/src/ft/ftchunkmap.cc b/libretroshare/src/ft/ftchunkmap.cc index 604633aa0..65c92f324 100644 --- a/libretroshare/src/ft/ftchunkmap.cc +++ b/libretroshare/src/ft/ftchunkmap.cc @@ -27,6 +27,8 @@ * #define DEBUG_FTCHUNK 1 *********/ +#define USE_NEW_CHUNK_CHECKING_CODE + #ifdef DEBUG_FTCHUNK #include #endif @@ -152,7 +154,14 @@ void ChunkMap::dataReceived(const ftChunk::ChunkId& cid) std::cerr << "*** ChunkMap::dataReceived: Chunk is complete. Removing it." << std::endl ; #endif - _map[n] = FileChunksInfo::CHUNK_CHECKING ; +#ifdef USE_NEW_CHUNK_CHECKING_CODE + // In this case (cache files, mainly) we rely on the final hash-checking only. + // + if(_assume_availability) + _map[n] = FileChunksInfo::CHUNK_DONE ; + else +#endif + _map[n] = FileChunksInfo::CHUNK_CHECKING ; if(n > 0 || _file_size > CHUNKMAP_FIXED_CHUNK_SIZE) // dont' put <1MB files into checking mode. This is useless. _chunks_checking_queue.push_back(n) ; @@ -616,6 +625,13 @@ void ChunkMap::getAvailabilityMap(CompressedChunkMap& compressed_map) const void ChunkMap::forceCheck() { +#ifdef USE_NEW_CHUNK_CHECKING_CODE + // In this case (cache files, mainly) we rely on the final hash-checking only. + // + if(_assume_availability) + return ; +#endif + for(uint32_t i=0;i<_map.size();++i) { _map[i] = FileChunksInfo::CHUNK_CHECKING ; diff --git a/libretroshare/src/ft/fttransfermodule.cc b/libretroshare/src/ft/fttransfermodule.cc index 5fb555ab8..f676aecf8 100644 --- a/libretroshare/src/ft/fttransfermodule.cc +++ b/libretroshare/src/ft/fttransfermodule.cc @@ -27,6 +27,8 @@ * #define FT_DEBUG 1 *****/ +#define USE_NEW_CHUNK_CHECKING_CODE + #include "retroshare/rsturtle.h" #include "fttransfermodule.h" @@ -636,6 +638,8 @@ void ftTransferModule::forceCheck() _crcmap_last_asked_time = 0 ; #else mFileCreator->forceCheck() ; + mFlag = FT_TM_FLAG_DOWNLOADING ; // Ask for CRC map. + mFileStatus.stat = ftFileStatus::PQIFILE_DOWNLOADING; #endif } @@ -777,7 +781,8 @@ bool ftTransferModule::checkCRC() { // We do as if the file is not complete. This way, it finishes properly. // - mFlag = FT_TM_FLAG_COMPLETE ; // Transfer is complete. + //mFlag = FT_TM_FLAG_COMPLETE ; // Transfer is complete. + mFlag = FT_TM_FLAG_DOWNLOADING ; mFileStatus.stat = ftFileStatus::PQIFILE_DOWNLOADING; #ifdef FT_DEBUG std::cerr << "ftTransferModule::checkCRC(): Done. CRC check is ok, file is complete." << std::endl ; diff --git a/libretroshare/src/retroshare/rstypes.h b/libretroshare/src/retroshare/rstypes.h index ba086bf98..f038ede89 100644 --- a/libretroshare/src/retroshare/rstypes.h +++ b/libretroshare/src/retroshare/rstypes.h @@ -34,6 +34,8 @@ #include #include +#define USE_NEW_CHUNK_CHECKING_CODE + typedef std::string RsCertId; typedef std::string RsChanId; typedef std::string RsMsgId; diff --git a/retroshare-gui/src/gui/TransfersDialog.cpp b/retroshare-gui/src/gui/TransfersDialog.cpp index 71d497f49..dba02d71a 100644 --- a/retroshare-gui/src/gui/TransfersDialog.cpp +++ b/retroshare-gui/src/gui/TransfersDialog.cpp @@ -649,9 +649,14 @@ int TransfersDialog::addItem(int row, const FileInfo &fileInfo, const std::mapsetBrush(linearGrad); + { + QColor gradColor_a1, gradColor_a2 ; + gradColor_a1.setRgb(170, 20, 9); + gradColor_a2.setRgb(223, 121,123); + linearGrad.setColorAt(0.00, gradColor_a1); + linearGrad.setColorAt(0.16, gradColor_a2); + linearGrad.setColorAt(1.00, gradColor_a1); + painter->setBrush(linearGrad); - for(uint32_t i=0;i<_pinfo.chunks_in_progress.size();++i) - painter->drawRect(rect.x() + hSpan+(int)rint(_pinfo.chunks_in_progress[i]*width/(float)ss), rect.y() + vSpan, (int)ceil(1.0f*width/(float)ss), rect.height() - 1 - vSpan * 2); + for(uint32_t i=0;i<_pinfo.chunks_in_progress.size();++i) + painter->drawRect(rect.x() + hSpan+(int)rint(_pinfo.chunks_in_progress[i]*width/(float)ss), rect.y() + vSpan, (int)ceil(1.0f*width/(float)ss), rect.height() - 1 - vSpan * 2); + } + + { + + QColor gradColor_a1, gradColor_a2 ; + gradColor_a1.setRgb(186, 143, 0); + gradColor_a2.setRgb(223, 196, 61); + linearGrad.setColorAt(0.00, gradColor_a1); + linearGrad.setColorAt(0.16, gradColor_a2); + linearGrad.setColorAt(1.00, gradColor_a1); + painter->setBrush(linearGrad); + + for(uint32_t i=0;i<_pinfo.chunks_in_checking.size();++i) + painter->drawRect(rect.x() + hSpan+(int)rint(_pinfo.chunks_in_checking[i]*width/(float)ss), rect.y() + vSpan, (int)ceil(1.0f*width/(float)ss), rect.height() - 1 - vSpan * 2); + } } else { diff --git a/retroshare-gui/src/gui/xprogressbar.h b/retroshare-gui/src/gui/xprogressbar.h index bfb409b7b..307e7e1a4 100644 --- a/retroshare-gui/src/gui/xprogressbar.h +++ b/retroshare-gui/src/gui/xprogressbar.h @@ -47,6 +47,7 @@ class FileProgressInfo uint32_t nb_chunks ; std::vector chunks_in_progress ; + std::vector chunks_in_checking ; bool operator<(const FileProgressInfo &other) const; bool operator>(const FileProgressInfo &other) const;