📄 transmdlg.cpp
字号:
/******************************************************************************\
* Technische Universitaet Darmstadt, Institut fuer Nachrichtentechnik
* Copyright (c) 2001
*
* Author(s):
* Volker Fischer
*
* Description:
*
*
******************************************************************************
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option) any later
* version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
\******************************************************************************/
#include "TransmDlg.h"
TransmDialog::TransmDialog(QWidget* parent, const char* name, bool modal,
WFlags f)
: TransmDlgBase(parent, name, modal, f), bIsStarted(FALSE),
vecstrTextMessage(1) /* 1 for new text */, iIDCurrentText(0)
{
int i;
/* Set help text for the controls */
AddWhatsThisHelp();
/* Set controls to custom behavior */
MultiLineEditTextMessage->setWordWrap(QMultiLineEdit::WidgetWidth);
MultiLineEditTextMessage->setEdited(FALSE);
ComboBoxTextMessage->insertItem(tr("new"), 0);
UpdateMSCProtLevCombo();
/* Init controls with default settings */
ButtonStartStop->setText(tr("&Start"));
/* Init progress bar for input signal level */
ProgrInputLevel->setRange(-50.0, 0.0);
ProgrInputLevel->setOrientation(QwtThermo::Horizontal, QwtThermo::Bottom);
ProgrInputLevel->setFillColor(QColor(0, 190, 0));
ProgrInputLevel->setAlarmLevel(-5.0);
ProgrInputLevel->setAlarmColor(QColor(255, 0, 0));
/* Init progress bar for current transmitted picture */
ProgressBarCurPict->setTotalSteps(100);
ProgressBarCurPict->setProgress(0);
TextLabelCurPict->setText("");
/* Output mode (real valued, I / Q or E / P) */
switch (TransThread.DRMTransmitter.GetTransData()->GetIQOutput())
{
case CTransmitData::OF_REAL_VAL:
RadioButtonOutReal->setChecked(TRUE);
break;
case CTransmitData::OF_IQ_POS:
RadioButtonOutIQPos->setChecked(TRUE);
break;
case CTransmitData::OF_IQ_NEG:
RadioButtonOutIQNeg->setChecked(TRUE);
break;
case CTransmitData::OF_EP:
RadioButtonOutEP->setChecked(TRUE);
break;
}
/* Robustness mode */
switch (TransThread.DRMTransmitter.GetParameters()->GetWaveMode())
{
case RM_ROBUSTNESS_MODE_A:
RadioButtonRMA->setChecked(TRUE);
break;
case RM_ROBUSTNESS_MODE_B:
RadioButtonRMB->setChecked(TRUE);
break;
case RM_ROBUSTNESS_MODE_C:
RadioButtonRMC->setChecked(TRUE);
break;
case RM_ROBUSTNESS_MODE_D:
RadioButtonRMD->setChecked(TRUE);
break;
}
/* Bandwidth */
switch (TransThread.DRMTransmitter.GetParameters()->GetSpectrumOccup())
{
case SO_0:
RadioButtonBandwidth45->setChecked(TRUE);
break;
case SO_1:
RadioButtonBandwidth5->setChecked(TRUE);
break;
case SO_2:
RadioButtonBandwidth9->setChecked(TRUE);
break;
case SO_3:
RadioButtonBandwidth10->setChecked(TRUE);
break;
case SO_4:
RadioButtonBandwidth18->setChecked(TRUE);
break;
case SO_5:
RadioButtonBandwidth20->setChecked(TRUE);
break;
}
/* Set button group IDs */
ButtonGroupBandwidth->insert(RadioButtonBandwidth45, 0);
ButtonGroupBandwidth->insert(RadioButtonBandwidth5, 1);
ButtonGroupBandwidth->insert(RadioButtonBandwidth9, 2);
ButtonGroupBandwidth->insert(RadioButtonBandwidth10, 3);
ButtonGroupBandwidth->insert(RadioButtonBandwidth18, 4);
ButtonGroupBandwidth->insert(RadioButtonBandwidth20, 5);
/* MSC interleaver mode */
ComboBoxMSCInterleaver->insertItem(tr("2 s (Long Interleaving)"), 0);
ComboBoxMSCInterleaver->insertItem(tr("400 ms (Short Interleaving)"), 1);
switch (TransThread.DRMTransmitter.GetParameters()->eSymbolInterlMode)
{
case CParameter::SI_LONG:
ComboBoxMSCInterleaver->setCurrentItem(0);
break;
case CParameter::SI_SHORT:
ComboBoxMSCInterleaver->setCurrentItem(1);
break;
}
/* MSC Constellation Scheme */
ComboBoxMSCConstellation->insertItem(tr("SM 16-QAM"), 0);
ComboBoxMSCConstellation->insertItem(tr("SM 64-QAM"), 1);
// These modes should not be used right now, TODO
// ComboBoxMSCConstellation->insertItem(tr("HMsym 64-QAM"), 2);
// ComboBoxMSCConstellation->insertItem(tr("HMmix 64-QAM"), 3);
switch (TransThread.DRMTransmitter.GetParameters()->eMSCCodingScheme)
{
case CParameter::CS_2_SM:
ComboBoxMSCConstellation->setCurrentItem(0);
break;
case CParameter::CS_3_SM:
ComboBoxMSCConstellation->setCurrentItem(1);
break;
// case CParameter::CS_3_HMSYM:
// ComboBoxMSCConstellation->setCurrentItem(2);
// break;
//
// case CParameter::CS_3_HMMIX:
// ComboBoxMSCConstellation->setCurrentItem(3);
// break;
}
/* SDC Constellation Scheme */
ComboBoxSDCConstellation->insertItem(tr("4-QAM"), 0);
ComboBoxSDCConstellation->insertItem(tr("16-QAM"), 1);
switch (TransThread.DRMTransmitter.GetParameters()->eSDCCodingScheme)
{
case CParameter::CS_1_SM:
ComboBoxSDCConstellation->setCurrentItem(0);
break;
case CParameter::CS_2_SM:
ComboBoxSDCConstellation->setCurrentItem(1);
break;
}
/* Service parameters --------------------------------------------------- */
/* Service label */
LineEditServiceLabel->setText(TransThread.DRMTransmitter.
GetParameters()->Service[0].strLabel.c_str());
/* Service ID */
LineEditServiceID->setText(QString().setNum((int) TransThread.
DRMTransmitter.GetParameters()->Service[0].iServiceID));
/* Language */
for (i = 0; i < LEN_TABLE_LANGUAGE_CODE; i++)
ComboBoxLanguage->insertItem(strTableLanguageCode[i].c_str(), i);
ComboBoxLanguage->setCurrentItem(TransThread.DRMTransmitter.
GetParameters()->Service[0].iLanguage);
/* Program type */
for (i = 0; i < LEN_TABLE_PROG_TYPE_CODE; i++)
ComboBoxProgramType->insertItem(strTableProgTypCod[i].c_str(), i);
ComboBoxProgramType->setCurrentItem(TransThread.DRMTransmitter.
GetParameters()->Service[0].iServiceDescr);
/* Sound card IF */
LineEditSndCrdIF->setText(QString().number(
TransThread.DRMTransmitter.GetCarOffset(), 'f', 2));
/* Clear list box for file names and set up columns */
ListViewFileNames->clear();
/* We assume that one column is already there */
ListViewFileNames->setColumnText(0, "File Name");
ListViewFileNames->addColumn("Size [KB]");
ListViewFileNames->addColumn("Full Path");
/* Disable other three services */
TabWidgetServices->setTabEnabled(tabService2, FALSE);
TabWidgetServices->setTabEnabled(tabService3, FALSE);
TabWidgetServices->setTabEnabled(tabService4, FALSE);
CheckBoxEnableService->setChecked(TRUE);
CheckBoxEnableService->setEnabled(FALSE);
/* Let this service be an audio service for initialization */
/* Set audio enable check box */
CheckBoxEnableAudio->setChecked(TRUE);
EnableAudio(TRUE);
CheckBoxEnableData->setChecked(FALSE);
EnableData(FALSE);
/* Add example text message at startup ---------------------------------- */
/* Activate text message */
EnableTextMessage(TRUE);
CheckBoxEnableTextMessage->setChecked(TRUE);
/* Add example text in internal container */
vecstrTextMessage.Add(tr("Dream DRM Transmitter\x0B\x0AThis is a test "
"transmission").latin1());
/* Insert item in combo box, display text and set item to our text */
ComboBoxTextMessage->insertItem(QString().setNum(1), 1);
ComboBoxTextMessage->setCurrentItem(1);
iIDCurrentText = 1;
MultiLineEditTextMessage->insertLine(vecstrTextMessage[1].c_str());
/* Now make sure that the text message flag is activated in global struct */
TransThread.DRMTransmitter.GetParameters()->
Service[0].AudioParam.bTextflag = TRUE;
/* Enable all controls */
EnableAllControlsForSet();
/* Set Menu ***************************************************************/
/* Settings menu ------------------------------------------------------- */
pSettingsMenu = new QPopupMenu(this);
CHECK_PTR(pSettingsMenu);
pSettingsMenu->insertItem(tr("&Sound Card Selection"),
new CSoundCardSelMenu(TransThread.DRMTransmitter.
GetSoundInterface(), this));
/* Main menu bar */
pMenu = new QMenuBar(this);
CHECK_PTR(pMenu);
pMenu->insertItem(tr("&Settings"), pSettingsMenu);
pMenu->insertItem(tr("&?"), new CDreamHelpMenu(this));
pMenu->setSeparator(QMenuBar::InWindowsStyle);
/* Now tell the layout about the menu */
TransmDlgBaseLayout->setMenuBar(pMenu);
/* Connections ---------------------------------------------------------- */
connect(ButtonStartStop, SIGNAL(clicked()),
this, SLOT(OnButtonStartStop()));
connect(PushButtonAddText, SIGNAL(clicked()),
this, SLOT(OnPushButtonAddText()));
connect(PushButtonClearAllText, SIGNAL(clicked()),
this, SLOT(OnButtonClearAllText()));
connect(PushButtonAddFile, SIGNAL(clicked()),
this, SLOT(OnPushButtonAddFileName()));
connect(PushButtonClearAllFileNames, SIGNAL(clicked()),
this, SLOT(OnButtonClearAllFileNames()));
connect(CheckBoxEnableTextMessage, SIGNAL(toggled(bool)),
this, SLOT(OnToggleCheckBoxEnableTextMessage(bool)));
connect(CheckBoxEnableAudio, SIGNAL(toggled(bool)),
this, SLOT(OnToggleCheckBoxEnableAudio(bool)));
connect(CheckBoxEnableData, SIGNAL(toggled(bool)),
this, SLOT(OnToggleCheckBoxEnableData(bool)));
/* Combo boxes */
connect(ComboBoxMSCInterleaver, SIGNAL(highlighted(int)),
this, SLOT(OnComboBoxMSCInterleaverHighlighted(int)));
connect(ComboBoxMSCConstellation, SIGNAL(highlighted(int)),
this, SLOT(OnComboBoxMSCConstellationHighlighted(int)));
connect(ComboBoxSDCConstellation, SIGNAL(highlighted(int)),
this, SLOT(OnComboBoxSDCConstellationHighlighted(int)));
connect(ComboBoxLanguage, SIGNAL(highlighted(int)),
this, SLOT(OnComboBoxLanguageHighlighted(int)));
connect(ComboBoxProgramType, SIGNAL(highlighted(int)),
this, SLOT(OnComboBoxProgramTypeHighlighted(int)));
connect(ComboBoxTextMessage, SIGNAL(highlighted(int)),
this, SLOT(OnComboBoxTextMessageHighlighted(int)));
connect(ComboBoxMSCProtLev, SIGNAL(highlighted(int)),
this, SLOT(OnComboBoxMSCProtLevHighlighted(int)));
/* Button groups */
connect(ButtonGroupRobustnessMode, SIGNAL(clicked(int)),
this, SLOT(OnRadioRobustnessMode(int)));
connect(ButtonGroupBandwidth, SIGNAL(clicked(int)),
this, SLOT(OnRadioBandwidth(int)));
connect(ButtonGroupBandwidth, SIGNAL(clicked(int)),
this, SLOT(OnRadioBandwidth(int)));
connect(ButtonGroupOutput, SIGNAL(clicked(int)),
this, SLOT(OnRadioOutput(int)));
/* Line edits */
connect(LineEditServiceLabel, SIGNAL(textChanged(const QString&)),
this, SLOT(OnTextChangedServiceLabel(const QString&)));
connect(LineEditServiceID, SIGNAL(textChanged(const QString&)),
this, SLOT(OnTextChangedServiceID(const QString&)));
connect(LineEditSndCrdIF, SIGNAL(textChanged(const QString&)),
this, SLOT(OnTextChangedSndCrdIF(const QString&)));
connect(&Timer, SIGNAL(timeout()),
this, SLOT(OnTimer()));
/* Set timer for real-time controls */
Timer.start(GUI_CONTROL_UPDATE_TIME);
}
TransmDialog::~TransmDialog()
{
/* Stop transmitter */
if (bIsStarted == TRUE)
TransThread.Stop();
}
void TransmDialog::OnTimer()
{
/* Set value for input level meter (only in "start" mode) */
if (bIsStarted == TRUE)
{
ProgrInputLevel->
setValue(TransThread.DRMTransmitter.GetReadData()->GetLevelMeter());
string strCPictureName;
_REAL rCPercent;
/* Activate progress bar for slide show pictures only if current state
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -