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

📄 fdrmdialog.cpp

📁 Dream.exe soft source (Visual C++)
💻 CPP
📖 第 1 页 / 共 2 页
字号:
void FDRMDialog::SetReceiverMode(const CDRMReceiver::ERecMode eNewReMo)
{
	const _BOOLEAN bModeHastChanged = pDRMRec->GetReceiverMode() != eNewReMo;

	/* Set mode in receiver object */
	pDRMRec->SetReceiverMode(eNewReMo);

	/* Make sure correct evaluation dialog is shown */
	switch (eNewReMo)
	{
	case CDRMReceiver::RM_DRM:
		/* For DRM mode, always show main window */
		show();

		pAnalogDemDlg->hide();

		/* Recover visibility state (only if mode has changed) */
		if (bModeHastChanged)
		{
			if (bSysEvalDlgWasVis == TRUE)
				pSysEvalDlg->show();

			if (bMultMedDlgWasVis == TRUE)
				pMultiMediaDlg->show();
		}

		/* Load correct schedule */
		pStationsDlg->LoadSchedule(CDRMSchedule::SM_DRM);
		break;

	case CDRMReceiver::RM_AM:
		/* Main window is not needed, hide it. If Multimedia window was open,
		   hide it. Make sure analog demodulation dialog is visible */
		hide();

		/* Store visibility state */
		bSysEvalDlgWasVis = pSysEvalDlg->isVisible();
		bMultMedDlgWasVis = pMultiMediaDlg->isVisible();

		pSysEvalDlg->hide();
		pMultiMediaDlg->hide();

		pAnalogDemDlg->show();

		/* Load correct schedule */
		pStationsDlg->LoadSchedule(CDRMSchedule::SM_ANALOG);
		break;
	}
}

void FDRMDialog::OnButtonService1()
{
	if (PushButtonService1->isOn())
	{
		/* Set all other buttons up */
		if (PushButtonService2->isOn()) PushButtonService2->setOn(FALSE);
		if (PushButtonService3->isOn()) PushButtonService3->setOn(FALSE);
		if (PushButtonService4->isOn()) PushButtonService4->setOn(FALSE);

		SetService(0);
	}
	else
		PushButtonService1->setOn(TRUE);
}

void FDRMDialog::OnButtonService2()
{
	if (PushButtonService2->isOn())
	{
		/* Set all other buttons up */
		if (PushButtonService1->isOn()) PushButtonService1->setOn(FALSE);
		if (PushButtonService3->isOn()) PushButtonService3->setOn(FALSE);
		if (PushButtonService4->isOn()) PushButtonService4->setOn(FALSE);

		SetService(1);
	}
	else
		PushButtonService2->setOn(TRUE);

}

void FDRMDialog::OnButtonService3()
{
	if (PushButtonService3->isOn())
	{
		/* Set all other buttons up */
		if (PushButtonService1->isOn()) PushButtonService1->setOn(FALSE);
		if (PushButtonService2->isOn()) PushButtonService2->setOn(FALSE);
		if (PushButtonService4->isOn()) PushButtonService4->setOn(FALSE);

		SetService(2);
	}
	else
		PushButtonService3->setOn(TRUE);
}

void FDRMDialog::OnButtonService4()
{
	if (PushButtonService4->isOn())
	{
		/* Set all other buttons up */
		if (PushButtonService1->isOn()) PushButtonService1->setOn(FALSE);
		if (PushButtonService2->isOn()) PushButtonService2->setOn(FALSE);
		if (PushButtonService3->isOn()) PushButtonService3->setOn(FALSE);

		SetService(3);
	}
	else
		PushButtonService4->setOn(TRUE);
}

void FDRMDialog::SetService(int iNewServiceID)
{
	pDRMRec->GetParameters()->SetCurSelAudioService(iNewServiceID);
	pDRMRec->GetParameters()->SetCurSelDataService(iNewServiceID);
	iCurSelServiceGUI = iNewServiceID;

	/* If service is only data service, activate multimedia window */
	if (pDRMRec->GetParameters()->Service[iNewServiceID].eAudDataFlag ==
		CParameter::SF_DATA)
	{
		OnViewMultiMediaDlg();
	}
}

void FDRMDialog::OnViewEvalDlg()
{
	if (pDRMRec->GetReceiverMode() == CDRMReceiver::RM_DRM)
	{
		/* Show evauation window in DRM mode */
		pSysEvalDlg->show();
	}
	else
	{
		/* Show AM demodulation window in AM mode */
		pAnalogDemDlg->show();
	}
}

void FDRMDialog::OnViewMultiMediaDlg()
{
	/* Show evaluation window */
	pMultiMediaDlg->show();
}

void FDRMDialog::OnViewStationsDlg()
{
	/* Show evauation window */
	pStationsDlg->show();
}

