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:
thunder2 2011-01-07 16:56:57 +00:00
parent 3a9181bc85
commit 4b091a54d6
16 changed files with 1100 additions and 873 deletions

View File

@ -45,6 +45,7 @@ virtual ~RsDisc() { return; }
virtual bool getDiscFriends(std::string id, std::list<std::string>& friends) = 0;
virtual bool getDiscGPGFriends(std::string id, std::list<std::string>& gpg_friends) = 0;
virtual bool getDiscVersions(std::map<std::string, std::string> &versions) = 0;
virtual bool getWaitingDiscCount(unsigned int *sendCount, unsigned int *recvCount) = 0;
};

View File

@ -37,6 +37,7 @@ bool p3Discovery::getDiscGPGFriends(std::string id, std::list<std::string>& gpg_
}
return false;
}
bool p3Discovery::getDiscFriends(std::string id, std::list<std::string> &friends)
{
if (mDisc)
@ -56,3 +57,12 @@ bool p3Discovery::getDiscVersions(std::map<std::string, std::string> &versions)
return false;
}
bool p3Discovery::getWaitingDiscCount(unsigned int *sendCount, unsigned int *recvCount)
{
if (mDisc)
{
mDisc->getWaitingDiscCount(sendCount, recvCount);
return true;
}
return false;
}

View File

@ -40,6 +40,7 @@ virtual ~p3Discovery() { return; }
virtual bool getDiscFriends(std::string id, std::list<std::string> &friends);
virtual bool getDiscGPGFriends(std::string id, std::list<std::string> &gpg_friends);
virtual bool getDiscVersions(std::map<std::string, std::string> &versions);
virtual bool getWaitingDiscCount(unsigned int *sendCount, unsigned int *recvCount);
private:

View File

@ -283,7 +283,7 @@ void p3disc::sendAllInfoToJustConnectedPeer(const std::string &id)
rsPeers->getFriendList(friendIds);
/* send them a list of all friend's details */
for(friendIdsIt = friendIds.begin(); friendIdsIt != friendIds.end(); friendIdsIt++) {
for(friendIdsIt = friendIds.begin(); friendIdsIt != friendIds.end(); friendIdsIt++) {
/* get details */
peerConnectState detail;
if (!mConnMgr->getFriendNetStatus(*friendIdsIt, detail)) {
@ -1017,6 +1017,29 @@ void p3disc::getversions(std::map<std::string, std::string> &versions)
versions = this->versions;
}
void p3disc::getWaitingDiscCount(unsigned int *sendCount, unsigned int *recvCount)
{
if (sendCount == NULL && recvCount == NULL) {
/* Nothing to do */
return;
}
RsStackMutex stack(mDiscMtx); /********** STACK LOCKED MTX ******/
if (sendCount) {
*sendCount = 0;
std::map<std::string, std::list<std::string> >::iterator it;
for (it = sendIdList.begin(); it != sendIdList.end(); it++) {
*sendCount += it->second.size();
}
}
if (recvCount) {
*recvCount = pendingDiscReplyInList.size();
}
}
int p3disc::idServers()
{
RsStackMutex stack(mDiscMtx); /********** STACK LOCKED MTX ******/

View File

@ -92,6 +92,7 @@ int tick();
bool potentialGPGproxies(const std::string& id, std::list<std::string> &proxyGPGIds);
bool potentialproxies(const std::string& id, std::list<std::string> &proxyIds);
void getversions(std::map<std::string, std::string> &versions);
void getWaitingDiscCount(unsigned int *sendCount, unsigned int *recvCount);
/************* from AuthGPService ****************/
virtual AuthGPGOperation *getGPGOperation();

View File

@ -300,6 +300,7 @@ HEADERS += rshare.h \
gui/statusbar/dhtstatus.h \
gui/statusbar/ratesstatus.h \
gui/statusbar/hashingstatus.h \
gui/statusbar/discstatus.h \
gui/advsearch/advancedsearchdialog.h \
gui/advsearch/expressionwidget.h \
gui/advsearch/guiexprelement.h \
@ -517,6 +518,7 @@ SOURCES += main.cpp \
gui/statusbar/dhtstatus.cpp \
gui/statusbar/ratesstatus.cpp \
gui/statusbar/hashingstatus.cpp \
gui/statusbar/discstatus.cpp \
gui/toaster/MessageToaster.cpp \
gui/toaster/DownloadToaster.cpp \
gui/toaster/OnlineToaster.cpp \

View File

@ -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));

View File

@ -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;

View File

@ -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 */

View File

@ -765,7 +765,7 @@
</item>
</layout>
</item>
<item row="3" column="0">
<item row="4" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
@ -778,6 +778,13 @@
</property>
</spacer>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="showDiscStatusBar">
<property name="text">
<string>Show Discovery information in statusbar</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2">

View File

@ -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 ()
{

View File

@ -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 ();

View 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);
}

