Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
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