filepage.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 FILEPAGE_H
00021 #define FILEPAGE_H
00022 
00023 //include files for the application
00024 #include <filelayout.h>
00025 
00026 // include files for QT
00027 #include <qwidget.h>
00028 #include <qtable.h>
00029 #include <qlineedit.h>
00030 #include <qregexp.h>
00031 
00032 // include files for KDE
00033 
00034 
00035 //General C++ include files
00036 #include <iostream>
00037 using namespace std;
00038 
00043 class FilePage : public FileLayout
00044 {
00045 Q_OBJECT
00046 public:
00048  FilePage(QWidget *parent = 0, const char *name = 0);
00049  
00051  ~FilePage();
00052 
00054 inline void setSamplingRate(float rate){samplingRateLineEdit->setText(QString("%1").arg(rate));};
00055 
00057 inline void setExtension(QString extension){
00058  this->extension = extension;
00059  extensionLineEdit->setText(extension);
00060 };
00061 
00065 void setChannelMapping(const QMap<int, QValueList<int> >& channels);
00066 
00070 QMap<int, QValueList<int> > getChannelMapping()const;
00071 
00073 inline float getSamplingRate() const{return samplingRateLineEdit->text().toFloat();};
00074 
00076 inline QString getExtension() const{return extensionLineEdit->text();};
00077 
00079 inline bool isModified()const{return modified;};
00080 
00081 signals:
00086  void extensionChanged(const QString& extension,FilePage* filePage);
00087 
00088 protected:
00093  bool eventFilter(QObject* object,QEvent* event);
00094  
00095 public slots:
00096  
00098  inline void changeCaption(){
00099   if(extensionLineEdit->text() != extension){
00100    extension = extensionLineEdit->text();
00101    emit extensionChanged(extension,this);
00102   }
00103  };
00104 
00106  void addChannel();
00107  
00109  void removeChannel();
00110  
00112  inline void slotValidate(){
00113   modified = true;
00114   if(isIncorrectRow){
00115    mappingTable->selectRow(incorrectRow);
00116    mappingTable->editCell(incorrectRow,0);
00117   }
00118  };
00119  
00121  inline void mappingChanged(int row,int column){
00122   modified = true;
00123   QString channel = mappingTable->text(row,column);
00124   //the group entry should only contain digits and whitespaces
00125   if(channel.contains(QRegExp("[^\\d\\s]")) != 0){
00126    isIncorrectRow = true;
00127    incorrectRow = row;
00128    mappingTable->selectRow(row);
00129   }
00130   else{
00131    if(isIncorrectRow){
00132     QString incorrectMapping = mappingTable->text(incorrectRow,0);
00133     if(incorrectMapping.contains(QRegExp("[^\\d\\s]")) != 0) return;
00134    }
00135    isIncorrectRow = false;
00136    mappingTable->adjustColumn(column);
00137   } 
00138  };
00139  
00141  inline void propertyModified(){
00142 
00143 cout<<"in propertyModified isInit "<<isInit<<endl;
00144 if(!isInit) modified = true;};
00145 
00147  inline void initialisationOver(){isInit = false;}
00148  
00150  inline void resetModificationStatus(){modified = false;};
00151  
00152 private:
00153  bool isIncorrectRow;
00154  int incorrectRow;
00155  bool modified;
00156  bool isInit;
00157  QString extension; 
00158 };
00159 
00160 #endif

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