mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-21 21:55:15 -05:00
Tuned the matrix to show sub-networks
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@851 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
02583ad232
commit
84e12fd1e7
@ -1,6 +1,7 @@
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QWheelEvent>
|
#include <QWheelEvent>
|
||||||
|
#include <QHeaderView>
|
||||||
#include "rsiface/rsiface.h"
|
#include "rsiface/rsiface.h"
|
||||||
#include "rsiface/rspeers.h"
|
#include "rsiface/rspeers.h"
|
||||||
|
|
||||||
@ -14,13 +15,15 @@ TrustView::TrustView()
|
|||||||
setupUi(this) ;
|
setupUi(this) ;
|
||||||
|
|
||||||
trustTableTW->setMouseTracking(true) ;
|
trustTableTW->setMouseTracking(true) ;
|
||||||
trustInconsistencyCB->setEnabled(false) ;
|
// trustInconsistencyCB->setEnabled(false) ;
|
||||||
|
|
||||||
zoomHS->setValue(100) ;
|
zoomHS->setValue(100) ;
|
||||||
|
|
||||||
QObject::connect(zoomHS,SIGNAL(valueChanged(int)),this,SLOT(updateZoom(int))) ;
|
QObject::connect(zoomHS,SIGNAL(valueChanged(int)),this,SLOT(updateZoom(int))) ;
|
||||||
QObject::connect(updatePB,SIGNAL(clicked()),this,SLOT(update())) ;
|
QObject::connect(updatePB,SIGNAL(clicked()),this,SLOT(update())) ;
|
||||||
QObject::connect(trustTableTW,SIGNAL(cellClicked(int,int)),this,SLOT(selectCell(int,int))) ;
|
QObject::connect(trustTableTW,SIGNAL(cellClicked(int,int)),this,SLOT(selectCell(int,int))) ;
|
||||||
|
QObject::connect(trustTableTW->verticalHeader(),SIGNAL(sectionClicked(int)),this,SLOT(hideShowPeers(int))) ;
|
||||||
|
QObject::connect(trustTableTW->horizontalHeader(),SIGNAL(sectionClicked(int)),this,SLOT(hideShowPeers(int))) ;
|
||||||
|
|
||||||
updatePB->setToolTip(QString("This table normaly auto-updates every 10 seconds.")) ;
|
updatePB->setToolTip(QString("This table normaly auto-updates every 10 seconds.")) ;
|
||||||
|
|
||||||
@ -48,6 +51,9 @@ void TrustView::selectCell(int row,int col)
|
|||||||
static int last_row = -1 ;
|
static int last_row = -1 ;
|
||||||
static int last_col = -1 ;
|
static int last_col = -1 ;
|
||||||
|
|
||||||
|
cout << "row = " << row << ", column = " << col << endl;
|
||||||
|
if(row == 0 || col == 0)
|
||||||
|
cout << "***********************************************" << endl ;
|
||||||
if(last_row > -1)
|
if(last_row > -1)
|
||||||
{
|
{
|
||||||
int col_s,row_s ;
|
int col_s,row_s ;
|
||||||
@ -61,10 +67,15 @@ void TrustView::selectCell(int row,int col)
|
|||||||
{
|
{
|
||||||
trustTableTW->setColumnWidth(col,_base_cell_width) ;
|
trustTableTW->setColumnWidth(col,_base_cell_width) ;
|
||||||
trustTableTW->setRowHeight(row,_base_cell_height) ;
|
trustTableTW->setRowHeight(row,_base_cell_height) ;
|
||||||
}
|
|
||||||
|
|
||||||
last_col = col ;
|
last_col = col ;
|
||||||
last_row = row ;
|
last_row = row ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
last_col = -1 ;
|
||||||
|
last_row = -1 ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TrustView::getCellSize(int z,int& col_s,int& row_s) const
|
void TrustView::getCellSize(int z,int& col_s,int& row_s) const
|
||||||
@ -203,6 +214,43 @@ void TrustView::update()
|
|||||||
|
|
||||||
for(int j=0;j<trustTableTW->columnCount();++j)
|
for(int j=0;j<trustTableTW->columnCount();++j)
|
||||||
trustTableTW->horizontalHeaderItem(j)->setToolTip(trustTableTW->horizontalHeaderItem(j)->text()+" trusts " + QString::number(nj[j]) + " peers, including him(her)self.") ;
|
trustTableTW->horizontalHeaderItem(j)->setToolTip(trustTableTW->horizontalHeaderItem(j)->text()+" trusts " + QString::number(nj[j]) + " peers, including him(her)self.") ;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TrustView::hideShowPeers(int col)
|
||||||
|
{
|
||||||
|
// Choose what to show/hide
|
||||||
|
//
|
||||||
|
|
||||||
|
static int last_col = -1 ;
|
||||||
|
|
||||||
|
if(col == last_col)
|
||||||
|
{
|
||||||
|
for(int i=0;i<trustTableTW->rowCount();++i)
|
||||||
|
{
|
||||||
|
trustTableTW->setColumnHidden(i,false) ;
|
||||||
|
trustTableTW->setRowHidden(i,false) ;
|
||||||
|
}
|
||||||
|
last_col = -1 ;
|
||||||
|
|
||||||
|
showingLabel->setText(QString("Showing: whole network")) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for(int i=0;i<trustTableTW->rowCount();++i)
|
||||||
|
if(trustTableTW->item(i,col) == NULL && trustTableTW->item(col,i) == NULL)
|
||||||
|
{
|
||||||
|
trustTableTW->setColumnHidden(i,true) ;
|
||||||
|
trustTableTW->setRowHidden(i,true) ;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
trustTableTW->setColumnHidden(i,false) ;
|
||||||
|
trustTableTW->setRowHidden(i,false) ;
|
||||||
|
}
|
||||||
|
last_col = col ;
|
||||||
|
showingLabel->setText(QString("Showing: peers connected to ")+trustTableTW->verticalHeaderItem(col)->text()) ;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ class TrustView: public QWidget, public Ui::TrustView
|
|||||||
void update() ;
|
void update() ;
|
||||||
void updateZoom(int) ;
|
void updateZoom(int) ;
|
||||||
void selectCell(int,int) ;
|
void selectCell(int,int) ;
|
||||||
|
void hideShowPeers(int) ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void getCellSize(int z,int& cell_width,int& cell_height) const ;
|
void getCellSize(int z,int& cell_width,int& cell_height) const ;
|
||||||
|
@ -18,13 +18,6 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout" >
|
<layout class="QHBoxLayout" name="horizontalLayout" >
|
||||||
<item>
|
|
||||||
<widget class="QCheckBox" name="trustInconsistencyCB" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>Show trust inconsistencies</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="Line" name="line" >
|
<widget class="Line" name="line" >
|
||||||
<property name="orientation" >
|
<property name="orientation" >
|
||||||
@ -32,13 +25,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="updatePB" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>Update</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label" >
|
<widget class="QLabel" name="label" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
@ -56,6 +42,20 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="updatePB" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Update</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="showingLabel" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Showing: whole network</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
Loading…
Reference in New Issue
Block a user