Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

mxcpcCameraSelector.cpp

00001 //           ///          //                                        Mx clientSDK
00002 //          /////        ////                    Mx Crossplatform Client Library
00003 //         /// XXX     XXX ///
00004 //        ///    XXX XXX    ///     $RCSfile: mxcpcCameraSelector.cpp,v $
00005 //       ///       XXX       ///     $Revision: 1.6 $
00006 //      ///      XXX XXX      ///     $Date: 2006/01/05 12:19:20 $
00007 //     ////    XXX     XXX    ////     $Author: cvs-kai $
00008 //    ////                     ////
00009 //   ////  M  O  B  O  T  I  X  ////////////////////////////////////////////////
00010 //  //// Security Vision Systems //////////////////////////////////////////////
00011 //                                                                          //
00012 //  Copyright (C) 2005 - 2006, MOBOTIX AG, Germany                         //
00013 //  This software is made available under the BSD licence. Please refer   //
00014 //  to the file LICENCE.TXT contained in this distribution for details.  //
00015 //                                                                      //
00016 //  /////////////////////////////////////////////////////////////////////
00017 
00018 
00019 
00020 #include <mxcpcCameraSelector.h>
00021 #include <mxcpcIPEdit.h>
00022 
00023 #include <QVBoxLayout>
00024 #include <QHBoxLayout>
00025 #include <QLabel>
00026 #include <QSpinBox>
00027 #include <QComboBox>
00028 #include <QCheckBox>
00029 #include <QFrame>
00030 
00031 
00032 
00033 mxcpcCameraSelector::mxcpcCameraSelector(QWidget *parent) 
00034                       : QWidget(parent)                   {
00035                         
00036   mxcpcIPEdit *ip_edit;
00037   QVBoxLayout *layout;
00038   QHBoxLayout *layout2;
00039   QLabel *label;
00040   QSpinBox *spin_box;
00041   QComboBox *combo_box;
00042   QCheckBox *checkbox;
00043   QFrame *frame;
00044   
00045   layout = new QVBoxLayout(this);
00046   layout->setMargin(0);
00047   //layout->setSizeConstraint(QLayout::SetFixedSize);
00048   
00049   combo_box = new QComboBox(this);
00050   layout->addWidget(combo_box, 0, Qt::AlignHCenter);
00051   combo_box->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
00052                                        QSizePolicy::Fixed));
00053   //combo_box->addItem(QString("MOBOTIX Units On Local Subnet"));                                     
00054   //combo_box->addItem(QString("Recently Connected"));
00055   combo_box->addItem(QString("Specify Manually"));
00056   
00057   frame = new QFrame(this);
00058   layout->addWidget(frame);
00059   frame->setFrameStyle(QFrame::HLine | QFrame::Sunken);
00060   
00061   CameraIPEdit = ip_edit = new mxcpcIPEdit(this);
00062   layout->addWidget(ip_edit);
00063   
00064   layout2 = new QHBoxLayout();
00065   layout->addLayout(layout2);
00066 
00067   label = new QLabel(QString("Camera Port:"), this);
00068   layout2->addWidget(label);
00069   CameraPortSpinBox = spin_box = new QSpinBox(this);
00070   layout2->addWidget(spin_box);
00071   spin_box->setMinimum(0);
00072   spin_box->setMaximum(65536);
00073   spin_box->setValue(80);
00074   spin_box->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
00075                                       QSizePolicy::Fixed));  
00076                        
00077   frame = new QFrame(this);
00078   layout->addWidget(frame);
00079   frame->setFrameStyle(QFrame::HLine | QFrame::Sunken);
00080                                       
00081   ProxyCheckBox
00082    = checkbox 
00083    = new QCheckBox(QString("Access this Camera through Proxy Server"), 
00084                    this);
00085   layout->addWidget(checkbox);
00086   checkbox->setChecked(false);
00087   QObject::connect(checkbox, SIGNAL(stateChanged(int)),
00088                    this, SLOT(processProxyCheckBoxStateChanged(int)));
00089   
00090   ProxyIPEdit = ip_edit = new mxcpcIPEdit(this);
00091   layout->addWidget(ip_edit);
00092   ip_edit->setIPAddress(mxcpcIPAddress(192, 168, 1, 254));
00093   ip_edit->setEnabled(false);
00094   
00095   layout2 = new QHBoxLayout();
00096   layout->addLayout(layout2);
00097 
00098   label = new QLabel(QString("Proxy Port:"), this);
00099   layout2->addWidget(label);
00100   ProxyPortSpinBox = spin_box = new QSpinBox(this);
00101   layout2->addWidget(spin_box);
00102   spin_box->setMinimum(0);
00103   spin_box->setMaximum(65536);
00104   spin_box->setValue(8080);
00105   spin_box->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
00106                                       QSizePolicy::Fixed));
00107   spin_box->setEnabled(false);
00108 }
00109 
00110 
00111 
00112 mxcpcIPAddress mxcpcCameraSelector::cameraIP(void) {
00113 
00114   return(CameraIPEdit->getIPAddress());
00115 }
00116 
00117 
00118 int mxcpcCameraSelector::cameraPort(void) {
00119   
00120   return(CameraPortSpinBox->value());
00121 }
00122 
00123 
00124 mxcpcProxyConfiguration mxcpcCameraSelector::cameraProxyConfiguration(void) {
00125 
00126   if(ProxyCheckBox->checkState() == Qt::Checked) {
00127     return(mxcpcProxyConfiguration(ProxyIPEdit->getIPAddress(),
00128                                    ProxyPortSpinBox->value()));
00129   }
00130   else {
00131     return(mxcpcProxyConfiguration());   // don't use any proxy
00132   }
00133 }
00134 
00135 
00136 void mxcpcCameraSelector::processProxyCheckBoxStateChanged(int state) {
00137 
00138   ProxyIPEdit->blockSignals(true);
00139   ProxyPortSpinBox->blockSignals(true);
00140   
00141   if(state == Qt::Checked) {
00142     ProxyIPEdit->setEnabled(true);
00143     ProxyPortSpinBox->setEnabled(true);
00144   }
00145   else {
00146     ProxyIPEdit->setEnabled(false);
00147     ProxyPortSpinBox->setEnabled(false);
00148   }
00149   
00150   ProxyIPEdit->blockSignals(false);
00151   ProxyPortSpinBox->blockSignals(false);
00152 }
00153 

Generated on Fri Jan 20 13:33:32 2006 for mxcpc by  doxygen 1.4.4