⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 systemevaldlg.cpp

📁 Dream.exe soft source (Visual C++)
💻 CPP
📖 第 1 页 / 共 4 页
字号:
	}

	switch (pDRMRec->GetChanEst()->GetFreqInt())
	{
	case CChannelEstimation::FLINEAR:
		if (!RadioButtonFreqLinear->isChecked())
			RadioButtonFreqLinear->setChecked(TRUE);
		break;

	case CChannelEstimation::FDFTFILTER:
		if (!RadioButtonFreqDFT->isChecked())
			RadioButtonFreqDFT->setChecked(TRUE);
		break;

	case CChannelEstimation::FWIENER:
		if (!RadioButtonFreqWiener->isChecked())
			RadioButtonFreqWiener->setChecked(TRUE);
		break;
	}

	switch (pDRMRec->GetChanEst()->GetTimeSyncTrack()->GetTiSyncTracType())
	{
	case CTimeSyncTrack::TSFIRSTPEAK:
		if (!RadioButtonTiSyncFirstPeak->isChecked())
			RadioButtonTiSyncFirstPeak->setChecked(TRUE);
		break;

	case CTimeSyncTrack::TSENERGY:
		if (!RadioButtonTiSyncEnergy->isChecked())
			RadioButtonTiSyncEnergy->setChecked(TRUE);
		break;
	}

	/* Update settings checkbuttons */
	CheckBoxReverb->setChecked(pDRMRec->GetAudSorceDec()->GetReverbEffect());
	CheckBoxRecFilter->setChecked(pDRMRec->GetFreqSyncAcq()->GetRecFilter());
	CheckBoxModiMetric->setChecked(pDRMRec->GetChanEst()->GetIntCons());
	CheckBoxMuteAudio->setChecked(pDRMRec->GetWriteData()->GetMuteAudio());
	CheckBoxFlipSpec->
		setChecked(pDRMRec->GetReceiver()->GetFlippedSpectrum());

	CheckBoxSaveAudioWave->
		setChecked(pDRMRec->GetWriteData()->GetIsWriteWaveFile());


	/* Update frequency edit control (frequency could be changed by
	   schedule dialog */
	QString strFreq = EdtFrequency->text();
	const int iCurLogFreq =
		pDRMRec->GetParameters()->ReceptLog.GetFrequency();

	if (iCurLogFreq != iCurFrequency)
	{
		EdtFrequency->setText(QString().setNum(iCurLogFreq));
		iCurFrequency = iCurLogFreq;
	}
}

void systemevalDlg::showEvent(QShowEvent* pEvent)
{
	/* Restore chart windows */
	const int iNumChartWin = pDRMRec->GeomChartWindows.Size();

	for (int i = 0; i < iNumChartWin; i++)
	{
		/* Convert int to enum type. TODO: better solution for storing enum
		   types in init file! */
		const CDRMPlot::ECharType eNewType =
			(CDRMPlot::ECharType) pDRMRec->GeomChartWindows[i].iType;

		/* Open new chart window */
		CDRMPlot* pNewChartWin = OpenChartWin(eNewType);

		/* Add window pointer in vector (needed for closing the windows) */
		vecpDRMPlots.Add(pNewChartWin);

#ifdef _WIN32 /* This works only reliable under Windows :-( */
		/* Chart windows: get window geometry data from DRMReceiver module
		   and apply it */
		const QRect WinGeom(pDRMRec->GeomChartWindows[i].iXPos,
			pDRMRec->GeomChartWindows[i].iYPos,
			pDRMRec->GeomChartWindows[i].iWSize,
			pDRMRec->GeomChartWindows[i].iHSize);

		if (WinGeom.isValid() && !WinGeom.isEmpty() && !WinGeom.isNull())
			pNewChartWin->setGeometry(WinGeom);
#else /* Under Linux only restore the size */
		resize(pDRMRec->GeomChartWindows[i].iWSize,
			pDRMRec->GeomChartWindows[i].iHSize);
#endif
	}

	/* Update controls */
	UpdateControls();
}

void systemevalDlg::hideEvent(QHideEvent* pEvent)
{
	/* Store size and position of all additional chart windows */
	pDRMRec->GeomChartWindows.Init(0);

	for (int i = 0; i < vecpDRMPlots.Size(); i++)
	{
		/* Check, if window wasn't closed by the user */
		if (vecpDRMPlots[i]->isVisible())
		{
			const QRect CWGeom = vecpDRMPlots[i]->geometry();

			/* Enlarge vector for storing parameters of new window */
			const int iOldSizeCWV = pDRMRec->GeomChartWindows.Size();
			pDRMRec->GeomChartWindows.Enlarge(1);

			/* Set parameters */
			pDRMRec->GeomChartWindows[iOldSizeCWV].iXPos = CWGeom.x();
			pDRMRec->GeomChartWindows[iOldSizeCWV].iYPos = CWGeom.y();
			pDRMRec->GeomChartWindows[iOldSizeCWV].iHSize = CWGeom.height();
			pDRMRec->GeomChartWindows[iOldSizeCWV].iWSize = CWGeom.width();

			/* Convert plot type into an integer type. TODO: better solution */
			pDRMRec->GeomChartWindows[iOldSizeCWV].iType =
				(int) vecpDRMPlots[i]->GetChartType();
		}

		/* Close window afterwards */
		vecpDRMPlots[i]->close();
	}

	/* We do not need the pointers anymore, reset vector */
	vecpDRMPlots.Init(0);
}

