From 17f32db68721f66cce9e09ee540f60c5221877dc Mon Sep 17 00:00:00 2001 From: defnax Date: Sat, 16 Jan 2021 12:42:33 +0100 Subject: [PATCH] Added Dark theme for the graphframe * Added Dark theme for the graphframe * Added Combobox for switch * Added for other graphs the settings * Added fix by phenom for get stored the configs for the statistics pages * Removed uneeded line from the toolbar * New icon for Identities stats page --- retroshare-gui/src/gui/MainWindow.cpp | 1 + .../src/gui/common/RSGraphWidget.cpp | 33 +++- retroshare-gui/src/gui/common/RSGraphWidget.h | 14 +- retroshare-gui/src/gui/icons.qrc | 1 + retroshare-gui/src/gui/icons/identities.png | Bin 0 -> 3837 bytes retroshare-gui/src/gui/statistics/BWGraph.cpp | 2 +- .../gui/statistics/BandwidthGraphWindow.cpp | 21 +++ .../src/gui/statistics/BandwidthGraphWindow.h | 1 + .../gui/statistics/BandwidthGraphWindow.ui | 145 +++++++++++---- .../gui/statistics/BandwidthStatsWidget.cpp | 54 ++++++ .../src/gui/statistics/BandwidthStatsWidget.h | 7 + .../gui/statistics/BandwidthStatsWidget.ui | 16 +- .../src/gui/statistics/DhtWindow.ui | 2 +- .../gui/statistics/GlobalRouterStatistics.cpp | 7 +- .../gui/statistics/GlobalRouterStatistics.ui | 166 +++++++++--------- .../gui/statistics/GxsTransportStatistics.ui | 4 +- .../src/gui/statistics/RttStatistics.cpp | 7 + .../src/gui/statistics/StatisticsWindow.cpp | 2 +- .../src/gui/statistics/StatisticsWindow.ui | 18 +- .../gui/statistics/TurtleRouterStatistics.cpp | 13 +- .../gui/statistics/TurtleRouterStatistics.ui | 49 +++--- retroshare-gui/src/gui/statistics/dhtgraph.h | 8 + .../src/gui/statistics/turtlegraph.h | 11 +- 23 files changed, 409 insertions(+), 173 deletions(-) create mode 100644 retroshare-gui/src/gui/icons/identities.png diff --git a/retroshare-gui/src/gui/MainWindow.cpp b/retroshare-gui/src/gui/MainWindow.cpp index 85b571f2f..4092334b5 100644 --- a/retroshare-gui/src/gui/MainWindow.cpp +++ b/retroshare-gui/src/gui/MainWindow.cpp @@ -378,6 +378,7 @@ MainWindow::~MainWindow() delete trayIcon; delete notifyMenu;//notifyMenu belongs to trayMenu delete trayMenu; + StatisticsWindow::releaseInstance(); #ifdef MESSENGER_WINDOW MessengerWindow::releaseInstance(); #endif diff --git a/retroshare-gui/src/gui/common/RSGraphWidget.cpp b/retroshare-gui/src/gui/common/RSGraphWidget.cpp index 5b9740b0b..dab0645c4 100644 --- a/retroshare-gui/src/gui/common/RSGraphWidget.cpp +++ b/retroshare-gui/src/gui/common/RSGraphWidget.cpp @@ -345,7 +345,11 @@ void RSGraphWidget::paintEvent(QPaintEvent *) _painter->setRenderHint(QPainter::TextAntialiasing); /* Fill in the background */ - _painter->fillRect(_rec, QBrush(BACK_COLOR)); + if (_flags & RSGRAPH_FLAGS_DARK_STYLE){ + _painter->fillRect(_rec, QBrush(BACK_COLOR_DARK)); + }else { + _painter->fillRect(_rec, QBrush(BACK_COLOR)); + } _painter->drawRect(_rec); /* Paint the scale */ @@ -649,10 +653,17 @@ void RSGraphWidget::paintScale1() QString text = _source->displayValue(scale) ; - _painter->setPen(SCALE_COLOR); - _painter->drawText(QPointF(SCALE_WIDTH*fact - QFontMetricsF(font()).width(text) - 4*fact, pos+0.4*FS), text); - _painter->setPen(GRID_COLOR); - _painter->drawLine(QPointF(SCALE_WIDTH*fact, pos), QPointF(_rec.width(), pos)); + if (_flags & RSGRAPH_FLAGS_DARK_STYLE){ + _painter->setPen(SCALE_COLOR_DARK); + _painter->drawText(QPointF(SCALE_WIDTH*fact - QFontMetricsF(font()).width(text) - 4*fact, pos+0.4*FS), text); + _painter->setPen(GRID_COLOR_DARK); + _painter->drawLine(QPointF(SCALE_WIDTH*fact, pos), QPointF(_rec.width(), pos)); + }else{ + _painter->setPen(SCALE_COLOR); + _painter->drawText(QPointF(SCALE_WIDTH*fact - QFontMetricsF(font()).width(text) - 4*fact, pos+0.4*FS), text); + _painter->setPen(GRID_COLOR); + _painter->drawLine(QPointF(SCALE_WIDTH*fact, pos), QPointF(_rec.width(), pos)); + } } /* Draw vertical separator */ @@ -675,8 +686,10 @@ void RSGraphWidget::paintScale2() int seconds = (_rec.width()-i)/_time_scale ; // pixels / (pixels per second) => seconds QString text = QString::number(seconds)+ " secs"; - - _painter->setPen(SCALE_COLOR); + if (_flags & RSGRAPH_FLAGS_DARK_STYLE) + _painter->setPen(SCALE_COLOR_DARK); + else + _painter->setPen(SCALE_COLOR); _painter->drawText(QPointF(i, _rec.height()-0.5*FS), text); } } @@ -743,8 +756,10 @@ void RSGraphWidget::paintLegend() _painter->setPen(pen); _painter->drawLine(QPointF(SCALE_WIDTH*fact+10.0*fact, pos+FS/3), QPointF(SCALE_WIDTH*fact+30.0*fact, pos+FS/3)); _painter->setPen(oldPen); - - _painter->setPen(SCALE_COLOR); + if (_flags & RSGRAPH_FLAGS_DARK_STYLE) + _painter->setPen(SCALE_COLOR_DARK); + else + _painter->setPen(SCALE_COLOR); _painter->drawText(QPointF(SCALE_WIDTH *fact+ 40*fact,pos + 0.5*FS), text) ; ++j ; diff --git a/retroshare-gui/src/gui/common/RSGraphWidget.h b/retroshare-gui/src/gui/common/RSGraphWidget.h index beefe314c..210402b12 100644 --- a/retroshare-gui/src/gui/common/RSGraphWidget.h +++ b/retroshare-gui/src/gui/common/RSGraphWidget.h @@ -36,11 +36,14 @@ #define MINUSER_SCALE 2000 /** 2000 users is the minimum scale */ #define SCROLL_STEP 4 /** Horizontal change on graph update */ -#define BACK_COLOR Qt::white -#define SCALE_COLOR Qt::black -#define GRID_COLOR Qt::lightGray -#define RSDHT_COLOR Qt::magenta -#define ALLDHT_COLOR Qt::yellow +#define BACK_COLOR Qt::white +#define SCALE_COLOR Qt::black +#define GRID_COLOR Qt::lightGray +#define BACK_COLOR_DARK Qt::black +#define SCALE_COLOR_DARK Qt::green +#define GRID_COLOR_DARK Qt::darkGreen +#define RSDHT_COLOR Qt::magenta +#define ALLDHT_COLOR Qt::yellow struct ZeroInitFloat { @@ -145,6 +148,7 @@ public: static const uint32_t RSGRAPH_FLAGS_LEGEND_CUMULATED = 0x0040 ;// show the total in the legend rather than current values static const uint32_t RSGRAPH_FLAGS_PAINT_STYLE_DOTS = 0x0080 ;// use dots static const uint32_t RSGRAPH_FLAGS_LEGEND_INTEGER = 0x0100 ;// use integer number in the legend, and move the lines to match integers + static const uint32_t RSGRAPH_FLAGS_DARK_STYLE = 0x0200 ;// darkstyle graph /** Bandwidth graph style. */ enum GraphStyle diff --git a/retroshare-gui/src/gui/icons.qrc b/retroshare-gui/src/gui/icons.qrc index 6996ce50d..32c57e037 100644 --- a/retroshare-gui/src/gui/icons.qrc +++ b/retroshare-gui/src/gui/icons.qrc @@ -53,6 +53,7 @@ icons/gmail.png icons/help_128.png icons/help_64.png + icons/identities.png icons/information_128.png icons/internet_128.png icons/invite64.png diff --git a/retroshare-gui/src/gui/icons/identities.png b/retroshare-gui/src/gui/icons/identities.png new file mode 100644 index 0000000000000000000000000000000000000000..779f73b36ba8c617903ae37e46d6e8f8032b0340 GIT binary patch literal 3837 zcmVn?cBVdpUM2zA#Mu7qkR!{`p zU0B$2UjFEwy_l;`t|UpqxS*5cfM;S5r-3qVrT2v7&i2F^xv_-LD|+m9xOcY*c5 zCJ~Rd+EkY#6rBJhMJ=J%;j@5RAmEZYoxoN!F>F8+M2AbZn4)L|ASvoOz+zw#FwA9h z((x_uBJjM3$F{g_OfD3(03<~nhvxLfXl;5iu@iV6O$?vAZA>}}QUH>o)&O?`^?>BE zIr$=h*MJ8_JocX3#tfvO1RyEuOyDly61Q!!iPwP#L_GG6+lC}52mwfndJ%9hFw<>Y z9O4~dsffq^>9!%R3P4iSF~D+Qfon#%%PYXmA|7jW%K%pdAStRJxCvMSL>)JvusDMD zK0Gesu`Z`8cU%CHqSgUV0n;6=xbWEy+#uqyO-@$om;fY2^#S(*w^RH*d%F<8L%`i4 z9_x0ZLPrFkxAiZejo^7?XA^Lx6MX~O?g}JDod;~gbG{MkfNlDFXDhZv07+3LU>R^L zUd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wt58wvfTw`zrVAO2ksuImBRt|3Bgq_A;J5$)Bt`WDH=!k)nmasTu!unR3BuKD z2!t=sHI2(kToFJ|SRz(0c*1Q{k`$Bxl1PeL1KbJJ zlj|99g)D+l)jopdx2Id8?Ir~&fFzQljsq6!U)k417m^74r5%LI-@#vcPpX|c3Wb6e zKwl(9JqJw)i-7b?j@=Z291w&mJ|Yl)eBf?eg-X!~Ac>xaRtL-mW&yQ8px;GKi9nJd z5IsyF{2{)Q*YE|NwrkAZE{aY71CbOpLa!js2BrX`Z4rU5B!NHFf05Z$FDx=Rq<0TSIl5?$I*xa3P9`w~dLP9(V# z+1HLFw;~7jBKx-^`!^%|){B+(U%L8_*}(q+U5CJ>+zR`|00000NkvXXu0mjf5jPh6 literal 0 HcmV?d00001 diff --git a/retroshare-gui/src/gui/statistics/BWGraph.cpp b/retroshare-gui/src/gui/statistics/BWGraph.cpp index db014e3e4..1663cb3bd 100644 --- a/retroshare-gui/src/gui/statistics/BWGraph.cpp +++ b/retroshare-gui/src/gui/statistics/BWGraph.cpp @@ -602,6 +602,6 @@ BWGraph::BWGraph(QWidget *parent) : RSGraphWidget(parent) BWGraph::~BWGraph() { - delete _local_source ; + //delete _local_source ;//Will be deleted by RSGraphWidget destructor } diff --git a/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.cpp b/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.cpp index 8669e8061..47436a40f 100644 --- a/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.cpp +++ b/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.cpp @@ -34,10 +34,12 @@ #define SETTING_OPACITY "Opacity" #define SETTING_ALWAYS_ON_TOP "AlwaysOnTop" #define SETTING_STYLE "GraphStyle" +#define SETTING_GRAPHCOLOR "GraphColor" #define DEFAULT_FILTER (BWGRAPH_LINE_SEND|BWGRAPH_LINE_RECV) #define DEFAULT_ALWAYS_ON_TOP false #define DEFAULT_OPACITY 100 #define DEFAULT_STYLE LineGraph +#define DEFAULT_GRAPHCOLOR DefaultColor #define ADD_TO_FILTER(f,v,b) (f = ((b) ? ((f) | (v)) : ((f) & ~(v)))) @@ -132,6 +134,19 @@ BandwidthGraph::loadSettings() ui.frmGraph->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_PAINT_STYLE_PLAIN); else ui.frmGraph->setFlags(RSGraphWidget::RSGRAPH_FLAGS_PAINT_STYLE_PLAIN); + + /* Set whether we are plotting bandwidth as area graphs or not */ + int graphColor = getSetting(SETTING_GRAPHCOLOR, DEFAULT_GRAPHCOLOR).toInt(); + + if (graphColor < 0 || graphColor >= ui.cmbGraphColor->count()) { + graphColor = DEFAULT_GRAPHCOLOR; + } + ui.cmbGraphColor->setCurrentIndex(graphColor); + + if(graphColor==0) + ui.frmGraph->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); + else + ui.frmGraph->setFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); /* Set graph frame settings */ ui.frmGraph->setShowEntry(0,ui.chkReceiveRate->isChecked()) ; @@ -158,6 +173,7 @@ void BandwidthGraph::saveChanges() /* Save the opacity and graph style */ saveSetting(SETTING_OPACITY, ui.sldrOpacity->value()); saveSetting(SETTING_STYLE, ui.cmbGraphStyle->currentIndex()); + saveSetting(SETTING_GRAPHCOLOR, ui.cmbGraphColor->currentIndex()); /* Save the Always On Top setting */ saveSetting(SETTING_ALWAYS_ON_TOP, ui.chkAlwaysOnTop->isChecked()); @@ -184,6 +200,11 @@ void BandwidthGraph::saveChanges() else ui.frmGraph->setFlags(RSGraphWidget::RSGRAPH_FLAGS_PAINT_STYLE_PLAIN); + if(ui.cmbGraphColor->currentIndex()==0) + ui.frmGraph->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); + else + ui.frmGraph->setFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); + /* A change in window flags causes the window to disappear, so make sure * it's still visible. */ showNormal(); diff --git a/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.h b/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.h index 953112289..dbf498115 100644 --- a/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.h +++ b/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.h @@ -40,6 +40,7 @@ class BandwidthGraph : public RWindow public: enum { AreaGraph=0,LineGraph=1 } ; + enum { DefaultColor=0,DarkColor=1 } ; /** Default constructor */ BandwidthGraph(QWidget *parent = 0, Qt::WindowFlags flags = 0); diff --git a/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.ui b/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.ui index 51287c7d9..58136f46c 100644 --- a/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.ui +++ b/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.ui @@ -6,7 +6,7 @@ 0 0 - 414 + 418 305 @@ -24,7 +24,16 @@ 6 - + + 0 + + + 0 + + + 0 + + 0 @@ -69,13 +78,13 @@ - 355 + 400 82 - 355 + 400 82 @@ -88,19 +97,34 @@ QFrame::Raised - - - 6 - - + + 9 - + + 9 + + + 9 + + + 9 + + 6 - + + 3 + + + 3 + + + 3 + + 3 @@ -166,12 +190,21 @@ - + 1 - + + 0 + + + 0 + + + 0 + + 0 @@ -179,7 +212,16 @@ 6 - + + 0 + + + 0 + + + 0 + + 0 @@ -224,6 +266,20 @@ + + + + + Default + + + + + Dark + + + + @@ -241,7 +297,16 @@ 3 - + + 0 + + + 0 + + + 0 + + 0 @@ -299,7 +364,16 @@ 0 - + + 0 + + + 0 + + + 0 + + 0 @@ -377,25 +451,21 @@ - - - - Qt::Horizontal - - - - 21 - 20 - - - - - + 1 - + + 0 + + + 0 + + + 0 + + 0 @@ -414,6 +484,19 @@ + + + + Qt::Horizontal + + + + 21 + 20 + + + + diff --git a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp index 56ac1645c..a27335ad9 100644 --- a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp +++ b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.cpp @@ -24,6 +24,7 @@ #include "retroshare/rspeers.h" #include "retroshare/rsservicecontrol.h" #include "retroshare-gui/RsAutoUpdatePage.h" +#include "gui/settings/rsharesettings.h" #include "BandwidthStatsWidget.h" BandwidthStatsWidget::BandwidthStatsWidget(QWidget *parent) @@ -31,6 +32,8 @@ BandwidthStatsWidget::BandwidthStatsWidget(QWidget *parent) { ui.setupUi(this) ; + m_bProcessSettings = false; + // now add one button per service ui.friend_CB->addItem(tr("Sum")) ; @@ -51,6 +54,8 @@ BandwidthStatsWidget::BandwidthStatsWidget(QWidget *parent) updateUnitSelection(0); toggleLogScale(ui.logScale_CB->checkState() == Qt::Checked);//Update bwgraph_BW with default logScale_CB state defined in ui file. + + // Setup connections QObject::connect(ui.friend_CB ,SIGNAL(currentIndexChanged(int )),this, SLOT( updateFriendSelection(int ))) ; @@ -59,6 +64,7 @@ BandwidthStatsWidget::BandwidthStatsWidget(QWidget *parent) QObject::connect(ui.service_CB ,SIGNAL(currentIndexChanged(int )),this, SLOT(updateServiceSelection(int ))) ; QObject::connect(ui.legend_CB ,SIGNAL(currentIndexChanged(int )),this, SLOT( updateLegendType(int ))) ; QObject::connect(ui.logScale_CB,SIGNAL( toggled(bool)),this, SLOT( toggleLogScale(bool))) ; + QObject::connect(ui.cmbGraphColor,SIGNAL(currentIndexChanged(int )),this, SLOT( updateGraphSelection(int))) ; // setup one timer for auto-update @@ -66,6 +72,45 @@ BandwidthStatsWidget::BandwidthStatsWidget(QWidget *parent) connect(mTimer, SIGNAL(timeout()), this, SLOT(updateComboBoxes())) ; mTimer->setSingleShot(false) ; mTimer->start(2000) ; + + // load settings + processSettings(true); + + int graphColor = ui.cmbGraphColor->currentIndex(); + + if(graphColor==0) + ui.bwgraph_BW->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); + else + ui.bwgraph_BW->setFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); +} + +BandwidthStatsWidget::~BandwidthStatsWidget () +{ + // save settings + processSettings(false); +} + +void BandwidthStatsWidget::processSettings(bool bLoad) +{ + m_bProcessSettings = true; + + Settings->beginGroup(QString("BandwidthStatsWidget")); + + if (bLoad) { + // load settings + + // state of Graph Color combobox + int index = Settings->value("cmbGraphColor", 0).toInt(); + ui.cmbGraphColor->setCurrentIndex(index); + } else { + // save settings + + // state of Graph Color combobox + Settings->setValue("cmbGraphColor", ui.cmbGraphColor->currentIndex()); + } + + Settings->endGroup(); + m_bProcessSettings = false; } void BandwidthStatsWidget::toggleLogScale(bool b) @@ -75,6 +120,7 @@ void BandwidthStatsWidget::toggleLogScale(bool b) else ui.bwgraph_BW->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_LOG_SCALE_Y) ; } + void BandwidthStatsWidget::updateComboBoxes() { if(!isVisible()) @@ -234,3 +280,11 @@ void BandwidthStatsWidget::updateUnitSelection(int n) ui.legend_CB->setItemText(1,tr("Total")); } } + +void BandwidthStatsWidget::updateGraphSelection(int n) +{ + if(n==0) + ui.bwgraph_BW->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); + else + ui.bwgraph_BW->setFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); +} diff --git a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.h b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.h index 9c809bc23..c0ae4b4b2 100644 --- a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.h +++ b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.h @@ -26,7 +26,10 @@ class BandwidthStatsWidget: public QWidget Q_OBJECT public: + /** Default Constructor */ BandwidthStatsWidget(QWidget *parent) ; + /** Default Destructor */ + ~BandwidthStatsWidget (); protected slots: void updateFriendSelection(int n); @@ -36,8 +39,12 @@ protected slots: void updateUnitSelection(int n); void toggleLogScale(bool b); void updateLegendType(int n); + void updateGraphSelection(int n); private: + void processSettings(bool bLoad); + bool m_bProcessSettings; + Ui::BwStatsWidget ui; QTimer *mTimer ; diff --git a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.ui b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.ui index fdfefb99b..dc36efbad 100644 --- a/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.ui +++ b/retroshare-gui/src/gui/statistics/BandwidthStatsWidget.ui @@ -6,7 +6,7 @@ 0 0 - 1148 + 800 385 @@ -140,6 +140,20 @@ + + + + + Default + + + + + Dark + + + + diff --git a/retroshare-gui/src/gui/statistics/DhtWindow.ui b/retroshare-gui/src/gui/statistics/DhtWindow.ui index 9513eeb87..38fb48dde 100644 --- a/retroshare-gui/src/gui/statistics/DhtWindow.ui +++ b/retroshare-gui/src/gui/statistics/DhtWindow.ui @@ -7,7 +7,7 @@ 0 0 760 - 603 + 500 diff --git a/retroshare-gui/src/gui/statistics/GlobalRouterStatistics.cpp b/retroshare-gui/src/gui/statistics/GlobalRouterStatistics.cpp index bd97bc391..e70044d9a 100644 --- a/retroshare-gui/src/gui/statistics/GlobalRouterStatistics.cpp +++ b/retroshare-gui/src/gui/statistics/GlobalRouterStatistics.cpp @@ -84,6 +84,9 @@ GlobalRouterStatistics::GlobalRouterStatistics(QWidget *parent) connect(treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(CustomPopupMenu(QPoint))); + /* Set initial size the splitter */ + splitter->setStretchFactor(1, 1); + splitter->setStretchFactor(0, 0); // load settings processSettings(true); @@ -106,12 +109,12 @@ void GlobalRouterStatistics::processSettings(bool bLoad) // load settings // state of splitter - //splitter->restoreState(Settings->value("Splitter").toByteArray()); + splitter->restoreState(Settings->value("Splitter").toByteArray()); } else { // save settings // state of splitter - //Settings->setValue("Splitter", splitter->saveState()); + Settings->setValue("Splitter", splitter->saveState()); } diff --git a/retroshare-gui/src/gui/statistics/GlobalRouterStatistics.ui b/retroshare-gui/src/gui/statistics/GlobalRouterStatistics.ui index 83de70e5b..08067a1c0 100644 --- a/retroshare-gui/src/gui/statistics/GlobalRouterStatistics.ui +++ b/retroshare-gui/src/gui/statistics/GlobalRouterStatistics.ui @@ -6,19 +6,96 @@ 0 0 - 1468 - 659 + 800 + 429 Router Statistics - + Qt::Vertical + + + GroupBox + + + + + + Qt::CustomContextMenu + + + true + + + + ID + + + + + Identity Name + + + + + Destinaton + + + + + Data status + + + + + Tunnel status + + + + + Stored data size + + + + + Data hash + + + + + Receive time + + + + + Sending time + + + + + Branching factor + + + + + Receive time (secs ago) + + + + + Sending time (secs ago) + + + + + + QFrame::NoFrame @@ -34,93 +111,14 @@ 0 0 - 1450 - 317 + 782 + 69 - - - - GroupBox - - - - - - Qt::CustomContextMenu - - - true - - - - ID - - - - - Identity Name - - - - - Destinaton - - - - - Data status - - - - - Tunnel status - - - - - Stored data size - - - - - Data hash - - - - - Receive time - - - - - Sending time - - - - - Branching factor - - - - - Receive time (secs ago) - - - - - Sending time (secs ago) - - - - - - - diff --git a/retroshare-gui/src/gui/statistics/GxsTransportStatistics.ui b/retroshare-gui/src/gui/statistics/GxsTransportStatistics.ui index 8ce780e81..781f3c078 100644 --- a/retroshare-gui/src/gui/statistics/GxsTransportStatistics.ui +++ b/retroshare-gui/src/gui/statistics/GxsTransportStatistics.ui @@ -6,8 +6,8 @@ 0 0 - 1468 - 779 + 800 + 500 diff --git a/retroshare-gui/src/gui/statistics/RttStatistics.cpp b/retroshare-gui/src/gui/statistics/RttStatistics.cpp index 57debbb64..f4e97948e 100644 --- a/retroshare-gui/src/gui/statistics/RttStatistics.cpp +++ b/retroshare-gui/src/gui/statistics/RttStatistics.cpp @@ -131,4 +131,11 @@ RttStatisticsGraph::RttStatisticsGraph(QWidget *parent) resetFlags(RSGRAPH_FLAGS_LOG_SCALE_Y) ; resetFlags(RSGRAPH_FLAGS_PAINT_STYLE_PLAIN) ; setFlags(RSGRAPH_FLAGS_SHOW_LEGEND) ; + + int graphColor = Settings->valueFromGroup("BandwidthStatsWidget", "cmbGraphColor", 0).toInt(); + + if(graphColor==0) + resetFlags(RSGraphWidget::RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); + else + setFlags(RSGraphWidget::RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); } diff --git a/retroshare-gui/src/gui/statistics/StatisticsWindow.cpp b/retroshare-gui/src/gui/statistics/StatisticsWindow.cpp index 3d3868135..c5d0deade 100644 --- a/retroshare-gui/src/gui/statistics/StatisticsWindow.cpp +++ b/retroshare-gui/src/gui/statistics/StatisticsWindow.cpp @@ -54,7 +54,7 @@ #define IMAGE_DHT ":/icons/DHT128.png" #define IMAGE_TURTLE ":/icons/turtle128.png" -#define IMAGE_IDENTITIES ":/icons/avatar_128.png" +#define IMAGE_IDENTITIES ":/icons/identities.png" #define IMAGE_BWGRAPH ":/icons/bandwidth128.png" #define IMAGE_GLOBALROUTER ":/icons/GRouter128.png" #define IMAGE_GXSTRANSPORT ":/icons/transport128.png" diff --git a/retroshare-gui/src/gui/statistics/StatisticsWindow.ui b/retroshare-gui/src/gui/statistics/StatisticsWindow.ui index 08ae47cd3..b372bae75 100644 --- a/retroshare-gui/src/gui/statistics/StatisticsWindow.ui +++ b/retroshare-gui/src/gui/statistics/StatisticsWindow.ui @@ -15,7 +15,16 @@ - + + 0 + + + 0 + + + 0 + + 0 @@ -45,7 +54,6 @@ false - @@ -61,7 +69,7 @@ - + :/images/add-share24.png:/images/add-share24.png @@ -79,7 +87,7 @@ - + :/images/messenger.png:/images/messenger.png @@ -105,7 +113,7 @@ - + :/images/exit_24x24.png:/images/exit_24x24.png diff --git a/retroshare-gui/src/gui/statistics/TurtleRouterStatistics.cpp b/retroshare-gui/src/gui/statistics/TurtleRouterStatistics.cpp index fa3b21893..50015406b 100644 --- a/retroshare-gui/src/gui/statistics/TurtleRouterStatistics.cpp +++ b/retroshare-gui/src/gui/statistics/TurtleRouterStatistics.cpp @@ -202,7 +202,14 @@ TurtleRouterStatistics::TurtleRouterStatistics(QWidget *parent) float fact = fontHeight/14.0; frmGraph->setMinimumHeight(200*fact); - + + int graphColor = Settings->valueFromGroup("BandwidthStatsWidget", "cmbGraphColor", 0).toInt(); + + if(graphColor==0) + frmGraph->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); + else + frmGraph->setFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); + // load settings processSettings(true); } @@ -224,12 +231,12 @@ void TurtleRouterStatistics::processSettings(bool bLoad) // load settings // state of splitter - //splitter->restoreState(Settings->value("Splitter").toByteArray()); + splitter->restoreState(Settings->value("Splitter").toByteArray()); } else { // save settings // state of splitter - //Settings->setValue("Splitter", splitter->saveState()); + Settings->setValue("Splitter", splitter->saveState()); } diff --git a/retroshare-gui/src/gui/statistics/TurtleRouterStatistics.ui b/retroshare-gui/src/gui/statistics/TurtleRouterStatistics.ui index e7b443fd1..6cea8ac02 100644 --- a/retroshare-gui/src/gui/statistics/TurtleRouterStatistics.ui +++ b/retroshare-gui/src/gui/statistics/TurtleRouterStatistics.ui @@ -7,7 +7,7 @@ 0 0 680 - 523 + 500 @@ -29,15 +29,15 @@ Qt::Vertical + + 5 + - - - - - QFrame::NoFrame - - - Qt::ScrollBarAlwaysOff + + + 0 + 200 + true @@ -47,28 +47,23 @@ 0 0 - 640 - 248 + 636 + 198 - - true - - - - - - - - 120 - 200 - - - - Qt::NoContextMenu - + + + + 120 + 200 + + + + Qt::NoContextMenu + + diff --git a/retroshare-gui/src/gui/statistics/dhtgraph.h b/retroshare-gui/src/gui/statistics/dhtgraph.h index b908d8e59..b8baff3b0 100644 --- a/retroshare-gui/src/gui/statistics/dhtgraph.h +++ b/retroshare-gui/src/gui/statistics/dhtgraph.h @@ -26,6 +26,7 @@ #include #include +#include "gui/settings/rsharesettings.h" #include #include @@ -74,5 +75,12 @@ class DhtGraph : public RSGraphWidget resetFlags(RSGRAPH_FLAGS_LOG_SCALE_Y) ; setFlags(RSGRAPH_FLAGS_PAINT_STYLE_PLAIN) ; + + int graphColor = Settings->valueFromGroup("BandwidthStatsWidget", "cmbGraphColor", 0).toInt(); + + if(graphColor==0) + resetFlags(RSGraphWidget::RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); + else + setFlags(RSGraphWidget::RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); } }; diff --git a/retroshare-gui/src/gui/statistics/turtlegraph.h b/retroshare-gui/src/gui/statistics/turtlegraph.h index ed9b0338c..6b6da78e9 100644 --- a/retroshare-gui/src/gui/statistics/turtlegraph.h +++ b/retroshare-gui/src/gui/statistics/turtlegraph.h @@ -20,6 +20,8 @@ #pragma once +#include "gui/settings/rsharesettings.h" + #include "retroshare/rsturtle.h" #include @@ -68,7 +70,14 @@ class TurtleGraph: public RSGraphWidget resetFlags(RSGRAPH_FLAGS_LOG_SCALE_Y) ; resetFlags(RSGRAPH_FLAGS_PAINT_STYLE_PLAIN) ; - setFlags(RSGRAPH_FLAGS_SHOW_LEGEND) ; + setFlags(RSGRAPH_FLAGS_SHOW_LEGEND) ; + + int graphColor = Settings->valueFromGroup("BandwidthStatsWidget", "cmbGraphColor", 0).toInt(); + + if(graphColor==0) + resetFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); + else + setFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); } };