mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-03-01 11:21:25 -05:00
added some visualization of mapping on disk for debugging purpose
git-svn-id: http://svn.code.sf.net/p/retroshare/code/branches/v0.5-SparseFileStorage@6088 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
d96052c442
commit
30a3fe7b06
@ -44,6 +44,7 @@ FileTransferInfoWidget::FileTransferInfoWidget(QWidget * /*parent*/, Qt::WFlags
|
||||
QRect TaskGraphRect = geometry();
|
||||
maxWidth = TaskGraphRect.width();
|
||||
maxHeight = 0;
|
||||
draw_file_map = false ;
|
||||
pixmap = QPixmap(size());
|
||||
pixmap.fill(this, 0, 0);
|
||||
|
||||
@ -62,6 +63,12 @@ void FileTransferInfoWidget::resizeEvent(QResizeEvent */*event*/)
|
||||
|
||||
updateDisplay();
|
||||
}
|
||||
void FileTransferInfoWidget::toggleDisplayMode(bool b)
|
||||
{
|
||||
draw_file_map = b ;
|
||||
updateDisplay();
|
||||
}
|
||||
|
||||
void FileTransferInfoWidget::updateDisplay()
|
||||
{
|
||||
//std::cout << "In TaskGraphPainterWidget::updateDisplay()" << std::endl ;
|
||||
@ -110,7 +117,7 @@ void FileTransferInfoWidget::paintEvent(QPaintEvent */*event*/)
|
||||
void FileTransferInfoWidget::draw(const FileInfo& nfo,const FileChunksInfo& info,QPainter *painter)
|
||||
{
|
||||
x=0;
|
||||
y=0;
|
||||
y=5;
|
||||
int blocks = info.chunks.size() ;
|
||||
uint64_t fileSize = info.file_size ;
|
||||
uint32_t blockSize = info.chunk_size ;
|
||||
@ -123,6 +130,8 @@ void FileTransferInfoWidget::draw(const FileInfo& nfo,const FileChunksInfo& info
|
||||
painter->drawText(0,y,tr("Chunk map") + ":") ;
|
||||
y += block_sep ;
|
||||
|
||||
QPixmap variablePixmap(downloadedPixmap) ;
|
||||
|
||||
// draw the chunk map
|
||||
//
|
||||
for (int i=0;i<blocks;i++)
|
||||
@ -134,6 +143,16 @@ void FileTransferInfoWidget::draw(const FileInfo& nfo,const FileChunksInfo& info
|
||||
}
|
||||
QRectF target(x, y, 12.0, 12.0);
|
||||
|
||||
if(draw_file_map)
|
||||
{
|
||||
if(i<info.chunks_on_disk.size())
|
||||
variablePixmap.fill(QColor::fromHsv(int(300*info.chunks_on_disk[i]/(float)blocks),200,255)) ;
|
||||
else
|
||||
variablePixmap.fill(QColor::fromHsv(int(300*i/(float)blocks),0,128)) ;
|
||||
|
||||
painter->drawPixmap(target,variablePixmap,source) ;
|
||||
}
|
||||
else
|
||||
switch(info.chunks[i])
|
||||
{
|
||||
case FileChunksInfo::CHUNK_DONE: painter->drawPixmap(target, downloadedPixmap, source);
|
||||
|
@ -39,6 +39,10 @@ public:
|
||||
void setFileHash(const std::string& hash) { _file_hash = hash ; }
|
||||
|
||||
virtual void updateDisplay() ; // update from RsAutoUpdateWidget
|
||||
|
||||
public slots:
|
||||
void toggleDisplayMode(bool) ;
|
||||
|
||||
protected:
|
||||
void draw(const FileInfo& nfo,const FileChunksInfo& details,QPainter *painter) ;
|
||||
|
||||
@ -56,6 +60,7 @@ private:
|
||||
QPixmap downloadingPixmap;
|
||||
QPixmap notDownloadPixmap;
|
||||
QPixmap checkingPixmap;
|
||||
bool draw_file_map ;
|
||||
|
||||
std::string _file_hash ;
|
||||
};
|
||||
|
@ -303,6 +303,9 @@ TransfersDialog::TransfersDialog(QWidget *parent)
|
||||
|
||||
QObject::connect(ui.downloadList->selectionModel(),SIGNAL(selectionChanged (const QItemSelection&, const QItemSelection&)),this,SLOT(showFileDetails())) ;
|
||||
|
||||
ftiw->toggleDisplayMode(ui.diskMap_CB->isChecked()) ;
|
||||
connect(ui.diskMap_CB, SIGNAL(toggled(bool)), ftiw, SLOT( toggleDisplayMode(bool)));
|
||||
|
||||
ui.tabWidget->addTab( new TurtleRouterStatistics(), tr("Router Statistics")) ;
|
||||
|
||||
ui.tabWidget->addTab( new TurtleRouterDialog(), tr("Router Requests")) ;
|
||||
|
@ -166,7 +166,7 @@
|
||||
</font>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
<number>1</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="uploadsTab">
|
||||
<attribute name="icon">
|
||||
@ -228,8 +228,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>100</width>
|
||||
<height>30</height>
|
||||
<width>598</width>
|
||||
<height>91</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
@ -282,6 +282,19 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>368</width>
|
||||
<height>13</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<layout class="QGridLayout">
|
||||
<item row="0" column="0">
|
||||
@ -303,19 +316,6 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="4">
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>368</width>
|
||||
<height>13</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="2">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
@ -337,6 +337,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="0" column="5">
|
||||
<widget class="QCheckBox" name="diskMap_CB">
|
||||
<property name="text">
|
||||
<string>Show disk map</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
|
@ -164,10 +164,10 @@ sshserver {
|
||||
}
|
||||
|
||||
INCLUDEPATH += $$LIBSSH_DIR/include/
|
||||
#LIBS += $$LIBSSH_DIR/build/src/libssh.a
|
||||
#LIBS += $$LIBSSH_DIR/build/src/threads/libssh_threads.a
|
||||
LIBS += -lssh
|
||||
LIBS += -lssh_threads
|
||||
LIBS += $$LIBSSH_DIR/build/src/libssh.a
|
||||
LIBS += $$LIBSSH_DIR/build/src/threads/libssh_threads.a
|
||||
#LIBS += -lssh
|
||||
#LIBS += -lssh_threads
|
||||
|
||||
HEADERS += ssh/rssshd.h
|
||||
SOURCES += ssh/rssshd.cc
|
||||
|
Loading…
x
Reference in New Issue
Block a user