void MainWindow::slotRadarMenu(QPoint pos){ qDebug() << "MainWindow::slotRadarMenu(QPoint pos)"; ////////////////////////////////////////////// /// /// radarTypeMenu /// ////////////////////////////////////////////// QMenu radarTypeMenu(tr("Radar Type"), this); QAction action1("Base", this); QAction action2("Long Range", this); QAction action3("Storm Motion", this); QAction action4("Velocity", this); QAction action5("One-Hour Precipitation", this); QAction action6("Composite", this); QAction action7("Storm Precipitation", this); radarTypeMenu.addAction(&action1); radarTypeMenu.addAction(&action2); radarTypeMenu.addAction(&action3); radarTypeMenu.addAction(&action4); radarTypeMenu.addAction(&action5); radarTypeMenu.addAction(&action6); radarTypeMenu.addAction(&action7); //radarTypeMenu.setStyleSheet("QMenu::item:selected{border:1px solid red;}"); connect(&action1, &QAction::triggered, this, [this]{ slotRadarChanged(RadarType::N0R); }); connect(&action2, &QAction::triggered, this, [this]{ slotRadarChanged(RadarType::N0Z); }); connect(&action3, &QAction::triggered, this, [this]{ slotRadarChanged(RadarType::N0S); }); connect(&action4, &QAction::triggered, this, [this]{ slotRadarChanged(RadarType::N0V); }); connect(&action5, &QAction::triggered, this, [this]{ slotRadarChanged(RadarType::N1P); }); connect(&action6, &QAction::triggered, this, [this]{ slotRadarChanged(RadarType::NCR); }); connect(&action7, &QAction::triggered, this, [this]{ slotRadarChanged(RadarType::NTP); }); QMenu radarImageContextMenu(tr("Context Menu"), this); radarImageContextMenu.addMenu(&radarTypeMenu); ////////////////////////////////////////////// /// /// radarStationMenu /// ////////////////////////////////////////////// QMenu radarStationMenu(tr("Radar Station"), this); RadarTreeWidget radarTreeWidget(this); connect(&radarTreeWidget, SIGNAL(signalDoubleClick(QString)), this, SLOT(slotWeatherStationSelected(QString))); QWidgetAction *radarTreeAction = new QWidgetAction(this); radarTreeAction->setDefaultWidget(&radarTreeWidget); radarStationMenu.addAction(radarTreeAction); radarImageContextMenu.addMenu(&radarStationMenu); ////////////////////////////////////////////// /// /// radarOverlayMenu /// ////////////////////////////////////////////// bool rangeRing = m_radar_station->getCurrentRadarProductType() != RadarType::N0Z; QMenu radarOverlayMenu(tr("Overlays"), this); QCheckBox *checkTopography = new QCheckBox("Topography", this); QCheckBox *checkCities = new QCheckBox("Cities", this); QCheckBox *checkCounties = new QCheckBox("Counties", this); QCheckBox *checkHighways = new QCheckBox("Highways", this); QCheckBox *checkRivers = new QCheckBox("Rivers", this); QCheckBox *checkRangeRing = new QCheckBox("Range Ring", this); QCheckBox *checkWarnings = new QCheckBox("Warnings", this); QCheckBox *checkLegend = new QCheckBox("Legend", this); checkTopography->setStyleSheet("padding: 6px;"); checkCities->setStyleSheet("padding: 6px;"); checkCounties->setStyleSheet("padding: 6px;"); checkHighways->setStyleSheet("padding: 6px;"); checkRivers->setStyleSheet("padding: 6px;"); if (rangeRing) checkRangeRing->setStyleSheet("padding: 6px;"); checkWarnings->setStyleSheet("padding: 6px;"); checkLegend->setStyleSheet("padding: 6px;"); checkTopography->setChecked(this->m_radar_settings.topoEnabled); checkCities->setChecked(this->m_radar_settings.cityEnabled); checkCounties->setChecked(this->m_radar_settings.countiesEnabled); checkHighways->setChecked(this->m_radar_settings.highwaysEnabled); checkRivers->setChecked(this->m_radar_settings.riversEnabled); if (rangeRing) checkRangeRing->setChecked(this->m_radar_settings.rangeEnabled); checkWarnings->setChecked(this->m_radar_settings.warningsEnabled); checkLegend->setChecked(this->m_radar_settings.legendEnabled); QWidgetAction *radarTopographyAction = new QWidgetAction(this); QWidgetAction *radarCitiesAction = new QWidgetAction(this); QWidgetAction *radarCountiesAction = new QWidgetAction(this); QWidgetAction *radarHighwaysAction = new QWidgetAction(this); QWidgetAction *radarRiversAction = new QWidgetAction(this); QWidgetAction *radarRangeRingAction = new QWidgetAction(this); QWidgetAction *radarWarningsAction = new QWidgetAction(this); QWidgetAction *radarLegendAction = new QWidgetAction(this); radarTopographyAction->setDefaultWidget(checkTopography); radarCitiesAction->setDefaultWidget(checkCities); radarCountiesAction->setDefaultWidget(checkCounties); radarHighwaysAction->setDefaultWidget(checkHighways); radarRiversAction->setDefaultWidget(checkRivers); if (rangeRing) radarRangeRingAction->setDefaultWidget(checkRangeRing); radarWarningsAction->setDefaultWidget(checkWarnings); radarLegendAction->setDefaultWidget(checkLegend); radarOverlayMenu.addAction(radarTopographyAction); radarOverlayMenu.addAction(radarCitiesAction); radarOverlayMenu.addAction(radarCountiesAction); radarOverlayMenu.addAction(radarHighwaysAction); radarOverlayMenu.addAction(radarRiversAction); if (rangeRing) radarOverlayMenu.addAction(radarRangeRingAction); radarOverlayMenu.addAction(radarWarningsAction); radarOverlayMenu.addAction(radarLegendAction); connect(checkTopography, &QCheckBox::clicked, this, [this]{ slotOverlayChanged(1); } ); connect(checkCities, &QCheckBox::clicked, this, [this]{ slotOverlayChanged(2); } ); connect(checkCounties, &QCheckBox::clicked, this, [this]{ slotOverlayChanged(3); } ); connect(checkHighways, &QCheckBox::clicked, this, [this]{ slotOverlayChanged(4); } ); connect(checkRivers, &QCheckBox::clicked, this, [this]{ slotOverlayChanged(5); } ); if (rangeRing) connect(checkRangeRing, &QCheckBox::clicked, this, [this]{ slotOverlayChanged(6); } ); connect(checkWarnings, &QCheckBox::clicked, this, [this]{ slotOverlayChanged(7); } ); connect(checkLegend, &QCheckBox::clicked, this, [this]{ slotOverlayChanged(8); } ); radarImageContextMenu.addMenu(&radarOverlayMenu); //////////////////////////////////////////////// radarImageContextMenu.exec(ui->radarDisplay->mapToGlobal(pos)); return; }
UI::UI() { widget.setupUi(this); widget.gridLayout->setContentsMargins(2,2,2,2); widget.gridLayout->setVerticalSpacing(0); // connect up all the menus connect(widget.actionAbout,SIGNAL(triggered()),this,SLOT(actionAbout())); connect(widget.actionConnectToServer,SIGNAL(triggered()),this,SLOT(actionConnect())); connect(widget.actionDisconnectFromServer,SIGNAL(triggered()),this,SLOT(actionDisconnect())); connect(widget.actionSubrx,SIGNAL(triggered()),this,SLOT(actionSubRx())); connect(widget.actionBandscope,SIGNAL(triggered()),this,SLOT(actionBandscope())); connect(widget.actionRecord,SIGNAL(triggered()),this,SLOT(actionRecord())); connect(&connection,SIGNAL(isConnected()),this,SLOT(connected())); connect(&connection,SIGNAL(disconnected(QString)),this,SLOT(disconnected(QString))); connect(&connection,SIGNAL(audioBuffer(char*,char*)),this,SLOT(audioBuffer(char*,char*))); connect(&connection,SIGNAL(spectrumBuffer(char*,char*)),this,SLOT(spectrumBuffer(char*,char*))); connect(widget.actionConfig,SIGNAL(triggered()),this,SLOT(actionConfigure())); connect(widget.actionMuteMainRx,SIGNAL(triggered()),this,SLOT(actionMuteMainRx())); connect(widget.actionMuteSubRx,SIGNAL(triggered()),this,SLOT(actionMuteSubRx())); connect(widget.actionGain_10,SIGNAL(triggered()),this,SLOT(actionGain_10())); connect(widget.actionGain_20,SIGNAL(triggered()),this,SLOT(actionGain_20())); connect(widget.actionGain_30,SIGNAL(triggered()),this,SLOT(actionGain_30())); connect(widget.actionGain_40,SIGNAL(triggered()),this,SLOT(actionGain_40())); connect(widget.actionGain_50,SIGNAL(triggered()),this,SLOT(actionGain_50())); connect(widget.actionGain_60,SIGNAL(triggered()),this,SLOT(actionGain_60())); connect(widget.actionGain_70,SIGNAL(triggered()),this,SLOT(actionGain_70())); connect(widget.actionGain_80,SIGNAL(triggered()),this,SLOT(actionGain_80())); connect(widget.actionGain_90,SIGNAL(triggered()),this,SLOT(actionGain_90())); connect(widget.actionGain_100,SIGNAL(triggered()),this,SLOT(actionGain_100())); connect(widget.actionKeypad, SIGNAL(triggered()),this,SLOT(actionKeypad())); connect(&keypad,SIGNAL(setKeypadFrequency(long long)),this,SLOT(setKeypadFrequency(long long))); connect(widget.action160, SIGNAL(triggered()),this,SLOT(action160())); connect(widget.action80, SIGNAL(triggered()),this,SLOT(action80())); connect(widget.action60, SIGNAL(triggered()),this,SLOT(action60())); connect(widget.action40, SIGNAL(triggered()),this,SLOT(action40())); connect(widget.action30, SIGNAL(triggered()),this,SLOT(action30())); connect(widget.action20, SIGNAL(triggered()),this,SLOT(action20())); connect(widget.action17, SIGNAL(triggered()),this,SLOT(action17())); connect(widget.action15, SIGNAL(triggered()),this,SLOT(action15())); connect(widget.action12, SIGNAL(triggered()),this,SLOT(action12())); connect(widget.action10, SIGNAL(triggered()),this,SLOT(action10())); connect(widget.action6, SIGNAL(triggered()),this,SLOT(action6())); connect(widget.actionGen, SIGNAL(triggered()),this,SLOT(actionGen())); connect(widget.actionWWV, SIGNAL(triggered()),this,SLOT(actionWWV())); connect(widget.actionCWL,SIGNAL(triggered()),this,SLOT(actionCWL())); connect(widget.actionCWU,SIGNAL(triggered()),this,SLOT(actionCWU())); connect(widget.actionLSB,SIGNAL(triggered()),this,SLOT(actionLSB())); connect(widget.actionUSB,SIGNAL(triggered()),this,SLOT(actionUSB())); connect(widget.actionDSB,SIGNAL(triggered()),this,SLOT(actionDSB())); connect(widget.actionAM,SIGNAL(triggered()),this,SLOT(actionAM())); connect(widget.actionSAM,SIGNAL(triggered()),this,SLOT(actionSAM())); connect(widget.actionFMN,SIGNAL(triggered()),this,SLOT(actionFMN())); connect(widget.actionDIGL,SIGNAL(triggered()),this,SLOT(actionDIGL())); connect(widget.actionDIGU,SIGNAL(triggered()),this,SLOT(actionDIGU())); connect(widget.actionFilter_0,SIGNAL(triggered()),this,SLOT(actionFilter0())); connect(widget.actionFilter_1,SIGNAL(triggered()),this,SLOT(actionFilter1())); connect(widget.actionFilter_2,SIGNAL(triggered()),this,SLOT(actionFilter2())); connect(widget.actionFilter_3,SIGNAL(triggered()),this,SLOT(actionFilter3())); connect(widget.actionFilter_4,SIGNAL(triggered()),this,SLOT(actionFilter4())); connect(widget.actionFilter_5,SIGNAL(triggered()),this,SLOT(actionFilter5())); connect(widget.actionFilter_6,SIGNAL(triggered()),this,SLOT(actionFilter6())); connect(widget.actionFilter_7,SIGNAL(triggered()),this,SLOT(actionFilter7())); connect(widget.actionFilter_8,SIGNAL(triggered()),this,SLOT(actionFilter8())); connect(widget.actionFilter_9,SIGNAL(triggered()),this,SLOT(actionFilter9())); connect(widget.actionANF,SIGNAL(triggered()),this,SLOT(actionANF())); connect(widget.actionNR,SIGNAL(triggered()),this,SLOT(actionNR())); connect(widget.actionNB,SIGNAL(triggered()),this,SLOT(actionNB())); connect(widget.actionSDROM,SIGNAL(triggered()),this,SLOT(actionSDROM())); connect(widget.actionPolyphase,SIGNAL(triggered()),this,SLOT(actionPolyphase())); connect(widget.actionLong,SIGNAL(triggered()),this,SLOT(actionLong())); connect(widget.actionSlow,SIGNAL(triggered()),this,SLOT(actionSlow())); connect(widget.actionMedium,SIGNAL(triggered()),this,SLOT(actionMedium())); connect(widget.actionFast,SIGNAL(triggered()),this,SLOT(actionFast())); connect(widget.actionPreamp,SIGNAL(triggered()),this,SLOT(actionPreamp())); connect(widget.actionBookmarkThisFrequency,SIGNAL(triggered()),this,SLOT(actionBookmark())); connect(widget.actionEditBookmarks,SIGNAL(triggered()),this,SLOT(editBookmarks())); // connect up band and frequency changes connect(&band,SIGNAL(bandChanged(int,int)),this,SLOT(bandChanged(int,int))); // connect(&band,SIGNAL(frequencyChanged(long long)),this,SLOT(frequencyChanged(long long))); // connect up mode changes connect(&mode,SIGNAL(modeChanged(int,int)),this,SLOT(modeChanged(int,int))); // connect up filter changes connect(&filters,SIGNAL(filtersChanged(FiltersBase*,FiltersBase*)),this,SLOT(filtersChanged(FiltersBase*,FiltersBase*))); connect(&filters,SIGNAL(filterChanged(int,int)),this,SLOT(filterChanged(int,int))); // connect up spectrum frame connect(widget.spectrumFrame, SIGNAL(frequencyMoved(int,int)), this, SLOT(frequencyMoved(int,int))); connect(widget.spectrumFrame, SIGNAL(frequencyChanged(long long)), this, SLOT(frequencyChanged(long long))); connect(widget.spectrumFrame, SIGNAL(spectrumHighChanged(int)), this,SLOT(spectrumHighChanged(int))); connect(widget.spectrumFrame, SIGNAL(spectrumLowChanged(int)), this,SLOT(spectrumLowChanged(int))); connect(widget.spectrumFrame, SIGNAL(waterfallHighChanged(int)), this,SLOT(waterfallHighChanged(int))); connect(widget.spectrumFrame, SIGNAL(waterfallLowChanged(int)), this,SLOT(waterfallLowChanged(int))); // connect up waterfall frame connect(widget.waterfallFrame, SIGNAL(frequencyMoved(int,int)), this, SLOT(frequencyMoved(int,int))); // connect up configuration changes connect(&configure,SIGNAL(spectrumHighChanged(int)),this,SLOT(spectrumHighChanged(int))); connect(&configure,SIGNAL(spectrumLowChanged(int)),this,SLOT(spectrumLowChanged(int))); connect(&configure,SIGNAL(fpsChanged(int)),this,SLOT(fpsChanged(int))); connect(&configure,SIGNAL(waterfallHighChanged(int)),this,SLOT(waterfallHighChanged(int))); connect(&configure,SIGNAL(waterfallLowChanged(int)),this,SLOT(waterfallLowChanged(int))); connect(&configure,SIGNAL(waterfallAutomaticChanged(bool)),this,SLOT(waterfallAutomaticChanged(bool))); configure.initAudioDevices(&audio); connect(&configure,SIGNAL(audioDeviceChanged(QAudioDeviceInfo,int,int,QAudioFormat::Endian)),this,SLOT(audioDeviceChanged(QAudioDeviceInfo,int,int,QAudioFormat::Endian))); connect(&configure,SIGNAL(hostChanged(QString)),this,SLOT(hostChanged(QString))); connect(&configure,SIGNAL(receiverChanged(int)),this,SLOT(receiverChanged(int))); connect(&configure,SIGNAL(nrValuesChanged(int,int,double,double)),this,SLOT(nrValuesChanged(int,int,double,double))); connect(&configure,SIGNAL(anfValuesChanged(int,int,double,double)),this,SLOT(anfValuesChanged(int,int,double,double))); connect(&configure,SIGNAL(nbThresholdChanged(double)),this,SLOT(nbThresholdChanged(double))); connect(&configure,SIGNAL(sdromThresholdChanged(double)),this,SLOT(sdromThresholdChanged(double))); connect(&bookmarks,SIGNAL(bookmarkSelected(QAction*)),this,SLOT(selectBookmark(QAction*))); connect(&bookmarkDialog,SIGNAL(accepted()),this,SLOT(addBookmark())); connect(&configure,SIGNAL(addXVTR(QString,long long,long long,long long,long long,int,int)),this,SLOT(addXVTR(QString,long long,long long,long long,long long,int,int))); connect(&configure,SIGNAL(deleteXVTR(int)),this,SLOT(deleteXVTR(int))); connect(&xvtr,SIGNAL(xvtrSelected(QAction*)),this,SLOT(selectXVTR(QAction*))); bandscope=NULL; fps=15; gain=100; subRx=FALSE; subRxGain=100; agc=AGC_SLOW; cwPitch=600; audio_device=0; audio_sample_rate=configure.getSampleRate(); audio_channels=configure.getChannels(); audio_byte_order=configure.getByteOrder(); audio.initialize_audio(AUDIO_BUFFER_SIZE); // load any saved settings loadSettings(); switch(agc) { case AGC_SLOW: widget.actionSlow->setChecked(TRUE); break; case AGC_MEDIUM: widget.actionMedium->setChecked(TRUE); break; case AGC_FAST: widget.actionFast->setChecked(TRUE); break; case AGC_LONG: widget.actionLong->setChecked(TRUE); break; } fps=configure.getFps(); configure.updateXvtrList(&xvtr); xvtr.buildMenu(widget.menuXVTR); widget.spectrumFrame->setHost(configure.getHost()); widget.spectrumFrame->setReceiver(configure.getReceiver()); widget.actionSubrx->setDisabled(TRUE); widget.actionMuteSubRx->setDisabled(TRUE); band.initBand(band.getBand()); }