mainwindowui.cpp
79 lines
| 3.6 KiB
| text/x-c
|
CppLexer
/ spwtimegenerator / mainwindowui.cpp
r14 | #include "mainwindowui.h" | |||
mainwindowui::mainwindowui(QWidget *parent) : | ||||
QWidget(parent) | ||||
{ | ||||
r50 | arbitraryTime = 0x80000000; | |||
r14 | starDundeeStatusQueryDialog = new QDialog; | |||
connection_LAYOUT = new QGridLayout; | ||||
usbDeviceNumber_LABEL = new QLabel(tr("USB device number: ")); | ||||
linkNumber_LABEL = new QLabel(tr("SpaceWire link number: ")); | ||||
starDundeeStatusQueryDialogLabel = new QLabel(tr("SpaceWire link not running")); | ||||
r50 | currentTimecodeValue_LABEL = new QLabel(tr("Current Timecode Value: -")); | |||
currentTimecodeFlag_LABEL = new QLabel(tr("Current Timecode Flag: -")); | ||||
r14 | ||||
//*** QPUSHBUTTON ***// | ||||
r50 | button_sendSystemTime = new QPushButton(tr("Send System Time")); | |||
button_sendArbitraryTime = new QPushButton(tr("Send Arbitrary Time")); | ||||
r62 | button_sendSystemTimeAndTimecode = new QPushButton(tr("Send System Time + Timecode")); | |||
button_sendArbitraryTimeAndTimecode = new QPushButton(tr("Send Arbitrary Time + Timecode")); | ||||
r14 | starDundeeStatusQueryRetryButton = new QPushButton(tr("Retry")); | |||
starDundeeStatusQueryAbortButton = new QPushButton(tr("Abort")); | ||||
r62 | startTimeButton = new QPushButton(tr("start sending timecodes periodically [PC]")); | |||
startPeriodicalTimecode_StarDundee = new QPushButton(tr("start sending timecodes periodically [Star Dundee]")); | ||||
r14 | sendTimecodeButton = new QPushButton(tr("send one timecode")); | |||
usbDeviceNumber_SPINBOX = new QSpinBox; | ||||
usbDeviceNumber_SPINBOX->setRange(0,32); | ||||
usbDeviceNumber_SPINBOX->setValue(0); | ||||
linkNumber_SPINBOX = new QSpinBox; | ||||
linkNumber_SPINBOX->setRange(1,2); | ||||
linkNumber_SPINBOX->setValue(1); | ||||
console = new QTextEdit; | ||||
r50 | systemTime = new SystemTime; | |||
r14 | ||||
// STAR DUNDEE STATUS QUERY DIALOG | ||||
starDundeeStatusQueryDialogLayout = new QGridLayout; | ||||
starDundeeStatusQueryDialogLayout->addWidget(starDundeeStatusQueryDialogLabel, 0, 0, 1, 2); | ||||
starDundeeStatusQueryDialogLayout->addWidget(starDundeeStatusQueryRetryButton, 1, 0, 0); | ||||
starDundeeStatusQueryDialogLayout->addWidget(starDundeeStatusQueryAbortButton, 1, 1, 0); | ||||
starDundeeStatusQueryDialog->setLayout(starDundeeStatusQueryDialogLayout); | ||||
connection_LAYOUT->addWidget(usbDeviceNumber_LABEL, 0, 0, 1, 1); | ||||
connection_LAYOUT->addWidget(usbDeviceNumber_SPINBOX, 0, 1, 1, 1); | ||||
connection_LAYOUT->addWidget(linkNumber_LABEL, 1, 0, 1, 1); | ||||
connection_LAYOUT->addWidget(linkNumber_SPINBOX, 1, 1, 1, 1); | ||||
connection_LAYOUT->addWidget(sendTimecodeButton, 2, 0, 1, 2); | ||||
r50 | connection_LAYOUT->addWidget(startTimeButton, 3, 0, 1, 2); | |||
r62 | connection_LAYOUT->addWidget(startPeriodicalTimecode_StarDundee, 4, 0, 1, 2); | |||
connection_LAYOUT->addWidget(currentTimecodeValue_LABEL, 5, 0, 1, 2); | ||||
connection_LAYOUT->addWidget(currentTimecodeFlag_LABEL, 6, 0, 1, 2); | ||||
connection_LAYOUT->addWidget(button_sendSystemTime, 7, 0, 1, 1); | ||||
connection_LAYOUT->addWidget(button_sendArbitraryTime, 7, 1, 1, 1); | ||||
connection_LAYOUT->addWidget(button_sendSystemTimeAndTimecode, 8, 0, 1, 1); | ||||
connection_LAYOUT->addWidget(button_sendArbitraryTimeAndTimecode, 8, 1, 1, 1); | ||||
connection_LAYOUT->addWidget(systemTime, 9, 0, 1, 2); | ||||
r50 | connection_LAYOUT->addWidget(console, 0, 2, 7, 2); | |||
r14 | ||||
//connection_LAYOUT->setRowStretch(6, 1); | ||||
connection_LAYOUT->setColumnStretch(2, 1); | ||||
this->setLayout(connection_LAYOUT); | ||||
connect(starDundeeStatusQueryAbortButton, SIGNAL(clicked()), starDundeeStatusQueryDialog, SLOT(reject())); | ||||
r50 | connect(this->systemTime, SIGNAL(timeToSendChanged(long)), this, SLOT(updateTimeToSend(long))); | |||
r14 | } | |||
void mainwindowui::displayMessage(QString message) | ||||
{ | ||||
this->console->append(message); | ||||
} | ||||
r50 | ||||
void::mainwindowui::updateTimeToSend(long timeToSend) | ||||
{ | ||||
arbitraryTime = timeToSend; | ||||
} | ||||