When reverting to original graph order, reset any pins.

This commit is contained in:
Seeker4 2019-07-31 08:40:20 -07:00
parent 4532b22fc6
commit 3b1414c37d
4 changed files with 13 additions and 6 deletions

View File

@ -3306,9 +3306,16 @@ void gGraphView::resetLayout()
updateScale(); updateScale();
timedRedraw(0); timedRedraw(0);
} }
// Reset order of current graphs to match defaults // Reset order of current graphs to match defaults, remove pinning
void gGraphView::resetGraphOrder() { void gGraphView::resetGraphOrder(bool pinFirst) {
m_graphs = m_default_graphs; m_graphs = m_default_graphs;
for (auto & graph : m_graphs) {
if (!graph) continue;
if (graph->isSnapshot()) continue;
graph->setPinned(false);
}
if (pinFirst)
m_graphs[0]->setPinned(true);
} }
void gGraphView::SaveDefaultSettings() { void gGraphView::SaveDefaultSettings() {

View File

@ -377,7 +377,7 @@ class gGraphView
void SaveDefaultSettings(); void SaveDefaultSettings();
//! \brief Reset the current graph order, heights, min & max Y values to match default values //! \brief Reset the current graph order, heights, min & max Y values to match default values
void resetGraphOrder(); void resetGraphOrder(bool pinFirst);
//! \brief Returns the graph object matching the supplied name, nullptr if it does not exist. //! \brief Returns the graph object matching the supplied name, nullptr if it does not exist.
gGraph *findGraph(QString name); gGraph *findGraph(QString name);

View File

@ -851,7 +851,7 @@ void Daily::ResetGraphLayout()
} }
void Daily::ResetGraphOrder() void Daily::ResetGraphOrder()
{ {
GraphView->resetGraphOrder(); GraphView->resetGraphOrder(true);
ResetGraphLayout(); ResetGraphLayout();
} }

View File

@ -418,7 +418,7 @@ void Overview::ResetGraphLayout()
void Overview::ResetGraphOrder() void Overview::ResetGraphOrder()
{ {
GraphView->resetGraphOrder(); GraphView->resetGraphOrder(false);
ResetGraphLayout(); ResetGraphLayout();
} }