bool InstIconList::AddFile(const wxString fileName) { wxFileName iconFileName(fileName); wxImage image(iconFileName.GetFullPath()); if(!image.IsOk()) { return false; } wxString iconKey = iconFileName.GetName(); wxImage highlightIcon = tintImage(image,wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT)); return Add(image,highlightIcon, image, iconKey, iconKey, iconFileName.GetFullPath()); }
wxIcon* IconGetter::GetFolderIcon(const wxString& filePath, int iconSize) { #ifdef __WIN32__ wxString desktopIniFilePath = filePath + wxT("/Desktop.ini"); wxFileName filename(desktopIniFilePath); if (filename.FileExists()) { // If the folder contains a Desktop.ini file, try // to get the icon path from it CSimpleIniA ini(false, false, true); ini.LoadFile(desktopIniFilePath.c_str()); const char* cIconFileValue = ini.GetValue(".ShellClassInfo", "IconFile", ""); if (cIconFileValue != "") { wxString iconFileValue = wxString::FromAscii(cIconFileValue); // Normalize the path since the IconFile value is usually stored // as a path relative to the folder wxFileName iconFileName(iconFileValue); iconFileName.Normalize(wxPATH_NORM_ALL, filePath); iconFileValue = iconFileName.GetFullPath(); return GetExecutableIcon(iconFileValue, iconSize); } } SHFILEINFO fileInfo; int success; wxFileName fileName(filePath); if (iconSize == 32) { success = SHGetFileInfo(fileName.GetPath().c_str(), FILE_ATTRIBUTE_DIRECTORY, &fileInfo, sizeof(fileInfo), SHGFI_ICON | SHGFI_LARGEICON); } else { success = SHGetFileInfo(fileName.GetPath().c_str(), FILE_ATTRIBUTE_DIRECTORY, &fileInfo, sizeof(fileInfo), SHGFI_ICON | SHGFI_SMALLICON); } if (success != 0) { wxIcon* icon = new wxIcon(); icon->SetHICON((WXHICON)fileInfo.hIcon); icon->SetSize(iconSize, iconSize); return icon; } #endif // __WIN32__ return NULL; }
QString StatusIcons::iconFileName(const Jid &AStreamJid, const Jid &AContactJid) const { return iconFileName(iconsetByJid(AContactJid),iconKeyByJid(AStreamJid,AContactJid)); }