CDRMPlot* systemevalDlg::OpenChartWin(const CDRMPlot::ECharType eNewType)
{
	/* Create new chart window */
	CDRMPlot* pNewChartWin = new CDRMPlot(NULL);
	pNewChartWin->setCaption(tr("Chart Window"));

	/* Set color scheme */
	pNewChartWin->SetPlotStyle(pDRMRec->iMainPlotColorStyle);

	/* Set correct icon (use the same as this dialog) */
	pNewChartWin->setIcon(*this->icon());

	/* Set receiver object and correct chart type */
	pNewChartWin->SetRecObj(pDRMRec);
	pNewChartWin->SetupChart(eNewType);

	/* Show new window */
	pNewChartWin->show();

	return pNewChartWin;
}

void systemevalDlg::SetStatus(int MessID, int iMessPara)
{
	switch(MessID)
	{
	case MS_FAC_CRC:
		LEDFAC->SetLight(iMessPara);
		break;

	case MS_SDC_CRC:
		LEDSDC->SetLight(iMessPara);
		break;

	case MS_MSC_CRC:
		LEDMSC->SetLight(iMessPara);
		break;

	case MS_FRAME_SYNC:
		LEDFrameSync->SetLight(iMessPara);
		break;

	case MS_TIME_SYNC:
		LEDTimeSync->SetLight(iMessPara);
		break;

	case MS_IOINTERFACE:
		LEDIOInterface->SetLight(iMessPara);
		break;

	case MS_RESET_ALL:
		LEDFAC->Reset();
		LEDSDC->Reset();
		LEDMSC->Reset();
		LEDFrameSync->Reset();
		LEDTimeSync->Reset();
		LEDIOInterface->Reset();
		break;
	}
}

