mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-23 14:39:34 -05: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
@ -53,6 +53,7 @@
|
||||
#endif
|
||||
|
||||
#include "statusbar/peerstatus.h"
|
||||
#include "statusbar/dhtstatus.h"
|
||||
#include "Preferences/PreferencesWindow.h"
|
||||
#include "Settings/gsettingswin.h"
|
||||
#include "util/rsversion.h"
|
||||
@ -313,17 +314,20 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
#endif
|
||||
peerstatus = new PeerStatus();
|
||||
statusBar()->addWidget(peerstatus);
|
||||
|
||||
dhtstatus = new DHTStatus();
|
||||
statusBar()->addWidget(dhtstatus);
|
||||
|
||||
QWidget *widget = new QWidget();
|
||||
QWidget *widget = new QWidget();
|
||||
QSizePolicy sizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred);
|
||||
sizePolicy.setHorizontalStretch(0);
|
||||
sizePolicy.setVerticalStretch(0);
|
||||
sizePolicy.setHeightForWidth(widget->sizePolicy().hasHeightForWidth());
|
||||
widget->setSizePolicy(sizePolicy);
|
||||
QHBoxLayout *horizontalLayout = new QHBoxLayout(widget);
|
||||
horizontalLayout->setContentsMargins(0, 0, 0, 0);
|
||||
horizontalLayout->setContentsMargins(0, 0, 0, 0);
|
||||
horizontalLayout->setObjectName(QString::fromUtf8("horizontalLayout"));
|
||||
_hashing_info_label = new QLabel(widget) ;
|
||||
_hashing_info_label = new QLabel(widget) ;
|
||||
_hashing_info_label->setObjectName(QString::fromUtf8("label"));
|
||||
|
||||
horizontalLayout->addWidget(_hashing_info_label);
|
||||
@ -331,7 +335,7 @@ MainWindow::MainWindow(QWidget* parent, Qt::WFlags flags)
|
||||
horizontalLayout->addItem(horizontalSpacer);
|
||||
|
||||
statusBar()->addPermanentWidget(widget);
|
||||
_hashing_info_label->hide() ;
|
||||
_hashing_info_label->hide() ;
|
||||
|
||||
statusBar()->addPermanentWidget(statusRates = new QLabel(tr("<strong>Down:</strong> 0.00 (kB/s) | <strong>Up:</strong> 0.00 (kB/s) ")));
|
||||
|
||||
@ -404,8 +408,11 @@ void MainWindow::updateStatus()
|
||||
if (statusRates)
|
||||
statusRates -> setText(QString::fromStdString(out.str()));
|
||||
|
||||
if (peerstatus)
|
||||
peerstatus->setPeerStatus();
|
||||
if (peerstatus)
|
||||
peerstatus->setPeerStatus();
|
||||
|
||||
if (dhtstatus)
|
||||
dhtstatus->getDHTStatus();
|
||||
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,7 @@
|
||||
class SMPlayer;
|
||||
|
||||
class PeerStatus;
|
||||
class DHTStatus;
|
||||
|
||||
void openFile(std::string path);
|
||||
|
||||
@ -214,6 +215,7 @@ private:
|
||||
|
||||
QLabel *statusRates;
|
||||
PeerStatus *peerstatus;
|
||||
DHTStatus *dhtstatus;
|
||||
|
||||
QLabel *_hashing_info_label ;
|
||||
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "rsiface/rspeers.h"
|
||||
#include <sstream>
|
||||
|
||||
#include <QTimer>
|
||||
#include <QTime>
|
||||
#include <QContextMenuEvent>
|
||||
#include <QMenu>
|
||||
@ -125,7 +126,7 @@ NetworkDialog::NetworkDialog(QWidget *parent)
|
||||
setLogInfo(tr("RetroShare %1 started.", "e.g: RetroShare v0.x started.").arg(retroshareVersion()));
|
||||
|
||||
setLogInfo(tr("Welcome to RetroShare."), QString::fromUtf8("blue"));
|
||||
|
||||
|
||||
QMenu *menu = new QMenu(tr("View"));
|
||||
menu->addAction(ui.actionTabsright);
|
||||
menu->addAction(ui.actionTabswest);
|
||||
@ -136,6 +137,12 @@ NetworkDialog::NetworkDialog(QWidget *parent)
|
||||
menu->addAction(ui.actionTabsRounded);
|
||||
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 */
|
||||
#ifdef Q_WS_WIN
|
||||
@ -594,6 +601,83 @@ void NetworkDialog::displayInfoLogMenu(const QPoint& pos) {
|
||||
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()
|
||||
{
|
||||
ui.networkTab->setTabPosition(QTabWidget::East);
|
||||
|
@ -24,6 +24,8 @@
|
||||
#define _CONNECTIONSDIALOG_H
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QtGui>
|
||||
|
||||
|
||||
//#include <config/rsharesettings.h>
|
||||
|
||||
@ -69,6 +71,8 @@ private slots:
|
||||
void on_actionClearLog_triggered();
|
||||
void displayInfoLogMenu(const QPoint& pos);
|
||||
|
||||
void getNetworkStatus();
|
||||
|
||||
void on_actionTabsright_activated();
|
||||
void on_actionTabsnorth_activated();
|
||||
void on_actionTabssouth_activated();
|
||||
|
@ -246,6 +246,10 @@
|
||||
<file>images/pause.png</file>
|
||||
<file>images/player_play.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/removefriend16.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…
Reference in New Issue
Block a user