1 | #include "MainWindow.h"
|
---|
2 |
|
---|
3 | #include <iostream>
|
---|
4 | #include <sstream>
|
---|
5 |
|
---|
6 | #include <QTimer>
|
---|
7 |
|
---|
8 | #include "src/Dim.h"
|
---|
9 |
|
---|
10 | #include "DockWindow.h"
|
---|
11 | #include "HtmlDelegate.h"
|
---|
12 | #include "CheckBoxDelegate.h"
|
---|
13 |
|
---|
14 | using namespace std;
|
---|
15 |
|
---|
16 | void MainWindow::MakeLEDs(QPushButton **arr, QGridLayout *lay, const char *slot) const
|
---|
17 | {
|
---|
18 | arr[0]->setToolTip("Crate 0, Board 0, Index 0");
|
---|
19 |
|
---|
20 | for (int i=1; i<40; i++)
|
---|
21 | {
|
---|
22 | QPushButton *b = new QPushButton(static_cast<QWidget*>(arr[0]->parent()));
|
---|
23 |
|
---|
24 | b->setEnabled(arr[0]->isEnabled());
|
---|
25 | b->setSizePolicy(arr[0]->sizePolicy());
|
---|
26 | b->setMaximumSize(arr[0]->maximumSize());
|
---|
27 | b->setIcon(arr[0]->icon());
|
---|
28 | b->setIconSize(arr[0]->iconSize());
|
---|
29 | b->setCheckable(arr[0]->isCheckable());
|
---|
30 | b->setFlat(arr[0]->isFlat());
|
---|
31 |
|
---|
32 | ostringstream str;
|
---|
33 | str << "Crate " << i/10 << ", Board " << i%10 << ", Index " << i;
|
---|
34 | b->setToolTip(str.str().c_str());
|
---|
35 |
|
---|
36 | lay->addWidget(b, i/10+1, i%10+1, 1, 1);
|
---|
37 |
|
---|
38 | arr[i] = b;
|
---|
39 | }
|
---|
40 |
|
---|
41 | const QString name = arr[0]->objectName();
|
---|
42 |
|
---|
43 | for (int i=0; i<40; i++)
|
---|
44 | {
|
---|
45 | arr[i]->setObjectName(name+QString::number(i));
|
---|
46 | QObject::connect(arr[i], SIGNAL(clicked()), this, slot);
|
---|
47 | }
|
---|
48 | }
|
---|
49 |
|
---|
50 | MainWindow::MainWindow(QWidget *p) : QMainWindow(p)
|
---|
51 | {
|
---|
52 | // setupUi MUST be called before the DimNetwork is initilized
|
---|
53 | // In this way it can be ensured that nothing from the
|
---|
54 | // DimNetwork arrives before all graphical elements are
|
---|
55 | // initialized. This is a simple but very powerfull trick.
|
---|
56 | setupUi(this);
|
---|
57 |
|
---|
58 | // Now here we can do further setup which should be done
|
---|
59 | // before the gui is finally displayed.
|
---|
60 | fDimCmdServers->setItemDelegate(new CheckBoxDelegate);
|
---|
61 | fDimCmdCommands->setItemDelegate(new CheckBoxDelegate);
|
---|
62 | fDimCmdDescription->setItemDelegate(new HtmlDelegate);
|
---|
63 |
|
---|
64 | fDimSvcServers->setItemDelegate(new CheckBoxDelegate);
|
---|
65 | fDimSvcServices->setItemDelegate(new CheckBoxDelegate);
|
---|
66 | fDimSvcDescription->setItemDelegate(new HtmlDelegate);
|
---|
67 |
|
---|
68 | // Set a default string to be displayed in a the status bar at startup
|
---|
69 | fStatusBar->showMessage(PACKAGE_STRING" | "PACKAGE_URL" | report bugs to <"PACKAGE_BUGREPORT">");
|
---|
70 |
|
---|
71 | // Initialize the 40 FTU Leds as a copy of the prototype LED
|
---|
72 | fFtuLED[0] = fFtuLEDPrototype;
|
---|
73 | MakeLEDs(fFtuLED, fFtuLedLayout, SLOT(slot_fFtuLED_clicked()));
|
---|
74 |
|
---|
75 | // Initialize the 40 FAD Leds as a copy of the prototype LED
|
---|
76 | fFadLED[0] = fFadLEDPrototype;
|
---|
77 | MakeLEDs(fFadLED, fFadLedLayout, SLOT(slot_fFadLED_clicked()));
|
---|
78 |
|
---|
79 | // Initialize a timer to update the displayed UTC time
|
---|
80 | QTimer *timer = new QTimer(this);
|
---|
81 | connect(timer, SIGNAL(timeout()), this, SLOT(slot_TimeUpdate()));
|
---|
82 | timer->start(100);
|
---|
83 | }
|
---|
84 |
|
---|
85 | void MainWindow::slot_TimeUpdate()
|
---|
86 | {
|
---|
87 | // Used toUTC to support also older Qt versions
|
---|
88 | // toTime_t() always returns the datetime converted to UTC
|
---|
89 | // dateTime() unfortunately returns our UTC always as LocalTime
|
---|
90 | QDateTime now = QDateTime::currentDateTime().toUTC();
|
---|
91 | now.setTimeSpec(Qt::LocalTime);
|
---|
92 |
|
---|
93 | if (now.toTime_t()==fUTC->dateTime().toTime_t())
|
---|
94 | return;
|
---|
95 |
|
---|
96 | fUTC->setDateTime(now);
|
---|
97 | }
|
---|
98 |
|
---|
99 |
|
---|
100 | void MainWindow::SelectTab(const QString &name)
|
---|
101 | {
|
---|
102 | for (int i=0; i<fTabWidget->count(); i++)
|
---|
103 | if (fTabWidget->tabText(i)==name)
|
---|
104 | {
|
---|
105 | fTabWidget->setCurrentIndex(i);
|
---|
106 | break;
|
---|
107 | }
|
---|
108 | }
|
---|
109 |
|
---|
110 | void MainWindow::on_fRatesMin_valueChanged(int min)
|
---|
111 | {
|
---|
112 | fRatesCanv->SetMin(min);
|
---|
113 | }
|
---|
114 |
|
---|
115 | void MainWindow::on_fRatesMax_valueChanged(int max)
|
---|
116 | {
|
---|
117 | fRatesCanv->SetMax(max);
|
---|
118 | }
|
---|
119 |
|
---|
120 | void MainWindow::on_fShutdown_clicked()
|
---|
121 | {
|
---|
122 | Dim::SendCommand("DIS_DNS/KILL_SERVERS");
|
---|
123 | }
|
---|
124 |
|
---|
125 |
|
---|
126 | void MainWindow::on_fShutdownAll_clicked()
|
---|
127 | {
|
---|
128 | Dim::SendCommand("DIS_DNS/KILL_SERVERS");
|
---|
129 | Dim::SendCommand("DIS_DNS/EXIT", int(1));
|
---|
130 | }
|
---|
131 |
|
---|
132 | void MainWindow::on_fTabWidget_tabCloseRequested(int which)
|
---|
133 | {
|
---|
134 | // To get the correct size we have to switch to this tab
|
---|
135 | // An alternative would be to take the size of the current tab
|
---|
136 | fTabWidget->setCurrentIndex(which);
|
---|
137 |
|
---|
138 | QWidget *w = fTabWidget->currentWidget(); //fTabWidget->widget(which);
|
---|
139 | if (!w)
|
---|
140 | {
|
---|
141 | cout << "Weird... the tab requested to be closed doesn't exist!" << endl;
|
---|
142 | return;
|
---|
143 | }
|
---|
144 |
|
---|
145 | QDockWidget *d = w->findChild<QDockWidget*>();
|
---|
146 | if (!d)
|
---|
147 | {
|
---|
148 | cout << "Sorry, tab requested to be closed contains no QDockWidget!" << endl;
|
---|
149 | return;
|
---|
150 | }
|
---|
151 |
|
---|
152 | new DockWindow(d, fTabWidget->tabText(which));
|
---|
153 | fTabWidget->removeTab(which);
|
---|
154 |
|
---|
155 | if (fTabWidget->count()==1)
|
---|
156 | fTabWidget->setTabsClosable(false);
|
---|
157 | }
|
---|
158 |
|
---|
159 | void MainWindow::on_fMcpStartRun_clicked()
|
---|
160 | {
|
---|
161 | struct Value
|
---|
162 | {
|
---|
163 | uint64_t time;
|
---|
164 | uint64_t nevts;
|
---|
165 | char type[];
|
---|
166 | };
|
---|
167 |
|
---|
168 | const int idx1 = fMcpRunType->currentIndex();
|
---|
169 | const int idx2 = fMcpTime->currentIndex();
|
---|
170 | const int idx3 = fMcpNumEvents->currentIndex();
|
---|
171 |
|
---|
172 | const int64_t v2 = fMcpTime->itemData(idx2).toInt();
|
---|
173 | const int64_t v3 = fMcpNumEvents->itemData(idx3).toInt();
|
---|
174 |
|
---|
175 | const QString rt = fMcpRunType->itemData(idx1).toString();
|
---|
176 |
|
---|
177 | const size_t len = sizeof(Value)+rt.length()+1;
|
---|
178 |
|
---|
179 | char *buf = new char[len];
|
---|
180 |
|
---|
181 | Value *val = reinterpret_cast<Value*>(buf);
|
---|
182 |
|
---|
183 | val->time = v2;
|
---|
184 | val->nevts = v3;
|
---|
185 |
|
---|
186 | strcpy(val->type, rt.toStdString().c_str());
|
---|
187 |
|
---|
188 | Dim::SendCommand("MCP/START", buf, len);
|
---|
189 |
|
---|
190 | delete [] buf;
|
---|
191 |
|
---|
192 | }
|
---|
193 | void MainWindow::on_fMcpStopRun_clicked()
|
---|
194 | {
|
---|
195 | Dim::SendCommand("MCP/STOP");
|
---|
196 | }
|
---|
197 |
|
---|
198 | void MainWindow::on_fMcpReset_clicked()
|
---|
199 | {
|
---|
200 | Dim::SendCommand("MCP/RESET");
|
---|
201 | }
|
---|
202 |
|
---|
203 | void MainWindow::on_fLoggerStart_clicked()
|
---|
204 | {
|
---|
205 | Dim::SendCommand("DATA_LOGGER/WAIT_FOR_RUN_NUMBER");
|
---|
206 | }
|
---|
207 |
|
---|
208 | void MainWindow::on_fLoggerStop_clicked()
|
---|
209 | {
|
---|
210 | Dim::SendCommand("DATA_LOGGER/BACK_TO_NIGHTLY_OPEN");
|
---|
211 | }
|
---|
212 |
|
---|
213 | void MainWindow::on_fFtmStartRun_clicked()
|
---|
214 | {
|
---|
215 | Dim::SendCommand("FTM_CONTROL/START_RUN");
|
---|
216 | }
|
---|
217 |
|
---|
218 | void MainWindow::on_fFtmStopRun_clicked()
|
---|
219 | {
|
---|
220 | Dim::SendCommand("FTM_CONTROL/STOP_RUN");
|
---|
221 | }
|
---|
222 |
|
---|
223 | void MainWindow::on_fFadStartRun_clicked()
|
---|
224 | {
|
---|
225 | Dim::SendCommand("FAD_CONTROL/START_RUN");
|
---|
226 | }
|
---|
227 |
|
---|
228 | void MainWindow::on_fFadStopRun_clicked()
|
---|
229 | {
|
---|
230 | Dim::SendCommand("FAD_CONTROL/STOP_RUN");
|
---|
231 | }
|
---|
232 |
|
---|
233 | void MainWindow::on_fFadDrsOn_clicked()
|
---|
234 | {
|
---|
235 | Dim::SendCommand("FAD_CONTROL/ENABLE_DRS", uint8_t(true));
|
---|
236 | }
|
---|
237 |
|
---|
238 | void MainWindow::on_fFadDrsOff_clicked()
|
---|
239 | {
|
---|
240 | Dim::SendCommand("FAD_CONTROL/ENABLE_DRS", uint8_t(false));
|
---|
241 | }
|
---|
242 |
|
---|
243 | void MainWindow::on_fFadDwriteOn_clicked()
|
---|
244 | {
|
---|
245 | Dim::SendCommand("FAD_CONTROL/ENABLE_DWRITE", uint8_t(true));
|
---|
246 | }
|
---|
247 |
|
---|
248 | void MainWindow::on_fFadDwriteOff_clicked()
|
---|
249 | {
|
---|
250 | Dim::SendCommand("FAD_CONTROL/ENABLE_DWRITE", uint8_t(false));
|
---|
251 | }
|
---|
252 |
|
---|
253 | void MainWindow::on_fFadSingleTrigger_clicked()
|
---|
254 | {
|
---|
255 | Dim::SendCommand("FAD_CONTROL/SEND_SINGLE_TRIGGER");
|
---|
256 | }
|
---|
257 |
|
---|
258 | void MainWindow::on_fFadTriggerLineOn_clicked()
|
---|
259 | {
|
---|
260 | Dim::SendCommand("FAD_CONTROL/ENABLE_TRIGGER_LINE", uint8_t(true));
|
---|
261 | }
|
---|
262 |
|
---|
263 | void MainWindow::on_fFadTriggerLineOff_clicked()
|
---|
264 | {
|
---|
265 | Dim::SendCommand("FAD_CONTROL/ENABLE_TRIGGER_LINE", uint8_t(false));
|
---|
266 | }
|
---|
267 |
|
---|
268 | void MainWindow::on_fFadContTriggerOn_clicked()
|
---|
269 | {
|
---|
270 | Dim::SendCommand("FAD_CONTROL/ENABLE_CONTINOUS_TRIGGER", uint8_t(true));
|
---|
271 | }
|
---|
272 |
|
---|
273 | void MainWindow::on_fFadContTriggerOff_clicked()
|
---|
274 | {
|
---|
275 | Dim::SendCommand("FAD_CONTROL/ENABLE_CONTINOUS_TRIGGER", uint8_t(false));
|
---|
276 | }
|
---|
277 |
|
---|
278 | void MainWindow::on_fFadBusyOnOn_clicked()
|
---|
279 | {
|
---|
280 | Dim::SendCommand("FAD_CONTROL/ENABLE_BUSY_ON", uint8_t(true));
|
---|
281 | }
|
---|
282 |
|
---|
283 | void MainWindow::on_fFadBusyOnOff_clicked()
|
---|
284 | {
|
---|
285 | Dim::SendCommand("FAD_CONTROL/ENABLE_BUSY_ON", uint8_t(false));
|
---|
286 | }
|
---|
287 |
|
---|
288 | void MainWindow::on_fFadBusyOffOn_clicked()
|
---|
289 | {
|
---|
290 | Dim::SendCommand("FAD_CONTROL/ENABLE_BUSY_OFF", uint8_t(true));
|
---|
291 | }
|
---|
292 |
|
---|
293 | void MainWindow::on_fFadBusyOffOff_clicked()
|
---|
294 | {
|
---|
295 | Dim::SendCommand("FAD_CONTROL/ENABLE_BUSY_OFF", uint8_t(false));
|
---|
296 | }
|
---|
297 |
|
---|
298 | void MainWindow::on_fFadSocket0_clicked()
|
---|
299 | {
|
---|
300 | Dim::SendCommand("FAD_CONTROL/ENABLE_COMMAND_SOCKET_MODE", uint8_t(true));
|
---|
301 | }
|
---|
302 |
|
---|
303 | void MainWindow::on_fFadSocket17_clicked()
|
---|
304 | {
|
---|
305 | Dim::SendCommand("FAD_CONTROL/ENABLE_COMMAND_SOCKET_MODE", uint8_t(false));
|
---|
306 | }
|
---|
307 |
|
---|
308 | void MainWindow::on_fFadResetTriggerId_clicked()
|
---|
309 | {
|
---|
310 | Dim::SendCommand("FAD_CONTROL/RESET_EVENT_COUNTER");
|
---|
311 | }
|
---|
312 |
|
---|
313 | void MainWindow::on_fFadStart_clicked()
|
---|
314 | {
|
---|
315 | Dim::SendCommand("FAD_CONTROL/START");
|
---|
316 | }
|
---|
317 |
|
---|
318 | void MainWindow::on_fFadStop_clicked()
|
---|
319 | {
|
---|
320 | Dim::SendCommand("FAD_CONTROL/STOP");
|
---|
321 | }
|
---|
322 |
|
---|
323 | void MainWindow::on_fFadAbort_clicked()
|
---|
324 | {
|
---|
325 | Dim::SendCommand("FAD_CONTROL/ABORT");
|
---|
326 | }
|
---|
327 |
|
---|
328 | void MainWindow::on_fFadSoftReset_clicked()
|
---|
329 | {
|
---|
330 | Dim::SendCommand("FAD_CONTROL/SOFT_RESET");
|
---|
331 | }
|
---|
332 |
|
---|
333 | void MainWindow::on_fFadHardReset_clicked()
|
---|
334 | {
|
---|
335 | Dim::SendCommand("FAD_CONTROL/HARD_RESET");
|
---|
336 | }
|
---|
337 |
|
---|
338 | void MainWindow::slot_fFadLED_clicked()
|
---|
339 | {
|
---|
340 | for (int32_t i=0; i<40; i++)
|
---|
341 | if (sender()==fFadLED[i])
|
---|
342 | {
|
---|
343 | Dim::SendCommand("FAD_CONTROL/TOGGLE", i);
|
---|
344 | break;
|
---|
345 | }
|
---|
346 | }
|
---|
347 |
|
---|
348 | void MainWindow::on_fFadPrescalerCmd_valueChanged(int val)
|
---|
349 | {
|
---|
350 | Dim::SendCommand("FAD_CONTROL/SET_TRIGGER_RATE", uint32_t(val));
|
---|
351 | }
|
---|
352 |
|
---|
353 | void MainWindow::on_fFadRunNumberCmd_valueChanged(int val)
|
---|
354 | {
|
---|
355 | Dim::SendCommand("FAD_CONTROL/SET_RUN_NUMBER", uint64_t(val));
|
---|
356 | }
|
---|
357 |
|
---|
358 | void MainWindow::on_fFadRoiCmd_valueChanged(int val)
|
---|
359 | {
|
---|
360 | const int32_t vals[2] = { -1, val };
|
---|
361 | Dim::SendCommand("FAD_CONTROL/SET_REGION_OF_INTEREST", vals);
|
---|
362 | }
|
---|
363 |
|
---|
364 | void MainWindow::FadDacCmd_valueChanged(uint16_t val, uint16_t idx)
|
---|
365 | {
|
---|
366 | const uint32_t cmd[2] = { idx, val };
|
---|
367 | Dim::SendCommand("FAD_CONTROL/SET_DAC_VALUE", cmd);
|
---|
368 | }
|
---|
369 |
|
---|
370 | void MainWindow::SetTriggerSequence()
|
---|
371 | {
|
---|
372 | const uint16_t d[3] =
|
---|
373 | {
|
---|
374 | uint16_t(fTriggerSeqPed->value()),
|
---|
375 | uint16_t(fTriggerSeqLPext->value()),
|
---|
376 | uint16_t(fTriggerSeqLPint->value())
|
---|
377 | };
|
---|
378 |
|
---|
379 | if (!fInHandler)
|
---|
380 | Dim::SendCommand("FTM_CONTROL/SET_TRIGGER_SEQUENCE", d);
|
---|
381 | }
|
---|
382 |
|
---|
383 | void on_fEnableTrigger_clicked(bool b)
|
---|
384 | {
|
---|
385 | Dim::SendCommand("FTM_CONTROL/ENABLE_TRIGGER", b);
|
---|
386 | }
|
---|
387 |
|
---|
388 | void on_fEnableExt1_clicked(bool b)
|
---|
389 | {
|
---|
390 | Dim::SendCommand("FTM_CONTROL/ENABLE_EXT1", b);
|
---|
391 | }
|
---|
392 |
|
---|
393 | void on_fEnableExt2_clicked(bool b)
|
---|
394 | {
|
---|
395 | Dim::SendCommand("FTM_CONTROL/ENABLE_EXT2", b);
|
---|
396 | }
|
---|
397 |
|
---|
398 | void on_fEnableVeto_clicked(bool b)
|
---|
399 | {
|
---|
400 | Dim::SendCommand("FTM_CONTROL/ENABLE_VETO", b);
|
---|
401 | }
|
---|
402 |
|
---|
403 | void MainWindow::on_fPhysicsCoincidence_valueChanged(int v)
|
---|
404 | {
|
---|
405 | if (!fInHandler)
|
---|
406 | Dim::SendCommand("FTM_CONTROL/SET_TRIGGER_MULTIPLICITY", v);
|
---|
407 | }
|
---|
408 |
|
---|
409 | void MainWindow::on_fPhysicsWindow_valueChanged(int v)
|
---|
410 | {
|
---|
411 | if (!fInHandler)
|
---|
412 | Dim::SendCommand("FTM_CONTROL/SET_TRIGGER_WINDOW", v/4-2);
|
---|
413 | }
|
---|
414 |
|
---|
415 | void MainWindow::on_fCalibCoincidence_valueChanged(int v)
|
---|
416 | {
|
---|
417 | if (!fInHandler)
|
---|
418 | Dim::SendCommand("FTM_CONTROL/SET_CALIBRATION_MULTIPLICITY", v);
|
---|
419 | }
|
---|
420 |
|
---|
421 | void MainWindow::on_fCalibWindow_valueChanged(int v)
|
---|
422 | {
|
---|
423 | if (!fInHandler)
|
---|
424 | Dim::SendCommand("FTM_CONTROL/SET_CALIBRATION_WINDOW", v/4-2);
|
---|
425 | }
|
---|
426 |
|
---|
427 | void MainWindow::on_fTriggerInterval_valueChanged(int val)
|
---|
428 | {
|
---|
429 | if (!fInHandler)
|
---|
430 | Dim::SendCommand("FTM_CONTROL/SET_TRIGGER_INTERVAL", val);
|
---|
431 | }
|
---|
432 |
|
---|
433 | void MainWindow::on_fTriggerDelay_valueChanged(int val)
|
---|
434 | {
|
---|
435 | if (!fInHandler)
|
---|
436 | Dim::SendCommand("FTM_CONTROL/SET_TRIGGER_DELAY", val/4-2);
|
---|
437 | }
|
---|
438 |
|
---|
439 | void MainWindow::on_fTimeMarkerDelay_valueChanged(int val)
|
---|
440 | {
|
---|
441 | if (!fInHandler)
|
---|
442 | Dim::SendCommand("FTM_CONTROL/SET_TIME_MARKER_DELAY", val/4-2);
|
---|
443 | }
|
---|
444 |
|
---|
445 | void MainWindow::on_fDeadTime_valueChanged(int val)
|
---|
446 | {
|
---|
447 | if (!fInHandler)
|
---|
448 | Dim::SendCommand("FTM_CONTROL/SET_DEAD_TIME", val/4-2);
|
---|
449 | }
|
---|
450 |
|
---|
451 | void MainWindow::on_fPrescalingVal_valueChanged(int val)
|
---|
452 | {
|
---|
453 | if (!fInHandler)
|
---|
454 | Dim::SendCommand("FTM_CONTROL/SET_PRESCALING", val);
|
---|
455 | }
|
---|
456 |
|
---|
457 | void MainWindow::on_fPixelEnableAll_clicked()
|
---|
458 | {
|
---|
459 | Dim::SendCommand("FTM_CONTROL/ENABLE_PIXEL", int16_t(-1));
|
---|
460 | }
|
---|
461 |
|
---|
462 | void MainWindow::on_fPixelDisableAll_clicked()
|
---|
463 | {
|
---|
464 | Dim::SendCommand("FTM_CONTROL/DISABLE_PIXEL", int16_t(-1));
|
---|
465 | }
|
---|
466 |
|
---|
467 | void MainWindow::on_fEnableTrigger_stateChanged(int b)
|
---|
468 | {
|
---|
469 | if (!fInHandler)
|
---|
470 | Dim::SendCommand("FTM_CONTROL/ENABLE_TRIGGER", b==Qt::Checked);
|
---|
471 | }
|
---|
472 |
|
---|
473 | void MainWindow::on_fEnableExt1_stateChanged(int b)
|
---|
474 | {
|
---|
475 | if (!fInHandler)
|
---|
476 | Dim::SendCommand("FTM_CONTROL/ENABLE_EXT1", b==Qt::Checked);
|
---|
477 | }
|
---|
478 |
|
---|
479 | void MainWindow::on_fEnableExt2_stateChanged(int b)
|
---|
480 | {
|
---|
481 | if (!fInHandler)
|
---|
482 | Dim::SendCommand("FTM_CONTROL/ENABLE_EXT2", b==Qt::Checked);
|
---|
483 | }
|
---|
484 |
|
---|
485 | void MainWindow::on_fEnableClockCond_stateChanged(int b)
|
---|
486 | {
|
---|
487 | if (!fInHandler)
|
---|
488 | Dim::SendCommand("FTM_CONTROL/ENABLE_CLOCK_CONDITIONER", b==Qt::Checked);
|
---|
489 | }
|
---|
490 |
|
---|
491 | void MainWindow::on_fEnableVeto_stateChanged(int b)
|
---|
492 | {
|
---|
493 | if (!fInHandler)
|
---|
494 | Dim::SendCommand("FTM_CONTROL/ENABLE_VETO", b==Qt::Checked);
|
---|
495 | }
|
---|
496 |
|
---|
497 | void MainWindow::on_fClockCondFreq_activated(int idx)
|
---|
498 | {
|
---|
499 | if (!fInHandler)
|
---|
500 | Dim::SendCommand("FTM_CONTROL/SET_CLOCK_FREQUENCY", fClockCondFreq->itemData(idx).toInt());
|
---|
501 | }
|
---|
502 |
|
---|
503 | void MainWindow::slot_fFtuLED_clicked()
|
---|
504 | {
|
---|
505 | for (int32_t i=0; i<40; i++)
|
---|
506 | if (sender()==fFtuLED[i])
|
---|
507 | {
|
---|
508 | Dim::SendCommand("FTM_CONTROL/TOGGLE_FTU", i);
|
---|
509 | break;
|
---|
510 | }
|
---|
511 | }
|
---|
512 |
|
---|
513 | void MainWindow::on_fFtuPing_toggled(bool checked)
|
---|
514 | {
|
---|
515 | if (checked)
|
---|
516 | Dim::SendCommand("FTM_CONTROL/PING");
|
---|
517 | }
|
---|
518 |
|
---|
519 | void MainWindow::on_fFtuAllOn_clicked()
|
---|
520 | {
|
---|
521 | static const struct Data { int32_t id; char on; } __attribute__((__packed__)) d = { -1, 1 };
|
---|
522 | Dim::SendCommand("FTM_CONTROL/ENABLE_FTU", &d, sizeof(d));
|
---|
523 | }
|
---|
524 |
|
---|
525 | void MainWindow::on_fFtuAllOff_clicked()
|
---|
526 | {
|
---|
527 | static const struct Data { int32_t id; char on; } __attribute__((__packed__)) d = { -1, 0 };
|
---|
528 | Dim::SendCommand("FTM_CONTROL/ENABLE_FTU", &d, sizeof(d));
|
---|
529 | }
|
---|
530 |
|
---|
531 | void MainWindow::on_fLpIntIntensity_valueChanged(int val)
|
---|
532 | {
|
---|
533 | if (!fInHandler)
|
---|
534 | Dim::SendCommand("FTM_CONTROL/SET_INTENSITY_LPINT", uint16_t(val));
|
---|
535 | }
|
---|
536 |
|
---|
537 | void MainWindow::on_fLpExtIntensity_valueChanged(int val)
|
---|
538 | {
|
---|
539 | if (!fInHandler)
|
---|
540 | Dim::SendCommand("FTM_CONTROL/SET_INTENSITY_LPEXT", uint16_t(val));
|
---|
541 | }
|
---|
542 |
|
---|
543 | void MainWindow::on_fLpIntGroup1_stateChanged(int b)
|
---|
544 | {
|
---|
545 | if (!fInHandler)
|
---|
546 | Dim::SendCommand("FTM_CONTROL/ENABLE_GROUP1_LPINT", uint8_t(b));
|
---|
547 | }
|
---|
548 |
|
---|
549 | void MainWindow::on_fLpExtGroup1_stateChanged(int b)
|
---|
550 | {
|
---|
551 | if (!fInHandler)
|
---|
552 | Dim::SendCommand("FTM_CONTROL/ENABLE_GROUP1_LPEXT", uint8_t(b));
|
---|
553 | }
|
---|
554 |
|
---|
555 | void MainWindow::on_fLpIntGroup2_stateChanged(int b)
|
---|
556 | {
|
---|
557 | if (!fInHandler)
|
---|
558 | Dim::SendCommand("FTM_CONTROL/ENABLE_GROUP2_LPINT", uint8_t(b));
|
---|
559 | }
|
---|
560 |
|
---|
561 | void MainWindow::on_fLpExtGroup2_stateChanged(int b)
|
---|
562 | {
|
---|
563 | if (!fInHandler)
|
---|
564 | Dim::SendCommand("FTM_CONTROL/ENABLE_GROUP2_LPEXT", uint8_t(b));
|
---|
565 | }
|
---|
566 |
|
---|
567 | void MainWindow::on_fChatSend_clicked()
|
---|
568 | {
|
---|
569 | const string msg = fChatMessage->text().toStdString();
|
---|
570 | if (Dim::SendCommand("CHAT/MSG", msg.c_str(), msg.length()+1))
|
---|
571 | fChatMessage->clear();
|
---|
572 | }
|
---|
573 |
|
---|
574 | void MainWindow::on_fStatusLoggerLed_clicked()
|
---|
575 | {
|
---|
576 | SelectTab("Logger");
|
---|
577 | }
|
---|
578 |
|
---|
579 | void MainWindow::on_fStatusChatLed_clicked()
|
---|
580 | {
|
---|
581 | SelectTab("Chat");
|
---|
582 | }
|
---|
583 |
|
---|
584 | void MainWindow::on_fStatusFTMLed_clicked()
|
---|
585 | {
|
---|
586 | SelectTab("Trigger");
|
---|
587 | }
|
---|
588 |
|
---|
589 | void MainWindow::on_fStatusFTULed_clicked()
|
---|
590 | {
|
---|
591 | SelectTab("FTUs");
|
---|
592 | }
|
---|
593 |
|
---|
594 | void MainWindow::on_fStatusFADLed_clicked()
|
---|
595 | {
|
---|
596 | SelectTab("FAD");
|
---|
597 | }
|
---|