00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef POSITIONPROPERTIES_H
00019 #define POSITIONPROPERTIES_H
00020
00021
00022 #include <qwidget.h>
00023 #include <qvalidator.h>
00024 #include <qcombobox.h>
00025 #include <qpushbutton.h>
00026 #include <qlineedit.h>
00027 #include <qlabel.h>
00028 #include <qpixmap.h>
00029 #include <qimage.h>
00030 #include <qgroupbox.h>
00031 #include <qcheckbox.h>
00032
00033
00034 #include <kfiledialog.h>
00035 #include <klocale.h>
00036
00037
00038 #include <positionpropertieslayout.h>
00039
00040 #include <iostream>
00041 using namespace std;
00042
00047 class PositionProperties : public PositionPropertiesLayout {
00048 Q_OBJECT
00049 public:
00050 PositionProperties(QWidget *parent=0, const char *name=0);
00051 ~PositionProperties();
00052
00054 inline void setSamplingRate(double rate){samplingRateLineEdit->setText(QString("%1").arg(rate,0,'g',14));};
00055
00057 inline void setWidth(int width){widthLineEdit->setText(QString("%1").arg(width));};
00058
00060 inline void setHeight(int height){heightLineEdit->setText(QString("%1").arg(height));};
00061
00063 inline void setBackgroundImage(QString image){
00064 backgroundLineEdit->setText(image);
00065 if(image != ""){
00066 backgroungImage.load(image);
00067 if(backgroungImage != NULL){
00068
00069 updateDisplayedImage();
00070 }
00071 }
00072 };
00073
00077 inline void setPositionsBackground(bool draw){checkBoxBackground->setChecked(draw);};
00078
00080 inline void setRotation(int angle){
00081 switch(angle){
00082 case 0:
00083 rotateComboBox->setCurrentItem(0);
00084 break;
00085 case 90:
00086 rotateComboBox->setCurrentItem(1);
00087 break;
00088 case 180:
00089 rotateComboBox->setCurrentItem(2);
00090 break;
00091 case 270:
00092 rotateComboBox->setCurrentItem(3);
00093 break;
00094 default:
00095 rotateComboBox->setCurrentItem(0);
00096 break;
00097 }
00098 };
00099
00103 inline void setFlip(int orientation){
00104 switch(orientation){
00105 case 0:
00106 filpComboBox->setCurrentItem(0);
00107 break;
00108 case 1:
00109 filpComboBox->setCurrentItem(1);
00110 break;
00111 case 2:
00112 filpComboBox->setCurrentItem(2);
00113 break;
00114 default:
00115 filpComboBox->setCurrentItem(0);
00116 break;
00117 }
00118 };
00119
00121 inline double getSamplingRate()const{return samplingRateLineEdit->text().toDouble();};
00122
00124 inline int getWidth()const{return widthLineEdit->text().toInt();};
00125
00127 inline int getHeight()const{return heightLineEdit->text().toInt();};
00128
00130 inline QString getBackgroundImage()const{return backgroundLineEdit->text();};
00131
00136 inline bool getPositionsBackground()const{return checkBoxBackground->isChecked();};
00137
00138
00140 inline int getRotation()const{
00141 switch(rotateComboBox->currentItem()){
00142 case 0:
00143 return 0;
00144 case 1:
00145 return 90;
00146 case 2:
00147 return 180;
00148 case 3:
00149 return 270;
00150 default:
00151 return 0;
00152 }
00153 };
00154
00158 inline int getFlip()const{
00159 switch(filpComboBox->currentItem()){
00160 case 0:
00161 return 0;
00162 case 1:
00163 return 1;
00164 case 2:
00165 return 2;
00166 default:
00167 return 0;
00168 }
00169 };
00170
00171 public slots:
00175 inline void setEnabled (bool state){
00176 groupBox1->setEnabled(state);
00177 groupBox2->setEnabled(state);
00178 samplingRateLineEdit->setEnabled(state);
00179 widthLineEdit->setEnabled(state);
00180 heightLineEdit->setEnabled(state);
00181 backgroundLineEdit->setEnabled(state);
00182 rotateComboBox->setEnabled(state);
00183 filpComboBox->setEnabled(state);
00184 backgroundButton->setEnabled(state);
00185 sampleRateLabel->setEnabled(state);
00186 widthLabel->setEnabled(state);
00187 heightLabel->setEnabled(state);
00188 backgroundLabel->setEnabled(state);
00189 rotateLabel->setEnabled(state);
00190 flipLabel->setEnabled(state);
00191
00192 if(!state){
00193 QPixmap pixmap;
00194 pixmap.resize(getWidth(),getHeight());
00195 pixmap.fill(black);
00196 backgroundPixmap->setPixmap(pixmap);
00197 }
00198 };
00199
00200
00201 private slots:
00202 inline void updateBackgroundImage(){
00203 QString image = KFileDialog::getOpenFileName(QString::null,
00204 QString::null, this, i18n("Select the background image..."));
00205
00206 if(image != "") setBackgroundImage(image);
00207 };
00208
00209 inline void updateBackgroundImage(const QString& image){
00210 if(image != "") setBackgroundImage(image);
00211 else{
00212 QPixmap pixmap;
00213 pixmap.resize(getWidth(),getHeight());
00214 pixmap.fill(black);
00215 backgroundPixmap->setPixmap(pixmap);
00216 }
00217 };
00218
00219 void updateDisplayedImage();
00220
00221 private:
00222 QIntValidator intValidator;
00223 QDoubleValidator doubleValidator;
00224 QImage backgroungImage;
00225 };
00226
00227 #endif