SceneSettingsDialog.ui.h

00001 /****************************************************************************
00002 ** ui.h extension file, included from the uic-generated form implementation.
00003 **
00004 ** If you want to add, delete, or rename functions or slots, use
00005 ** Qt Designer to update this file, preserving your code.
00006 **
00007 ** You should not define a constructor or destructor in this file.
00008 ** Instead, write your code in functions called init() and destroy().
00009 ** These will automatically be called by the form's constructor and
00010 ** destructor.
00011 *****************************************************************************/
00012 
00013 
00014 void SceneSettingsDialog::init( SceneGenerator *trainScene, SceneGenerator *testScene )
00015 {
00016   itsTrainScene = trainScene;
00017   itsTestScene = testScene;
00018 
00019   static bool setSceneTypeList = true;
00020 
00021   //Set up the lists of scene types
00022   if (setSceneTypeList)
00023   {
00024     for (uint i=0; i<itsTrainScene->getNumSceneTypes(); i++){
00025       itsTrainingSceneType->insertItem(
00026           QString(itsTrainScene->getSceneTypeNames(
00027               SceneGenerator::SceneType(i))));
00028 
00029       itsTestingSceneType->insertItem(
00030           QString(itsTestScene->getSceneTypeNames(
00031               SceneGenerator::SceneType(i))));
00032     }
00033     setSceneTypeList = false;
00034 
00035   }
00036 
00037 
00038   //set up the Train settings
00039   itsTrainingSceneType->setCurrentItem(itsTrainScene->getSceneType());
00040 
00041   itsTrainingTargetObject->setText(
00042       QString("%L1").arg(itsTrainScene->getTargetObject()));
00043 
00044   PixRGB<byte> targetColor = itsTrainScene->getTargetColor();
00045   itsTrainingTargetColorR->setText(QString("%L1").arg(targetColor[0]));
00046   itsTrainingTargetColorG->setText(QString("%L1").arg(targetColor[1]));
00047   itsTrainingTargetColorB->setText(QString("%L1").arg(targetColor[2]));
00048 
00049   itsTrainingLum->setText(
00050       QString("%L1").arg(itsTrainScene->getLum()));
00051 
00052   itsTrainingRotation->setText(
00053       QString("%L1").arg(itsTrainScene->getRotation()));
00054 
00055   PixRGB<byte> color = itsTrainScene->getColor();
00056   itsTrainingColorR->setText(QString("%L1").arg(color[0]));
00057   itsTrainingColorG->setText(QString("%L1").arg(color[1]));
00058   itsTrainingColorB->setText(QString("%L1").arg(color[2]));
00059 
00060   itsTrainingNoise->setText(
00061       QString("%L1").arg(itsTrainScene->getNoise()));
00062 
00063   PixRGB<byte> backColor = itsTrainScene->getBackgroundColor();
00064   itsTrainingBackColorR->setText(QString("%L1").arg(backColor[0]));
00065   itsTrainingBackColorG->setText(QString("%L1").arg(backColor[1]));
00066   itsTrainingBackColorB->setText(QString("%L1").arg(backColor[2]));
00067 
00068   //set up the Test settings
00069   itsTestingSceneType->setCurrentItem(itsTestScene->getSceneType());
00070 
00071   itsTestingTargetObject->setText(
00072       QString("%L1").arg(itsTestScene->getTargetObject()));
00073 
00074   targetColor = itsTestScene->getTargetColor();
00075   itsTestingTargetColorR->setText(QString("%L1").arg(targetColor[0]));
00076   itsTestingTargetColorG->setText(QString("%L1").arg(targetColor[1]));
00077   itsTestingTargetColorB->setText(QString("%L1").arg(targetColor[2]));
00078 
00079   itsTestingLum->setText(
00080       QString("%L1").arg(itsTestScene->getLum()));
00081 
00082   color = itsTestScene->getColor();
00083   itsTestingColorR->setText(QString("%L1").arg(color[0]));
00084   itsTestingColorG->setText(QString("%L1").arg(color[1]));
00085   itsTestingColorB->setText(QString("%L1").arg(color[2]));
00086 
00087   itsTestingNoise->setText(
00088       QString("%L1").arg(itsTestScene->getNoise()));
00089 
00090   backColor = itsTestScene->getBackgroundColor();
00091   itsTestingBackColorR->setText(QString("%L1").arg(backColor[0]));
00092   itsTestingBackColorG->setText(QString("%L1").arg(backColor[1]));
00093   itsTestingBackColorB->setText(QString("%L1").arg(backColor[2]));
00094 
00095   itsTestingRotation->setText(
00096       QString("%L1").arg(itsTestScene->getRotation()));
00097 }
00098 
00099 
00100 
00101 
00102 void SceneSettingsDialog::accept()
00103 {
00104 
00105   //set the train scene;
00106 
00107   itsTrainScene->setSceneType(
00108       (SceneGenerator::SceneType)itsTrainingSceneType->currentItem());
00109 
00110   itsTrainScene->setTargetObject(
00111       itsTrainingTargetObject->text().toInt());
00112 
00113   itsTrainScene->setTargetColor(PixRGB<byte>(
00114     itsTrainingTargetColorR->text().toInt(),
00115     itsTrainingTargetColorG->text().toInt(),
00116     itsTrainingTargetColorB->text().toInt()
00117     ));
00118 
00119   itsTrainScene->setLum(itsTrainingLum->text().toInt());
00120 
00121   itsTrainScene->setRotation(itsTrainingRotation->text().toInt());
00122 
00123   itsTrainScene->setColor(PixRGB<byte>(
00124     itsTrainingColorR->text().toInt(),
00125     itsTrainingColorG->text().toInt(),
00126     itsTrainingColorB->text().toInt()
00127     ));
00128 
00129   itsTrainScene->setNoise(itsTrainingNoise->text().toInt());
00130 
00131   itsTrainScene->setBackgroundColor(PixRGB<byte>(
00132     itsTrainingBackColorR->text().toInt(),
00133     itsTrainingBackColorG->text().toInt(),
00134     itsTrainingBackColorB->text().toInt()
00135     ));
00136 
00137 
00138   //set the Test scene;
00139 
00140   itsTestScene->setSceneType(
00141       (SceneGenerator::SceneType)itsTestingSceneType->currentItem());
00142 
00143   itsTestScene->setTargetObject(
00144       itsTestingTargetObject->text().toInt());
00145 
00146   itsTestScene->setTargetColor(PixRGB<byte>(
00147     itsTestingTargetColorR->text().toInt(),
00148     itsTestingTargetColorG->text().toInt(),
00149     itsTestingTargetColorB->text().toInt()
00150     ));
00151 
00152   itsTestScene->setLum(itsTestingLum->text().toInt());
00153 
00154   itsTestScene->setRotation(itsTestingRotation->text().toInt());
00155 
00156   itsTestScene->setColor(PixRGB<byte>(
00157     itsTestingColorR->text().toInt(),
00158     itsTestingColorG->text().toInt(),
00159     itsTestingColorB->text().toInt()
00160     ));
00161 
00162   itsTestScene->setNoise(itsTestingNoise->text().toInt());
00163 
00164   itsTestScene->setBackgroundColor(PixRGB<byte>(
00165     itsTestingBackColorR->text().toInt(),
00166     itsTestingBackColorG->text().toInt(),
00167     itsTestingBackColorB->text().toInt()
00168     ));
00169 
00170 
00171   close();
00172 
00173 }
Generated on Sun May 8 08:41:15 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3