14 #include "graphdialogconnector.h"
16 #include <QPushButton>
19 #include <qtabwidget.h>
23 #include "ui_graphdialog.h"
25 XQGraphDialogConnector::XQGraphDialogConnector
31 m_selPlot = XNode::createOrphan<XItemNode<XPlotList, XPlot> >(
"",
true, ref(tr), graph->plots(),
true);
32 m_selAxis = XNode::createOrphan<XItemNode<XAxisList, XAxis> >(
"",
true, ref(tr), graph->axes(),
true);
34 m_pItem->m_dblIntensity->setRange(0.0, 2.0);
35 m_pItem->m_dblIntensity->setSingleStep(0.1);
36 m_pItem->m_dblPersistence->setRange(0.0, 1.0);
37 m_pItem->m_dblPersistence->setSingleStep(0.1);
39 m_conBackGround = xqcon_create<XColorConnector>
40 (graph->backGround(), m_pItem->m_clrBackGroundColor);
41 m_conDrawLegends = xqcon_create<XQToggleButtonConnector>
42 (graph->drawLegends(), m_pItem->m_ckbDrawLegends);
43 m_conPersistence = xqcon_create<XQDoubleSpinBoxConnector>
44 (graph->persistence(), m_pItem->m_dblPersistence, m_pItem->m_slPersistence);
45 m_conPlots = xqcon_create<XQListWidgetConnector>(m_selPlot, m_pItem->lbPlots,
Snapshot( *graph));
46 m_conAxes = xqcon_create<XQListWidgetConnector>(m_selAxis, m_pItem->lbAxes,
Snapshot( *graph));
49 m_lsnAxisChanged = tr[ *m_selAxis].onValueChanged().connectWeakly
50 (shared_from_this(), &XQGraphDialogConnector::onSelAxisChanged, XListener::FLAG_MAIN_THREAD_CALL);
53 m_lsnPlotChanged = tr[ *m_selPlot].onValueChanged().connectWeakly
54 (shared_from_this(), &XQGraphDialogConnector::onSelPlotChanged, XListener::FLAG_MAIN_THREAD_CALL);
57 m_pItem->showNormal();
59 XQGraphDialogConnector::~XQGraphDialogConnector() {
60 if(isItemAlive()) m_pItem->close();
65 m_conAutoScale.reset();
66 m_conLogScale.reset();
67 m_conDisplayTicLabels.reset();
68 m_conDisplayMajorTics.reset();
69 m_conDisplayMinorTics.reset();
72 m_conTicLabelFormat.reset();
73 shared_ptr<XAxis> axis = shot[ *m_selAxis];
77 m_conAutoScale = xqcon_create<XQToggleButtonConnector>(
78 axis->autoScale(), m_pItem->ckbAutoScale);
79 m_conLogScale = xqcon_create<XQToggleButtonConnector>(
80 axis->logScale(), m_pItem->ckbLogScale);
81 m_conDisplayTicLabels = xqcon_create<XQToggleButtonConnector>
82 (axis->displayTicLabels(), m_pItem->ckbDisplayTicLabels);
83 m_conDisplayMajorTics = xqcon_create<XQToggleButtonConnector>
84 (axis->displayMajorTics(), m_pItem->ckbDisplayMajorTics);
85 m_conDisplayMinorTics = xqcon_create<XQToggleButtonConnector>
86 (axis->displayMinorTics(), m_pItem->ckbDisplayMinorTics);
87 m_conAxisMin = xqcon_create<XQLineEditConnector>(axis->minValue(), m_pItem->edAxisMin);
88 m_conAxisMax = xqcon_create<XQLineEditConnector>(axis->maxValue(), m_pItem->edAxisMax);
89 m_conTicLabelFormat = xqcon_create<XQLineEditConnector>
90 (axis->ticLabelFormat(), m_pItem->edTicLabelFormat);
94 m_conDrawPoints.reset();
95 m_conDrawLines.reset();
96 m_conDrawBars.reset();
97 m_conDisplayMajorGrids.reset();
98 m_conDisplayMinorGrids.reset();
99 m_conMajorGridColor.reset();
100 m_conMinorGridColor.reset();
101 m_conPointColor.reset();
102 m_conLineColor.reset();
103 m_conBarColor.reset();
104 m_conMaxCount.reset();
105 m_conClearPoints.reset();
106 m_conIntensity.reset();
107 m_conColorPlot.reset();
108 m_conColorPlotColorLow.reset();
109 m_conColorPlotColorHigh.reset();
111 shared_ptr<XPlot> plot = shot[ *m_selPlot];
115 m_conDrawPoints = xqcon_create<XQToggleButtonConnector>
116 (plot->drawPoints(), m_pItem->ckbDrawPoints);
117 m_conDrawLines = xqcon_create<XQToggleButtonConnector>
118 (plot->drawLines(), m_pItem->ckbDrawLines);
119 m_conDrawBars = xqcon_create<XQToggleButtonConnector>
120 (plot->drawBars(), m_pItem->ckbDrawBars);
121 m_conDisplayMajorGrids = xqcon_create<XQToggleButtonConnector>
122 (plot->displayMajorGrid(), m_pItem->ckbDisplayMajorGrids);
123 m_conDisplayMinorGrids = xqcon_create<XQToggleButtonConnector>
124 (plot->displayMinorGrid(), m_pItem->ckbDisplayMinorGrids);
125 m_conMajorGridColor = xqcon_create<XColorConnector>
126 (plot->majorGridColor(), m_pItem->clrMajorGridColor);
127 m_conMinorGridColor = xqcon_create<XColorConnector>
128 (plot->minorGridColor(), m_pItem->clrMinorGridColor);
129 m_conPointColor = xqcon_create<XColorConnector>
130 (plot->pointColor(), m_pItem->clrPointColor);
131 m_conLineColor = xqcon_create<XColorConnector>
132 (plot->lineColor(), m_pItem->clrLineColor);
133 m_conBarColor = xqcon_create<XColorConnector>
134 (plot->barColor(), m_pItem->clrBarColor);
135 m_conMaxCount = xqcon_create<XQLineEditConnector>
136 (plot->maxCount(), m_pItem->edMaxCount);
137 m_conClearPoints = xqcon_create<XQButtonConnector>
138 (plot->clearPoints(), m_pItem->btnClearPoints);
139 m_conIntensity = xqcon_create<XQDoubleSpinBoxConnector>
140 (plot->intensity(), m_pItem->m_dblIntensity, m_pItem->m_slIntensity);
141 m_conColorPlot = xqcon_create<XQToggleButtonConnector>
142 (plot->colorPlot(), m_pItem->ckbColorPlot);
143 m_conColorPlotColorLow = xqcon_create<XColorConnector>
144 (plot->colorPlotColorLow(), m_pItem->clrColorPlotLow);
145 m_conColorPlotColorHigh = xqcon_create<XColorConnector>
146 (plot->colorPlotColorHigh(), m_pItem->clrColorPlotHigh);