MCPcopy Create free account
hub / github.com/bumptop/BumpTop / GetSystemIconInfo

Method GetSystemIconInfo

trunk/win/Source/BT_WindowsOS.cpp:3395–3450  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3393}
3394
3395QString WindowsSystem::GetSystemIconInfo(QString FileName)
3396{
3397 if (FileName.isEmpty())
3398 return QString();
3399
3400 QString thisFileName(FileName);
3401 SHFILEINFO FileInfo = {0};
3402 int Indx = 0;
3403 bool Rtrn = false;
3404
3405 if (GLOBAL(settings).enableHiResIcons &&
3406 FileName.endsWith(".lnk", Qt::CaseInsensitive))
3407 {
3408 // Resolve the LNK target
3409 fsManager->getShortcutTarget(thisFileName, &thisFileName);
3410 bool loadLinkIcon = false;
3411 QString fullPathExtension = fsManager->getFileExtension(thisFileName);
3412 // NOTE: we only get the full high-res icons if we pull the data from the exe
3413 // if (fullPathExtension != ".exe")
3414 loadLinkIcon = true;
3415
3416 if (loadLinkIcon)
3417 {
3418 if (GLOBAL(settings).useThemeIconOverrides &&
3419 (fsManager->getFileAttributes(thisFileName) & Directory) &&
3420 !winOS->IsWindowsVersionGreaterThanOrEqualTo(WindowsVista))
3421 {
3422 return "override.ext.folder";
3423 }
3424 else if (fsManager->getFileAttributes(thisFileName))
3425 {
3426 thisFileName = FileName;
3427 }
3428 }
3429 }
3430
3431 // Get its Index
3432 SHGetFileInfo((LPCWSTR) thisFileName.utf16(), -1, &FileInfo, sizeof(SHFILEINFO), SHGFI_SYSICONINDEX);
3433 Indx = FileInfo.iIcon;
3434
3435 thisFileName = thisFileName.toLower();
3436
3437 // Cope over the path of the resource
3438 QString temp;
3439 if (thisFileName.contains("exe"))
3440 {
3441 temp.append(thisFileName);
3442 Indx = 0;
3443 }else{
3444 temp.append("*");
3445 }
3446
3447 temp.append(ICON_PATH_CONCAT);
3448 temp.append(QString::number(Indx));
3449 return temp;
3450}
3451
3452QString WindowsSystem::GetFileTypeDescription(QString filename)

Callers 2

setFilePathMethod · 0.80
WebActorMethod · 0.80

Calls 9

getShortcutTargetMethod · 0.80
getFileExtensionMethod · 0.80
getFileAttributesMethod · 0.80
QStringFunction · 0.50
isEmptyMethod · 0.45
endsWithMethod · 0.45
containsMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected