This commit is contained in:
defnax 2025-07-18 15:44:42 +02:00 committed by GitHub
commit 45097c9a17
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 6 deletions

View file

@ -29,6 +29,7 @@
#include "FileTransferInfoWidget.h" #include "FileTransferInfoWidget.h"
#include "gui/RetroShareLink.h" #include "gui/RetroShareLink.h"
#include "gui/common/FilesDefs.h" #include "gui/common/FilesDefs.h"
#include "gui/settings/rsharesettings.h"
// Variables to decide of display behaviour. All variables are expressed as a factor of font height // Variables to decide of display behaviour. All variables are expressed as a factor of font height
// //
@ -132,7 +133,13 @@ void FileTransferInfoWidget::draw(const FileInfo& nfo,const FileChunksInfo& info
int ch_num_size = ch_num_size_factor*S ; int ch_num_size = ch_num_size_factor*S ;
int tab_size = tab_size_factor*S ; int tab_size = tab_size_factor*S ;
painter->setPen(QColor::fromRgb(0,0,0)) ; if (Settings->getSheetName() == ":Standard_Dark"){
penColor = Qt::gray ;
} else {
penColor = Qt::black ;
}
painter->setPen(penColor) ;
y += text_height ; y += text_height ;
painter->drawText(0,y,tr("Chunk map") + ":") ; painter->drawText(0,y,tr("Chunk map") + ":") ;
y += block_sep ; y += block_sep ;
@ -176,13 +183,13 @@ void FileTransferInfoWidget::draw(const FileInfo& nfo,const FileChunksInfo& info
uint32_t sizeY = 1*S ; uint32_t sizeY = 1*S ;
y += block_sep ; y += block_sep ;
y += text_height ; y += text_height ;
painter->setPen(QColor::fromRgb(0,0,0)) ; painter->setPen(penColor) ;
painter->drawText(0,y,tr("Active chunks") + ":") ; painter->drawText(0,y,tr("Active chunks") + ":") ;
y += block_sep ; y += block_sep ;
for(uint i=0;i<info.active_chunks.size();++i) for(uint i=0;i<info.active_chunks.size();++i)
{ {
painter->setPen(QColor::fromRgb(0,0,0)) ; painter->setPen(penColor) ;
painter->drawText(0.5*S,y+text_height*0.9,QString::number(info.active_chunks[i].first)) ; painter->drawText(0.5*S,y+text_height*0.9,QString::number(info.active_chunks[i].first)) ;
int size_of_this_chunk = ( info.active_chunks[i].first == info.chunks.size()-1 && ((info.file_size % blockSize)>0) )?(info.file_size % blockSize):blockSize ; int size_of_this_chunk = ( info.active_chunks[i].first == info.chunks.size()-1 && ((info.file_size % blockSize)>0) )?(info.file_size % blockSize):blockSize ;
@ -212,7 +219,7 @@ void FileTransferInfoWidget::draw(const FileInfo& nfo,const FileChunksInfo& info
} }
painter->setPen(QColor::fromRgb(0,0,0)) ; painter->setPen(penColor) ;
float percent = (size_of_this_chunk - info.active_chunks[i].second)*100.0/size_of_this_chunk ; float percent = (size_of_this_chunk - info.active_chunks[i].second)*100.0/size_of_this_chunk ;
painter->drawText(sizeX+5.5*S,y+text_height*0.9,QString::number(percent,'f',2) + " %") ; painter->drawText(sizeX+5.5*S,y+text_height*0.9,QString::number(percent,'f',2) + " %") ;
@ -227,7 +234,7 @@ void FileTransferInfoWidget::draw(const FileInfo& nfo,const FileChunksInfo& info
y += block_sep ; y += block_sep ;
y += text_height ; y += text_height ;
painter->setPen(QColor::fromRgb(0,0,0)) ; painter->setPen(penColor) ;
painter->drawText(0,y,(info.compressed_peer_availability_maps.size() == 1 ? tr("Availability map (%1 active source)") : tr("Availability map (%1 active sources)")).arg(info.compressed_peer_availability_maps.size())) ; painter->drawText(0,y,(info.compressed_peer_availability_maps.size() == 1 ? tr("Availability map (%1 active source)") : tr("Availability map (%1 active sources)")).arg(info.compressed_peer_availability_maps.size())) ;
y += block_sep ; y += block_sep ;
@ -254,7 +261,8 @@ void FileTransferInfoWidget::draw(const FileInfo& nfo,const FileChunksInfo& info
// various info: // various info:
// //
painter->setPen(QColor::fromRgb(0,0,0)) ; painter->setPen(penColor) ;
y += text_height ; painter->drawText(0,y,tr("File info") + ":") ; y += text_height ; painter->drawText(0,y,tr("File info") + ":") ;
y += block_sep ; y += block_sep ;
y += text_height ; painter->drawText(2*S,y,tr("File name") + ":") ; painter->drawText(tab_size,y,QString::fromUtf8(nfo.fname.c_str())) ; y += text_height ; painter->drawText(2*S,y,tr("File name") + ":") ; painter->drawText(tab_size,y,QString::fromUtf8(nfo.fname.c_str())) ;

View file

@ -24,6 +24,7 @@
#include <QWidget> #include <QWidget>
#include <QPainter> #include <QPainter>
#include <QBitmap> #include <QBitmap>
#include <QColor>
#include <retroshare-gui/RsAutoUpdatePage.h> #include <retroshare-gui/RsAutoUpdatePage.h>
#include <retroshare/rstypes.h> #include <retroshare/rstypes.h>
@ -58,6 +59,7 @@ private:
QPixmap downloadingPixmap; QPixmap downloadingPixmap;
QPixmap notDownloadPixmap; QPixmap notDownloadPixmap;
QPixmap checkingPixmap; QPixmap checkingPixmap;
QColor penColor;
RsFileHash _file_hash ; RsFileHash _file_hash ;
}; };