00001 #include <OTIcons.h>
00002
00003 #include <opie2/odebug.h>
00004 #include <qpe/resource.h>
00005
00006 using namespace Opietooth2;
00007
00008 OTIcons::OTIcons() : deviceIcons(), serviceIcons() {
00009
00010
00011 deviceIcons.insert( "unknown", "unknown_16" );
00012 deviceIcons.insert( "misc", "misc_16" );
00013 deviceIcons.insert( "computer", "computer_16" );
00014 deviceIcons.insert( "phone", "phone_16" );
00015 deviceIcons.insert( "lan", "network_16" );
00016 deviceIcons.insert( "audiovideo", "audio_16" );
00017 deviceIcons.insert( "peripheral", "print_16" );
00018 deviceIcons.insert( "imaging", "other_16" );
00019
00020 serviceIcons.insert( 0x1101 , "serial_16" );
00021 serviceIcons.insert( 0x1102 , "network_16" );
00022 serviceIcons.insert( 0x1103 , "network_16");
00023 serviceIcons.insert( 0x1104 , "sync_16" );
00024 serviceIcons.insert( 0x1105 , "obex_16" );
00025 serviceIcons.insert( 0x1106 , "obex_16" );
00026 serviceIcons.insert( 0x1107 , "sync_16" );
00027 serviceIcons.insert( 0x1108 , "phone_16");
00028 serviceIcons.insert( 0x1109 , "phone_16");
00029 serviceIcons.insert( 0x110A , "audio_16");
00030 serviceIcons.insert( 0x110B , "audio_16");
00031
00032
00033
00034
00035
00036 serviceIcons.insert( 0x1111 , "fax_16" );
00037 serviceIcons.insert( 0x1112 , "audio_16");
00038
00039
00040 serviceIcons.insert( 0x1115 , "network_16");
00041 serviceIcons.insert( 0x1116 , "network_16");
00042 serviceIcons.insert( 0x1117 , "network_16");
00043 serviceIcons.insert( 0x1118 , "print_16" );
00044 serviceIcons.insert( 0x1119 , "print_16" );
00045
00046
00047
00048
00049
00050
00051 serviceIcons.insert( 0x1120 , "print_16" );
00052
00053 serviceIcons.insert( 0x1122 , "print_16" );
00054 serviceIcons.insert( 0x1123 , "print_16" );
00055
00056
00057 serviceIcons.insert( 0x1126 , "print_16" );
00058 serviceIcons.insert( 0x1127 , "print_16" );
00059 serviceIcons.insert( 0x1128 , "phone_16" );
00060
00061
00062
00063 serviceIcons.insert( 0x1201 , "network_16" );
00064 serviceIcons.insert( 0x1202 , "folder_16" );
00065 serviceIcons.insert( 0x1203 , "audio_16" );
00066 serviceIcons.insert( 0x1204 , "phone_16" );
00067
00068
00069
00070 Modems.resize( 3 );
00071 Modems[0].setUUID32( 0x1101 );
00072 Modems[1].setUUID32( 0x1102 );
00073 Modems[2].setUUID32( 0x1103 );
00074
00075 Networks.resize( 3 );
00076 Networks[0].setUUID32( 0x1115 );
00077 Networks[1].setUUID32( 0x1116 );
00078 Networks[2].setUUID32( 0x1117 );
00079 }
00080
00081 OTIcons::~OTIcons() {
00082 }
00083
00084 QPixmap OTIcons::deviceIcon( const QString & deviceClass ) {
00085
00086 QString iconName;
00087
00088 QMap<QString, QString>::Iterator it;
00089
00090 it = deviceIcons.find( deviceClass );
00091 iconName = it.data();
00092
00093 if ( iconName.isEmpty() ) {
00094 iconName = "unknown_16";
00095 }
00096 return loadPixmap( iconName, 1 );
00097 }
00098
00099 QPixmap OTIcons::serviceIcon( int serviceClass, bool & found ) {
00100
00101 QString iconName;
00102
00103 QMap<int, QString>::Iterator it;
00104
00105 it = serviceIcons.find( serviceClass );
00106 iconName = it.data();
00107
00108 if ( iconName.isEmpty() ) {
00109 iconName = "unknown_16";
00110 found = 0 ;
00111 } else
00112 found = 1 ;
00113 return loadPixmap( iconName, 1 );
00114 }
00115
00116 QPixmap OTIcons::loadPixmap( const QString & name, bool Sub ) {
00117 return( Resource::loadPixmap( "opietooth/" +
00118 QString( (Sub) ? "icons/" : "" ) +
00119 name ) );
00120 }