// // 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: videopropertiesSub.cxx,v $ * Revision 1.4 2004/04/23 05:09:59 dereksmithies * Fixes so it works with latest openh323 lib, and not lock X display. * * Revision 1.3 2003/08/26 04:48:02 dereksmithies * Fixes to get statistics working right, add icons, add ok,cancel,apply buttons * * 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:05 dereksmithies * Initial release. * * * * */ #include #include #include #include #include #include #include #include #include "keys.h" #include "videopropertiesSub.h" #include "qtvid.h" #define CUSTOM_EVENT_SETUP (QEvent::User + 1) /* * Constructs a VideoProperties 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. */ VideoProperties::VideoProperties(VideoOptions & vc) : FormVideoProperties( 0, "Video Properties", FALSE, 0), videoConfig(vc) { move (600,60); CPhone::Current().SetWindowId(eVideoProperties, winId()); QApplication::postEvent(this, new QCustomEvent(CUSTOM_EVENT_SETUP)); } /* * Destroys the object and frees any allocated resources */ VideoProperties::~VideoProperties() { // no need to delete child widgets, Qt does it all for us } void VideoProperties::Setup() { SliderBrightness->setValue(videoConfig.GetBrightness()); SliderColour->setValue(videoConfig.GetColour()); SliderContrast->setValue(videoConfig.GetContrast()); SliderHue->setValue(videoConfig.GetHue()); SliderWhiteness->setValue(videoConfig.GetWhiteness()); //////////////// SpinBoxVideoInputChannel->setValue(videoConfig.GetInputChannel()); SpinBoxVideoReceiveQuality->setValue(videoConfig.GetReceiveQuality()); SpinBoxVideoTransmitQuality->setValue(videoConfig.GetTransmitQuality()); ///// RadioButtonPalVideoFormat->setChecked(videoConfig.GetPalFormat() ); RadioButtonNtscVideoFormat->setChecked(videoConfig.GetNtscFormat() ); //// CheckBoxLargeSize->setChecked(videoConfig.GetUseLargeSize()); CheckBoxDisplayLocalVideo->setChecked(videoConfig.GetDisplayLocal()); CheckBoxFlipLocalVideo->setChecked(videoConfig.GetFlipLocal()); CheckBoxFlipReceivedVideo->setChecked(videoConfig.GetFlipReceived()); ///// PINDEX i; PStringList allVideoDevices = videoConfig.GetAllVideoDevices(); for (i = 0; i < allVideoDevices.GetSize(); i++) ComboBoxVideoInputDevice->insertItem((const char *)allVideoDevices[i].GetPointer()); for(i = 0; i < (PINDEX)ComboBoxVideoInputDevice->count(); i++) if (strcmp((const char *)videoConfig.GetVideoDevice(), ComboBoxVideoInputDevice->text(i)) == 0 ) ComboBoxVideoInputDevice->setCurrentItem(i); } void VideoProperties::OkVideoSlot() { SaveCurrentEntries(); close(TRUE); } void VideoProperties::ApplyVideoSlot() { SaveCurrentEntries(); } void VideoProperties::CancelVideoSlot() { close(TRUE); } void VideoProperties::SaveCurrentEntries() { videoConfig.WhitenessChange(SliderWhiteness->value()); videoConfig.BrightnessChange(SliderBrightness->value()); videoConfig.ColourChange(SliderColour->value()); videoConfig.ContrastChange(SliderContrast->value()); videoConfig.HueChange(SliderHue->value()); videoConfig.DisplayLocalChange(CheckBoxDisplayLocalVideo->isChecked()); videoConfig.LocalVideoOrientationChange(CheckBoxFlipLocalVideo->isChecked()); videoConfig.ReceivedVideoOrientationChange(CheckBoxFlipReceivedVideo->isChecked()); videoConfig.ChannelChange(SpinBoxVideoInputChannel->value()); PString newDevice; if(ComboBoxVideoInputDevice->count()>0) newDevice = (const char *)ComboBoxVideoInputDevice->currentText(); videoConfig.DeviceChange(newDevice); videoConfig.ReceivedQualityChange(SpinBoxVideoReceiveQuality->value()); videoConfig.TransmitQualityChange(SpinBoxVideoTransmitQuality->value()); videoConfig.FormatChange(RadioButtonPalVideoFormat->isChecked()); } void VideoProperties::closeEvent(QCloseEvent *e) { CPhone::Current().ForgetExists(eVideoProperties, winId()); e->accept(); } void VideoProperties::customEvent(QCustomEvent *e) { if (e->type() == CUSTOM_EVENT_DIE) close(TRUE); if (e->type() == CUSTOM_EVENT_SETUP) Setup(); }