Merge pull request #2637 from defnax/fixbwgraph

fix storing graph style
This commit is contained in:
csoler 2022-10-14 09:28:58 +02:00 committed by GitHub
commit 9009326970
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 11 deletions

View File

@ -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));

View File

@ -61,7 +61,7 @@
<string>PushButton</string>
</property>
<property name="checkable">
<bool>false</bool>
<bool>true</bool>
</property>
</widget>
</item>
@ -180,7 +180,15 @@
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<widget class="QWidget" name="">
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>218</width>
<height>88</height>
</rect>
</property>
<layout class="QVBoxLayout" name="_3">
<property name="spacing">
<number>1</number>