00001 /*************************************************************************** 00002 Picture.cc - description 00003 ------------------- 00004 begin : Thu Dec 30 1999 00005 copyright : (C) 1999 by Jurrien Loonstra 00006 email : j.h.loonstra@st.hanze.nl 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 #include "Picture.h" 00018 00019 #include <opie2/odebug.h> 00020 #include <opie2/oresource.h> 00021 #ifdef KDEVER 00022 #include <kapp.h> 00023 #include <kstandarddirs.h> 00024 #include <kdebug.h> 00025 #endif 00026 void Picture::load(const char *name, int index) { 00027 #ifdef KDEVER 00028 KStandardDirs dirs; 00029 QString file; 00030 00031 if (index>=0) { 00032 //kdDebug() << "Here"; 00033 QString sindex; 00034 sindex.setNum(index); 00035 // kdDebug() << "kbill/pixmaps/" + QString::fromLocal8Bit(name) + "_" + sindex + ".xpm"; 00036 file = dirs.findResource("data","kbill/pixmaps/" + QString::fromLocal8Bit(name) + "_" + sindex + ".xpm"); 00037 } else { 00038 file = dirs.findResource("data","kbill/pixmaps/" + QString::fromLocal8Bit(name) + ".xpm"); 00039 } 00040 kdDebug() << file << std::endl; 00041 pix = new QPixmap(); 00042 if (pix->load(file) == FALSE) 00043 oerr << "cannot open " << file << oendl; 00044 width = pix->width(); 00045 height = pix->height(); 00046 #endif 00047 QString sindex; 00048 //pix = new QPixmap(); 00049 sindex.setNum(index); 00050 if (index>=0) 00051 pix = new QPixmap( Opie::Core::OResource::loadPixmap( "kbill/pixmaps/" + QString::fromLocal8Bit(name) +"_"+ sindex ) ); 00052 else 00053 pix = new QPixmap( Opie::Core::OResource::loadPixmap( "kbill/pixmaps/" + QString::fromLocal8Bit(name) ) ); 00054 00055 width = pix->width(); 00056 height = pix->height(); 00057 00058 } 00059 00060 QPixmap* Picture::getPixmap() { 00061 return pix; 00062 }
1.4.2