Engauge Digitizer 2
Loading...
Searching...
No Matches
SettingsForGraph Class Reference

Manage storage and retrieval of the settings for the curves. More...

#include <SettingsForGraph.h>

Collaboration diagram for SettingsForGraph:
Collaboration graph

Public Member Functions

 SettingsForGraph ()
 Single constructor.
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.
int numberOfCurvesForImport () const
 Return the number of curve names to be generated. Value is maximum of 1 and the number in the configuration file.

Detailed Description

Manage storage and retrieval of the settings for the curves.

Definition at line 13 of file SettingsForGraph.h.

Constructor & Destructor Documentation

◆ SettingsForGraph()

SettingsForGraph::SettingsForGraph ( )

Single constructor.

Definition at line 12 of file SettingsForGraph.cpp.

13{
14}

Member Function Documentation

◆ defaultCurveName()

QString SettingsForGraph::defaultCurveName ( int indexOneBased,
const QString & defaultName ) const

Default graph name for the specified curve index.

Definition at line 16 of file SettingsForGraph.cpp.

18{
19 QString groupName = groupNameForNthCurve (indexOneBased);
20
21 QSettings settings (SETTINGS_ENGAUGE, SETTINGS_DIGITIZER);
22 settings.beginGroup (groupName);
23
24 QString curveName = settings.value (SETTINGS_CURVE_NAME,
25 defaultName).toString();
26
27 settings.endGroup ();
28
29 return curveName;
30}
const QString SETTINGS_ENGAUGE
const QString SETTINGS_DIGITIZER
const QString SETTINGS_CURVE_NAME
QString groupNameForNthCurve(int indexOneBased) const
Return the group name, that appears in the settings file/registry, for the specified curve index.

◆ groupNameForNthCurve()

QString SettingsForGraph::groupNameForNthCurve ( int indexOneBased) const

Return the group name, that appears in the settings file/registry, for the specified curve index.

Definition at line 32 of file SettingsForGraph.cpp.

33{
34 ENGAUGE_ASSERT (indexOneBased != 0); // Make sure index is one-based versus zero-based
35
36 QString groupNameWithPlaceholder = SETTINGS_GROUP_CURVE_GRAPH;
37 QString groupName = groupNameWithPlaceholder.replace (SETTINGS_GROUP_CURVE_GRAPH_PLACEHOLDER,
38 QString::number (indexOneBased));
39
40 return groupName;
41}
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT.
const QString SETTINGS_GROUP_CURVE_GRAPH
const QString SETTINGS_GROUP_CURVE_GRAPH_PLACEHOLDER

◆ numberOfCurvesForImport()

int SettingsForGraph::numberOfCurvesForImport ( ) const

Return the number of curve names to be generated. Value is maximum of 1 and the number in the configuration file.

Definition at line 43 of file SettingsForGraph.cpp.

44{
45 const QString EMPTY_CURVE_NAME;
46
47 // Loop until the configuration file returns an empty string
48 int indexOneBased = 1;
49 while (defaultCurveName (indexOneBased + 1, EMPTY_CURVE_NAME) != EMPTY_CURVE_NAME) {
50 ++indexOneBased;
51 }
52
53 return indexOneBased;
54}
QString defaultCurveName(int indexOneBased, const QString &defaultName) const
Default graph name for the specified curve index.

The documentation for this class was generated from the following files: