libyui-qt-pkg  2.45.13.1
YQIconPool.cc
1 /**************************************************************************
2 Copyright (C) 2000 - 2010 Novell, Inc.
3 All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 
19 **************************************************************************/
20 
21 
22 /*---------------------------------------------------------------------\
23 | |
24 | __ __ ____ _____ ____ |
25 | \ \ / /_ _/ ___|_ _|___ \ |
26 | \ V / _` \___ \ | | __) | |
27 | | | (_| |___) || | / __/ |
28 | |_|\__,_|____/ |_| |_____| |
29 | |
30 | core system |
31 | (C) SuSE GmbH |
32 \----------------------------------------------------------------------/
33 
34  File: YQIconPool.cc
35 
36  Author: Stefan Hundhammer <sh@suse.de>
37 
38 /-*/
39 
40 #include <qpixmap.h>
41 
42 #define YUILogComponent "qt-ui"
43 #include "YUILog.h"
44 
45 #include "YQIconPool.h"
46 
47 #include "icons/autodel.xpm"
48 #include "icons/autodel_disabled.xpm"
49 #include "icons/autoinstall.xpm"
50 #include "icons/autoinstall_disabled.xpm"
51 #include "icons/autoupdate.xpm"
52 #include "icons/autoupdate_disabled.xpm"
53 #include "icons/del.xpm"
54 #include "icons/del_disabled.xpm"
55 #include "icons/install.xpm"
56 #include "icons/install_disabled.xpm"
57 #include "icons/keepinstalled.xpm"
58 #include "icons/keepinstalled_disabled.xpm"
59 #include "icons/noinst.xpm"
60 #include "icons/noinst_disabled.xpm"
61 #include "icons/protected.xpm"
62 #include "icons/protected_disabled.xpm"
63 #include "icons/taboo.xpm"
64 #include "icons/taboo_disabled.xpm"
65 #include "icons/update.xpm"
66 #include "icons/update_disabled.xpm"
67 #include "icons/tree_plus.xpm"
68 #include "icons/tree_minus.xpm"
69 #include "icons/warning_sign.xpm"
70 #include "icons/satisfied.xpm"
71 
72 #include "icons/normal_conflict.xpm"
73 #include "icons/select_conflict.xpm"
74 #include "icons/delete_conflict.xpm"
75 #include "icons/unresolvable_conflict.xpm"
76 
77 #include "icons/checklist_off.xpm"
78 #include "icons/checklist_on.xpm"
79 
80 #include "icons/step_current.xpm"
81 #include "icons/step_todo.xpm"
82 #include "icons/step_done.xpm"
83 
84 #include "icons/tab_remove.xpm"
85 #include "icons/arrow_left.xpm"
86 #include "icons/arrow_right.xpm"
87 #include "icons/arrow_up.xpm"
88 #include "icons/arrow_down.xpm"
89 
90 
91 
92 YQIconPool * YQIconPool::_iconPool = 0;
93 
94 QPixmap YQIconPool::pkgTaboo() { return iconPool()->cachedIcon( taboo_xpm ); }
95 QPixmap YQIconPool::pkgDel() { return iconPool()->cachedIcon( del_xpm ); }
96 QPixmap YQIconPool::pkgUpdate() { return iconPool()->cachedIcon( update_xpm ); }
97 QPixmap YQIconPool::pkgInstall() { return iconPool()->cachedIcon( install_xpm ); }
98 QPixmap YQIconPool::pkgAutoInstall() { return iconPool()->cachedIcon( autoinstall_xpm ); }
99 QPixmap YQIconPool::pkgAutoUpdate() { return iconPool()->cachedIcon( autoupdate_xpm ); }
100 QPixmap YQIconPool::pkgAutoDel() { return iconPool()->cachedIcon( autodel_xpm ); }
101 QPixmap YQIconPool::pkgKeepInstalled() { return iconPool()->cachedIcon( keepinstalled_xpm ); }
102 QPixmap YQIconPool::pkgNoInst() { return iconPool()->cachedIcon( noinst_xpm ); }
103 QPixmap YQIconPool::pkgProtected() { return iconPool()->cachedIcon( protected_xpm ); }
104 
105 QPixmap YQIconPool::disabledPkgTaboo() { return iconPool()->cachedIcon( taboo_disabled_xpm ); }
106 QPixmap YQIconPool::disabledPkgDel() { return iconPool()->cachedIcon( del_disabled_xpm ); }
107 QPixmap YQIconPool::disabledPkgUpdate() { return iconPool()->cachedIcon( update_disabled_xpm ); }
108 QPixmap YQIconPool::disabledPkgInstall() { return iconPool()->cachedIcon( install_disabled_xpm ); }
109 QPixmap YQIconPool::disabledPkgAutoInstall() { return iconPool()->cachedIcon( autoinstall_disabled_xpm ); }
110 QPixmap YQIconPool::disabledPkgAutoUpdate() { return iconPool()->cachedIcon( autoupdate_disabled_xpm ); }
111 QPixmap YQIconPool::disabledPkgAutoDel() { return iconPool()->cachedIcon( autodel_disabled_xpm ); }
112 QPixmap YQIconPool::disabledPkgKeepInstalled() { return iconPool()->cachedIcon( keepinstalled_disabled_xpm ); }
113 QPixmap YQIconPool::disabledPkgNoInst() { return iconPool()->cachedIcon( noinst_disabled_xpm ); }
114 QPixmap YQIconPool::disabledPkgProtected() { return iconPool()->cachedIcon( protected_disabled_xpm ); }
115 
116 QPixmap YQIconPool::checkMarkOn() { return iconPool()->cachedIcon( checklist_on_xpm ); }
117 QPixmap YQIconPool::checkMarkOff() { return iconPool()->cachedIcon( checklist_off_xpm ); }
118 
119 QPixmap YQIconPool::normalPkgConflict() { return iconPool()->cachedIcon( normal_conflict_xpm ); }
120 QPixmap YQIconPool::severePkgConflict() { return iconPool()->cachedIcon( normal_conflict_xpm ); }
121 QPixmap YQIconPool::unresolvablePkgConflict() { return iconPool()->cachedIcon( unresolvable_conflict_xpm ); }
122 QPixmap YQIconPool::deletePkgConflict() { return iconPool()->cachedIcon( delete_conflict_xpm ); }
123 QPixmap YQIconPool::tabooPkgConflict() { return iconPool()->cachedIcon( normal_conflict_xpm ); }
124 QPixmap YQIconPool::selectPkgConflict() { return iconPool()->cachedIcon( select_conflict_xpm ); }
125 
126 QPixmap YQIconPool::treePlus() { return iconPool()->cachedIcon( tree_plus_xpm ); }
127 QPixmap YQIconPool::treeMinus() { return iconPool()->cachedIcon( tree_minus_xpm ); }
128 
129 QPixmap YQIconPool::warningSign() { return iconPool()->cachedIcon( warning_sign_xpm ); }
130 QPixmap YQIconPool::pkgSatisfied() { return iconPool()->cachedIcon( satisfied_xpm ); }
131 
132 QPixmap YQIconPool::stepCurrent() { return iconPool()->cachedIcon( step_current_xpm ); }
133 QPixmap YQIconPool::stepToDo() { return iconPool()->cachedIcon( step_todo_xpm ); }
134 QPixmap YQIconPool::stepDone() { return iconPool()->cachedIcon( step_done_xpm ); }
135 
136 QPixmap YQIconPool::tabRemove() { return iconPool()->cachedIcon( tab_remove_xpm ); }
137 QPixmap YQIconPool::arrowLeft() { return iconPool()->cachedIcon( arrow_left_xpm ); }
138 QPixmap YQIconPool::arrowRight() { return iconPool()->cachedIcon( arrow_right_xpm ); }
139 QPixmap YQIconPool::arrowUp() { return iconPool()->cachedIcon( arrow_up_xpm ); }
140 QPixmap YQIconPool::arrowDown() { return iconPool()->cachedIcon( arrow_down_xpm ); }
141 
142 
144 {
145  if ( ! _iconPool )
146  _iconPool = new YQIconPool();
147 
148  return _iconPool;
149 }
150 
151 
152 YQIconPool::YQIconPool()
153 {
154 }
155 
156 
157 YQIconPool::~YQIconPool()
158 {
159  // NOP
160 }
161 
162 
163 
164 QPixmap
165 YQIconPool::cachedIcon( const char ** xpm_data )
166 {
167  QPixmap iconPtr = _iconCache[ xpm_data ];
168 
169  if ( iconPtr.isNull() )
170  {
171  iconPtr = QPixmap( xpm_data );
172  _iconCache.insert( xpm_data, iconPtr );
173  }
174 
175  return iconPtr;
176 }
177 
static YQIconPool * iconPool()
Return the global icon pool.
Definition: YQIconPool.cc:143
QPixmap cachedIcon(const char **xpm_data)
Return the cached icon for &#39;xpm_data&#39; ( an included XPM file ).
Definition: YQIconPool.cc:165