Changeset 1028 for trunk/src/gui


Ignore:
Timestamp:
Aug 26, 2011, 2:11:12 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

OS/2: Take style icons for SP_FileIcon & SP_DirIcon from QFileIconProvider.

This makes sure that the icons are consistent (taken from the system theme)
both in QCommonStyle and in QFileIconProvider. Previously, the former would
return the stock Qt icons which are completely different which made the
Projects view in Qt Creator look odd compared to the FileSystem view.

Note that this (as many other similar settings as well) is only done when
QApplication::desktopSettingsAware() is true.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gui/styles/qcommonstyle.cpp

    r1021 r1028  
    9090#ifdef Q_WS_PM
    9191#   include <qt_os2.h>
     92#   include <qfileiconprovider.h>
    9293#endif
    9394
     
    57835784#endif // Q_WS_MAC
    57845785
     5786#if defined(Q_WS_PM)
     5787    if (QApplication::desktopSettingsAware()) {
     5788        // Take file/folder icons from QFileProvider as it knows how to get
     5789        // them from the system theme (see QFileProvider::pmIcon()).
     5790        switch (standardIcon) {
     5791        case SP_FileIcon:
     5792        case SP_FileLinkIcon: {
     5793            QFileIconProvider fip;
     5794            static char kernelFilePath[] = "?:\\OS2KRNL";
     5795            if (kernelFilePath[0] == '?') {
     5796                ULONG bootDrive = 0;
     5797                DosQuerySysInfo(QSV_BOOT_DRIVE, QSV_BOOT_DRIVE,
     5798                                (PVOID)&bootDrive, sizeof(bootDrive));
     5799                kernelFilePath[0] = bootDrive + 'A' - 1;
     5800            }
     5801            return fip.icon(QFileInfo(QLatin1String(kernelFilePath)));
     5802        }
     5803        case SP_DirIcon:
     5804        case SP_DirLinkIcon:
     5805        case SP_DirClosedIcon:
     5806        case SP_DirOpenIcon: {
     5807            // TODO: Use WPS to get icons for open folders
     5808            // (see see QFileProvider::pmIcon() again)
     5809            QFileIconProvider fip;
     5810            return fip.icon(QFileInfo(QLatin1String("\\")));
     5811        }
     5812        default:
     5813            break;
     5814        }
     5815    }
     5816#endif
     5817
    57855818    switch (standardIcon) {
    57865819#ifndef QT_NO_IMAGEFORMAT_PNG
     
    60186051        case SP_DriveHDIcon:
    60196052        case SP_DriveFDIcon:
    6020         case SP_FileIcon:
    6021         case SP_FileLinkIcon:
    6022         case SP_DirLinkIcon:
    6023         case SP_DirClosedIcon:
    60246053        case SP_DesktopIcon:
    60256054        case SP_ComputerIcon:
    6026         case SP_DirOpenIcon:
    60276055        case SP_FileDialogNewFolder:
    60286056        case SP_DirHomeIcon:
Note: See TracChangeset for help on using the changeset viewer.