neuroscopevideopage.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 NEUROSCOPEVIDEOPAGE_H
00021 #define NEUROSCOPEVIDEOPAGE_H
00022 
00023 //include files for the application
00024 #include <neuroscopevideolayout.h>
00025 
00026 // include files for QT
00027 #include <qwidget.h>
00028 #include <qvalidator.h>
00029 #include <qcombobox.h>
00030 #include <qpushbutton.h>
00031 #include <qlineedit.h>
00032 #include <qlabel.h>
00033 #include <qpixmap.h>
00034 #include <qimage.h>
00035 #include <qgroupbox.h>
00036 #include <qcheckbox.h> 
00037 
00038 // include files for KDE
00039 #include <kfiledialog.h>
00040 #include <klocale.h>
00041 
00042 //General C++ include files
00043 #include <iostream>
00044 using namespace std;
00045 
00046 
00050 class NeuroscopeVideoPage : public NeuroscopeVideoLayout
00051 {
00052 Q_OBJECT
00053 public:
00054     NeuroscopeVideoPage(QWidget* parent = 0, const char *name = 0);
00055     ~NeuroscopeVideoPage();
00056   
00058   inline void setBackgroundImage(QString image){  
00059    backgroundLineEdit->setText(image);
00060    if(image != ""){
00061     backgroungImage.load(image);
00062     if(backgroungImage != NULL){
00063      //flip and rotation values should have been set before any call to this function.
00064      updateDisplayedImage();
00065     }
00066    }
00067    else{
00068     QPixmap pixmap;
00069     pixmap.resize(width,height);
00070     pixmap.fill(black);
00071     backgroundPixmap->setPixmap(pixmap); 
00072    }
00073   };
00074   
00078   inline void setPositionsBackground(bool draw){checkBoxBackground->setChecked(draw);};
00079 
00081   inline void setRotation(int angle){
00082    switch(angle){
00083       case 0:
00084         rotateComboBox->setCurrentItem(0);
00085         break;
00086       case 90:
00087         rotateComboBox->setCurrentItem(1);
00088         break;
00089       case 180:
00090         rotateComboBox->setCurrentItem(2);
00091         break;
00092       case 270:
00093         rotateComboBox->setCurrentItem(3);
00094         break;
00095       default:
00096         rotateComboBox->setCurrentItem(0);
00097         break;
00098    }
00099   };
00100 
00104   inline void setFlip(int orientation){
00105    switch(orientation){
00106       case 0:
00107         filpComboBox->setCurrentItem(0);
00108         break;
00109       case 1:
00110         filpComboBox->setCurrentItem(1);
00111         break;
00112       case 2:
00113         filpComboBox->setCurrentItem(2);
00114         break;
00115       default:
00116         filpComboBox->setCurrentItem(0);
00117         break;
00118    }
00119   };
00120   
00122   inline QString getBackgroundImage()const{return backgroundLineEdit->text();};
00123 
00128   inline bool getPositionsBackground()const{return checkBoxBackground->isChecked();};
00129 
00130     
00132   inline int getRotation()const{
00133    switch(rotateComboBox->currentItem()){
00134       case 0:
00135         return 0;
00136       case 1:
00137         return 90;
00138       case 2:
00139         return 180;
00140       case 3:
00141         return 270;
00142       default:
00143         return 0;
00144    }
00145   };
00146 
00150   inline int getFlip()const{
00151    switch(filpComboBox->currentItem()){
00152       case 0:
00153         return 0;
00154       case 1:
00155         return 1;
00156       case 2:
00157         return 2;
00158       default:
00159         return 0;
00160    }
00161   };
00162 
00164  inline bool isModified()const{return modified;};
00165 
00167  inline void initialisationOver(){isInit = false;}
00168  
00169 private slots:
00170   inline void updateBackgroundImage(){
00171    QString image = KFileDialog::getOpenFileName(QString::null,
00172             QString::null, this, i18n("Select the background image..."));
00173 
00174    if(image != "") setBackgroundImage(image);
00175   };
00176 
00177   inline void updateBackgroundImage(const QString& image){
00178    if(image != "")  setBackgroundImage(image);
00179    else{
00180     QPixmap pixmap;
00181     pixmap.resize(width,height);
00182     pixmap.fill(black);
00183     backgroundPixmap->setPixmap(pixmap);
00184    }
00185   };
00186   
00187   void updateDisplayedImage();
00188   
00190  inline void propertyModified(){if(!isInit) modified = true;};
00191    
00193  inline void resetModificationStatus(){modified = false;};
00194  
00195  private:
00196   QImage backgroungImage;  
00197   int height;
00198   int width;
00199   bool modified;
00200   bool isInit;
00201 };
00202 
00203 #endif

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