MCPcopy Create free account
hub / github.com/KangLin/RabbitRemoteControl / accept

Method accept

Plugins/Player/DlgPlayer.cpp:93–150  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93void CDlgPlayer::accept()
94{
95 int nRet = 0;
96
97 if(!ui->leName->text().isEmpty())
98 m_pParameters->SetName(ui->leName->text());
99 if((ui->cmbType->currentData().value<CParameterPlayer::TYPE>()
100 == CParameterPlayer::TYPE::Url) && ui->leUrl->text().isEmpty()) {
101 ui->leUrl->setFocus();
102 ui->tabWidget->setCurrentIndex(0);
103 QString szErr = tr("The url is empty. please set!");
104 QMessageBox::critical(this, tr("Error"), szErr);
105 qCritical(log) << szErr;
106 return;
107 }
108
109 if(!m_pRecordUI->CheckValidity(true)) {
110 ui->tabWidget->setCurrentWidget(m_pRecordUI);
111 return;
112 }
113
114 m_pParameters->SetType(
115 ui->cmbType->currentData().value<CParameterPlayer::TYPE>());
116 m_pParameters->SetUrl(ui->leUrl->text());
117 m_pParameters->SetCamera(ui->cmbCamera->currentIndex());
118 switch(m_pParameters->GetType()) {
119 case CParameterPlayer::TYPE::Camera: {
120 int nIndex = m_pParameters->GetCamera();
121 if(-1 < nIndex && nIndex < QMediaDevices::videoInputs().size())
122 if(ui->leName->text().isEmpty())
123 m_pParameters->SetName(
124 tr("Camera: ")
125 + QMediaDevices::videoInputs().at(nIndex).description());
126 break;
127 }
128 case CParameterPlayer::TYPE::Url:
129 QFileInfo fi(m_pParameters->GetUrl());
130 if(ui->leName->text().isEmpty())
131 m_pParameters->SetName(tr("Url: ") + fi.fileName());
132 break;
133 }
134
135 m_pParameters->SetSubtitle(ui->cbEnableSubtitle->isChecked());
136 m_pParameters->SetEnableAudioInput(ui->gbAudioInput->isChecked());
137 m_pParameters->SetAudioInput(ui->cmbAudioInput->currentIndex());
138 m_pParameters->SetAudioInputMuted(ui->cbAudioInputMuted->isChecked());
139 m_pParameters->SetAudioInputVolume(ui->dsAudioInputVolume->value());
140 m_pParameters->SetEnableAudioOutput(ui->gbAudioOutput->isChecked());
141 m_pParameters->SetAudioOutput(ui->cmbAudioOutput->currentIndex());
142 m_pParameters->SetAudioOutputMuted(ui->cbAudioOutputMuted->isChecked());
143 m_pParameters->SetAudioOutputVolume(ui->dsAudioOutputVolume->value());
144
145 nRet = m_pRecordUI->Accept();
146 if(nRet)
147 return;
148
149 QDialog::accept();
150}

Callers

nothing calls this directly

Calls 15

SetCameraMethod · 0.80
GetCameraMethod · 0.80
GetUrlMethod · 0.80
SetSubtitleMethod · 0.80
SetEnableAudioInputMethod · 0.80
SetAudioInputMethod · 0.80
SetAudioInputMutedMethod · 0.80
SetAudioInputVolumeMethod · 0.80
SetEnableAudioOutputMethod · 0.80
SetAudioOutputMethod · 0.80
SetAudioOutputMutedMethod · 0.80
SetAudioOutputVolumeMethod · 0.80

Tested by

no test coverage detected