QString	FDRMDialog::SetServParamStr(int iServiceID)
{
	QString strReturn;

	if (pDRMRec->GetParameters()->Service[iServiceID].
		eAudDataFlag == CParameter::SF_AUDIO)
	{
		/* Audio service ---------------------------------------------------- */
		/* Audio coding */
		switch (pDRMRec->GetParameters()->Service[iServiceID].
			AudioParam.eAudioCoding)
		{
		case CParameter::AC_AAC:	
			strReturn = "AAC(";
			break;

		case CParameter::AC_CELP:
			strReturn = "Celp(";
			break;

		case CParameter::AC_HVXC:
			strReturn = "HVXC(";
			break;
		}

		/* Sample rate */
		switch (pDRMRec->GetParameters()->Service[iServiceID].
			AudioParam.eAudioSamplRate)
		{
		case CParameter::AS_8_KHZ:	
			strReturn += "8 kHz)";
			break;

		case CParameter::AS_12KHZ:	
			strReturn += "12 kHz)";
			break;

		case CParameter::AS_16KHZ:	
			strReturn += "16 kHz)";
			break;

		case CParameter::AS_24KHZ:	
			strReturn += "24 kHz)";
			break;
		}

		/* SBR */
		if (pDRMRec->GetParameters()->Service[iServiceID].
			AudioParam.eSBRFlag == CParameter::SB_USED)
		{
			strReturn += "+SBR";
		}

		/* Mono-Stereo */
		switch (pDRMRec->GetParameters()->
			Service[iServiceID].AudioParam.eAudioMode)
		{
			case CParameter::AM_MONO:
				strReturn += " Mono";
				break;

			case CParameter::AM_P_STEREO:
				strReturn += " P-Stereo";
				break;

			case CParameter::AM_STEREO:
				strReturn += " Stereo";
				break;
		}

		/* Language */
		strReturn += " / ";
		strReturn += strTableLanguageCode[pDRMRec->GetParameters()->
			Service[iServiceID].iLanguage].c_str();

		/* Program type */
		strReturn += " / ";
		strReturn += strTableProgTypCod[pDRMRec->GetParameters()->
			Service[iServiceID].iServiceDescr].c_str();
	}
	else
	{
		/* Data service ----------------------------------------------------- */
		strReturn = "Data Service: ";

		if (pDRMRec->GetParameters()->Service[iServiceID].DataParam.
			ePacketModInd == CParameter::PM_PACKET_MODE)
		{
			if (pDRMRec->GetParameters()->Service[iServiceID].DataParam.
				eAppDomain == CParameter::AD_DAB_SPEC_APP)
			{
				switch (pDRMRec->GetParameters()->Service[iServiceID].
					DataParam.iUserAppIdent)
				{
				case 1:
					strReturn += "Dynamic labels";
					break;

				case 2:
					strReturn += "MOT Slideshow";
					break;

				case 3:
					strReturn += "MOT Broadcast Web Site";
					break;

				case 4:
					strReturn += "TPEG";
					break;

				case 5:
					strReturn += "DGPS";
					break;

				case 0x44A: /* Journaline */
					strReturn += "NewsService Journaline";
					break;
				}
			}
			else
				strReturn += tr("Unknown Service");
		}
		else
			strReturn += tr("Unknown Service");
	}

	return strReturn;
}

QString	FDRMDialog::SetBitrIDStr(int iServiceID)
{
	/* Bit-rate */
	QString strServIDBitrate = tr("Bit Rate:") + QString().setNum(pDRMRec->
		GetParameters()->GetBitRateKbps(iServiceID, FALSE), 'f', 2) +
		tr(" kbps");

	/* Equal or unequal error protection */
	const _REAL rPartABLenRat =
		pDRMRec->GetParameters()->PartABLenRatio(iServiceID);

	if (rPartABLenRat != (_REAL) 0.0)
	{
		/* Print out the percentage of part A length to total length */
		strServIDBitrate += " UEP (" +
			QString().setNum(rPartABLenRat * 100, 'f', 1) + " %)";
	}
	else
	{
		/* If part A is zero, equal error protection (EEP) is used */
		strServIDBitrate += " EEP";
	}

	/* Service ID */
	strServIDBitrate += " / ID:";
	strServIDBitrate += QString().setNum((long) pDRMRec->GetParameters()->
		Service[iServiceID].iServiceID);

	return strServIDBitrate;
}

void FDRMDialog::customEvent(QCustomEvent* Event)
{
	if (Event->type() == QEvent::User + 11)
	{
		int iMessType = ((DRMEvent*) Event)->iMessType;
		int iStatus = ((DRMEvent*) Event)->iStatus;

		if (iMessType == MS_MOT_OBJ_STAT)
			pMultiMediaDlg->SetStatus(iMessType, iStatus);
		else
		{
			pSysEvalDlg->SetStatus(iMessType, iStatus);

			switch(iMessType)
			{
			case MS_FAC_CRC:
				CLED_FAC->SetLight(iStatus);
				break;

			case MS_SDC_CRC:
				CLED_SDC->SetLight(iStatus);
				break;

			case MS_MSC_CRC:
				CLED_MSC->SetLight(iStatus);
				break;

			case MS_RESET_ALL:
				CLED_FAC->Reset();
				CLED_SDC->Reset();
				CLED_MSC->Reset();
				break;
			}
		}
	}
}

