17 #include <tqstringlist.h> 18 #include <tqptrlist.h> 19 #include <tqintdict.h> 21 #include <tqpixmapcache.h> 23 #include <tqfileinfo.h> 25 #include <tqiconset.h> 29 #include <tdeapplication.h> 32 #include <kstandarddirs.h> 33 #include <tdeglobal.h> 34 #include <tdeconfig.h> 35 #include <ksimpleconfig.h> 36 #include <kinstance.h> 38 #include <kicontheme.h> 39 #include <kiconloader.h> 40 #include <kiconeffect.h> 42 #include <sys/types.h> 50 #include "svgicons/ksvgiconengine.h" 51 #include "svgicons/ksvgiconpainter.h" 54 #include <kimageeffect.h> 56 #include "kiconloader_p.h" 58 #include "../q4os/dpi1.cc" 67 TDEIconThemeNode::~TDEIconThemeNode()
72 void TDEIconThemeNode::printTree(TQString& dbgString)
const 77 dbgString += theme->
name();
81 void TDEIconThemeNode::queryIcons(TQStringList *result,
85 *result += theme->queryIcons(size, context);
88 void TDEIconThemeNode::queryIconsByContext(TQStringList *result,
92 *result += theme->queryIconsByContext(size, context);
95 TDEIcon TDEIconThemeNode::findIcon(
const TQString& name,
int size,
98 return theme->iconPath(name, size, match);
116 #ifdef TDEICONLOADER_DEBUG 119 struct TDEIconLoaderDebug
122 : loader( l ), appname( a ), valid( true )
124 TDEIconLoaderDebug() {};
131 static TQValueList< TDEIconLoaderDebug > *kiconloaders;
138 #ifdef TDEICONLOADER_DEBUG 139 if( kiconloaders == NULL )
140 kiconloaders =
new TQValueList< TDEIconLoaderDebug>();
143 for( TQValueList< TDEIconLoaderDebug >::Iterator it = kiconloaders->begin();
144 it != kiconloaders->end();
147 if( (*it).loader ==
this )
148 it = kiconloaders->remove( it );
152 kiconloaders->append( TDEIconLoaderDebug(
this, _appname ));
156 d =
new TDEIconLoaderPrivate;
159 d->imgDict.setAutoDelete(
true);
160 d->links.setAutoDelete(
true);
163 kapp->addKipcEventMask(KIPC::IconChanged);
164 TQObject::connect(kapp, TQT_SIGNAL(updateIconLoaders()), d, TQT_SLOT(reconfigure()));
167 init( _appname, _dirs );
174 d->mThemesInTree.clear();
175 d->lastImage.reset();
176 d->lastImageKey = TQString::null;
177 delete [] d->mpGroups;
179 init( _appname, _dirs );
182 void TDEIconLoader::init(
const TQString& _appname,
TDEStandardDirs *_dirs )
188 d->appname = _appname;
189 d->extraDesktopIconsLoaded =
false;
190 d->delayedLoading =
false;
197 TQString appname = _appname;
198 if (appname.isEmpty())
207 kdDebug(264) <<
"Couldn't find current icon theme, falling back to default." <<
endl;
211 kdError(264) <<
"Error: standard icon theme" 213 <<
" not found!" <<
endl;
218 d->mpThemeRoot =
new TDEIconThemeNode(def);
219 d->links.append(d->mpThemeRoot);
221 addBaseThemes(d->mpThemeRoot, appname);
224 static const char *
const groups[] = {
"Desktop",
"Toolbar",
"MainToolbar",
"Small",
"Panel", 0L };
229 const int hsystem_dpi = get_q4dpi();
235 config->
setGroup(TQString::fromLatin1(groups[i]) +
"Icons");
237 d->mpGroups[i].dblPixels = config->
readBoolEntry(
"DoublePixels",
false);
238 if (TQPixmap::defaultDepth()>8)
239 d->mpGroups[i].alphaBlending = config->
readBoolEntry(
"AlphaBlending",
true);
241 d->mpGroups[i].alphaBlending =
false;
243 if (!d->mpGroups[i].size)
244 d->mpGroups[i].size = d->mpThemeRoot->theme->defaultSize(i);
247 d->mpGroups[i].size = recalculate_iconsize_by_dpi( d->mpGroups[i].size, hsystem_dpi );
256 appname +
"/toolbar/");
260 dirs += d->mpDirs->resourceDirs(
"icon");
261 dirs += d->mpDirs->resourceDirs(
"pixmap");
262 dirs += d->mpDirs->resourceDirs(
"xdgdata-icon");
263 dirs +=
"/usr/share/pixmaps";
265 dirs += d->mpDirs->resourceDirs(
"xdgdata-pixmap");
266 for (TQStringList::ConstIterator it = dirs.begin(); it != dirs.end(); ++it)
267 d->mpDirs->addResourceDir(
"appicon", *it);
270 TQString dbgString =
"Theme tree: ";
271 d->mpThemeRoot->printTree(dbgString);
272 kdDebug(264) << dbgString <<
endl;
278 #ifdef TDEICONLOADER_DEBUG 279 for( TQValueList< TDEIconLoaderDebug >::Iterator it = kiconloaders->begin();
280 it != kiconloaders->end();
283 if( (*it).loader ==
this )
286 (*it).delete_bt = kdBacktrace();
294 delete[] d->mpGroups;
300 d->delayedLoading = enable;
305 return d->delayedLoading;
314 appname +
"/toolbar/");
315 addAppThemes(appname);
318 void TDEIconLoader::addAppThemes(
const TQString& appname)
325 TDEIconThemeNode* node =
new TDEIconThemeNode(def);
326 d->links.append(node);
327 addBaseThemes(node, appname);
334 TDEIconThemeNode* node =
new TDEIconThemeNode(def);
335 d->links.append(node);
336 addBaseThemes(node, appname);
339 void TDEIconLoader::addBaseThemes(TDEIconThemeNode *node,
const TQString &appname)
341 TQStringList lst = node->theme->inherits();
342 TQStringList::ConstIterator it;
344 for (it=lst.begin(); it!=lst.end(); ++it)
346 if( d->mThemesInTree.contains(*it) && (*it) !=
"hicolor")
353 TDEIconThemeNode *n =
new TDEIconThemeNode(theme);
354 d->mThemesInTree.append(*it);
356 addBaseThemes(n, appname);
362 if ( d->extraDesktopIconsLoaded )
return;
366 TQStringList::ConstIterator it;
369 for (it=icnlibs.begin(); it!=icnlibs.end(); ++it)
374 TQStringList lst = dir.entryList(
"default.*", TQDir::Dirs);
375 TQStringList::ConstIterator it2;
376 for (it2=lst.begin(); it2!=lst.end(); ++it2)
381 r=readlink( TQFile::encodeName(*it + *it2) , buf,
sizeof(buf)-1);
386 TQString themeName=dir2.dirName();
388 if (!list.contains(themeName))
389 list.append(themeName);
394 for (it=list.begin(); it!=list.end(); ++it)
396 if ( d->mThemesInTree.contains(*it) )
398 if ( *it == TQString(
"default.tde") )
continue;
401 TDEIconThemeNode* node =
new TDEIconThemeNode(def);
402 d->mThemesInTree.append(*it);
403 d->links.append(node);
404 addBaseThemes(node,
"" );
407 d->extraDesktopIconsLoaded=
true;
413 return d->extraDesktopIconsLoaded;
416 TQString TDEIconLoader::removeIconExtension(
const TQString &name)
const 418 int extensionLength=0;
420 TQString ext = name.right(4);
424 if (ext == png_ext || ext == xpm_ext)
432 if (name.right(5) == svgz_ext)
434 else if (ext == svg_ext)
439 if ( extensionLength > 0 )
441 return name.left(name.length() - extensionLength);
446 TQString TDEIconLoader::removeIconExtensionInternal(
const TQString &name)
const 448 TQString name_noext = removeIconExtension(name);
451 if (name != name_noext)
454 <<
" loads icon " << name <<
" with extension." <<
endl;
461 TDEIcon TDEIconLoader::findMatchingIcon(
const TQString& name,
int size)
const 465 const TQString *ext[4];
468 ext[count++]=&png_ext;
471 ext[count++]=&svgz_ext;
473 ext[count++]=&svg_ext;
476 ext[count++]=&xpm_ext;
490 for ( TDEIconThemeNode *themeNode = d->links.first() ; themeNode ;
491 themeNode = d->links.next() )
493 for (
int i = 0 ; i < count ; i++)
496 if (icon.
isValid())
goto icon_found ;
499 for (
int i = 0 ; i < count ; i++)
502 if (icon.
isValid())
goto icon_found;
509 inline TQString TDEIconLoader::unknownIconPath(
int size )
const 513 TDEIcon icon = findMatchingIcon(str_unknown, size);
516 kdDebug(264) <<
"Warning: could not find \"Unknown\" icon for size = " 518 return TQString::null;
526 bool canReturnNull)
const 528 if (d->mpThemeRoot == 0L)
529 return TQString::null;
531 if (!TQDir::isRelativePath(_name))
534 TQString name = removeIconExtensionInternal( _name );
541 path = d->mpDirs->findResource(
"appicon", name + png_ext);
547 path = d->mpDirs->findResource(
"appicon", name + svgz_ext);
549 path = d->mpDirs->findResource(
"appicon", name + svg_ext);
552 path = d->mpDirs->findResource(
"appicon", name + xpm_ext);
558 kdDebug(264) <<
"Illegal icon group: " << group_or_size <<
endl;
563 if (group_or_size >= 0)
564 size = d->mpGroups[group_or_size].size;
566 size = -group_or_size;
568 if (_name.isEmpty()) {
570 return TQString::null;
572 return unknownIconPath(size);
575 TDEIcon icon = findMatchingIcon(name, size);
581 if (!path.isEmpty() || canReturnNull)
585 return TQString::null;
587 return unknownIconPath(size);
593 int state, TQString *path_store,
bool canReturnNull)
const 595 TQString name = _name;
598 bool absolutePath=
false, favIconOverlay=
false;
600 if (d->mpThemeRoot == 0L)
604 if (name.startsWith(
"favicons/"))
606 favIconOverlay =
true;
607 name = locateLocal(
"cache", name+
".png");
609 if (!TQDir::isRelativePath(name)) absolutePath=
true;
617 key += TQString::number(size); key +=
'_';
619 bool inCache = TQPixmapCache::find(key, pix);
620 if (inCache && (path_store == 0L))
623 TQString path = (absolutePath) ? name :
633 kdDebug(264) <<
"Warning: Cannot find \"unknown\" icon." <<
endl;
638 if (path_store != 0L)
644 img=img.smoothScale(size,size);
646 pix.convertFromImage(img);
647 TQPixmapCache::insert(key, pix);
655 kdDebug(264) <<
"Illegal icon group: " << group <<
endl;
659 int overlay = (state & TDEIcon::OverlayMask);
660 state &= ~
TDEIcon::OverlayMask;
663 kdDebug(264) <<
"Illegal icon state: " << state <<
endl;
667 if (size == 0 && group < 0)
669 kdDebug(264) <<
"Neither size nor group specified!" <<
endl;
675 if (!canReturnNull && name.isEmpty())
678 name = removeIconExtensionInternal(name);
684 size = d->mpGroups[group].size;
686 favIconOverlay = favIconOverlay && size > 22;
691 key += name; key +=
'_';
692 key += TQString::number(size); key +=
'_';
694 TQString overlayStr = TQString::number( overlay );
696 TQString noEffectKey = key +
'_' + overlayStr;
700 key += d->mpEffect.fingerprint(group, state);
701 if (d->mpGroups[group].dblPixels)
702 key += TQString::fromLatin1(
":dblsize");
704 key += TQString::fromLatin1(
"noeffect");
709 bool inCache = TQPixmapCache::find(key, pix);
710 if (inCache && (path_store == 0L))
717 if ( ( path_store != 0L ) ||
718 noEffectKey != d->lastImageKey )
722 if (absolutePath && !favIconOverlay)
731 icon = findMatchingIcon(favIconOverlay ? TQString(
"www") : name, size);
737 pix = loadIcon(name,
TDEIcon::User, size, state, path_store,
true);
738 if (!pix.isNull() || canReturnNull) {
739 TQPixmapCache::insert(key, pix);
743 icon = findMatchingIcon(str_unknown, size);
747 <<
"Warning: could not find \"Unknown\" icon for size = " 754 if (path_store != 0L)
755 *path_store = icon.
path;
760 TQString ext = icon.
path.right(3).upper();
761 if(ext !=
"SVG" && ext !=
"VGZ")
763 img =
new TQImage(icon.
path, ext.latin1());
773 KSVGIconEngine *svgEngine =
new KSVGIconEngine();
775 if(svgEngine->load(size, size, icon.
path))
776 img = svgEngine->painter()->image();
786 iconType = icon.
type;
789 d->lastImage = img->copy();
790 d->lastImageKey = noEffectKey;
791 d->lastIconType = iconType;
792 d->lastIconThreshold = iconThreshold;
796 img =
new TQImage( d->lastImage.copy() );
797 iconType = d->lastIconType;
798 iconThreshold = d->lastIconThreshold;
807 ((ovl = loadOverlay(theme->
lockOverlay(), size)) != 0L))
810 ((ovl = loadOverlay(theme->
linkOverlay(), size)) != 0L))
813 ((ovl = loadOverlay(theme->
zipOverlay(), size)) != 0L))
816 ((ovl = loadOverlay(theme->
shareOverlay(), size)) != 0L))
820 if (img->depth() != 32)
821 *img = img->convertDepth(32);
822 for (
int y = 0; y < img->height(); y++)
824 QRgb *line =
reinterpret_cast<QRgb *
>(img->scanLine(y));
825 for (
int x = 0; x < img->width(); x++)
826 line[x] = (line[x] & 0x00ffffff) | (TQMIN(0x80, tqAlpha(line[x])) << 24);
834 *img = img->smoothScale(size, size);
838 if ( abs(size-img->width())>iconThreshold )
839 *img = img->smoothScale(size, size);
841 if (group >= 0 && d->mpGroups[group].dblPixels)
843 *img = d->mpEffect.doublePixels(*img);
847 *img = d->mpEffect.apply(*img, group, state);
852 TQImage favIcon(name,
"PNG");
853 int x = img->width() - favIcon.width() - 1,
854 y = img->height() - favIcon.height() - 1;
855 if( favIcon.depth() != 32 )
856 favIcon = favIcon.convertDepth( 32 );
857 if( img->depth() != 32 )
858 *img = img->convertDepth( 32 );
860 line < favIcon.height();
863 QRgb* fpos =
reinterpret_cast< QRgb*
>( favIcon.scanLine( line ));
864 QRgb* ipos =
reinterpret_cast< QRgb*
>( img->scanLine( line + y )) + x;
867 ++i, ++fpos, ++ipos )
868 *ipos = tqRgba( ( tqRed( *ipos ) * ( 255 - tqAlpha( *fpos )) + tqRed( *fpos ) * tqAlpha( *fpos )) / 255,
869 ( tqGreen( *ipos ) * ( 255 - tqAlpha( *fpos )) + tqGreen( *fpos ) * tqAlpha( *fpos )) / 255,
870 ( tqBlue( *ipos ) * ( 255 - tqAlpha( *fpos )) + tqBlue( *fpos ) * tqAlpha( *fpos )) / 255,
871 ( tqAlpha( *ipos ) * ( 255 - tqAlpha( *fpos )) + tqAlpha( *fpos ) * tqAlpha( *fpos )) / 255 );
875 if (TQPaintDevice::x11AppDepth() == 32) pix.convertFromImage(KImageEffect::convertToPremultipliedAlpha( *img ));
876 else pix.convertFromImage(*img);
880 TQPixmapCache::insert(key, pix);
884 TQImage *TDEIconLoader::loadOverlay(
const TQString &name,
int size)
const 886 TQString key = name +
'_' + TQString::number(size);
887 TQImage *image = d->imgDict.find(key);
891 TDEIcon icon = findMatchingIcon(name, size);
894 kdDebug(264) <<
"Overlay " << name <<
"not found." <<
endl;
897 image =
new TQImage(icon.
path);
900 if ( size != image->width() )
901 *image = image->smoothScale( size, size );
902 d->imgDict.insert(key, image);
910 TQString file = moviePath( name, group, size );
913 int dirLen = file.findRev(
'/');
914 TQString icon = iconPath(name, size ? -size : group,
true);
915 if (!icon.isEmpty() && file.left(dirLen) != icon.left(dirLen))
917 return TQMovie(file);
922 if (!d->mpGroups)
return TQString::null;
926 kdDebug(264) <<
"Illegal icon group: " << group <<
endl;
929 if (size == 0 && group < 0)
931 kdDebug(264) <<
"Neither size nor group specified!" <<
endl;
935 TQString file = name +
".mng";
938 file = d->mpDirs->findResource(
"appicon", file);
943 size = d->mpGroups[group].size;
947 for ( TDEIconThemeNode *themeNode = d->links.first() ; themeNode ;
948 themeNode = d->links.next() )
951 if (icon.
isValid())
goto icon_found ;
954 if (icon.
isValid())
goto icon_found ;
958 file = icon.
isValid() ? icon.
path : TQString::null;
968 if (!d->mpGroups)
return lst;
972 kdDebug(264) <<
"Illegal icon group: " << group <<
endl;
975 if ((size == 0) && (group < 0))
977 kdDebug(264) <<
"Neither size nor group specified!" <<
endl;
981 TQString file = name +
"/0001";
984 file = d->mpDirs->findResource(
"appicon", file +
".png");
988 size = d->mpGroups[group].size;
989 TDEIcon icon = findMatchingIcon(file, size);
990 file = icon.
isValid() ? icon.
path : TQString::null;
996 TQString path = file.left(file.length()-8);
997 DIR* dp = opendir( TQFile::encodeName(path) );
1002 while( ( ep = readdir( dp ) ) != 0L )
1004 TQString fn(TQFile::decodeName(ep->d_name));
1005 if(!(fn.left(4)).toUInt())
1017 if (d->mpThemeRoot)
return d->mpThemeRoot->theme;
1023 if (!d->mpGroups)
return -1;
1027 kdDebug(264) <<
"Illegal icon group: " << group <<
endl;
1030 return d->mpGroups[group].size;
1035 TQDir dir(iconsDir);
1036 TQStringList lst = dir.entryList(
"*.png;*.xpm", TQDir::Files);
1037 TQStringList result;
1038 TQStringList::ConstIterator it;
1039 for (it=lst.begin(); it!=lst.end(); ++it)
1040 result += iconsDir +
"/" + *it;
1047 TQStringList result;
1050 kdDebug(264) <<
"Illegal icon group: " << group_or_size <<
endl;
1054 if (group_or_size >= 0)
1055 size = d->mpGroups[group_or_size].size;
1057 size = -group_or_size;
1059 for ( TDEIconThemeNode *themeNode = d->links.first() ; themeNode ;
1060 themeNode = d->links.next() )
1061 themeNode->queryIconsByContext(&result, size, context);
1065 TQStringList res2, entries;
1066 TQStringList::ConstIterator it;
1067 for (it=result.begin(); it!=result.end(); ++it)
1069 int n = (*it).findRev(
'/');
1073 name = (*it).mid(n+1);
1074 name = removeIconExtension(name);
1075 if (!entries.contains(name))
1087 TQStringList result;
1090 kdDebug(264) <<
"Illegal icon group: " << group_or_size <<
endl;
1094 if (group_or_size >= 0)
1095 size = d->mpGroups[group_or_size].size;
1097 size = -group_or_size;
1099 for ( TDEIconThemeNode *themeNode = d->links.first() ; themeNode ;
1100 themeNode = d->links.next() )
1101 themeNode->queryIcons(&result, size, context);
1105 TQStringList res2, entries;
1106 TQStringList::ConstIterator it;
1107 for (it=result.begin(); it!=result.end(); ++it)
1109 int n = (*it).findRev(
'/');
1113 name = (*it).mid(n+1);
1114 name = removeIconExtension(name);
1115 if (!entries.contains(name))
1127 for ( TDEIconThemeNode *themeNode = d->links.first() ; themeNode ;
1128 themeNode = d->links.next() )
1129 if( themeNode->theme->hasContext( context ))
1136 return &d->mpEffect;
1141 if (!d->mpGroups)
return false;
1145 kdDebug(264) <<
"Illegal icon group: " << group <<
endl;
1148 return d->mpGroups[group].alphaBlending;
1153 return loadIconSet( name, group, size, canReturnNull,
true );
1158 return loadIconSet( name, group, size,
false );
1163 class TDEIconFactory
1164 :
public TQIconFactory
1167 TDEIconFactory(
const TQString& iconName_P,
TDEIcon::Group group_P,
1169 TDEIconFactory(
const TQString& iconName_P,
TDEIcon::Group group_P,
1171 virtual TQPixmap* createPixmap(
const TQIconSet&, TQIconSet::Size, TQIconSet::Mode, TQIconSet::State );
1182 bool canReturnNull,
bool immediateExistenceCheck)
1184 if ( !d->delayedLoading )
1185 return loadIconSetNonDelayed( name, g, s, canReturnNull );
1187 if (g < -1 || g > 6) {
1188 kdDebug() <<
"TDEIconLoader::loadIconSet " << name <<
" " << (int)g <<
" " << s <<
endl;
1189 tqDebug(
"%s", kdBacktrace().latin1());
1193 if(canReturnNull && immediateExistenceCheck)
1199 TQIconSet ret( pm );
1200 ret.installIconFactory(
new TDEIconFactory( name, g, s,
this ));
1205 ret.installIconFactory(
new TDEIconFactory( name, g, s,
this, canReturnNull ));
1209 TQIconSet TDEIconLoader::loadIconSetNonDelayed(
const TQString& name,
1211 int s,
bool canReturnNull )
1215 iconset.setPixmap( tmp, TQIconSet::Small, TQIconSet::Active );
1217 iconset.setPixmap( tmp, TQIconSet::Large, TQIconSet::Active );
1219 iconset.setPixmap( tmp, TQIconSet::Small, TQIconSet::Disabled );
1220 iconset.setPixmap( tmp, TQIconSet::Large, TQIconSet::Disabled );
1222 iconset.setPixmap( tmp, TQIconSet::Small, TQIconSet::Normal );
1223 iconset.setPixmap( tmp, TQIconSet::Large, TQIconSet::Normal );
1227 TDEIconFactory::TDEIconFactory(
const TQString& iconName_P,
TDEIcon::Group group_P,
1229 : iconName( iconName_P ), group( group_P ), size( size_P ), loader( loader_P )
1231 canReturnNull =
false;
1232 setAutoDelete(
true );
1235 TDEIconFactory::TDEIconFactory(
const TQString& iconName_P,
TDEIcon::Group group_P,
1237 : iconName( iconName_P ), group( group_P ), size( size_P ),
1238 loader( loader_P ), canReturnNull( canReturnNull_P)
1240 setAutoDelete(
true );
1243 TQPixmap* TDEIconFactory::createPixmap(
const TQIconSet&, TQIconSet::Size, TQIconSet::Mode mode_P, TQIconSet::State )
1245 #ifdef TDEICONLOADER_DEBUG 1247 for( TQValueList< TDEIconLoaderDebug >::Iterator it = kiconloaders->begin();
1248 it != kiconloaders->end();
1251 if( (*it).loader == loader )
1258 iconName =
"no_way_man_you_will_get_broken_icon";
1260 kdWarning() <<
"Using already destroyed TDEIconLoader for loading an icon!" <<
endl;
1261 kdWarning() <<
"Appname:" << (*it).appname <<
", icon:" << iconName <<
endl;
1262 kdWarning() <<
"Deleted at:" <<
endl;
1263 kdWarning() << (*it).delete_bt <<
endl;
1264 kdWarning() <<
"Current:" <<
endl;
1265 kdWarning() << kdBacktrace() <<
endl;
1277 iconName =
"no_way_man_you_will_get_broken_icon";
1279 kdWarning() <<
"Using unknown TDEIconLoader for loading an icon!" <<
endl;
1280 kdWarning() <<
"Icon:" << iconName <<
endl;
1281 kdWarning() << kdBacktrace() <<
endl;
1290 if( mode_P <= TQIconSet::Active )
1291 state = tbl[ mode_P ];
1292 if( group >= 0 && state == TDEIcon::ActiveState )
1294 if( loader->iconEffect()->fingerprint(group, TDEIcon::ActiveState )
1300 TQPixmap pm = loader->loadIcon( iconName, group, size, state, 0, canReturnNull );
1301 return new TQPixmap( pm );
1306 TQPixmap DesktopIcon(
const TQString& name,
int force_size,
int state,
1318 TQIconSet DesktopIconSet(
const TQString& name,
int force_size,
TDEInstance *instance)
1324 TQPixmap BarIcon(
const TQString& name,
int force_size,
int state,
1336 TQIconSet BarIconSet(
const TQString& name,
int force_size,
TDEInstance *instance)
1342 TQPixmap SmallIcon(
const TQString& name,
int force_size,
int state,
1354 TQIconSet SmallIconSet(
const TQString& name,
int force_size,
TDEInstance *instance)
1360 TQPixmap MainBarIcon(
const TQString& name,
int force_size,
int state,
1372 TQIconSet MainBarIconSet(
const TQString& name,
int force_size,
TDEInstance *instance)
1378 TQPixmap UserIcon(
const TQString& name,
int state,
TDEInstance *instance)
1404 if ( TQPixmapCache::find(
"unknown", pix) )
1410 kdDebug(264) <<
"Warning: Cannot find \"unknown\" icon." <<
endl;
1415 TQPixmapCache::insert(
"unknown", pix);
1421 void TDEIconLoaderPrivate::reconfigure()
1423 q->reconfigure(appname, mpDirs);
1426 #include "kiconloader_p.moc" Access KDE Configuration entries.
void enableDelayedIconSetLoading(bool enable)
Enables on-demand icon loading for QIconSets using TQIconFactory.
static TQString defaultThemeName()
Returns the default icon theme.
static TQPixmap unknown()
Returns the unknown icon.
TQStringList queryIcons(int group_or_size, TDEIcon::Context context=TDEIcon::Any) const
Queries all available icons for a specific group, having a specific context.
static TQString kde_default(const char *type)
This returns a default relative path for the standard KDE resource types.
TQString moviePath(const TQString &name, TDEIcon::Group group, int size=0) const
Returns the path to an animated icon.
TQString path
The full path of the icon.
bool readBoolEntry(const TQString &pKey, bool bDefault=false) const
Reads a boolean entry.
TDEIconLoader(const TQString &appname=TQString::null, TDEStandardDirs *dirs=0)
Constructs an iconloader.
bool alphaBlending(TDEIcon::Group group) const
Checks whether the user wants to blend the icons with the background using the alpha channel informat...
int currentSize(TDEIcon::Group group) const
Returns the current size of the group.
Helper class to facilitate working with TDEConfig / KSimpleConfig groups.
Take the best match if there is no exact match.
TQStringList loadAnimated(const TQString &name, TDEIcon::Group group, int size=0) const
Loads an animated icon as a series of still frames.
void setGroup(const TQString &group)
Specifies the group in which keys will be read and written.
void addExtraDesktopThemes()
Adds all the default themes from other desktops at the end of the list of icon themes.
static TDEIconLoader * iconLoader()
Returns an iconloader object.
TQCString instanceName() const
Returns the name of the instance.
static TQString current()
Returns the current icon theme.
TDEIconTheme * theme() const
Returns a pointer to the current theme.
bool isValid() const
Return true if this icon is valid, false otherwise.
TQString zipOverlay() const
Returns the name of this theme's zip overlay.
Site-independent access to standard KDE directories.
void reconfigure(const TQString &_appname, TDEStandardDirs *_dirs)
Called by TDEInstance::newIconLoader to reconfigure the icon loader.
Only try to find an exact match.
static TDEStandardDirs * dirs()
Returns the application standard dirs object.
static void overlay(TQImage &src, TQImage &overlay)
Overlays an image with an other image.
Class to use/access icon themes in KDE.
static TDEInstance * instance()
Returns the global instance.
Context
Defines the context of the icon.
MatchType
The type of a match.
One icon as found by TDEIconTheme.
bool extraDesktopThemesAdded() const
Returns if the default icon themes of other desktops have been added to the list of icon themes where...
TQString name() const
The stylized name of the icon theme.
Last state (last constant)
Some icon with unknown purpose.
Type type
The type of the icon: Fixed, Scalable or Threshold.
static const TQString & staticQString(const char *str)
Creates a static TQString.
TQString iconPath(const TQString &name, int group_or_size, bool canReturnNull=false) const
Returns the path of an icon.
TDEIconEffect * iconEffect() const
Returns a pointer to the TDEIconEffect object used by the icon loader.
TQString lockOverlay() const
Returns the name of this theme's lock overlay.
TQMovie loadMovie(const TQString &name, TDEIcon::Group group, int size=0) const
Loads an animated icon.
TQString linkOverlay() const
Returns the name of this theme's link overlay.
Group
The group of the icon.
Context context
The context of the icon.
int threshold
The threshold in case type == Threshold.
bool isValid() const
The icon theme exists?
TDEIconLoader * iconLoader() const
Returns an iconloader object.
TQString shareOverlay() const
Returns the name of this theme's share overlay.
bool isDelayedIconSetLoadingEnabled() const
Checks whether delayed loading for TQIconSet is enabled.
Applies effects to icons.
TQStringList queryIconsByContext(int group_or_size, TDEIcon::Context context=TDEIcon::Any) const
Queries all available icons for a specific context.
void addAppDir(const TQString &appname)
Adds appname to the list of application specific directories.
static TDEConfig * config()
Returns the general config object.
kndbgstream & endl(kndbgstream &s)
Does nothing.
TQPixmap loadIcon(const TQString &name, TDEIcon::Group group, int size=0, int state=TDEIcon::DefaultState, TQString *path_store=0L, bool canReturnNull=false) const
Loads an icon.
TQIconSet loadIconSet(const TQString &name, TDEIcon::Group group, int size, bool canReturnNull, bool immediateExistenceCheck)
Creates an icon set, that will do on-demand loading of the icon.
int readNumEntry(const TQString &pKey, int nDefault=0) const
Reads a numerical value.
TQStringList resourceDirs(const char *type) const
This function is used internally by almost all other function as it serves and fills the directories ...
TQStringList queryIconsByDir(const TQString &iconsDir) const
Returns a list of all icons (*.png or *.xpm extension) in the given directory.
Access to KDE global objects for use in shared libraries.
static bool exists(const TQString &fullPath)
Checks for existence and accessability of a file or directory.
States
Defines the possible states of an icon.