mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-09 03:18:41 -05:00
Fixed hide offline friends in ServicePermissionsPage
This commit is contained in:
parent
c9197864c6
commit
9d0b0664f1
@ -67,6 +67,18 @@ RSPermissionMatrixWidget::RSPermissionMatrixWidget(QWidget *parent)
|
|||||||
|
|
||||||
_max_width = 400 ;
|
_max_width = 400 ;
|
||||||
_max_height = 0 ;
|
_max_height = 0 ;
|
||||||
|
|
||||||
|
mHideOffline = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void RSPermissionMatrixWidget::setHideOffline(bool hide)
|
||||||
|
{
|
||||||
|
if (mHideOffline == hide) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
mHideOffline = hide;
|
||||||
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
void RSPermissionMatrixWidget::updateDisplay()
|
void RSPermissionMatrixWidget::updateDisplay()
|
||||||
@ -238,25 +250,21 @@ void RSPermissionMatrixWidget::paintEvent(QPaintEvent *)
|
|||||||
|
|
||||||
// sort list
|
// sort list
|
||||||
{
|
{
|
||||||
// RSPermissionMatrixWidgets parent is ServicePermissionsPage which holds the checkbox
|
// sort out offline peers
|
||||||
ServicePermissionsPage *spp = dynamic_cast<ServicePermissionsPage*>(parentWidget());
|
if(mHideOffline) {
|
||||||
if(spp != NULL) {
|
RsPeerDetails peerDetails;
|
||||||
// sort out offline peers
|
for(std::list<RsPeerId>::iterator it = ssllist.begin(); it != ssllist.end();) {
|
||||||
if(spp->isHideOfflineChecked()) {
|
rsPeers->getPeerDetails(*it, peerDetails);
|
||||||
RsPeerDetails peerDetails;
|
|
||||||
for(std::list<RsPeerId>::iterator it = ssllist.begin(); it != ssllist.end();) {
|
|
||||||
rsPeers->getPeerDetails(*it, peerDetails);
|
|
||||||
|
|
||||||
switch (peerDetails.connectState) {
|
switch (peerDetails.connectState) {
|
||||||
case RS_PEER_CONNECTSTATE_OFFLINE:
|
case RS_PEER_CONNECTSTATE_OFFLINE:
|
||||||
case RS_PEER_CONNECTSTATE_TRYING_TCP:
|
case RS_PEER_CONNECTSTATE_TRYING_TCP:
|
||||||
case RS_PEER_CONNECTSTATE_TRYING_UDP:
|
case RS_PEER_CONNECTSTATE_TRYING_UDP:
|
||||||
it = ssllist.erase(it);
|
it = ssllist.erase(it);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
it++;
|
it++;
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,9 @@ public:
|
|||||||
RSPermissionMatrixWidget(QWidget *parent=NULL);
|
RSPermissionMatrixWidget(QWidget *parent=NULL);
|
||||||
virtual ~RSPermissionMatrixWidget() ;
|
virtual ~RSPermissionMatrixWidget() ;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void setHideOffline(bool hide);
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
// Calls the internal source for a new data points; called by the timer. You might want to overload this
|
// Calls the internal source for a new data points; called by the timer. You might want to overload this
|
||||||
// if the collection system needs it. Otherwise, the default method will call getValues()
|
// if the collection system needs it. Otherwise, the default method will call getValues()
|
||||||
@ -100,6 +103,8 @@ private:
|
|||||||
/** The current dimensions of the graph. */
|
/** The current dimensions of the graph. */
|
||||||
QRect _rec;
|
QRect _rec;
|
||||||
|
|
||||||
|
bool mHideOffline;
|
||||||
|
|
||||||
static const float fROW_SIZE ;
|
static const float fROW_SIZE ;
|
||||||
static const float fCOL_SIZE ;
|
static const float fCOL_SIZE ;
|
||||||
static const float fICON_SIZE_X ;
|
static const float fICON_SIZE_X ;
|
||||||
|
@ -28,16 +28,19 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
|
|
||||||
#define PermissionStateUserRole (Qt::UserRole)
|
ServicePermissionsPage::ServicePermissionsPage(QWidget * parent, Qt::WindowFlags flags) :
|
||||||
#define ServiceIdUserRole (Qt::UserRole + 1)
|
ConfigPage(parent, flags)
|
||||||
#define PeerIdUserRole (Qt::UserRole + 2)
|
|
||||||
|
|
||||||
ServicePermissionsPage::ServicePermissionsPage(QWidget * parent, Qt::WindowFlags /*flags*/)
|
|
||||||
{
|
{
|
||||||
/* Invoke the Qt Designer generated object setup routine */
|
/* Invoke the Qt Designer generated object setup routine */
|
||||||
ui.setupUi(this);
|
ui.setupUi(this);
|
||||||
|
|
||||||
|
connect(ui.cb_hideOffline, SIGNAL(toggled(bool)), ui.frame, SLOT(setHideOffline(bool)));
|
||||||
//QObject::connect(ui.tableWidget,SIGNAL(itemChanged(QTableWidgetItem *)), this, SLOT(tableItemChanged(QTableWidgetItem *)));
|
//QObject::connect(ui.tableWidget,SIGNAL(itemChanged(QTableWidgetItem *)), this, SLOT(tableItemChanged(QTableWidgetItem *)));
|
||||||
|
|
||||||
|
ui.frame->setHideOffline(ui.cb_hideOffline->isChecked());
|
||||||
|
|
||||||
|
// Not implemented?
|
||||||
|
ui.pushButton->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ServicePermissionsPage::helpText() const
|
QString ServicePermissionsPage::helpText() const
|
||||||
@ -52,10 +55,3 @@ QString ServicePermissionsPage::helpText() const
|
|||||||
<p>Be very careful: Some services depend on each other. For instance turning turtle OFF will also\
|
<p>Be very careful: Some services depend on each other. For instance turning turtle OFF will also\
|
||||||
stop all anonymous transfer, distant chat and distant messaging.</p>");
|
stop all anonymous transfer, distant chat and distant messaging.</p>");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ServicePermissionsPage::isHideOfflineChecked()
|
|
||||||
{
|
|
||||||
return ui.cb_hideOffline->checkState() == Qt::Checked;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -44,10 +44,7 @@ public:
|
|||||||
virtual QString pageName() const { return tr("Permissions") ; }
|
virtual QString pageName() const { return tr("Permissions") ; }
|
||||||
virtual QString helpText() const ;
|
virtual QString helpText() const ;
|
||||||
|
|
||||||
bool isHideOfflineChecked();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
Ui::ServicePermissionsPage ui;
|
Ui::ServicePermissionsPage ui;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user