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

mxcpcIPEdit.cpp

00001 //           ///          //                                        Mx clientSDK
00002 //          /////        ////                    Mx Crossplatform Client Library
00003 //         /// XXX     XXX ///
00004 //        ///    XXX XXX    ///     $RCSfile: mxcpcIPEdit.cpp,v $
00005 //       ///       XXX       ///     $Revision: 1.3 $
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 <mxcpcIPEdit.h>
00021 #include <mxcpc_gui_config.h>
00022 
00023 #include <QLayout>
00024 #include <QSpinBox>
00025 #include <QLabel>
00026 
00027 
00028 
00029 mxcpcIPEdit::mxcpcIPEdit(QWidget *parent) : QWidget(parent) {
00030 
00031   QHBoxLayout *layout;
00032   QSpinBox *spin_box;
00033   QLabel *label;
00034   int i;
00035   
00036   layout = new QHBoxLayout(this);
00037   layout->setMargin(0);
00038   //layout->setSizeConstraint(QLayout::SetFixedSize);
00039   
00040   for(i = 0; i < 4; i++) {
00041   
00042     IPEdit[i] = spin_box = new QSpinBox(this);
00043     layout->addWidget(spin_box);
00044     spin_box->setMinimum(0);
00045     spin_box->setMaximum(255);
00046                                         
00047     if(i < 3) {
00048       
00049       label = new QLabel(QString("."), this);
00050       layout->addWidget(label);
00051       label->setSizePolicy(QSizePolicy(QSizePolicy::Fixed,
00052                                        QSizePolicy::Fixed));
00053     }
00054   }
00055   
00056   setIPAddress(mxcpcIPAddress(10, 0, 0, 1));
00057 }
00058 
00059 
00060 
00061 void mxcpcIPEdit::setIPAddress(const mxcpcIPAddress& ip) {
00062  
00063   int i;
00064   
00065   for(i = 0; i < 4; i++) IPEdit[i]->blockSignals(true);
00066   IPEdit[0]->setValue(ip.getIP1());
00067   IPEdit[1]->setValue(ip.getIP2());
00068   IPEdit[2]->setValue(ip.getIP3());
00069   IPEdit[3]->setValue(ip.getIP4());
00070   for(i = 0; i < 4; i++) IPEdit[i]->blockSignals(false);
00071 }
00072 
00073 
00074 mxcpcIPAddress mxcpcIPEdit::getIPAddress(void) {
00075 
00076   return(mxcpcIPAddress(IPEdit[0]->value(),
00077                         IPEdit[1]->value(),
00078                         IPEdit[2]->value(),
00079                         IPEdit[3]->value()));
00080 }

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