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 000000000..779f73b36 Binary files /dev/null and b/retroshare-gui/src/gui/icons/identities.png differ 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); } };