author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /microkde/kiconloader.cpp | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-p1.zip kdepimpi-p1.tar.gz kdepimpi-p1.tar.bz2 |
initial public commit of qt4 portp1
-rw-r--r-- | microkde/kiconloader.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/microkde/kiconloader.cpp b/microkde/kiconloader.cpp index 4842d71..e7f657d 100644 --- a/microkde/kiconloader.cpp +++ b/microkde/kiconloader.cpp | |||
@@ -1,140 +1,142 @@ | |||
1 | 1 | ||
2 | #include "kiconloader.h" | 2 | #include "kiconloader.h" |
3 | #include "kglobal.h" | 3 | #include "kglobal.h" |
4 | 4 | ||
5 | #ifndef DESKTOP_VERSION_OEGEL | 5 | #ifndef DESKTOP_VERSION_OEGEL |
6 | #include <qdir.h> | 6 | #include <qdir.h> |
7 | //Added by qt3to4: | ||
8 | #include <QPixmap> | ||
7 | QPixmap KIconLoader::loadIcon( const QString& name, KIcon::Group, int, | 9 | QPixmap KIconLoader::loadIcon( const QString& name, KIcon::Group, int, |
8 | int, QString *, bool ) const | 10 | int, QString *, bool ) const |
9 | { | 11 | { |
10 | QPixmap pix; | 12 | QPixmap pix; |
11 | QString file; | 13 | QString file; |
12 | file = iconPath() + name+".png"; | 14 | file = iconPath() + name+".png"; |
13 | pix.load ( file ); | 15 | pix.load ( file ); |
14 | // qDebug("KIconLoader::loadIcon %s -----------", file.latin1()); | 16 | // qDebug("KIconLoader::loadIcon %s -----------", file.latin1()); |
15 | return pix; | 17 | return pix; |
16 | } | 18 | } |
17 | QIconSet KIconLoader::loadIconSet( const QString& name) const | 19 | QIcon KIconLoader::loadIconSet( const QString& name) const |
18 | { | 20 | { |
19 | QPixmap pixmapLoader; | 21 | QPixmap pixmapLoader; |
20 | QString file; | 22 | QString file; |
21 | file = iconPath() + name+".png"; | 23 | file = iconPath() + name+".png"; |
22 | pixmapLoader.load( file ); | 24 | pixmapLoader.load( file ); |
23 | //qDebug("KIconLoader::loadIconSet: %s ************", file.latin1() ); | 25 | //qDebug("KIconLoader::loadIconSet: %s ************", file.latin1() ); |
24 | QIconSet is ( pixmapLoader ); | 26 | QIcon is ( pixmapLoader ); |
25 | return is; | 27 | return is; |
26 | } | 28 | } |
27 | 29 | ||
28 | QPixmap BarIcon( const QString &name ) | 30 | QPixmap BarIcon( const QString &name ) |
29 | { | 31 | { |
30 | QPixmap pix; | 32 | QPixmap pix; |
31 | pix.load ( KGlobal::iconLoader()->iconPath() + name +".png" ); | 33 | pix.load ( KGlobal::iconLoader()->iconPath() + name +".png" ); |
32 | return pix; | 34 | return pix; |
33 | } | 35 | } |
34 | 36 | ||
35 | QPixmap DesktopIcon( const QString &name, int ) | 37 | QPixmap DesktopIcon( const QString &name, int ) |
36 | { | 38 | { |
37 | QPixmap pix; | 39 | QPixmap pix; |
38 | pix.load ( KGlobal::iconLoader()->iconPath() + name +".png" ); | 40 | pix.load ( KGlobal::iconLoader()->iconPath() + name +".png" ); |
39 | return pix; | 41 | return pix; |
40 | 42 | ||
41 | } | 43 | } |
42 | 44 | ||
43 | QPixmap SmallIcon( const QString &name ) | 45 | QPixmap SmallIcon( const QString &name ) |
44 | { | 46 | { |
45 | QPixmap pixmapLoader; | 47 | QPixmap pixmapLoader; |
46 | QString file; | 48 | QString file; |
47 | file =KGlobal::iconLoader()->iconPath() + name +".png"; | 49 | file =KGlobal::iconLoader()->iconPath() + name +".png"; |
48 | pixmapLoader.load( file ); | 50 | pixmapLoader.load( file ); |
49 | return pixmapLoader; | 51 | return pixmapLoader; |
50 | 52 | ||
51 | } | 53 | } |
52 | 54 | ||
53 | QPixmap SmallIconSet( const QString &name ) | 55 | QPixmap SmallIconSet( const QString &name ) |
54 | { | 56 | { |
55 | QPixmap pixmapLoader; | 57 | QPixmap pixmapLoader; |
56 | QString file; | 58 | QString file; |
57 | file =KGlobal::iconLoader()->iconPath() + name +".png"; | 59 | file =KGlobal::iconLoader()->iconPath() + name +".png"; |
58 | pixmapLoader.load( file ); | 60 | pixmapLoader.load( file ); |
59 | return pixmapLoader; | 61 | return pixmapLoader; |
60 | } | 62 | } |
61 | 63 | ||
62 | 64 | ||
63 | #else | 65 | #else |
64 | 66 | ||
65 | #include <qpe/resource.h> | 67 | #include <qpe/resource.h> |
66 | #include <kglobal.h> | 68 | #include <kglobal.h> |
67 | QPixmap KIconLoader::loadIcon( const QString& name, KIcon::Group, int, | 69 | QPixmap KIconLoader::loadIcon( const QString& name, KIcon::Group, int, |
68 | int, QString *, bool ) const | 70 | int, QString *, bool ) const |
69 | { | 71 | { |
70 | QString px = this->iconPath() + "/" + name; | 72 | QString px = this->iconPath() + "/" + name; |
71 | 73 | ||
72 | QPixmap p = Resource::loadPixmap( px ); | 74 | QPixmap p = Resource::loadPixmap( px ); |
73 | QPixmap* pPtr = &p; | 75 | QPixmap* pPtr = &p; |
74 | if (pPtr == 0) | 76 | if (pPtr == 0) |
75 | qDebug("KIconLoader::loadIcon: %s not found", px.latin1()); | 77 | qDebug("KIconLoader::loadIcon: %s not found", px.latin1()); |
76 | 78 | ||
77 | return p; | 79 | return p; |
78 | } | 80 | } |
79 | 81 | ||
80 | QIconSet KIconLoader::loadIconSet( const QString& name) const | 82 | QIcon KIconLoader::loadIconSet( const QString& name) const |
81 | { | 83 | { |
82 | QString px = this->iconPath() + "/" + name; | 84 | QString px = this->iconPath() + "/" + name; |
83 | 85 | ||
84 | QIconSet is ;//= Resource::loadIconSet( px ); | 86 | QIcon is ;//= Resource::loadIconSet( px ); |
85 | QIconSet* isPtr = 0;//LR&is; | 87 | QIcon* isPtr = 0;//LR&is; |
86 | if (isPtr == 0) | 88 | if (isPtr == 0) |
87 | qDebug("KIconLoader::loadIconSet: %s not foun", px.latin1()); | 89 | qDebug("KIconLoader::loadIconSet: %s not foun", px.latin1()); |
88 | 90 | ||
89 | return is; | 91 | return is; |
90 | } | 92 | } |
91 | 93 | ||
92 | QPixmap BarIcon( const QString &name ) | 94 | QPixmap BarIcon( const QString &name ) |
93 | { | 95 | { |
94 | QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop); | 96 | QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop); |
95 | return p; | 97 | return p; |
96 | } | 98 | } |
97 | 99 | ||
98 | QPixmap DesktopIcon( const QString &name, int ) | 100 | QPixmap DesktopIcon( const QString &name, int ) |
99 | { | 101 | { |
100 | QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop); | 102 | QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop); |
101 | return p; | 103 | return p; |
102 | } | 104 | } |
103 | 105 | ||
104 | QPixmap SmallIcon( const QString &name ) | 106 | QPixmap SmallIcon( const QString &name ) |
105 | { | 107 | { |
106 | QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop); | 108 | QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop); |
107 | return p; | 109 | return p; |
108 | } | 110 | } |
109 | 111 | ||
110 | QPixmap SmallIconSet( const QString &name ) | 112 | QPixmap SmallIconSet( const QString &name ) |
111 | { | 113 | { |
112 | QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop); | 114 | QPixmap p = KGlobal::iconLoader()->loadIcon(name, KIcon::Desktop); |
113 | return p; | 115 | return p; |
114 | } | 116 | } |
115 | 117 | ||
116 | #endif | 118 | #endif |
117 | 119 | ||
118 | //US | 120 | //US |
119 | QString KIconLoader::setIconPath( const QString &iconpath) | 121 | QString KIconLoader::setIconPath( const QString &iconpath) |
120 | { | 122 | { |
121 | QString _old = mIconpath; | 123 | QString _old = mIconpath; |
122 | mIconpath = iconpath; | 124 | mIconpath = iconpath; |
123 | 125 | ||
124 | return _old; | 126 | return _old; |
125 | } | 127 | } |
126 | QString KIconLoader::iconPath( const QString & name, int ) const | 128 | QString KIconLoader::iconPath( const QString & name, int ) const |
127 | { | 129 | { |
128 | return mIconpath + name + ".png"; | 130 | return mIconpath + name + ".png"; |
129 | } | 131 | } |
130 | 132 | ||
131 | QString KIconLoader::iconPath( /*US const QString &, int */) const | 133 | QString KIconLoader::iconPath( /*US const QString &, int */) const |
132 | { | 134 | { |
133 | // LR we set the path at startup | 135 | // LR we set the path at startup |
134 | // if (KGlobal::getDesktopSize() == KGlobal::Small) | 136 | // if (KGlobal::getDesktopSize() == KGlobal::Small) |
135 | //return mIconpath + "/icons16"; | 137 | //return mIconpath + "/icons16"; |
136 | 138 | ||
137 | //Fall back to the defaultpath | 139 | //Fall back to the defaultpath |
138 | return mIconpath; | 140 | return mIconpath; |
139 | } | 141 | } |
140 | 142 | ||