From 659de2830aa940ee5eb46c1d652e1f69d393c0bb Mon Sep 17 00:00:00 2001 From: defnax Date: Tue, 26 Jan 2021 23:22:18 +0100 Subject: [PATCH] Set to show only the Sum for Download or Upload on BW Window --- .../gui/statistics/BandwidthGraphWindow.cpp | 24 ++++ .../src/gui/statistics/BandwidthGraphWindow.h | 1 + .../gui/statistics/BandwidthGraphWindow.ui | 112 ++++++++++-------- 3 files changed, 88 insertions(+), 49 deletions(-) diff --git a/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.cpp b/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.cpp index 47436a40f..d99a140fc 100644 --- a/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.cpp +++ b/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.cpp @@ -35,11 +35,13 @@ #define SETTING_ALWAYS_ON_TOP "AlwaysOnTop" #define SETTING_STYLE "GraphStyle" #define SETTING_GRAPHCOLOR "GraphColor" +#define SETTING_DIRECTION "Direction" #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 DEFAULT_DIRECTION DefaultDirection #define ADD_TO_FILTER(f,v,b) (f = ((b) ? ((f) | (v)) : ((f) & ~(v)))) @@ -148,6 +150,23 @@ BandwidthGraph::loadSettings() else ui.frmGraph->setFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); + /* Download & Upload */ + int defaultdirection = getSetting(SETTING_DIRECTION, DEFAULT_DIRECTION).toInt(); + + if (defaultdirection < 0 || defaultdirection >= ui.cmbDownUp->count()) { + defaultdirection = DEFAULT_DIRECTION; + } + ui.cmbDownUp->setCurrentIndex(graphColor); + + if(defaultdirection==0) + ui.frmGraph->setDirection(BWGraphSource::DIRECTION_UP) ; + else + ui.frmGraph->setDirection(BWGraphSource::DIRECTION_DOWN) ; + + /* Default Settings for the Graph */ + ui.frmGraph->setSelector(BWGraphSource::SELECTOR_TYPE_FRIEND,BWGraphSource::GRAPH_TYPE_SUM) ; + ui.frmGraph->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_LOG_SCALE_Y) ; + /* Set graph frame settings */ ui.frmGraph->setShowEntry(0,ui.chkReceiveRate->isChecked()) ; ui.frmGraph->setShowEntry(1,ui.chkSendRate->isChecked()) ; @@ -204,6 +223,11 @@ void BandwidthGraph::saveChanges() ui.frmGraph->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); else ui.frmGraph->setFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); + + if(ui.cmbDownUp->currentIndex()==0) + ui.frmGraph->setDirection(BWGraphSource::DIRECTION_UP) ; + else + ui.frmGraph->setDirection(BWGraphSource::DIRECTION_DOWN) ; /* A change in window flags causes the window to disappear, so make sure * it's still visible. */ diff --git a/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.h b/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.h index dbf498115..b1b4d9898 100644 --- a/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.h +++ b/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.h @@ -41,6 +41,7 @@ class BandwidthGraph : public RWindow public: enum { AreaGraph=0,LineGraph=1 } ; enum { DefaultColor=0,DarkColor=1 } ; + enum { DefaultDirection=0,Download=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 58136f46c..0bbf4dafe 100644 --- a/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.ui +++ b/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.ui @@ -78,13 +78,13 @@ - 400 + 450 82 - 400 + 450 82 @@ -190,7 +190,53 @@ - + + + + 1 + + + 0 + + + 0 + + + 0 + + + 0 + + + + + Save + + + + + + + Cancel + + + + + + + + + Qt::Horizontal + + + + 21 + 20 + + + + + 1 @@ -280,6 +326,20 @@ + + + + + Upload + + + + + Download + + + + @@ -451,52 +511,6 @@ - - - - 1 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - Save - - - - - - - Cancel - - - - - - - - - Qt::Horizontal - - - - 21 - 20 - - - -