void systemevalDlg::OnTimer()
{
	_REAL rSNREstimate;
	_REAL rSigmaEst;

	/* Show SNR if receiver is in tracking mode */
	if (pDRMRec->GetReceiverState() == CDRMReceiver::AS_WITH_SIGNAL)
	{
		/* Get SNR value and use it if available and valid */
		if (pDRMRec->GetChanEst()->GetSNREstdB(rSNREstimate))
		{
			/* SNR */
			ValueSNR->setText("<b>" +
				QString().setNum(rSNREstimate, 'f', 1) + " dB</b>");

			/* MSC WMER / MER */
			ValueMERWMER->setText(QString().
				setNum(pDRMRec->GetChanEst()->GetMSCWMEREstdB(), 'f', 1) +
				" dB / " + QString().
				setNum(pDRMRec->GetChanEst()->GetMSCMEREstdB(), 'f', 1) +
				" dB");

			/* Set SNR for log file */
			pDRMRec->GetParameters()->ReceptLog.SetSNR(rSNREstimate);
		}
		else
		{
			ValueSNR->setText("<b>---</b>");
			ValueMERWMER->setText("<b>---</b>");
		}

		/* Doppler estimation (assuming Gaussian doppler spectrum) */
		if (pDRMRec->GetChanEst()->GetSigma(rSigmaEst))
		{
			/* Plot delay and Doppler values */
			ValueWiener->setText(
				QString().setNum(rSigmaEst, 'f', 2) + " Hz / " +
				QString().setNum(
				pDRMRec->GetChanEst()->GetMinDelay(), 'f', 2) + " ms");
		}
		else
		{
			/* Plot only delay, Doppler not available */
			ValueWiener->setText("--- / " + QString().setNum(
				pDRMRec->GetChanEst()->GetMinDelay(), 'f', 2) + " ms");
		}

		/* Sample frequency offset estimation */
		const _REAL rCurSamROffs = pDRMRec->GetParameters()->GetSampFreqEst();

		/* Display value in [Hz] and [ppm] (parts per million) */
		ValueSampFreqOffset->setText(
			QString().setNum(rCurSamROffs, 'f', 2) + " Hz (" +
			QString().setNum((int) (rCurSamROffs / SOUNDCRD_SAMPLE_RATE * 1e6))
			+ " ppm)");
	}
	else
	{
		ValueSNR->setText("<b>---</b>");
		ValueMERWMER->setText("<b>---</b>");
		ValueWiener->setText("--- / ---");
		ValueSampFreqOffset->setText("---");
	}

#ifdef _DEBUG_
	TextFreqOffset->setText("DC: " +
		QString().setNum(pDRMRec->GetParameters()->
		GetDCFrequency(), 'f', 3) + " Hz ");

	/* Metric values */
	ValueFreqOffset->setText(tr("Metrics [dB]: MSC: ") +
		QString().setNum(
		pDRMRec->GetMSCMLC()->GetAccMetric(), 'f', 2) +	"\nSDC: " +
		QString().setNum(
		pDRMRec->GetSDCMLC()->GetAccMetric(), 'f', 2) +	" / FAC: " +
		QString().setNum(
		pDRMRec->GetFACMLC()->GetAccMetric(), 'f', 2));
#else
	/* DC frequency */
	ValueFreqOffset->setText(QString().setNum(
		pDRMRec->GetParameters()->GetDCFrequency(), 'f', 2) + " Hz");
#endif

/* _WIN32 fix because in Visual c++ the GUI files are always compiled even
   if USE_QT_GUI is set or not (problem with MDI in DRMReceiver) */
#ifdef USE_QT_GUI
	/* If MDI in is enabled, do not show any synchronization parameter */
	if (pDRMRec->GetMDI()->GetMDIInEnabled() == TRUE)
	{
		ValueSNR->setText("<b>---</b>");
		ValueMERWMER->setText("<b>---</b>");
		ValueWiener->setText("--- / ---");
		ValueSampFreqOffset->setText("---");
		ValueFreqOffset->setText("---");
	}
#endif


	/* FAC info static ------------------------------------------------------ */
	QString strFACInfo;

	/* Robustness mode #################### */
	strFACInfo = GetRobModeStr() + " / " + GetSpecOccStr();

	FACDRMModeBWL->setText("DRM Mode / Bandwidth:"); /* Label */
	FACDRMModeBWV->setText(strFACInfo); /* Value */


	/* Interleaver Depth #################### */
	switch (pDRMRec->GetParameters()->eSymbolInterlMode)
	{
	case CParameter::SI_LONG:
		strFACInfo = tr("2 s (Long Interleaving)");
		break;

	case CParameter::SI_SHORT:
		strFACInfo = tr("400 ms (Short Interleaving)");
		break;
	}

	FACInterleaverDepthL->setText(tr("Interleaver Depth:")); /* Label */
	FACInterleaverDepthV->setText(strFACInfo); /* Value */


	/* SDC, MSC mode #################### */
	/* SDC */
	switch (pDRMRec->GetParameters()->eSDCCodingScheme)
	{
	case CParameter::CS_1_SM:
		strFACInfo = "4-QAM / ";
		break;

	case CParameter::CS_2_SM:
		strFACInfo = "16-QAM / ";
		break;
	}

	/* MSC */
	switch (pDRMRec->GetParameters()->eMSCCodingScheme)
	{
	case CParameter::CS_2_SM:
		strFACInfo += "SM 16-QAM";
		break;

	case CParameter::CS_3_SM:
		strFACInfo += "SM 64-QAM";
		break;

	case CParameter::CS_3_HMSYM:
		strFACInfo += "HMsym 64-QAM";
		break;

	case CParameter::CS_3_HMMIX:
		strFACInfo += "HMmix 64-QAM";
		break;
	}

	FACSDCMSCModeL->setText(tr("SDC / MSC Mode:")); /* Label */
	FACSDCMSCModeV->setText(strFACInfo); /* Value */


	/* Code rates #################### */
	strFACInfo = QString().setNum(pDRMRec->GetParameters()->MSCPrLe.iPartB);
	strFACInfo += " / ";
	strFACInfo += QString().setNum(pDRMRec->GetParameters()->MSCPrLe.iPartA);

	FACCodeRateL->setText(tr("Prot. Level (B / A):")); /* Label */
	FACCodeRateV->setText(strFACInfo); /* Value */


	/* Number of services #################### */
	strFACInfo = tr("Audio: ");
	strFACInfo += QString().setNum(pDRMRec->GetParameters()->iNumAudioService);
	strFACInfo += tr(" / Data: ");
	strFACInfo +=QString().setNum(pDRMRec->GetParameters()->iNumDataService);

	FACNumServicesL->setText(tr("Number of Services:")); /* Label */
	FACNumServicesV->setText(strFACInfo); /* Value */


	/* Time, date #################### */
	if ((pDRMRec->GetParameters()->iUTCHour == 0) &&
		(pDRMRec->GetParameters()->iUTCMin == 0) &&
		(pDRMRec->GetParameters()->iDay == 0) &&
		(pDRMRec->GetParameters()->iMonth == 0) &&
		(pDRMRec->GetParameters()->iYear == 0))
	{
		/* No time service available */
		strFACInfo = tr("Service not available");
	}
	else
	{
#ifdef GUI_QT_DATE_TIME_TYPE
		/* QT type of displaying date and time */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -