| 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 |
|
|---|
| 111 | void MainWindow::on_fShutdown_clicked()
|
|---|
| 112 | {
|
|---|
| 113 | Dim::SendCommand("DIS_DNS/KILL_SERVERS");
|
|---|
| 114 | }
|
|---|
| 115 |
|
|---|
| 116 |
|
|---|
| 117 | void MainWindow::on_fShutdownAll_clicked()
|
|---|
| 118 | {
|
|---|
| 119 | Dim::SendCommand("DIS_DNS/KILL_SERVERS");
|
|---|
| 120 | Dim::SendCommand("DIS_DNS/EXIT", int(1));
|
|---|
| 121 | }
|
|---|
| 122 |
|
|---|
| 123 | void MainWindow::on_fTabWidget_tabCloseRequested(int which)
|
|---|
| 124 | {
|
|---|
| 125 | // To get the correct size we have to switch to this tab
|
|---|
| 126 | // An alternative would be to take the size of the current tab
|
|---|
| 127 | fTabWidget->setCurrentIndex(which);
|
|---|
| 128 |
|
|---|
| 129 | QWidget *w = fTabWidget->currentWidget(); //fTabWidget->widget(which);
|
|---|
| 130 | if (!w)
|
|---|
| 131 | {
|
|---|
| 132 | cout << "Weird... the tab requested to be closed doesn't exist!" << endl;
|
|---|
| 133 | return;
|
|---|
| 134 | }
|
|---|
| 135 |
|
|---|
| 136 | QDockWidget *d = w->findChild<QDockWidget*>();
|
|---|
| 137 | if (!d)
|
|---|
| 138 | {
|
|---|
| 139 | cout << "Sorry, tab requested to be closed contains no QDockWidget!" << endl;
|
|---|
| 140 | return;
|
|---|
| 141 | }
|
|---|
| 142 |
|
|---|
| 143 | new DockWindow(d, fTabWidget->tabText(which));
|
|---|
| 144 | fTabWidget->removeTab(which);
|
|---|
| 145 |
|
|---|
| 146 | if (fTabWidget->count()==1)
|
|---|
| 147 | fTabWidget->setTabsClosable(false);
|
|---|
| 148 | }
|
|---|
| 149 |
|
|---|
| 150 | void MainWindow::on_fLoggerStart_clicked()
|
|---|
| 151 | {
|
|---|
| 152 | Dim::SendCommand("DATA_LOGGER/WAIT_FOR_RUN_NUMBER");
|
|---|
| 153 | }
|
|---|
| 154 |
|
|---|
| 155 | void MainWindow::on_fLoggerStop_clicked()
|
|---|
| 156 | {
|
|---|
| 157 | Dim::SendCommand("DATA_LOGGER/BACK_TO_NIGHTLY_OPEN");
|
|---|
| 158 | }
|
|---|
| 159 |
|
|---|
| 160 | void MainWindow::on_fFtmStartRun_clicked()
|
|---|
| 161 | {
|
|---|
| 162 | Dim::SendCommand("FTM_CONTROL/START_RUN");
|
|---|
| 163 | }
|
|---|
| 164 |
|
|---|
| 165 | void MainWindow::on_fFtmStopRun_clicked()
|
|---|
| 166 | {
|
|---|
| 167 | Dim::SendCommand("FTM_CONTROL/STOP_RUN");
|
|---|
| 168 | }
|
|---|
| 169 |
|
|---|
| 170 | void MainWindow::on_fFadStartRun_clicked()
|
|---|
| 171 | {
|
|---|
| 172 | Dim::SendCommand("FAD_CONTROL/START_RUN");
|
|---|
| 173 | }
|
|---|
| 174 |
|
|---|
| 175 | void MainWindow::on_fFadStopRun_clicked()
|
|---|
| 176 | {
|
|---|
| 177 | Dim::SendCommand("FAD_CONTROL/STOP_RUN");
|
|---|
| 178 | }
|
|---|
| 179 |
|
|---|
| 180 | void MainWindow::on_fFadDrsOn_clicked()
|
|---|
| 181 | {
|
|---|
| 182 | Dim::SendCommand("FAD_CONTROL/ENABLE_DRS", uint8_t(true));
|
|---|
| 183 | }
|
|---|
| 184 |
|
|---|
| 185 | void MainWindow::on_fFadDrsOff_clicked()
|
|---|
| 186 | {
|
|---|
| 187 | Dim::SendCommand("FAD_CONTROL/ENABLE_DRS", uint8_t(false));
|
|---|
| 188 | }
|
|---|
| 189 |
|
|---|
| 190 | void MainWindow::on_fFadDwriteOn_clicked()
|
|---|
| 191 | {
|
|---|
| 192 | Dim::SendCommand("FAD_CONTROL/ENABLE_DWRITE", uint8_t(true));
|
|---|
| 193 | }
|
|---|
| 194 |
|
|---|
| 195 | void MainWindow::on_fFadDwriteOff_clicked()
|
|---|
| 196 | {
|
|---|
| 197 | Dim::SendCommand("FAD_CONTROL/ENABLE_DWRITE", uint8_t(false));
|
|---|
| 198 | }
|
|---|
| 199 |
|
|---|
| 200 | void MainWindow::on_fFadSingleTrigger_clicked()
|
|---|
| 201 | {
|
|---|
| 202 | Dim::SendCommand("FAD_CONTROL/SEND_SINGLE_TRIGGER");
|
|---|
| 203 | }
|
|---|
| 204 |
|
|---|
| 205 | void MainWindow::on_fFadTriggerLineOn_clicked()
|
|---|
| 206 | {
|
|---|
| 207 | Dim::SendCommand("FAD_CONTROL/ENABLE_TRIGGER_LINE", uint8_t(true));
|
|---|
| 208 | }
|
|---|
| 209 |
|
|---|
| 210 | void MainWindow::on_fFadTriggerLineOff_clicked()
|
|---|
| 211 | {
|
|---|
| 212 | Dim::SendCommand("FAD_CONTROL/ENABLE_TRIGGER_LINE", uint8_t(false));
|
|---|
| 213 | }
|
|---|
| 214 |
|
|---|
| 215 | void MainWindow::on_fFadContTriggerOn_clicked()
|
|---|
| 216 | {
|
|---|
| 217 | Dim::SendCommand("FAD_CONTROL/ENABLE_CONTINOUS_TRIGGER", uint8_t(true));
|
|---|
| 218 | }
|
|---|
| 219 |
|
|---|
| 220 | void MainWindow::on_fFadContTriggerOff_clicked()
|
|---|
| 221 | {
|
|---|
| 222 | Dim::SendCommand("FAD_CONTROL/ENABLE_CONTINOUS_TRIGGER", uint8_t(false));
|
|---|
| 223 | }
|
|---|
| 224 |
|
|---|
| 225 | void MainWindow::on_fFadBusyOn_clicked()
|
|---|
| 226 | {
|
|---|
| 227 | Dim::SendCommand("FAD_CONTROL/ENABLE_BUSY", uint8_t(true));
|
|---|
| 228 | }
|
|---|
| 229 |
|
|---|
| 230 | void MainWindow::on_fFadBusyOff_clicked()
|
|---|
| 231 | {
|
|---|
| 232 | Dim::SendCommand("FAD_CONTROL/ENABLE_BUSY", uint8_t(false));
|
|---|
| 233 | }
|
|---|
| 234 |
|
|---|
| 235 | void MainWindow::on_fFadSocket0_clicked()
|
|---|
| 236 | {
|
|---|
| 237 | Dim::SendCommand("FAD_CONTROL/ENABLE_COMMAND_SOCKET_MODE", uint8_t(true));
|
|---|
| 238 | }
|
|---|
| 239 |
|
|---|
| 240 | void MainWindow::on_fFadSocket17_clicked()
|
|---|
| 241 | {
|
|---|
| 242 | Dim::SendCommand("FAD_CONTROL/ENABLE_COMMAND_SOCKET_MODE", uint8_t(false));
|
|---|
| 243 | }
|
|---|
| 244 |
|
|---|
| 245 | void MainWindow::on_fFadResetTriggerId_clicked()
|
|---|
| 246 | {
|
|---|
| 247 | Dim::SendCommand("FAD_CONTROL/RESET_TRIGGER_ID");
|
|---|
| 248 | }
|
|---|
| 249 |
|
|---|
| 250 | void MainWindow::on_fFadStart_clicked()
|
|---|
| 251 | {
|
|---|
| 252 | Dim::SendCommand("FAD_CONTROL/START");
|
|---|
| 253 | }
|
|---|
| 254 |
|
|---|
| 255 | void MainWindow::on_fFadStop_clicked()
|
|---|
| 256 | {
|
|---|
| 257 | Dim::SendCommand("FAD_CONTROL/STOP");
|
|---|
| 258 | }
|
|---|
| 259 |
|
|---|
| 260 | void MainWindow::on_fFadAbort_clicked()
|
|---|
| 261 | {
|
|---|
| 262 | Dim::SendCommand("FAD_CONTROL/ABORT");
|
|---|
| 263 | }
|
|---|
| 264 |
|
|---|
| 265 | void MainWindow::on_fFadSoftReset_clicked()
|
|---|
| 266 | {
|
|---|
| 267 | Dim::SendCommand("FAD_CONTROL/SOFT_RESET");
|
|---|
| 268 | }
|
|---|
| 269 |
|
|---|
| 270 | void MainWindow::on_fFadHardReset_clicked()
|
|---|
| 271 | {
|
|---|
| 272 | Dim::SendCommand("FAD_CONTROL/HARD_RESET");
|
|---|
| 273 | }
|
|---|
| 274 |
|
|---|
| 275 | void MainWindow::slot_fFadLED_clicked()
|
|---|
| 276 | {
|
|---|
| 277 | for (int32_t i=0; i<40; i++)
|
|---|
| 278 | if (sender()==fFadLED[i])
|
|---|
| 279 | {
|
|---|
| 280 | Dim::SendCommand("FAD_CONTROL/TOGGLE", i);
|
|---|
| 281 | break;
|
|---|
| 282 | }
|
|---|
| 283 | }
|
|---|
| 284 |
|
|---|
| 285 | void MainWindow::on_fFadRunNumberCmd_valueChanged(int val)
|
|---|
| 286 | {
|
|---|
| 287 | Dim::SendCommand("FAD_CONTROL/SET_RUN_NUMBER", uint64_t(val));
|
|---|
| 288 | }
|
|---|
| 289 |
|
|---|
| 290 | void MainWindow::on_fFadRoiCmd_valueChanged(int val)
|
|---|
| 291 | {
|
|---|
| 292 | const int32_t vals[2] = { -1, val };
|
|---|
| 293 | Dim::SendCommand("FAD_CONTROL/SET_REGION_OF_INTEREST", vals);
|
|---|
| 294 | }
|
|---|
| 295 |
|
|---|
| 296 | void MainWindow::SetTriggerSequence()
|
|---|
| 297 | {
|
|---|
| 298 | const uint16_t d[3] =
|
|---|
| 299 | {
|
|---|
| 300 | uint16_t(fTriggerSeqPed->value()),
|
|---|
| 301 | uint16_t(fTriggerSeqLPext->value()),
|
|---|
| 302 | uint16_t(fTriggerSeqLPint->value())
|
|---|
| 303 | };
|
|---|
| 304 |
|
|---|
| 305 | if (!fInHandler)
|
|---|
| 306 | Dim::SendCommand("FTM_CONTROL/SET_TRIGGER_SEQUENCE", d);
|
|---|
| 307 | }
|
|---|
| 308 |
|
|---|
| 309 | void on_fEnableTrigger_clicked(bool b)
|
|---|
| 310 | {
|
|---|
| 311 | Dim::SendCommand("FTM_CONTROL/ENABLE_TRIGGER", b);
|
|---|
| 312 | }
|
|---|
| 313 |
|
|---|
| 314 | void on_fEnableExt1_clicked(bool b)
|
|---|
| 315 | {
|
|---|
| 316 | Dim::SendCommand("FTM_CONTROL/ENABLE_EXT1", b);
|
|---|
| 317 | }
|
|---|
| 318 |
|
|---|
| 319 | void on_fEnableExt2_clicked(bool b)
|
|---|
| 320 | {
|
|---|
| 321 | Dim::SendCommand("FTM_CONTROL/ENABLE_EXT2", b);
|
|---|
| 322 | }
|
|---|
| 323 |
|
|---|
| 324 | void on_fEnableVeto_clicked(bool b)
|
|---|
| 325 | {
|
|---|
| 326 | Dim::SendCommand("FTM_CONTROL/ENABLE_VETO", b);
|
|---|
| 327 | }
|
|---|
| 328 |
|
|---|
| 329 | void MainWindow::on_fPhysicsCoincidence_valueChanged(int v)
|
|---|
| 330 | {
|
|---|
| 331 | if (!fInHandler)
|
|---|
| 332 | Dim::SendCommand("FTM_CONTROL/SET_TRIGGER_MULTIPLICITY", v);
|
|---|
| 333 | }
|
|---|
| 334 |
|
|---|
| 335 | void MainWindow::on_fPhysicsWindow_valueChanged(int v)
|
|---|
| 336 | {
|
|---|
| 337 | if (!fInHandler)
|
|---|
| 338 | Dim::SendCommand("FTM_CONTROL/SET_TRIGGER_WINDOW", v/4-2);
|
|---|
| 339 | }
|
|---|
| 340 |
|
|---|
| 341 | void MainWindow::on_fCalibCoincidence_valueChanged(int v)
|
|---|
| 342 | {
|
|---|
| 343 | if (!fInHandler)
|
|---|
| 344 | Dim::SendCommand("FTM_CONTROL/SET_CALIBRATION_MULTIPLICITY", v);
|
|---|
| 345 | }
|
|---|
| 346 |
|
|---|
| 347 | void MainWindow::on_fCalibWindow_valueChanged(int v)
|
|---|
| 348 | {
|
|---|
| 349 | if (!fInHandler)
|
|---|
| 350 | Dim::SendCommand("FTM_CONTROL/SET_CALIBRATION_WINDOW", v/4-2);
|
|---|
| 351 | }
|
|---|
| 352 |
|
|---|
| 353 | void MainWindow::on_fTriggerInterval_valueChanged(int val)
|
|---|
| 354 | {
|
|---|
| 355 | if (!fInHandler)
|
|---|
| 356 | Dim::SendCommand("FTM_CONTROL/SET_TRIGGER_INTERVAL", val);
|
|---|
| 357 | }
|
|---|
| 358 |
|
|---|
| 359 | void MainWindow::on_fTriggerDelay_valueChanged(int val)
|
|---|
| 360 | {
|
|---|
| 361 | if (!fInHandler)
|
|---|
| 362 | Dim::SendCommand("FTM_CONTROL/SET_TRIGGER_DELAY", val/4-2);
|
|---|
| 363 | }
|
|---|
| 364 |
|
|---|
| 365 | void MainWindow::on_fTimeMarkerDelay_valueChanged(int val)
|
|---|
| 366 | {
|
|---|
| 367 | if (!fInHandler)
|
|---|
| 368 | Dim::SendCommand("FTM_CONTROL/SET_TIME_MARKER_DELAY", val/4-2);
|
|---|
| 369 | }
|
|---|
| 370 |
|
|---|
| 371 | void MainWindow::on_fDeadTime_valueChanged(int val)
|
|---|
| 372 | {
|
|---|
| 373 | if (!fInHandler)
|
|---|
| 374 | Dim::SendCommand("FTM_CONTROL/SET_DEAD_TIME", val/4-2);
|
|---|
| 375 | }
|
|---|
| 376 |
|
|---|
| 377 | void MainWindow::on_fPrescalingVal_valueChanged(int val)
|
|---|
| 378 | {
|
|---|
| 379 | if (!fInHandler)
|
|---|
| 380 | Dim::SendCommand("FTM_CONTROL/SET_PRESCALING", val);
|
|---|
| 381 | }
|
|---|
| 382 |
|
|---|
| 383 | void MainWindow::on_fPixelEnableAll_clicked()
|
|---|
| 384 | {
|
|---|
| 385 | Dim::SendCommand("FTM_CONTROL/ENABLE_PIXEL", int16_t(-1));
|
|---|
| 386 | }
|
|---|
| 387 |
|
|---|
| 388 | void MainWindow::on_fPixelDisableAll_clicked()
|
|---|
| 389 | {
|
|---|
| 390 | Dim::SendCommand("FTM_CONTROL/DISABLE_PIXEL", int16_t(-1));
|
|---|
| 391 | }
|
|---|
| 392 |
|
|---|
| 393 | void MainWindow::on_fEnableTrigger_stateChanged(int b)
|
|---|
| 394 | {
|
|---|
| 395 | if (!fInHandler)
|
|---|
| 396 | Dim::SendCommand("FTM_CONTROL/ENABLE_TRIGGER", b==Qt::Checked);
|
|---|
| 397 | }
|
|---|
| 398 |
|
|---|
| 399 | void MainWindow::on_fEnableExt1_stateChanged(int b)
|
|---|
| 400 | {
|
|---|
| 401 | if (!fInHandler)
|
|---|
| 402 | Dim::SendCommand("FTM_CONTROL/ENABLE_EXT1", b==Qt::Checked);
|
|---|
| 403 | }
|
|---|
| 404 |
|
|---|
| 405 | void MainWindow::on_fEnableExt2_stateChanged(int b)
|
|---|
| 406 | {
|
|---|
| 407 | if (!fInHandler)
|
|---|
| 408 | Dim::SendCommand("FTM_CONTROL/ENABLE_EXT2", b==Qt::Checked);
|
|---|
| 409 | }
|
|---|
| 410 |
|
|---|
| 411 | void MainWindow::on_fEnableClockCond_stateChanged(int b)
|
|---|
| 412 | {
|
|---|
| 413 | if (!fInHandler)
|
|---|
| 414 | Dim::SendCommand("FTM_CONTROL/ENABLE_CLOCK_CONDITIONER", b==Qt::Checked);
|
|---|
| 415 | }
|
|---|
| 416 |
|
|---|
| 417 | void MainWindow::on_fEnableVeto_stateChanged(int b)
|
|---|
| 418 | {
|
|---|
| 419 | if (!fInHandler)
|
|---|
| 420 | Dim::SendCommand("FTM_CONTROL/ENABLE_VETO", b==Qt::Checked);
|
|---|
| 421 | }
|
|---|
| 422 |
|
|---|
| 423 | void MainWindow::on_fClockCondFreq_activated(int idx)
|
|---|
| 424 | {
|
|---|
| 425 | if (!fInHandler)
|
|---|
| 426 | Dim::SendCommand("FTM_CONTROL/SET_CLOCK_FREQUENCY", fClockCondFreq->itemData(idx).toInt());
|
|---|
| 427 | }
|
|---|
| 428 |
|
|---|
| 429 | void MainWindow::slot_fFtuLED_clicked()
|
|---|
| 430 | {
|
|---|
| 431 | for (int32_t i=0; i<40; i++)
|
|---|
| 432 | if (sender()==fFtuLED[i])
|
|---|
| 433 | {
|
|---|
| 434 | Dim::SendCommand("FTM_CONTROL/TOGGLE_FTU", i);
|
|---|
| 435 | break;
|
|---|
| 436 | }
|
|---|
| 437 | }
|
|---|
| 438 |
|
|---|
| 439 | void MainWindow::on_fFtuPing_toggled(bool checked)
|
|---|
| 440 | {
|
|---|
| 441 | if (checked)
|
|---|
| 442 | Dim::SendCommand("FTM_CONTROL/PING");
|
|---|
| 443 | }
|
|---|
| 444 |
|
|---|
| 445 | void MainWindow::on_fFtuAllOn_clicked()
|
|---|
| 446 | {
|
|---|
| 447 | static const struct Data { int32_t id; char on; } __attribute__((__packed__)) d = { -1, 1 };
|
|---|
| 448 | Dim::SendCommand("FTM_CONTROL/ENABLE_FTU", &d, sizeof(d));
|
|---|
| 449 | }
|
|---|
| 450 |
|
|---|
| 451 | void MainWindow::on_fFtuAllOff_clicked()
|
|---|
| 452 | {
|
|---|
| 453 | static const struct Data { int32_t id; char on; } __attribute__((__packed__)) d = { -1, 0 };
|
|---|
| 454 | Dim::SendCommand("FTM_CONTROL/ENABLE_FTU", &d, sizeof(d));
|
|---|
| 455 | }
|
|---|
| 456 |
|
|---|
| 457 | void MainWindow::on_fChatSend_clicked()
|
|---|
| 458 | {
|
|---|
| 459 | const string msg = fChatMessage->text().toStdString();
|
|---|
| 460 | if (Dim::SendCommand("CHAT/MSG", msg.c_str(), msg.length()+1))
|
|---|
| 461 | fChatMessage->clear();
|
|---|
| 462 | }
|
|---|
| 463 |
|
|---|
| 464 | void MainWindow::on_fStatusLoggerLed_clicked()
|
|---|
| 465 | {
|
|---|
| 466 | SelectTab("Logger");
|
|---|
| 467 | }
|
|---|
| 468 |
|
|---|
| 469 | void MainWindow::on_fStatusChatLed_clicked()
|
|---|
| 470 | {
|
|---|
| 471 | SelectTab("Chat");
|
|---|
| 472 | }
|
|---|
| 473 |
|
|---|
| 474 | void MainWindow::on_fStatusFTMLed_clicked()
|
|---|
| 475 | {
|
|---|
| 476 | SelectTab("Trigger");
|
|---|
| 477 | }
|
|---|
| 478 |
|
|---|
| 479 | void MainWindow::on_fStatusFTULed_clicked()
|
|---|
| 480 | {
|
|---|
| 481 | SelectTab("FTUs");
|
|---|
| 482 | }
|
|---|
| 483 |
|
|---|
| 484 | void MainWindow::on_fStatusFADLed_clicked()
|
|---|
| 485 | {
|
|---|
| 486 | SelectTab("FAD");
|
|---|
| 487 | }
|
|---|