📄 audiopropertiessub.cxx
字号:
//// The contents of this file are subject to the Mozilla Public License// Version 1.0 (the "License"); you may not use this file except in// compliance with the License. You may obtain a copy of the License at// http://www.mozilla.org/MPL/// // Software distributed under the License is distributed on an "AS IS"// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See// the License for the specific language governing rights and limitations// under the License. // // The Original Code is CPhone, a cross platform voip gui.//// The Initial Developer of the Original Code is Derek Smithies.//// Copyright (C) 2002 Indranet Technologies Ltd, // http://www.indranet-technologies.com// All Rights Reserved.//// Contributor(s): _______________/* * * $Log: audiopropertiesSub.cxx,v $ * Revision 1.2 2003/04/04 04:37:49 dereksmithies * Major upgrade. * Ixj & microtelco support added. Fix threading issues. * * Revision 1.1.1.1 2002/05/12 22:55:04 dereksmithies * Initial release. * * * * */#include <ptlib.h>#include <qslider.h>#include <qcheckbox.h>#include <qcombobox.h>#include <qspinbox.h>#include <qapplication.h>#include "keys.h"#include "audiopropertiesSub.h"#include <qevent.h>#define CUSTOM_EVENT_SETUP (QEvent::User + 1)/* * Constructs a AudioProperties which is a child of 'parent', with the * name 'name' and widget flags set to 'f' * * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */AudioProperties::AudioProperties(AudioOptions & ac) : FormAudioProperties( 0 , "Audio Properties", FALSE, 0 ), audioConfig(ac), controlsSet(FALSE){ CPhone::Current().SetWindowId(eAudioProperties, winId()); QApplication::postEvent(this, new QCustomEvent(CUSTOM_EVENT_SETUP));}/* * Destroys the object and frees any allocated resources */AudioProperties::~AudioProperties(){ // no need to delete child widgets, Qt does it all for us}void AudioProperties::Setup(){ CheckBoxDisableSilenceDetection->setChecked(audioConfig.GetDisableSilence()); ///////////////////////////////////////////// PINDEX i; PStringArray names = CPhone::GetUi().GetAvailableDeviceNames(); for (i = 0; i < names.GetSize(); i++) ComboBoxAudioDevice->insertItem(QString(names[i].GetPointer())); for(i = 0; i < ComboBoxAudioDevice->count(); i++) if (strcmp(audioConfig.GetAudioDevice(), ComboBoxAudioDevice->text(i)) == 0) ComboBoxAudioDevice->setCurrentItem(i); names = CPhone::GetUi().GetAvailableEchoCancNames(); for (i = 0; i < names.GetSize(); i++) ComboBoxEchoCancellation->insertItem(QString(names[i].GetPointer())); for(i = 0; i < ComboBoxEchoCancellation->count(); i++) if (strcmp(audioConfig.GetEchoCancellation(), ComboBoxEchoCancellation->text(i)) == 0) ComboBoxEchoCancellation->setCurrentItem(i); ///////////////////////////////////// SliderJitterBufferSize->setValue(audioConfig.GetJitterBufferSize()); SliderMicrophone->setValue(audioConfig.GetVolumeMicrophone()); SliderSpeaker->setValue(audioConfig.GetVolumeSpeaker()); SpinBoxNumberSoundBuffers->setValue(audioConfig.GetBuffers()); BOOL inACall = !CPhone::GetUi().WaitingForACall(); OnConnectionEstablished(inACall); controlsSet = TRUE;} void AudioProperties::closeEvent(QCloseEvent *e){ CPhone::Current().ForgetExists(eAudioProperties, winId()); e->accept(); }void AudioProperties::AudioDeviceChanged_slot(){ if (!controlsSet) return; audioConfig.AudioDeviceChange((const char *)ComboBoxAudioDevice->currentText());}void AudioProperties::DisableSilenceDetectionChanged_slot(){ if (!controlsSet) return; audioConfig.DisableSilenceChange( CheckBoxDisableSilenceDetection->isChecked());}void AudioProperties::EchoCancellationChanged_slot(){ if (!controlsSet) return; audioConfig.EchoCancellationChange (ComboBoxEchoCancellation->currentText());}void AudioProperties::JitterBufferSizeChanged_slot(){ if (!controlsSet) return; audioConfig.JitterBufferSizeChange(SliderJitterBufferSize->value());}void AudioProperties::MicrophoneVolumeChanged_slot(){ if (!controlsSet) return; audioConfig.VolumeMicrophoneChange( SliderMicrophone->value());}void AudioProperties::SpeakerVolumeChanged_slot(){ if (!controlsSet) return; audioConfig.VolumeSpeakerChange( SliderSpeaker->value());}void AudioProperties::NumberSoundBuffers_slot(){ if (!controlsSet) return; audioConfig.BuffersChange( SpinBoxNumberSoundBuffers->value());}void AudioProperties::OnConnectionEstablished(bool isEstablished){ ComboBoxAudioDevice->setEnabled(!isEstablished);} void AudioProperties::customEvent(QCustomEvent *e){ if (e->type() == CUSTOM_EVENT_DIE) close(TRUE); if (e->type() == CUSTOM_EVENT_SETUP) Setup();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -