mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-07 14:12:43 -04:00
Added DHT status to statusbar, it will be change his color and changes the tooltip .
Added Network Status for Log Tab too in NetworkDialog at the moment realy basic,every 100 seconds checks for the actually status. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1148 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
dfabbcca6d
commit
63ea6946c7
11 changed files with 242 additions and 7 deletions
|
@ -53,6 +53,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "statusbar/peerstatus.h"
|
#include "statusbar/peerstatus.h"
|
||||||
|
#include "statusbar/dhtstatus.h"
|
||||||
#include "Preferences/PreferencesWindow.h"
|
#include "Preferences/PreferencesWindow.h"
|
||||||
#include "Settings/gsettingswin.h"
|
#include "Settings/gsettingswin.h"
|
||||||
#include "util/rsversion.h"
|
#include "util/rsversion.h"
|
||||||
|
@ -314,6 +315,9 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||||
peerstatus = new PeerStatus();
|
peerstatus = new PeerStatus();
|
||||||
statusBar()->addWidget(peerstatus);
|
statusBar()->addWidget(peerstatus);
|
||||||
|
|
||||||
|
dhtstatus = new DHTStatus();
|
||||||
|
statusBar()->addWidget(dhtstatus);
|
||||||
|
|
||||||
QWidget *widget = new QWidget();
|
QWidget *widget = new QWidget();
|
||||||
QSizePolicy sizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
|
QSizePolicy sizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
|
||||||
sizePolicy.setHorizontalStretch(0);
|
sizePolicy.setHorizontalStretch(0);
|
||||||
|
@ -407,6 +411,9 @@ void MainWindow::updateStatus()
|
||||||
if (peerstatus)
|
if (peerstatus)
|
||||||
peerstatus->setPeerStatus();
|
peerstatus->setPeerStatus();
|
||||||
|
|
||||||
|
if (dhtstatus)
|
||||||
|
dhtstatus->getDHTStatus();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateHashingInfo(const QString& s)
|
void MainWindow::updateHashingInfo(const QString& s)
|
||||||
|
|
|
@ -61,6 +61,7 @@
|
||||||
class SMPlayer;
|
class SMPlayer;
|
||||||
|
|
||||||
class PeerStatus;
|
class PeerStatus;
|
||||||
|
class DHTStatus;
|
||||||
|
|
||||||
void openFile(std::string path);
|
void openFile(std::string path);
|
||||||
|
|
||||||
|
@ -214,6 +215,7 @@ private:
|
||||||
|
|
||||||
QLabel *statusRates;
|
QLabel *statusRates;
|
||||||
PeerStatus *peerstatus;
|
PeerStatus *peerstatus;
|
||||||
|
DHTStatus *dhtstatus;
|
||||||
|
|
||||||
QLabel *_hashing_info_label ;
|
QLabel *_hashing_info_label ;
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "rsiface/rspeers.h"
|
#include "rsiface/rspeers.h"
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
#include <QTimer>
|
||||||
#include <QTime>
|
#include <QTime>
|
||||||
#include <QContextMenuEvent>
|
#include <QContextMenuEvent>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
|
@ -136,6 +137,12 @@ NetworkDialog::NetworkDialog(QWidget *parent)
|
||||||
menu->addAction(ui.actionTabsRounded);
|
menu->addAction(ui.actionTabsRounded);
|
||||||
ui.viewButton->setMenu(menu);
|
ui.viewButton->setMenu(menu);
|
||||||
|
|
||||||
|
QTimer *timer = new QTimer(this);
|
||||||
|
timer->connect(timer, SIGNAL(timeout()), this, SLOT(getNetworkStatus()));
|
||||||
|
timer->start(100000);
|
||||||
|
|
||||||
|
//getNetworkStatus();
|
||||||
|
|
||||||
|
|
||||||
/* Hide platform specific features */
|
/* Hide platform specific features */
|
||||||
#ifdef Q_WS_WIN
|
#ifdef Q_WS_WIN
|
||||||
|
@ -594,6 +601,83 @@ void NetworkDialog::displayInfoLogMenu(const QPoint& pos) {
|
||||||
myLogMenu.exec(mapToGlobal(pos)+QPoint(0,320));
|
myLogMenu.exec(mapToGlobal(pos)+QPoint(0,320));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NetworkDialog::getNetworkStatus()
|
||||||
|
{
|
||||||
|
rsiface->lockData(); /* Lock Interface */
|
||||||
|
|
||||||
|
/* now the extra bit .... switch on check boxes */
|
||||||
|
const RsConfig &config = rsiface->getConfig();
|
||||||
|
|
||||||
|
//ui.check_net->setChecked(config.netOk);
|
||||||
|
if(config.netUpnpOk)
|
||||||
|
{
|
||||||
|
setLogInfo(tr("UPNP is active."), QString::fromUtf8("blue"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setLogInfo(tr("UPNP NOT FOUND."), QString::fromUtf8("red"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(config.netDhtOk)
|
||||||
|
{
|
||||||
|
setLogInfo(tr("DHT OK"), QString::fromUtf8("green"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setLogInfo(tr("DHT is not working (down)."), QString::fromUtf8("red"));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(config.netExtOk)
|
||||||
|
{
|
||||||
|
setLogInfo(tr("External Address Found"), QString::fromUtf8("green"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setLogInfo(tr("Not Found External Address"), QString::fromUtf8("red"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(config.netUdpOk)
|
||||||
|
{
|
||||||
|
setLogInfo(tr("UDP Port is Reacheable"), QString::fromUtf8("green"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setLogInfo(tr("UDP Port isnt Reacheable"), QString::fromUtf8("red"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(config.netTcpOk)
|
||||||
|
{
|
||||||
|
setLogInfo(tr("TCP Port is Reacheable"), QString::fromUtf8("green"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setLogInfo(tr("TCP Port is not Reacheable"), QString::fromUtf8("red"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (config.netExtOk)
|
||||||
|
{
|
||||||
|
if (config.netUpnpOk || config.netTcpOk)
|
||||||
|
{
|
||||||
|
setLogInfo(tr("RetroShare Server"), QString::fromUtf8("green"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setLogInfo(tr("UDP Server"), QString::fromUtf8("green"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (config.netOk)
|
||||||
|
{
|
||||||
|
setLogInfo(tr("Net Limited"), QString::fromUtf8("magenta"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
setLogInfo(tr("No Conectivity"), QString::fromUtf8("red"));
|
||||||
|
}
|
||||||
|
|
||||||
|
rsiface->unlockData(); /* UnLock Interface */
|
||||||
|
}
|
||||||
|
|
||||||
void NetworkDialog::on_actionTabsright_activated()
|
void NetworkDialog::on_actionTabsright_activated()
|
||||||
{
|
{
|
||||||
ui.networkTab->setTabPosition(QTabWidget::East);
|
ui.networkTab->setTabPosition(QTabWidget::East);
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
#define _CONNECTIONSDIALOG_H
|
#define _CONNECTIONSDIALOG_H
|
||||||
|
|
||||||
#include <QFileDialog>
|
#include <QFileDialog>
|
||||||
|
#include <QtGui>
|
||||||
|
|
||||||
|
|
||||||
//#include <config/rsharesettings.h>
|
//#include <config/rsharesettings.h>
|
||||||
|
|
||||||
|
@ -69,6 +71,8 @@ private slots:
|
||||||
void on_actionClearLog_triggered();
|
void on_actionClearLog_triggered();
|
||||||
void displayInfoLogMenu(const QPoint& pos);
|
void displayInfoLogMenu(const QPoint& pos);
|
||||||
|
|
||||||
|
void getNetworkStatus();
|
||||||
|
|
||||||
void on_actionTabsright_activated();
|
void on_actionTabsright_activated();
|
||||||
void on_actionTabsnorth_activated();
|
void on_actionTabsnorth_activated();
|
||||||
void on_actionTabssouth_activated();
|
void on_actionTabssouth_activated();
|
||||||
|
|
|
@ -246,6 +246,10 @@
|
||||||
<file>images/pause.png</file>
|
<file>images/pause.png</file>
|
||||||
<file>images/player_play.png</file>
|
<file>images/player_play.png</file>
|
||||||
<file>images/quick_restart24.png</file>
|
<file>images/quick_restart24.png</file>
|
||||||
|
<file>images/redled.png</file>
|
||||||
|
<file>images/greenled.png</file>
|
||||||
|
<file>images/grayled.png</file>
|
||||||
|
<file>images/yellowled.png</file>
|
||||||
<file>images/records.png</file>
|
<file>images/records.png</file>
|
||||||
<file>images/removefriend16.png</file>
|
<file>images/removefriend16.png</file>
|
||||||
<file>images/replymail-pressed.png</file>
|
<file>images/replymail-pressed.png</file>
|
||||||
|
|
BIN
retroshare-gui/src/gui/images/grayled.png
Normal file
BIN
retroshare-gui/src/gui/images/grayled.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 382 B |
BIN
retroshare-gui/src/gui/images/greenled.png
Normal file
BIN
retroshare-gui/src/gui/images/greenled.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 418 B |
BIN
retroshare-gui/src/gui/images/redled.png
Normal file
BIN
retroshare-gui/src/gui/images/redled.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 479 B |
BIN
retroshare-gui/src/gui/images/yellowled.png
Normal file
BIN
retroshare-gui/src/gui/images/yellowled.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 376 B |
89
retroshare-gui/src/gui/statusbar/dhtstatus.cpp
Normal file
89
retroshare-gui/src/gui/statusbar/dhtstatus.cpp
Normal file
|
@ -0,0 +1,89 @@
|
||||||
|
/****************************************************************
|
||||||
|
* RetroShare is distributed under the following license:
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 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 "dhtstatus.h"
|
||||||
|
|
||||||
|
#include <QtGui>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
#include <QLayout>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QIcon>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QPixmap>
|
||||||
|
|
||||||
|
#include "rsiface/rsiface.h"
|
||||||
|
#include "rsiface/rspeers.h"
|
||||||
|
|
||||||
|
#include <sstream>
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
|
DHTStatus::DHTStatus(QWidget *parent)
|
||||||
|
: QWidget(parent)
|
||||||
|
{
|
||||||
|
QHBoxLayout *hbox = new QHBoxLayout();
|
||||||
|
hbox->setMargin(0);
|
||||||
|
hbox->setSpacing(6);
|
||||||
|
|
||||||
|
statusDHT = new QLabel( tr("<strong>DHT:</strong>"), this );
|
||||||
|
//statusDHT->setMinimumSize( statusPeers->frameSize().width() + 0, 0 );
|
||||||
|
hbox->addWidget(statusDHT);
|
||||||
|
|
||||||
|
iconLabel = new QLabel( this );
|
||||||
|
iconLabel->setPixmap(QPixmap::QPixmap(":/images/grayled.png"));
|
||||||
|
// iconLabel doesn't change over time, so we didn't need a minimum size
|
||||||
|
hbox->addWidget(iconLabel);
|
||||||
|
|
||||||
|
setLayout( hbox );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
DHTStatus::~DHTStatus()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void DHTStatus::getDHTStatus()
|
||||||
|
{
|
||||||
|
|
||||||
|
rsiface->lockData(); /* Lock Interface */
|
||||||
|
|
||||||
|
/* now the extra bit .... switch on check boxes */
|
||||||
|
const RsConfig &config = rsiface->getConfig();
|
||||||
|
|
||||||
|
|
||||||
|
if (config.netDhtOk)
|
||||||
|
{
|
||||||
|
iconLabel->setPixmap(QPixmap::QPixmap(":/images/greenled.png"));
|
||||||
|
iconLabel->setToolTip(tr("DHT OK"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
iconLabel->setPixmap(QPixmap::QPixmap(":/images/redled.png"));
|
||||||
|
iconLabel->setToolTip(tr("DHT DOWN"));
|
||||||
|
}
|
||||||
|
|
||||||
|
rsiface->unlockData(); /* UnLock Interface */
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
45
retroshare-gui/src/gui/statusbar/dhtstatus.h
Normal file
45
retroshare-gui/src/gui/statusbar/dhtstatus.h
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
/****************************************************************
|
||||||
|
* RetroShare is distributed under the following license:
|
||||||
|
*
|
||||||
|
* Copyright (C) 2009 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 DHTSTATUS_H
|
||||||
|
#define DHTSTATUS_H
|
||||||
|
#include "gui/MainWindow.h"
|
||||||
|
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
|
||||||
|
class DHTStatus : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
DHTStatus(QWidget *parent = 0);
|
||||||
|
|
||||||
|
~DHTStatus();
|
||||||
|
|
||||||
|
void getDHTStatus( );
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
class QLabel *iconLabel, *statusDHT;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
Add table
Add a link
Reference in a new issue