MeasuringReceiver::MeasuringReceiver(Device *devicePtr, double initialCenter, QWidget *parent) : QDialog(parent), device(devicePtr), running(true), reinitialize(true), recalibrate(true) { setWindowTitle("Measuring Receiver"); setObjectName("SH_Page"); setFixedWidth(400); QPoint pos(0, 0); // For positioning widgets Label *title = new Label("Synchronous Level Detector", this); title->move(QPoint(5, pos.y())); title->resize(width(), WIDGET_HEIGHT); pos += QPoint(0, WIDGET_HEIGHT+5); freqEntry = new FrequencyEntry("Center Freq", initialCenter, this); freqEntry->move(pos); freqEntry->resize(width() * 0.75, WIDGET_HEIGHT); pos += QPoint(0, WIDGET_HEIGHT+5); Label *ampRangeLabel = new Label("Amplitude Range", this); ampRangeLabel->move(QPoint(5, pos.y())); ampRangeLabel->resize(width(), WIDGET_HEIGHT); pos += QPoint(0, WIDGET_HEIGHT); ampGroup = new QButtonGroup(this); QRadioButton *highAmp = new QRadioButton("High Power Range", this), *midAmp = new QRadioButton("Mid Power Range", this), *lowAmp = new QRadioButton("Low Power Range", this); highAmp->move(pos); highAmp->resize(width()/2, WIDGET_HEIGHT); highAmp->setObjectName("SHPrefRadioButton"); highAmp->setChecked(true); ampGroup->addButton(highAmp, MeasRcvrRangeHigh); highLabel = new Label("", this); highLabel->move(QPoint(width()/2, pos.y())); highLabel->resize(width()/2, WIDGET_HEIGHT); pos += QPoint(0, WIDGET_HEIGHT); midAmp->move(pos); midAmp->resize(width()/2, WIDGET_HEIGHT); midAmp->setObjectName("SHPrefRadioButton"); ampGroup->addButton(midAmp, MeasRcvrRangeMid); midLabel = new Label("", this); midLabel->move(QPoint(width()/2, pos.y())); midLabel->resize(width()/2, WIDGET_HEIGHT); pos += QPoint(0, WIDGET_HEIGHT); lowAmp->move(pos); lowAmp->resize(width()/2, WIDGET_HEIGHT); lowAmp->setObjectName("SHPrefRadioButton"); ampGroup->addButton(lowAmp, MeasRcvrRangeLow); lowLabel = new Label("", this); lowLabel->move(QPoint(width()/2, pos.y())); lowLabel->resize(width()/2, WIDGET_HEIGHT); pos += QPoint(0, WIDGET_HEIGHT+5); Label *centerLabel = new Label("RF Frequency", this); centerLabel->move(QPoint(5, pos.y())); centerLabel->resize(width()/2, WIDGET_HEIGHT); centerReadout = new Label("915.11002 MHz", this); centerReadout->move(QPoint(width()/2 + 5, pos.y())); centerReadout->resize(width()/2, WIDGET_HEIGHT); pos += QPoint(0, WIDGET_HEIGHT); Label *powerLabel = new Label("RF Power", this); powerLabel->move(QPoint(5, pos.y())); powerLabel->resize(width()/2, WIDGET_HEIGHT); powerReadout = new Label("-32.22 dBm", this); powerReadout->move(QPoint(width()/2 + 5, pos.y())); powerReadout->resize(width()/2, WIDGET_HEIGHT); pos += QPoint(0, WIDGET_HEIGHT); Label *relativeLabel = new Label("Relative Power", this); relativeLabel->move(QPoint(5, pos.y())); relativeLabel->resize(width()/2, WIDGET_HEIGHT); relativeReadout = new Label("-5.002 dB", this); relativeReadout->move(QPoint(width()/2 + 5, pos.y())); relativeReadout->resize(width()/2, WIDGET_HEIGHT); pos += QPoint(0, WIDGET_HEIGHT); Label *averageLabel = new Label("Average Relative Power", this); averageLabel->move(QPoint(5, pos.y())); averageLabel->resize(width()/2, WIDGET_HEIGHT); averageReadout = new Label("-4.998 dB", this); averageReadout->move(QPoint(width()/2 + 5, pos.y())); averageReadout->resize(width()/2, WIDGET_HEIGHT); pos += QPoint(0, WIDGET_HEIGHT*1.5); SHPushButton *sync = new SHPushButton("Sync", this); sync->move(QPoint(5, pos.y())); sync->resize(width()/2 - 10, WIDGET_HEIGHT); //pos += QPoint(0, WIDGET_HEIGHT); SHPushButton *done = new SHPushButton("Done", this); done->move(QPoint(width()/2 + 5, pos.y())); done->resize(width()/2 - 10, WIDGET_HEIGHT); pos += QPoint(0, WIDGET_HEIGHT*2); setFixedHeight(pos.y()); setSizeGripEnabled(false); connect(sync, SIGNAL(clicked()), this, SLOT(triggerReinitialize())); connect(done, SIGNAL(clicked()), this, SLOT(accept())); connect(freqEntry, SIGNAL(freqViewChanged(Frequency)), this, SLOT(triggerReinitialize())); connect(this, SIGNAL(updateLabels(QString,QString,QString,QString)), this, SLOT(setLabels(QString,QString,QString,QString))); connect(this, SIGNAL(updateRangeLevelText(QString, int)), this, SLOT(setRangeLevelText(QString, int))); connect(this, SIGNAL(updateRangeLevelText(int,QString,int)), this, SLOT(setRangeLevelText(int,QString,int))); connect(this, SIGNAL(updateRangeEnabled(int)), this, SLOT(setRangeEnabled(int))); connect(this, SIGNAL(updateEntryEnabled(bool)), this, SLOT(setEntryEnabled(bool))); connect(ampGroup, SIGNAL(buttonClicked(int)), this, SLOT(triggerRecalibration())); threadHandle = std::thread(&MeasuringReceiver::ProcessThread, this); }
RaspiLcdWidget::RaspiLcdWidget( QWidget *parent ) : QWidget(parent) , m_image(128,64,QImage::Format_Mono) , m_keyPressed(eKeyNone) { QRgb value; value = m_background.rgb(); m_image.setColor(0, value); value = QColor(Qt::black).rgb(); m_image.setColor(1, value); QRadioButton *butA = new QRadioButton(this); butA->move(24+marginx,160+marginy); butA->setCheckable(false); registerKey(butA,eKeyA); QRadioButton *butB = new QRadioButton(this); butB->move(120+marginx,160+marginy); butB->setCheckable(false); registerKey(butB,eKeyB); QRadioButton *butC = new QRadioButton(this); butC->move(216+marginx,160+marginy); butC->setCheckable(false); registerKey(butC,eKeyC); QRadioButton *butD = new QRadioButton(this); butD->move(300+marginx,160+marginy); butD->setCheckable(false); registerKey(butD,eKeyD); QRadioButton *butUp = new QRadioButton(this); butUp->move(300+marginx,10+marginy); butUp->setCheckable(false); registerKey(butUp,eKeyUp); QRadioButton *butDown = new QRadioButton(this); butDown->move(300+marginx,96+marginy); butDown->setCheckable(false); registerKey(butDown,eKeyDown); resize(350+2*marginx,200+2*marginy); startTimer(100); }