mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-17 09:34:10 -05:00
Added new statusbar widget about pending discovery informations.
You can enable it in the server settings. Recompile of GUI needed. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3956 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
3a9181bc85
commit
4b091a54d6
16 changed files with 1100 additions and 873 deletions
|
|
@ -69,6 +69,7 @@
|
|||
#include "statusbar/ratesstatus.h"
|
||||
#include "statusbar/dhtstatus.h"
|
||||
#include "statusbar/hashingstatus.h"
|
||||
#include "statusbar/discstatus.h"
|
||||
#include <retroshare/rsstatus.h>
|
||||
|
||||
#include <retroshare/rsiface.h>
|
||||
|
|
@ -296,6 +297,9 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
|||
hashingstatus = new HashingStatus();
|
||||
statusBar()->addPermanentWidget(hashingstatus);
|
||||
|
||||
discstatus = new DiscStatus();
|
||||
statusBar()->addPermanentWidget(discstatus);
|
||||
|
||||
ratesstatus = new RatesStatus();
|
||||
statusBar()->addPermanentWidget(ratesstatus);
|
||||
/** Status Bar end ******/
|
||||
|
|
@ -330,6 +334,7 @@ MainWindow::~MainWindow()
|
|||
delete natstatus;
|
||||
delete dhtstatus;
|
||||
delete ratesstatus;
|
||||
delete discstatus;
|
||||
MessengerWindow::releaseInstance();
|
||||
#ifdef UNFINISHED
|
||||
delete applicationWindow;
|
||||
|
|
@ -766,6 +771,10 @@ void MainWindow::updateStatus()
|
|||
if (dhtstatus)
|
||||
dhtstatus->getDHTStatus();
|
||||
|
||||
if (discstatus) {
|
||||
discstatus->update();
|
||||
}
|
||||
|
||||
if (nOnlineCount == 0)
|
||||
{
|
||||
trayIcon->setIcon(QIcon(IMAGE_NOONLINE));
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ class Idle;
|
|||
class PeerStatus;
|
||||
class NATStatus;
|
||||
class RatesStatus;
|
||||
class DiscStatus;
|
||||
class DHTStatus;
|
||||
class HashingStatus;
|
||||
class ForumsDialog;
|
||||
|
|
@ -253,6 +254,7 @@ private:
|
|||
NATStatus *natstatus;
|
||||
DHTStatus *dhtstatus;
|
||||
RatesStatus *ratesstatus;
|
||||
DiscStatus *discstatus;
|
||||
HashingStatus *hashingstatus;
|
||||
QComboBox *statusComboBox;
|
||||
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
#include <gui/TurtleRouterDialog.h>
|
||||
|
||||
#include "rshare.h"
|
||||
#include "rsharesettings.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
|
@ -96,6 +97,7 @@ ServerPage::closeEvent (QCloseEvent * event)
|
|||
bool
|
||||
ServerPage::save(QString &errmsg)
|
||||
{
|
||||
Settings->setStatusBarFlag(STATUSBAR_DISC, ui.showDiscStatusBar->isChecked());
|
||||
|
||||
/* save the server address */
|
||||
/* save local address */
|
||||
|
|
@ -186,8 +188,10 @@ void ServerPage::load()
|
|||
/* set the server address */
|
||||
ui.extAddress->setText(QString::fromStdString(detail.extAddr));
|
||||
ui.extPort -> setValue(detail.extPort);
|
||||
/* set DynDNS */
|
||||
ui.dynDNS -> setText(QString::fromStdString(detail.dyndns));
|
||||
/* set DynDNS */
|
||||
ui.dynDNS -> setText(QString::fromStdString(detail.dyndns));
|
||||
|
||||
ui.showDiscStatusBar->setChecked(Settings->getStatusBarFlags() & STATUSBAR_DISC);
|
||||
}
|
||||
|
||||
/** Loads the settings for this page */
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -536,6 +536,30 @@ void RshareSettings::setLastPageInMainWindow (int value)
|
|||
setValueToGroup("MainWindow", "LastPage", value);
|
||||
}
|
||||
|
||||
uint RshareSettings::getStatusBarFlags()
|
||||
{
|
||||
/* Default = All but disc status */
|
||||
return valueFromGroup("MainWindow", "StatusBarFlags", 0xFFFFFFFF ^ STATUSBAR_DISC).toUInt();
|
||||
}
|
||||
|
||||
void RshareSettings::setStatusBarFlags(uint flags)
|
||||
{
|
||||
setValueToGroup("MainWindow", "StatusBarFlags", flags);
|
||||
}
|
||||
|
||||
void RshareSettings::setStatusBarFlag(uint flag, bool enable)
|
||||
{
|
||||
uint flags = getStatusBarFlags();
|
||||
|
||||
if (enable) {
|
||||
flags |= flag;
|
||||
} else {
|
||||
flags &= ~flag;
|
||||
}
|
||||
|
||||
setStatusBarFlags(flags);
|
||||
}
|
||||
|
||||
/* Messages */
|
||||
bool RshareSettings::getMsgSetToReadOnActivate ()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@
|
|||
****************************************************************/
|
||||
|
||||
|
||||
|
||||
#ifndef _RSHARESETTINGS_H
|
||||
#define _RSHARESETTINGS_H
|
||||
|
||||
|
|
@ -41,6 +40,8 @@
|
|||
|
||||
#define TRAYNOTIFY_COMBINEDICON 0x80000000
|
||||
|
||||
#define STATUSBAR_DISC 0x00000001
|
||||
|
||||
//Forward declaration.
|
||||
class QWidget;
|
||||
class QTableWidget;
|
||||
|
|
@ -194,6 +195,9 @@ public:
|
|||
/* MainWindow */
|
||||
int getLastPageInMainWindow ();
|
||||
void setLastPageInMainWindow (int value);
|
||||
uint getStatusBarFlags();
|
||||
void setStatusBarFlags(uint flags);
|
||||
void setStatusBarFlag(uint flag, bool enable);
|
||||
|
||||
/* Messages */
|
||||
bool getMsgSetToReadOnActivate ();
|
||||
|
|
|
|||
78
retroshare-gui/src/gui/statusbar/discstatus.cpp
Normal file
78
retroshare-gui/src/gui/statusbar/discstatus.cpp
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2008 RetroShare Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#include <QHBoxLayout>
|
||||
#include <QLabel>
|
||||
|
||||
#include "discstatus.h"
|
||||
#include "gui/settings/rsharesettings.h"
|
||||
|
||||
#include <retroshare/rsdisc.h>
|
||||
|
||||
DiscStatus::DiscStatus(QWidget *parent)
|
||||
: QWidget(parent)
|
||||
{
|
||||
hide (); // show only, when pending operations are available
|
||||
|
||||
QHBoxLayout *hbox = new QHBoxLayout(this);
|
||||
hbox->setMargin(0);
|
||||
hbox->setSpacing(6);
|
||||
|
||||
QLabel *iconLabel = new QLabel(this);
|
||||
iconLabel->setPixmap(QPixmap(":/images/uploads.png"));
|
||||
iconLabel->setToolTip(tr("Waiting outgoing discovery operations"));
|
||||
hbox->addWidget(iconLabel);
|
||||
|
||||
sendLabel = new QLabel("0", this);
|
||||
sendLabel->setToolTip(iconLabel->toolTip());
|
||||
hbox->addWidget(sendLabel);
|
||||
|
||||
iconLabel = new QLabel(this);
|
||||
iconLabel->setPixmap(QPixmap(":/images/download.png"));
|
||||
iconLabel->setToolTip(tr("Waiting incoming discovery operations"));
|
||||
hbox->addWidget(iconLabel);
|
||||
|
||||
recvLabel = new QLabel("0", this);
|
||||
recvLabel->setToolTip(iconLabel->toolTip());
|
||||
hbox->addWidget(recvLabel);
|
||||
|
||||
hbox->addSpacing(2);
|
||||
|
||||
setLayout(hbox);
|
||||
}
|
||||
|
||||
void DiscStatus::update()
|
||||
{
|
||||
if (rsDisc == NULL || (Settings->getStatusBarFlags() & STATUSBAR_DISC) == 0) {
|
||||
hide();
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned int sendCount = 0;
|
||||
unsigned int recvCount = 0;
|
||||
|
||||
rsDisc->getWaitingDiscCount(&sendCount, &recvCount);
|
||||
|
||||
sendLabel->setText(QString::number(sendCount));
|
||||
recvLabel->setText(QString::number(recvCount));
|
||||
|
||||
setVisible(sendCount || recvCount);
|
||||
}
|
||||
43
retroshare-gui/src/gui/statusbar/discstatus.h
Normal file
43
retroshare-gui/src/gui/statusbar/discstatus.h
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
/****************************************************************
|
||||
* RetroShare is distributed under the following license:
|
||||
*
|
||||
* Copyright (C) 2008 RetroShare Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#ifndef DISCSTATUS_H
|
||||
#define DISCSTATUS_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class QLabel;
|
||||
|
||||
class DiscStatus : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DiscStatus(QWidget *parent = 0);
|
||||
|
||||
void update();
|
||||
|
||||
private:
|
||||
QLabel *sendLabel;
|
||||
QLabel *recvLabel;
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue