Engauge Digitizer  2
SettingsForGraph.cpp
1 #include "EngaugeAssert.h"
2 #include <QSettings>
3 #include "Settings.h"
4 #include "SettingsForGraph.h"
5 
7 {
8 }
9 
10 QString SettingsForGraph::groupNameForNthCurve (int indexOneBased) const
11 {
12  ENGAUGE_ASSERT (indexOneBased != 0); // Make sure index is one-based versus zero-based
13 
14  QString groupNameWithPlaceholder = SETTINGS_GROUP_CURVE_GRAPH;
15  QString groupName = groupNameWithPlaceholder.replace (SETTINGS_GROUP_CURVE_GRAPH_PLACEHOLDER,
16  QString::number (indexOneBased));
17 
18  return groupName;
19 }
20 
21 QString SettingsForGraph::defaultCurveName (int indexOneBased,
22  const QString &defaultName) const
23 {
24  QString groupName = groupNameForNthCurve (indexOneBased);
25 
26  QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
27  settings.beginGroup (groupName);
28 
29  return settings.value (SETTINGS_CURVE_NAME,
30  defaultName).toString();
31 }
QString defaultCurveName(int indexOneBased, const QString &defaultName) const
Default graph name for the specified curve index.
QString groupNameForNthCurve(int indexOneBased) const
Return the group name, that appears in the settings file/registry, for the specified curve index...
SettingsForGraph()
Single constructor.