acquisitionsystempage.h

00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Lynn Hazan                                      *
00003  *   lynn.hazan@myrealbox.com                                              *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef ACQUISITIONSYSTEMPAGE_H
00021 #define ACQUISITIONSYSTEMPAGE_H
00022 
00023 //include files for the application
00024 #include <acquisitionsystemlayout.h>
00025 
00026 // include files for QT
00027 #include <qwidget.h>
00028 #include <qcombobox.h>
00029 #include <qspinbox.h>
00030 #include <qpushbutton.h>
00031 #include <qlineedit.h>
00032 #include <qvalidator.h>
00033 
00034 // include files for KDE
00035 
00039 class AcquisitionSystemPage : public AcquisitionSystemLayout
00040 {
00041 Q_OBJECT
00042 public:
00043     AcquisitionSystemPage(QWidget* parent = 0, const char *name = 0);
00044 
00045     ~AcquisitionSystemPage();
00046     
00048   inline void setNbChannels(int nb){
00049    nbChannels = nb;
00050    nbChannelsLineEdit->setText(QString("%1").arg(nb));
00051   };
00052 
00054   inline void setSamplingRate(int rate){samplingRateLineEdit->setText(QString("%1").arg(rate));};
00055 
00057    inline void setResolution(int res){
00058     switch(res){
00059        case 12:
00060          resolutionComboBox->setCurrentItem(0);
00061          break;
00062        case 14:
00063          resolutionComboBox->setCurrentItem(1);
00064          break;
00065        case 16:
00066          resolutionComboBox->setCurrentItem(2);
00067          break;
00068        case 32:
00069          resolutionComboBox->setCurrentItem(3);
00070          break;
00071        default:
00072          resolutionComboBox->setCurrentItem(2);
00073          break;
00074     }
00075    };
00076    
00078   inline void setOffset(int offset){offsetLineEdit->setText(QString("%1").arg(offset));};
00079 
00082   inline void setVoltageRange(int value){
00083    voltageRangeLineEdit->setText(QString("%1").arg(value));
00084   };
00085 
00088   inline void setAmplification(int value){
00089    amplificationLineEdit->setText(QString("%1").arg(value));
00090   };
00091 
00093   inline int getNbChannels() const{return nbChannelsLineEdit->text().toInt();};
00094 
00096   inline int getSamplingRate() const{return samplingRateLineEdit->text().toInt();};
00097  
00099   inline int getResolution()const{
00100    switch(resolutionComboBox->currentItem()){
00101       case 0:
00102         return 12;
00103       case 1:
00104         return 14;
00105       case 2:
00106         return 16;
00107       case 3:
00108         return 32;
00109       default:
00110         return 16;
00111    }    
00112   };
00113   
00115   inline int getOffset() const{return offsetLineEdit->text().toInt();};
00116   
00119   inline int getVoltageRange() const{
00120    return voltageRangeLineEdit->text().toInt();
00121   };
00122 
00125   inline int getAmplification() const{
00126    return amplificationLineEdit->text().toInt();
00127   };
00128  
00130   inline bool isModified()const{return modified;};
00131  
00133   void checkNbChannels();
00134    
00135   public slots:
00137    void nbChannelsLineEditReturnPressed();
00138    
00140    void nbChannelsLineEditLostFocus(); 
00141   
00143   inline void propertyModified(){if(!isInit) modified = true;};
00144 
00146   inline void initialisationOver(){isInit = false;}
00147     
00149   inline void resetModificationStatus(){modified = false;};
00150    
00151   signals:
00152    /*Signals that the number of channels has been modified.
00153    * @param nbChannels the neew number of channels
00154    */
00155    void nbChannelsModified(int nbChannels);
00156    
00157   private:
00158   
00160   void nbChannelsChanged(); 
00161     
00162   QIntValidator intValidator;
00163   bool isInit;
00164   int nbChannels;
00165   bool reset;
00166   bool isLostFocus;
00167   bool isReturnPressed;
00168   bool modified;
00169   bool isCheckAsked;
00170 };
00171 
00172 #endif

Generated on Sat Sep 15 16:04:45 2007 for ndmanager.kdevelop by  doxygen 1.5.1