ImageSourceSelector.cpp
Go to the documentation of this file.
00001 /*******************************************************************************
00002  *  ImageSourceSelector.cpp
00003  *
00004  *  (C) 2007 AG Aktives Sehen <agas@uni-koblenz.de>
00005  *           Universitaet Koblenz-Landau
00006  *
00007  *  Additional information:
00008  *  $Id: $ 
00009  *******************************************************************************/
00010 
00011 #include "ImageSourceSelector.h"
00012 #include <map>
00013 
00014 #define THIS ImageSourceSelector
00015 
00016 THIS::THIS( ImageSources::SourceId sourceId, QWidget* parent, ImageSources::SourceId firstSource, ImageSources::SourceId lastSource ): QComboBox( parent )
00017 {
00018   
00019   std::map< ImageSources::SourceId, std::string > sourceDesc=ImageSources::getSourceDesc();
00020   std::map< ImageSources::SourceId, std::string >::iterator it;
00021   int i=0;
00022   int myEntry=0;
00023   for ( it=sourceDesc.begin(); it!=sourceDesc.end(); it++ )
00024   {
00025     if ( ( it->first < firstSource ) || ( it->first > lastSource ) )
00026     {
00027       continue;
00028     }
00029     std::ostringstream stream;
00030     stream.width(3);
00031     stream.fill('0');
00032     stream << int(it->first);
00033     stream << " " << it->second;
00034     addItem( stream.str().c_str() , it->first);
00035     if ( it->first==sourceId ) { myEntry=i; }
00036     m_SelectorSourceIds[i]=it->first;
00037     i++;
00038   }
00039   setCurrentIndex(myEntry);
00040 
00041   connect( this, SIGNAL(activated(int)), this, SLOT(selectSource(int)));
00042   
00043 }
00044 
00045 THIS::~THIS()
00046 {
00047 }
00048 
00049 void THIS::selectSource( int index )
00050 {
00051   emit sourceSelected( m_SelectorSourceIds[ index ] );
00052 }
00053 
00054 #undef THIS


obj_rec_gui
Author(s): AGAS/agas@uni-koblenz.de
autogenerated on Mon Oct 6 2014 02:53:43