Engauge Digitizer
2
Toggle main menu visibility
Loading...
Searching...
No Matches
Checklist
ChecklistGuidePageCurves.cpp
Go to the documentation of this file.
1
/******************************************************************************************************
2
* (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3
* under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4
* LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5
******************************************************************************************************/
6
7
#include "
ChecklistGuidePageCurves.h
"
8
#include "
ChecklistLineEdit.h
"
9
#include "
Curve.h
"
10
#include "
Logger.h
"
11
#include <QHeaderView>
12
#include <QRadioButton>
13
#include <QTableWidget>
14
#include "
SettingsForGraph.h
"
15
16
ChecklistGuidePageCurves::ChecklistGuidePageCurves
(
const
QString &title) :
17
ChecklistGuidePage
(title)
18
{
19
qCInfo(ENGAUGE_LOG) <<
"ChecklistGuidePageCurves::ChecklistGuidePageCurves"
;
20
21
const
QString WHATS_THIS_CURVE (tr (
"Curve name. Empty if unused."
));
22
const
QString WHATS_THIS_LINES (tr (
"Draw lines between points in each curve."
));
23
const
QString WHATS_THIS_POINTS (tr (
"Draw points in each curve, without lines between the points."
));
24
25
addHtml
(QString (
"<p>%1</p>"
)
26
.arg (tr (
"What are the names of the curves that are to be digitized? At least one entry is required."
)));
27
28
m_edit =
new
ChecklistLineEdit
* [unsigned (NUM_CURVE_NAMES())];
29
30
for
(
int
i = 0; i < NUM_CURVE_NAMES(); i++) {
31
m_edit [i] =
new
ChecklistLineEdit
;
32
connect (m_edit [i], SIGNAL (signalKeyRelease()),
this
, SLOT (
slotTableChanged
()));
33
addLineEdit
(m_edit [i],
34
WHATS_THIS_CURVE);
35
}
36
37
SettingsForGraph
settingsForGraph;
38
QString curveName = settingsForGraph.
defaultCurveName
(1,
39
DEFAULT_GRAPH_CURVE_NAME
);
40
41
m_edit [0]->setText (curveName);
42
43
addHtml
(
"<p> </p>"
);
44
45
addHtml
(QString (
"<p>%1</p>"
)
46
.arg (tr (
"How are those curves drawn?"
)));
47
48
m_btnLines =
addLabelAndRadioButton
(tr (
"With lines (with or without points)"
),
49
WHATS_THIS_LINES);
50
m_btnPoints =
addLabelAndRadioButton
(tr (
"With points only (no lines between points)"
),
51
WHATS_THIS_POINTS);
52
53
m_btnLines->setChecked (
true
);
// Default encourages digitizing using the lines, since that is easier
54
}
55
56
QStringList
ChecklistGuidePageCurves::curveNames
()
const
57
{
58
QStringList
curveNames
;
59
60
for
(
int
i = 0; i < NUM_CURVE_NAMES(); i++) {
61
const
QLineEdit *edit = m_edit [i];
62
QString text = edit->text();
63
if
(!text.isEmpty()) {
64
curveNames
<< text;
65
}
66
}
67
68
return
curveNames
;
69
}
70
71
bool
ChecklistGuidePageCurves::curveNamesAreAllUnique()
const
72
{
73
qCInfo(ENGAUGE_LOG) <<
"ChecklistGuidePageCurves::curveNamesAreAllUnique"
;
74
75
QStringList names =
curveNames
();
76
77
int
numberDuplicatesRemoved = names.removeDuplicates();
78
79
return
(numberDuplicatesRemoved == 0);
80
}
81
82
bool
ChecklistGuidePageCurves::isComplete
()
const
83
{
84
qCInfo(ENGAUGE_LOG) <<
"ChecklistGuidePageCurves::isComplete"
;
85
86
return
!
curveNames
().isEmpty () &&
87
curveNamesAreAllUnique ();
88
}
89
90
void
ChecklistGuidePageCurves::slotTableChanged
()
91
{
92
qCInfo(ENGAUGE_LOG) <<
"ChecklistGuidePageCurves::slotTableChanged"
;
93
94
emit completeChanged();
95
}
96
97
bool
ChecklistGuidePageCurves::withLines
()
const
98
{
99
return
m_btnLines->isChecked();
100
}
ChecklistGuidePageCurves.h
ChecklistLineEdit.h
Curve.h
DEFAULT_GRAPH_CURVE_NAME
const QString DEFAULT_GRAPH_CURVE_NAME
Logger.h
SettingsForGraph.h
ChecklistGuidePageCurves::slotTableChanged
void slotTableChanged()
Update after curve table update.
Definition
ChecklistGuidePageCurves.cpp:90
ChecklistGuidePageCurves::isComplete
virtual bool isComplete() const
Validate the contents of this page.
Definition
ChecklistGuidePageCurves.cpp:82
ChecklistGuidePageCurves::curveNames
QStringList curveNames() const
Wizard selection for curve names.
Definition
ChecklistGuidePageCurves.cpp:56
ChecklistGuidePageCurves::ChecklistGuidePageCurves
ChecklistGuidePageCurves(const QString &title)
Single constructor.
Definition
ChecklistGuidePageCurves.cpp:16
ChecklistGuidePageCurves::withLines
bool withLines() const
Drawn with lines, else points.
Definition
ChecklistGuidePageCurves.cpp:97
ChecklistGuidePage::addLabelAndRadioButton
QRadioButton * addLabelAndRadioButton(const QString &label, const QString &whatsThis)
Insert radio button and corresponding label.
Definition
ChecklistGuidePage.cpp:39
ChecklistGuidePage::addLineEdit
void addLineEdit(ChecklistLineEdit *edit, const QString &whatsThis)
Insert line edit.
Definition
ChecklistGuidePage.cpp:55
ChecklistGuidePage::ChecklistGuidePage
ChecklistGuidePage(const QString &title)
Single constructor.
Definition
ChecklistGuidePage.cpp:16
ChecklistGuidePage::addHtml
void addHtml(const QString &html)
Insert html for display.
Definition
ChecklistGuidePage.cpp:29
ChecklistLineEdit
Adds key event handling to QLineEdit.
Definition
ChecklistLineEdit.h:14
SettingsForGraph
Manage storage and retrieval of the settings for the curves.
Definition
SettingsForGraph.h:14
SettingsForGraph::defaultCurveName
QString defaultCurveName(int indexOneBased, const QString &defaultName) const
Default graph name for the specified curve index.
Definition
SettingsForGraph.cpp:16
Generated on
for Engauge Digitizer by
1.17.0