mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-03 02:50:07 -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_height = 0 ;
|
||||
|
||||
mHideOffline = false;
|
||||
}
|
||||
|
||||
void RSPermissionMatrixWidget::setHideOffline(bool hide)
|
||||
{
|
||||
if (mHideOffline == hide) {
|
||||
return;
|
||||
}
|
||||
|
||||
mHideOffline = hide;
|
||||
repaint();
|
||||
}
|
||||
|
||||
void RSPermissionMatrixWidget::updateDisplay()
|
||||
@ -238,11 +250,8 @@ void RSPermissionMatrixWidget::paintEvent(QPaintEvent *)
|
||||
|
||||
// sort list
|
||||
{
|
||||
// RSPermissionMatrixWidgets parent is ServicePermissionsPage which holds the checkbox
|
||||
ServicePermissionsPage *spp = dynamic_cast<ServicePermissionsPage*>(parentWidget());
|
||||
if(spp != NULL) {
|
||||
// sort out offline peers
|
||||
if(spp->isHideOfflineChecked()) {
|
||||
if(mHideOffline) {
|
||||
RsPeerDetails peerDetails;
|
||||
for(std::list<RsPeerId>::iterator it = ssllist.begin(); it != ssllist.end();) {
|
||||
rsPeers->getPeerDetails(*it, peerDetails);
|
||||
@ -259,7 +268,6 @@ void RSPermissionMatrixWidget::paintEvent(QPaintEvent *)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// sort by name
|
||||
ssllist.sort(sortRsPeerIdByNameLocation);
|
||||
|
@ -60,6 +60,9 @@ public:
|
||||
RSPermissionMatrixWidget(QWidget *parent=NULL);
|
||||
virtual ~RSPermissionMatrixWidget() ;
|
||||
|
||||
public slots:
|
||||
void setHideOffline(bool hide);
|
||||
|
||||
protected slots:
|
||||
// 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()
|
||||
@ -100,6 +103,8 @@ private:
|
||||
/** The current dimensions of the graph. */
|
||||
QRect _rec;
|
||||
|
||||
bool mHideOffline;
|
||||
|
||||
static const float fROW_SIZE ;
|
||||
static const float fCOL_SIZE ;
|
||||
static const float fICON_SIZE_X ;
|
||||
|
@ -28,16 +28,19 @@
|
||||
#include <iostream>
|
||||
#include <QTimer>
|
||||
|
||||
#define PermissionStateUserRole (Qt::UserRole)
|
||||
#define ServiceIdUserRole (Qt::UserRole + 1)
|
||||
#define PeerIdUserRole (Qt::UserRole + 2)
|
||||
|
||||
ServicePermissionsPage::ServicePermissionsPage(QWidget * parent, Qt::WindowFlags /*flags*/)
|
||||
ServicePermissionsPage::ServicePermissionsPage(QWidget * parent, Qt::WindowFlags flags) :
|
||||
ConfigPage(parent, flags)
|
||||
{
|
||||
/* Invoke the Qt Designer generated object setup routine */
|
||||
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 *)));
|
||||
|
||||
ui.frame->setHideOffline(ui.cb_hideOffline->isChecked());
|
||||
|
||||
// Not implemented?
|
||||
ui.pushButton->hide();
|
||||
}
|
||||
|
||||
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\
|
||||
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 helpText() const ;
|
||||
|
||||
bool isHideOfflineChecked();
|
||||
|
||||
private:
|
||||
|
||||
Ui::ServicePermissionsPage ui;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user