summaryrefslogtreecommitdiff
path: root/noncore/games/kbill/Picture.cc
Unidiff
Diffstat (limited to 'noncore/games/kbill/Picture.cc') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/kbill/Picture.cc72
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
29void 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
57QString sindex;
58pix = new QPixmap();
59sindex.setNum(index);
60if (index>=0)
61pix->load(Resource::findPixmap("kbill/pixmaps/" + QString::fromLocal8Bit(name) +"_"+ sindex));
62else
63pix->load(Resource::findPixmap("kbill/pixmaps/" + QString::fromLocal8Bit(name)));
64
65 width = pix->width();
66 height = pix->height();
67
68}
69
70QPixmap* Picture::getPixmap() {
71 return pix;
72}