View 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

View File

@ -2851,6 +2851,19 @@ Das ist nützlich, wenn Du eine externe Festplatte freigibst und die Datei nicht
<translation>Eingehende Ordner automatisch freigeben</translation>
</message>
</context>
<context>
<name>DiscStatus</name>
<message>
<location filename="../gui/statusbar/discstatus.cpp" line="+39"/>
<source>Waiting outgoing discovery operations</source>
<translation>Wartende ausgehene Discovery-Operationen</translation>
</message>
<message>
<location line="+9"/>
<source>Waiting incoming discovery operations</source>
<translation>Wartende eingehende Discovery-Operationen</translation>
</message>
</context>
<context>
<name>DownloadToaster</name>
<message>
@ -5109,7 +5122,7 @@ p, li { white-space: pre-wrap; }
<context>
<name>MainWindow</name>
<message>
<location filename="../gui/MainWindow.cpp" line="+214"/>
<location filename="../gui/MainWindow.cpp" line="+215"/>
<source>Network</source>
<translation>Netzwerk</translation>
</message>
@ -5120,29 +5133,29 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<location line="+8"/>
<location line="+283"/>
<location line="+287"/>
<source>Transfers</source>
<translation>Übertragungen</translation>
</message>
<message>
<location line="-275"/>
<location line="+207"/>
<location line="-279"/>
<location line="+211"/>
<source>Messages</source>
<translation>Nachrichten</translation>
</message>
<message>
<location line="-204"/>
<location line="+238"/>
<location line="-208"/>
<location line="+242"/>
<source>Channels</source>
<translation>Kanäle</translation>
</message>
<message>
<location line="-234"/>
<location line="-238"/>
<source>Blogs</source>
<translation type="unfinished">Blogs</translation>
</message>
<message>
<location line="+251"/>
<location line="+255"/>
<source>Chat</source>
<translation>Chat</translation>
</message>
@ -5150,20 +5163,20 @@ p, li { white-space: pre-wrap; }
<location line="+94"/>
<location line="+41"/>
<location line="+41"/>
<location line="+154"/>
<location line="+158"/>
<source>%1 new messages</source>
<translation>%1 neue Nachrichten</translation>
</message>
<message>
<location line="-234"/>
<location line="-238"/>
<location line="+41"/>
<location line="+41"/>
<location line="+154"/>
<location line="+158"/>
<source>%1 new message</source>
<translation>%1 neue Nachricht</translation>
</message>
<message>
<location line="-132"/>
<location line="-136"/>
<source>You have %1 completed downloads</source>
<translation>Du hast %1 fertige Downloads</translation>
</message>
@ -5183,7 +5196,7 @@ p, li { white-space: pre-wrap; }
<translation>%1 fertigen Download</translation>
</message>
<message>
<location line="+79"/>
<location line="+83"/>
<source>Down: %1 (kB/s)</source>
<translation>Runter: %1 (kB/s)</translation>
</message>
@ -5234,7 +5247,7 @@ p, li { white-space: pre-wrap; }
<translation>Zeigen</translation>
</message>
<message>
<location line="-748"/>
<location line="-752"/>
<source>RetroShare</source>
<translation></translation>
</message>
@ -5265,7 +5278,7 @@ p, li { white-space: pre-wrap; }
<translation>Schnellstart Assistent</translation>
</message>
<message>
<location filename="../gui/MainWindow.cpp" line="-170"/>
<location filename="../gui/MainWindow.cpp" line="-174"/>
<source>Search</source>
<translation>Suchen</translation>
</message>
@ -5280,7 +5293,7 @@ p, li { white-space: pre-wrap; }
<translation>Messenger</translation>
</message>
<message>
<location filename="../gui/MainWindow.cpp" line="+138"/>
<location filename="../gui/MainWindow.cpp" line="+142"/>
<source>Show/Hide</source>
<translation>Anzeigen/Verbergen</translation>
</message>
@ -5293,15 +5306,15 @@ p, li { white-space: pre-wrap; }
<location line="+186"/>
<location line="+41"/>
<location line="+41"/>
<location line="+154"/>
<location line="+158"/>
<source>You have %1 new messages</source>
<translation>Du hast %1 neue Nachrichten</translation>
</message>
<message>
<location line="-234"/>
<location line="-238"/>
<location line="+41"/>
<location line="+41"/>
<location line="+154"/>
<location line="+158"/>
<source>You have %1 new message</source>
<translation>Du hast %1 neue Nachricht</translation>
</message>
@ -5321,7 +5334,7 @@ p, li { white-space: pre-wrap; }
<translation>Schliessen</translation>
</message>
<message>
<location filename="../gui/MainWindow.cpp" line="-686"/>
<location filename="../gui/MainWindow.cpp" line="-690"/>
<source>Minimize</source>
<translation>Minimieren</translation>
</message>
@ -5331,7 +5344,7 @@ p, li { white-space: pre-wrap; }
<translation>Maximieren</translation>
</message>
<message>
<location line="-136"/>
<location line="-140"/>
<source>Links Cloud</source>
<translation>Verknüpfungs-Wolke</translation>
</message>
@ -5346,7 +5359,7 @@ p, li { white-space: pre-wrap; }
<translation></translation>
</message>
<message>
<location filename="../gui/MainWindow.cpp" line="+813"/>
<location filename="../gui/MainWindow.cpp" line="+821"/>
<source>Help</source>
<translation>Hilfe</translation>
</message>
@ -5356,18 +5369,18 @@ p, li { white-space: pre-wrap; }
<translation>Über</translation>
</message>
<message>
<location filename="../gui/MainWindow.cpp" line="-834"/>
<location line="+213"/>
<location filename="../gui/MainWindow.cpp" line="-842"/>
<location line="+217"/>
<source>Forums</source>
<translation>Foren</translation>
</message>
<message>
<location line="-285"/>
<location line="-289"/>
<source>RetroShare %1 a secure decentralised communication platform</source>
<translation>RetroShare %1 eine sichere und dezentralisierte Kommunikationsplattform</translation>
</message>
<message>
<location line="+900"/>
<location line="+908"/>
<source>Open Messages</source>
<translation>Öffne Nachrichten</translation>
</message>
@ -5377,12 +5390,12 @@ p, li { white-space: pre-wrap; }
<translation>Anwendungen</translation>
</message>
<message>
<location line="-821"/>
<location line="-829"/>
<source>Plugins</source>
<translation></translation>
</message>
<message>
<location line="+837"/>
<location line="+845"/>
<source>Do you really want to exit RetroShare ?</source>
<translation>Willst Du RetroShare wirklich beenden?</translation>
</message>
@ -5392,7 +5405,7 @@ p, li { white-space: pre-wrap; }
<translation>Wirklich beenden?</translation>
</message>
<message>
<location line="-737"/>
<location line="-741"/>
<source>Low disk space warning</source>
<translation>Wenig Festplatenspeicher</translation>
</message>
@ -6446,7 +6459,7 @@ p, li { white-space: pre-wrap; }
<translation>&lt;strong&gt;RetroShare Instanz&lt;/strong&gt;</translation>
</message>
<message>
<location line="+503"/>
<location line="+509"/>
<source>Save Certificate</source>
<translation>Zertifikat speichern</translation>
</message>
@ -6513,7 +6526,7 @@ p, li { white-space: pre-wrap; }
<translation>Sortiere nach Status</translation>
</message>
<message>
<location filename="../gui/MessengerWindow.cpp" line="-553"/>
<location filename="../gui/MessengerWindow.cpp" line="-559"/>
<source>Recomend this Friend to...</source>
<translation>Freund weiterempfehlen...</translation>
</message>
@ -7278,7 +7291,7 @@ p, li { white-space: pre-wrap; }
<translation>Chat</translation>
</message>
<message>
<location line="+702"/>
<location line="+708"/>
<source>Save Certificate</source>
<translation>Zertifikat speichern</translation>
</message>
@ -7293,7 +7306,7 @@ p, li { white-space: pre-wrap; }
<translation>Status</translation>
</message>
<message>
<location filename="../gui/PeersDialog.cpp" line="-689"/>
<location filename="../gui/PeersDialog.cpp" line="-695"/>
<source>Connect To Friend</source>
<translation>Verbinde zum Freund</translation>
</message>
@ -7393,7 +7406,7 @@ p, li { white-space: pre-wrap; }
<translation>Aus allen Gruppen entfernen</translation>
</message>
<message>
<location line="+516"/>
<location line="+522"/>
<location line="+2"/>
<source>Available</source>
<translation>Verfügbar</translation>
@ -7556,7 +7569,7 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<location line="-150"/>
<location filename="../gui/PeersDialog.cpp" line="-1499"/>
<location filename="../gui/PeersDialog.cpp" line="-1505"/>
<source>Add Friend</source>
<translation>Freund hinzufügen</translation>
</message>
@ -7611,12 +7624,12 @@ p, li { white-space: pre-wrap; }
</message>
<message>
<location filename="../gui/PeersDialog.cpp" line="-40"/>
<location line="+870"/>
<location line="+876"/>
<source>RetroShare</source>
<translation></translation>
</message>
<message>
<location line="-831"/>
<location line="-837"/>
<source>Message Group</source>
<translation>Gruppe anschreiben</translation>
</message>
@ -7631,7 +7644,7 @@ p, li { white-space: pre-wrap; }
<translation>Gruppe entfernen</translation>
</message>
<message>
<location line="+823"/>
<location line="+829"/>
<source>Do you want to remove this Friend?</source>
<translation>Willst du diesen Freund entfernen?</translation>
</message>
@ -7668,12 +7681,12 @@ p, li { white-space: pre-wrap; }
<translation>Status Spalte ausblenden</translation>
</message>
<message>
<location filename="../gui/PeersDialog.cpp" line="-1844"/>
<location filename="../gui/PeersDialog.cpp" line="-1850"/>
<source>Friends Storm</source>
<translation>Aktivitäten</translation>
</message>
<message>
<location line="+1203"/>
<location line="+1209"/>
<source>is typing...</source>
<translation>tippt...</translation>
</message>
@ -7693,7 +7706,7 @@ p, li { white-space: pre-wrap; }
<translation>Freunde</translation>
</message>
<message>
<location filename="../gui/PeersDialog.cpp" line="-886"/>
<location filename="../gui/PeersDialog.cpp" line="-892"/>
<location line="+80"/>
<source>Paste Friend Link</source>
<translation>RetroShare Link einfügen</translation>
@ -9612,7 +9625,12 @@ p, li { white-space: pre-wrap; }
<translation></translation>
</message>
<message>
<location line="-125"/>
<location line="+155"/>
<source>Show Discovery information in statusbar</source>
<translation>Zeige Discovery-Informationen in der Statuszeile</translation>
</message>
<message>
<location line="-280"/>
<location line="+160"/>
<source>Network Configuration</source>
<translation>Netzwerkkonfiguration</translation>
@ -9648,7 +9666,7 @@ p, li { white-space: pre-wrap; }
<translation>Erlaube Tunnelverbindungen</translation>
</message>
<message>
<location line="+112"/>
<location line="+119"/>
<source>IP Service</source>
<translation>IP Dienst</translation>
</message>
@ -9669,7 +9687,7 @@ Es hilft auch, wenn Sie sich hinter einer Firewall/VPN befinden.</translation>
<translation>Erlaube RetroShare folgende Webseiten nach Ihrer IP zu fragen:</translation>
</message>
<message>
<location line="-93"/>
<location line="-100"/>
<source>Dynamic DNS</source>
<translation>Dynamisches DNS</translation>
</message>