From 3a8541291a998d618e3e91949501ab89c71a00e8 Mon Sep 17 00:00:00 2001 From: defnax Date: Tue, 26 Aug 2014 23:03:17 +0000 Subject: [PATCH] * beautify DHT details * Added to display the Bandwidth details,Turtle router, Global router into the DHT Window * Now the DHT Details, will be a place to view all the details about the DHT, Bandwidth, Turtle & Global router and more. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@7497 b45a01b8-16f6-495d-af2f-9b41ad6348cc --- retroshare-gui/src/gui/MainWindow.cpp | 18 - retroshare-gui/src/gui/MainWindow.h | 1 - .../src/gui/bwctrl/BwCtrlWindow.cpp | 15 +- retroshare-gui/src/gui/bwctrl/BwCtrlWindow.h | 12 +- retroshare-gui/src/gui/bwctrl/BwCtrlWindow.ui | 180 ++-- retroshare-gui/src/gui/dht/DhtWindow.cpp | 31 +- retroshare-gui/src/gui/dht/DhtWindow.ui | 911 +++++++++++++----- 7 files changed, 758 insertions(+), 410 deletions(-) diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index af03d2947..c65892e02 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -117,16 +117,11 @@ * ****/ #define USE_DHTWINDOW 1 -#define USE_BWCTRLWINDOW 1 #ifdef USE_DHTWINDOW #include "dht/DhtWindow.h" #endif -#ifdef USE_BWCTRLWINDOW -#include "bwctrl/BwCtrlWindow.h" -#endif - /* Images for toolbar icons */ //#define IMAGE_NETWORK2 ":/images/rs1.png" @@ -621,9 +616,6 @@ void MainWindow::createTrayIcon() #ifdef USE_DHTWINDOW trayMenu->addAction(QIcon(IMAGE_DHT), tr("DHT Details"), this, SLOT(showDhtWindow())); #endif -#ifdef USE_BWCTRLWINDOW - trayMenu->addAction(QIcon(IMAGE_DHT), tr("Bandwidth Details"), this, SLOT(showBwCtrlWindow())); -#endif #ifdef UNFINISHED trayMenu->addAction(QIcon(IMAGE_UNFINISHED), tr("Applications"), this, SLOT(showApplWindow())); @@ -1112,16 +1104,6 @@ void MainWindow::showDhtWindow() #endif } - -/** Shows Bandwitch Control window */ -void MainWindow::showBwCtrlWindow() -{ -#ifdef USE_BWCTRLWINDOW - BwCtrlWindow::showYourself(); -#endif -} - - /** Shows Application window */ #ifdef UNFINISHED void MainWindow::showApplWindow() diff --git a/retroshare-gui/src/gui/MainWindow.h b/retroshare-gui/src/gui/MainWindow.h index cdb4aeaf2..ffcd2c713 100644 --- a/retroshare-gui/src/gui/MainWindow.h +++ b/retroshare-gui/src/gui/MainWindow.h @@ -205,7 +205,6 @@ private slots: void newRsCollection(); void showMessengerWindow(); void showDhtWindow(); - void showBwCtrlWindow(); void servicePermission(); #ifdef UNFINISHED diff --git a/retroshare-gui/src/gui/bwctrl/BwCtrlWindow.cpp b/retroshare-gui/src/gui/bwctrl/BwCtrlWindow.cpp index 0ea4a0ed0..9a8555c11 100644 --- a/retroshare-gui/src/gui/bwctrl/BwCtrlWindow.cpp +++ b/retroshare-gui/src/gui/bwctrl/BwCtrlWindow.cpp @@ -165,7 +165,7 @@ QSize BWListDelegate::sizeHint(const QStyleOptionViewItem & /*option*/, const QM /**************************************************************************************************/ /********************************************** STATIC WINDOW *************************************/ -BwCtrlWindow * BwCtrlWindow::mInstance = NULL; +/*BwCtrlWindow * BwCtrlWindow::mInstance = NULL; void BwCtrlWindow::showYourself() { @@ -187,14 +187,14 @@ void BwCtrlWindow::releaseInstance() if (mInstance) { delete mInstance; } -} +}*/ /********************************************** STATIC WINDOW *************************************/ BwCtrlWindow::BwCtrlWindow(QWidget *parent) : - QMainWindow(parent), + QWidget(parent), ui(new Ui::BwCtrlWindow) { ui->setupUi(this); @@ -204,6 +204,8 @@ BwCtrlWindow::BwCtrlWindow(QWidget *parent) : BWDelegate = new BWListDelegate(); ui->bwTreeWidget->setItemDelegate(BWDelegate); + //ui->tabWidget->addTab(dhtdetails = new DhtWindow(),QIcon(), tr("DHT")); + // tick for gui update. QTimer *timer = new QTimer(this); @@ -213,10 +215,11 @@ BwCtrlWindow::BwCtrlWindow(QWidget *parent) : BwCtrlWindow::~BwCtrlWindow() { - delete ui; - mInstance = NULL; + //delete ui; + //mInstance = NULL; } +/* void BwCtrlWindow::changeEvent(QEvent *e) { QMainWindow::changeEvent(e); @@ -227,7 +230,7 @@ void BwCtrlWindow::changeEvent(QEvent *e) default: break; } -} +}*/ void BwCtrlWindow::update() { diff --git a/retroshare-gui/src/gui/bwctrl/BwCtrlWindow.h b/retroshare-gui/src/gui/bwctrl/BwCtrlWindow.h index ad1b1938e..0c92d4be6 100644 --- a/retroshare-gui/src/gui/bwctrl/BwCtrlWindow.h +++ b/retroshare-gui/src/gui/bwctrl/BwCtrlWindow.h @@ -67,13 +67,13 @@ namespace Ui { class BwCtrlWindow; } -class BwCtrlWindow : public QMainWindow { +class BwCtrlWindow : public QWidget { Q_OBJECT public: - static void showYourself (); - static BwCtrlWindow* getInstance(); - static void releaseInstance(); + //static void showYourself (); + //static BwCtrlWindow* getInstance(); + //static void releaseInstance(); BwCtrlWindow(QWidget *parent = 0); @@ -85,12 +85,12 @@ public slots: void update(); protected: - void changeEvent(QEvent *e); + //void changeEvent(QEvent *e); private: Ui::BwCtrlWindow *ui; - static BwCtrlWindow *mInstance; + //static BwCtrlWindow *mInstance; BWListDelegate *BWDelegate; diff --git a/retroshare-gui/src/gui/bwctrl/BwCtrlWindow.ui b/retroshare-gui/src/gui/bwctrl/BwCtrlWindow.ui index b74c67347..2fbe8c638 100644 --- a/retroshare-gui/src/gui/bwctrl/BwCtrlWindow.ui +++ b/retroshare-gui/src/gui/bwctrl/BwCtrlWindow.ui @@ -1,126 +1,88 @@ BwCtrlWindow - - - true - + 0 0 - 525 - 297 + 597 + 469 - Bandwidth Control Window + Form - - - :/images/logo/logo_16.png:/images/logo/logo_16.png - - - - - + + + + + true + + - Bandwidth Measurements + Name - - - - - - true + + + + ID - - - Name - - - - - ID - - - - - In (KB/s) - - - - - InMax (KB/s) - - - - - InQueue - - - - - InAllocated (KB/s) - - - - - Allocated Sent - - - - - Out (KB/s) - - - - - OutMax (KB/s) - - - - - OutQueue - - - - - OutAllowed (KB/s) - - - - - Allowed Recvd - - - - - - - - - - 0 - 0 - 525 - 20 - - - - - - TopToolBarArea - - - false - - - + + + + In (KB/s) + + + + + InMax (KB/s) + + + + + InQueue + + + + + InAllocated (KB/s) + + + + + Allocated Sent + + + + + Out (KB/s) + + + + + OutMax (KB/s) + + + + + OutQueue + + + + + OutAllowed (KB/s) + + + + + Allowed Recvd + + + + + - - - - + diff --git a/retroshare-gui/src/gui/dht/DhtWindow.cpp b/retroshare-gui/src/gui/dht/DhtWindow.cpp index a7ae6cb90..54c679e0b 100644 --- a/retroshare-gui/src/gui/dht/DhtWindow.cpp +++ b/retroshare-gui/src/gui/dht/DhtWindow.cpp @@ -34,6 +34,10 @@ #include "retroshare/rsconfig.h" #include "retroshare/rspeers.h" +#include +#include +#include + /********************************************** STATIC WINDOW *************************************/ DhtWindow * DhtWindow::mInstance = NULL; @@ -70,8 +74,17 @@ DhtWindow::DhtWindow(QWidget *parent) : ui->setupUi(this); setAttribute ( Qt::WA_DeleteOnClose, true ); + + BwCtrlWindow *bwdlg = new BwCtrlWindow ; + ui->tabWidget->addTab(bwdlg, tr("Bandwidth details")); + + TurtleRouterStatistics *trs = new TurtleRouterStatistics ; + ui->tabWidget->addTab(trs,tr("Turtle router")) ; - // tick for gui update. + GlobalRouterStatistics *grs = new GlobalRouterStatistics ; + ui->tabWidget->addTab(grs,tr("Global router")) ; + + // tick for gui update. QTimer *timer = new QTimer(this); connect(timer, SIGNAL(timeout()), this, SLOT(update())); timer->start(1000); @@ -506,7 +519,7 @@ void DhtWindow::updateNetPeers() } - QString connstr; + /*QString connstr; connstr = tr("#Peers: ") + QString::number(nPeers); connstr += tr(" DHT: (#off:") + QString::number(nOfflinePeers); connstr += tr(",unreach:") + QString::number(nUnreachablePeers); @@ -515,9 +528,19 @@ void DhtWindow::updateNetPeers() connstr += tr(",#dir:") + QString::number(nDirectPeers); connstr += tr(",#proxy:") + QString::number(nProxyPeers); connstr += tr(",#relay:") + QString::number(nRelayPeers); - connstr += ")"; + connstr += ")";*/ + + ui->label_peers->setText(QString::number(nPeers)); + ui->label_offline->setText(QString::number(nOfflinePeers)); + ui->label_unreachable->setText(QString::number(nUnreachablePeers)); + ui->label_online->setText(QString::number(nOnlinePeers)); + + ui->label_disconnected->setText(QString::number(nDisconnPeers)); + ui->label_direct->setText(QString::number(nDirectPeers)); + ui->label_proxy->setText(QString::number(nProxyPeers)); + ui->label_relay->setText(QString::number(nRelayPeers)); - ui->peerSummaryLabel->setText(connstr); + //ui->peerSummaryLabel->setText(connstr); } diff --git a/retroshare-gui/src/gui/dht/DhtWindow.ui b/retroshare-gui/src/gui/dht/DhtWindow.ui index 3aa205187..0c5ef0935 100644 --- a/retroshare-gui/src/gui/dht/DhtWindow.ui +++ b/retroshare-gui/src/gui/dht/DhtWindow.ui @@ -9,8 +9,8 @@ 0 0 - 665 - 490 + 777 + 604 @@ -21,272 +21,659 @@ :/images/dht16.png:/images/dht16.png - - - 0 - - - - - - - true - - - Peer Details - - - true - - - - - - - Net Status - - - - - - - - - - - - 0 - 0 - - - - Connect Options - - - - - - - Network Mode - - - - - - - Nat Type - - - - - - - Nat Hole - - - - - - - - - - - - 0 - 0 - - - - Peer Address - - - - - - - Extra Label - - - - - - - - - Qt::Vertical + + + + + 0 - - - - 0 - - - - - 6 - + + + DHT Details + + + + + + + + + + + 75 + true + + + + Net Status: + + + + + + + Qt::LeftToRight + + + Net Status + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + + + + + 75 + true + + + + Network Mode: + + + + + + + Network Mode + + + + + + + + + + + + 75 + true + + + + Nat Type: + + + + + + + Nat Type + + + + + + + + + + + + 75 + true + + + + Nat Hole: + + + + + + + Nat Hole + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + - - - - TextLabel + + + + + + + + + 75 + true + + + + Connect Mode: + + + + + + + + 0 + 0 + + + + Qt::LeftToRight + + + Connect Options + + + + + + + + + + + + 75 + true + + + + Peer Address: + + + + + + + + 0 + 0 + + + + Peer Address + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + + + 75 + true + + + DHT + + + + + + + + + 75 + true + + + + Unreachable: + + + + + + + + 50 + false + + + + + + + + + + + + + + + + 75 + true + + + + Online: + + + + + + + + 50 + false + + + + + + + + + + + + + + + + 75 + true + + + + Offline: + + + + + + + + 50 + false + + + + + + + + + + + + + + + + 75 + true + + + + Peers: + + + + + + + + 50 + false + + + + + + + + + + - - - - true + + + + + 75 + true + - - - Name + + Connections + + + + + + + + + 75 + true + + + + Disconnected: + + + + + + + + 50 + false + + + + + + + + + + + + + + + + 75 + true + + + + Direct: + + + + + + + + 50 + false + + + + + + + + + + + + + + + + 75 + true + + + + Proxy: + + + + + + + + 50 + false + + + + + + + + + + + + + + + + 75 + true + + + + Relay: + + + + + + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + Qt::Vertical + + + + + 0 + + + + + true + + + + Name + + + + + PeerId + + + + + DHT Status + + + + + ConnectLogic + + + + + Connect Status + + + + + Connect Mode + + + + + Request Status + + + + + Cb Status + + + + + RsId + + + + + + + + + + + + DHT Details + + + + + + + true + + + + Bucket + + + + + IP:Port + + + + + Key + + + + + Status Flags + + + + + Found + + + + + Last Sent + + + + + Last Recv + + + + + + + + + true - - - - PeerId - - - - - DHT Status - - - - - ConnectLogic - - - - - Connect Status - - - - - Connect Mode - - - - - Request Status - - - - - Cb Status - - - - - RsId - - + + + Relay Mode + + + + + Source + + + + + Proxy + + + + + Destination + + + + + Class + + + + + Age + + + + + Last Sent + + + + + Bandwidth + + + - - - - - - DHT Details - - - - - - - true - - - - Bucket - - - - - IP:Port - - - - - Key - - - - - Status Flags - - - - - Found - - - - - Last Sent - - - - - Last Recv - - - - - - - - - true - - - - Relay Mode - - - - - Source - - - - - Proxy - - - - - Destination - - - - - Class - - - - - Age - - - - - Last Sent - - - - - Bandwidth - - - @@ -296,19 +683,11 @@ 0 0 - 665 - 20 + 777 + 21 - - - TopToolBarArea - - - false - -