void FDRMDialog::AddWhatsThisHelp()
{
/*
	This text was taken from the only documentation of Dream software
*/
	/* Text Message */
	QWhatsThis::add(TextTextMessage,
		tr("<b>Text Message:</b> On the top right the text "
		"message label is shown. This label only appears when an actual text "
		"message is transmitted. If the current service does not transmit a "
		"text message, the label will be invisible."));

	/* Input Level */
	const QString strInputLevel =
		tr("<b>Input Level:</b> The input level meter shows "
		"the relative input signal peak level in dB. If the level is too high, "
		"the meter turns from green to red. The red region should be avoided "
		"since overload causes distortions which degrade the reception "
		"performance. Too low levels should be avoided too, since in this case "
		"the Signal-to-Noise Ratio (SNR) degrades.");

	QWhatsThis::add(TextLabelInputLevel, strInputLevel);
	QWhatsThis::add(ProgrInputLevel, strInputLevel);

	/* Status LEDs */
	const QString strStatusLEDS =
		tr("<b>Status LEDs:</b> The three status LEDs show "
		"the current CRC status of the three logical channels of a DRM stream. "
		"These LEDs are the same as the top LEDs on the Evaluation Dialog.");

	QWhatsThis::add(TextLabelStatusLEDs, strStatusLEDS);
	QWhatsThis::add(CLED_MSC, strStatusLEDS);
	QWhatsThis::add(CLED_SDC, strStatusLEDS);
	QWhatsThis::add(CLED_FAC, strStatusLEDS);

	/* Station Label and Info Display */
	const QString strStationLabelOther =
		tr("<b>Station Label and Info Display:</b> In the "
		"big label with the black background the station label and some other "
		"information about the current selected service is displayed. The red "
		"text on the top shows the audio compression format (e.g. AAC), the "
		"sample rate of the core coder without SBR (e.g. 24 kHz), if SBR is "
		"used and what audio mode is used (mono, stereo, P-stereo -> "
		"low-complexity or parametric stereo). In case SBR is used, the actual "
		"sample rate is twice the sample rate of the core AAC decoder. The "
		"next two types of information are the language and the program type "
		"of the service (e.g. German / News).<br>The big "
		"turquoise text in the middle is the station label. This label may "
		"appear later than the red text since this information is transmitted "
		"in a different logical channel of a DRM stream.<br>The "
		"turquoise text on the bottom shows the gross bit-rate in kbits per "
		"second of the current selected service. The abbreviations EEP and "
		"UEP stand for Equal Error Protection and Unequal Error Protection. "
		"UEP is a feature of DRM for a graceful degradation of the decoded "
		"audio signal in case of a bad reception situation. UEP means that "
		"some parts of the audio is higher protected and some parts are lower "
		"protected (the ratio of higher protected part length to total length "
		"is shown in the brackets). On the right, the ID number connected with "
		"this service is shown.");

	QWhatsThis::add(TextServiceAudio, strStationLabelOther);
	QWhatsThis::add(TextServiceLabel, strStationLabelOther);
	QWhatsThis::add(TextServiceIDRate, strStationLabelOther);

	/* Service Selectors */
	const QString strServiceSel =
		tr("<b>Service Selectors:</b> In a DRM stream up to "
		"four services can be carried. The service type can either be audio, "
		"data or audio and data. If a data service is selected, the Multimedia "
		"Dialog will automatically show up. On the right of each service "
		"selection button a short description of the service is shown. If a "
		"service is an audio and data service, a \"+ MM\" is added to this "
		"text. If a service is an audio and data service and this service "
		"is selected, by opening the Multimedia Dialog, the data can be viewed "
		"while the audio is still playing.");

	QWhatsThis::add(PushButtonService1, strServiceSel);
	QWhatsThis::add(PushButtonService2, strServiceSel);
	QWhatsThis::add(PushButtonService3, strServiceSel);
	QWhatsThis::add(PushButtonService4, strServiceSel);
	QWhatsThis::add(TextMiniService1, strServiceSel);
	QWhatsThis::add(TextMiniService2, strServiceSel);
	QWhatsThis::add(TextMiniService3, strServiceSel);
	QWhatsThis::add(TextMiniService4, strServiceSel);

	/* Dream Logo */
	QWhatsThis::add(PixmapLabelDreamLogo,
		tr("<b>Dream Logo:</b> This is the official logo "
		"of the Dream software."));
}

⌨️ 快捷键说明

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