From 2702edab30eb65fccdc78aa9cb62e98a350a7ebf Mon Sep 17 00:00:00 2001 From: defnax Date: Thu, 13 Oct 2022 23:10:24 +0200 Subject: [PATCH] fix storing graph style --- .../gui/statistics/BandwidthGraphWindow.cpp | 18 +++++++++--------- .../src/gui/statistics/BandwidthGraphWindow.ui | 12 ++++++++++-- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.cpp b/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.cpp index 87a87a5f8..f621d355b 100644 --- a/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.cpp +++ b/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.cpp @@ -42,7 +42,7 @@ #define DEFAULT_ALWAYS_ON_TOP false #define DEFAULT_OPACITY 100 #define DEFAULT_STYLE LineGraph -#define DEFAULT_GRAPHCOLOR DefaultColor +#define DEFAULT_GRAPHCOLOR false #define DEFAULT_DIRECTION DefaultDirection #define ADD_TO_FILTER(f,v,b) (f = ((b) ? ((f) | (v)) : ((f) & ~(v)))) @@ -135,16 +135,16 @@ void BandwidthGraph::toggleReceiveRate(bool b) void BandwidthGraph::switchGraphColor() { - if(ui.frmGraph->getFlags() & RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE) - { - ui.frmGraph->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); - ui.btnGraphColor->setIcon(FilesDefs::getIconFromQtResourcePath(IMG_GRAPH_LIGHT)); - } - else + if(ui.btnGraphColor->isChecked()) { ui.frmGraph->setFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); ui.btnGraphColor->setIcon(FilesDefs::getIconFromQtResourcePath(IMG_GRAPH_DARK)); } + else + { + ui.frmGraph->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); + ui.btnGraphColor->setIcon(FilesDefs::getIconFromQtResourcePath(IMG_GRAPH_LIGHT)); + } saveSettings(); } @@ -158,9 +158,9 @@ BandwidthGraph::loadSettings() setOpacity(ui.sldrOpacity->value()); /* Set whether we are plotting bandwidth as area graphs or not */ - int graphColor = getSetting(SETTING_GRAPHCOLOR, DEFAULT_GRAPHCOLOR).toInt(); + ui.btnGraphColor->setChecked(getSetting(SETTING_GRAPHCOLOR, DEFAULT_GRAPHCOLOR).toBool()); - if(graphColor>0) + if(ui.btnGraphColor->isChecked()) { ui.frmGraph->setFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); ui.btnGraphColor->setIcon(FilesDefs::getIconFromQtResourcePath(IMG_GRAPH_DARK)); diff --git a/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.ui b/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.ui index 56f1818f8..17d2ee6c5 100644 --- a/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.ui +++ b/retroshare-gui/src/gui/statistics/BandwidthGraphWindow.ui @@ -61,7 +61,7 @@ PushButton - false + true @@ -180,7 +180,15 @@ QFrame::Raised - + + + + 0 + 0 + 218 + 88 + + 1