fix storing graph style

This commit is contained in:
defnax 2022-10-13 23:10:24 +02:00
parent 0eda08f881
commit 2702edab30
2 changed files with 19 additions and 11 deletions

View File

@ -42,7 +42,7 @@
#define DEFAULT_ALWAYS_ON_TOP false #define DEFAULT_ALWAYS_ON_TOP false
#define DEFAULT_OPACITY 100 #define DEFAULT_OPACITY 100
#define DEFAULT_STYLE LineGraph #define DEFAULT_STYLE LineGraph
#define DEFAULT_GRAPHCOLOR DefaultColor #define DEFAULT_GRAPHCOLOR false
#define DEFAULT_DIRECTION DefaultDirection #define DEFAULT_DIRECTION DefaultDirection
#define ADD_TO_FILTER(f,v,b) (f = ((b) ? ((f) | (v)) : ((f) & ~(v)))) #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() void BandwidthGraph::switchGraphColor()
{ {
if(ui.frmGraph->getFlags() & RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE) if(ui.btnGraphColor->isChecked())
{
ui.frmGraph->resetFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE);
ui.btnGraphColor->setIcon(FilesDefs::getIconFromQtResourcePath(IMG_GRAPH_LIGHT));
}
else
{ {
ui.frmGraph->setFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE); ui.frmGraph->setFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE);
ui.btnGraphColor->setIcon(FilesDefs::getIconFromQtResourcePath(IMG_GRAPH_DARK)); 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(); saveSettings();
} }
@ -158,9 +158,9 @@ BandwidthGraph::loadSettings()
setOpacity(ui.sldrOpacity->value()); setOpacity(ui.sldrOpacity->value());
/* Set whether we are plotting bandwidth as area graphs or not */ /* 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.frmGraph->setFlags(RSGraphWidget::RSGRAPH_FLAGS_DARK_STYLE);
ui.btnGraphColor->setIcon(FilesDefs::getIconFromQtResourcePath(IMG_GRAPH_DARK)); ui.btnGraphColor->setIcon(FilesDefs::getIconFromQtResourcePath(IMG_GRAPH_DARK));

View File

@ -61,7 +61,7 @@
<string>PushButton</string> <string>PushButton</string>
</property> </property>
<property name="checkable"> <property name="checkable">
<bool>false</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
@ -180,7 +180,15 @@
<property name="frameShadow"> <property name="frameShadow">
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </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"> <layout class="QVBoxLayout" name="_3">
<property name="spacing"> <property name="spacing">
<number>1</number> <number>1</number>