author | mark <mark> | 2002-04-14 17:08:03 (UTC) |
---|---|---|
committer | mark <mark> | 2002-04-14 17:08:03 (UTC) |
commit | bfeb067c8acfb5f1797fdc886ac71ca1b10ccf57 (patch) (unidiff) | |
tree | ad77e90c90f4bfb598bbe93aa4b3e14b689c96f4 /noncore/games/kbill/Picture.cc | |
parent | a0fe593db4e700989cc19e28b67a58f87823afeb (diff) | |
download | opie-bfeb067c8acfb5f1797fdc886ac71ca1b10ccf57.zip opie-bfeb067c8acfb5f1797fdc886ac71ca1b10ccf57.tar.gz opie-bfeb067c8acfb5f1797fdc886ac71ca1b10ccf57.tar.bz2 |
Import of kbill
Diffstat (limited to 'noncore/games/kbill/Picture.cc') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/games/kbill/Picture.cc | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/noncore/games/kbill/Picture.cc b/noncore/games/kbill/Picture.cc new file mode 100644 index 0000000..79e19ba --- a/dev/null +++ b/noncore/games/kbill/Picture.cc | |||
@@ -0,0 +1,72 @@ | |||
1 | /*************************************************************************** | ||
2 | Picture.cc - description | ||
3 | ------------------- | ||
4 | begin : Thu Dec 30 1999 | ||
5 | copyright : (C) 1999 by Jurrien Loonstra | ||
6 | email : j.h.loonstra@st.hanze.nl | ||
7 | ***************************************************************************/ | ||
8 | |||
9 | /*************************************************************************** | ||
10 | * * | ||
11 | * This program is free software; you can redistribute it and/or modify * | ||
12 | * it under the terms of the GNU General Public License as published by * | ||
13 | * the Free Software Foundation; either version 2 of the License, or * | ||
14 | * (at your option) any later version. * | ||
15 | * * | ||
16 | ***************************************************************************/ | ||
17 | #include "Picture.h" | ||
18 | #include "objects.h" | ||
19 | |||
20 | #include <iostream.h> | ||
21 | |||
22 | #include <qstring.h> | ||
23 | #include <qpe/resource.h> | ||
24 | #ifdef KDEVER | ||
25 | #include <kapp.h> | ||
26 | #include <kstandarddirs.h> | ||
27 | #include <kdebug.h> | ||
28 | #endif | ||
29 | void Picture::load(const char *name, int index) { | ||
30 | //QString dir = KApplication::kde_datadir(), file; | ||
31 | // QString dir = locate("data",""),file; | ||
32 | // dir += "/kbill/"; | ||
33 | // if (index>=0) | ||
34 | // file.sprintf ("%spixmaps/%s_%d.xpm", (const char *)dir, name, index); | ||
35 | // else | ||
36 | // file.sprintf("%spixmaps/%s.xpm", (const char *)dir, name); | ||
37 | #ifdef KDEVER | ||
38 | KStandardDirs dirs; | ||
39 | QString file; | ||
40 | |||
41 | if (index>=0) { | ||
42 | //kdDebug() << "Here"; | ||
43 | QString sindex; | ||
44 | sindex.setNum(index); | ||
45 | // kdDebug() << "kbill/pixmaps/" + QString::fromLocal8Bit(name) + "_" + sindex + ".xpm"; | ||
46 | file = dirs.findResource("data","kbill/pixmaps/" + QString::fromLocal8Bit(name) + "_" + sindex + ".xpm"); | ||
47 | } else { | ||
48 | file = dirs.findResource("data","kbill/pixmaps/" + QString::fromLocal8Bit(name) + ".xpm"); | ||
49 | } | ||
50 | kdDebug() << file << endl; | ||
51 | pix = new QPixmap(); | ||
52 | if (pix->load(file) == FALSE) | ||
53 | cerr << "cannot open " << file << endl; | ||
54 | width = pix->width(); | ||
55 | height = pix->height(); | ||
56 | #endif | ||
57 | QString sindex; | ||
58 | pix = new QPixmap(); | ||
59 | sindex.setNum(index); | ||
60 | if (index>=0) | ||
61 | pix->load(Resource::findPixmap("kbill/pixmaps/" + QString::fromLocal8Bit(name) +"_"+ sindex)); | ||
62 | else | ||
63 | pix->load(Resource::findPixmap("kbill/pixmaps/" + QString::fromLocal8Bit(name))); | ||
64 | |||
65 | width = pix->width(); | ||
66 | height = pix->height(); | ||
67 | |||
68 | } | ||
69 | |||
70 | QPixmap* Picture::getPixmap() { | ||
71 | return pix; | ||
72 | } | ||