Changeset 846 for trunk/src/gui/itemviews/qfileiconprovider.cpp
- Timestamp:
- May 5, 2011, 5:36:53 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/vendor/nokia/qt/4.7.2 (added) merged: 845 /branches/vendor/nokia/qt/current merged: 844 /branches/vendor/nokia/qt/4.6.3 removed
- Property svn:mergeinfo changed
-
trunk/src/gui/itemviews/qfileiconprovider.cpp
r829 r846 1 1 /**************************************************************************** 2 2 ** 3 ** Copyright (C) 201 0Nokia Corporation and/or its subsidiary(-ies).3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). 4 4 ** All rights reserved. 5 5 ** Contact: Nokia Corporation (qt-info@nokia.com) … … 77 77 \class QFileIconProvider 78 78 79 \brief The QFileIconProvider class provides file icons for the QDirModel class.79 \brief The QFileIconProvider class provides file icons for the QDirModel and the QFileSystemModel classes. 80 80 */ 81 81 … … 106 106 #endif 107 107 QFileIconProvider *q_ptr; 108 QString homePath;108 const QString homePath; 109 109 110 110 private: 111 QIcon file;112 QIcon fileLink;113 QIcon directory;114 QIcon directoryLink;115 QIcon harddisk;116 QIcon floppy;117 QIcon cdrom;118 QIcon ram;119 QIcon network;120 QIcon computer;121 QIcon desktop;122 QIcon trashcan;123 QIcon generic;124 QIcon home;111 mutable QIcon file; 112 mutable QIcon fileLink; 113 mutable QIcon directory; 114 mutable QIcon directoryLink; 115 mutable QIcon harddisk; 116 mutable QIcon floppy; 117 mutable QIcon cdrom; 118 mutable QIcon ram; 119 mutable QIcon network; 120 mutable QIcon computer; 121 mutable QIcon desktop; 122 mutable QIcon trashcan; 123 mutable QIcon generic; 124 mutable QIcon home; 125 125 }; 126 126 127 QFileIconProviderPrivate::QFileIconProviderPrivate() 128 { 129 QStyle *style = QApplication::style(); 130 file = style->standardIcon(QStyle::SP_FileIcon); 131 directory = style->standardIcon(QStyle::SP_DirIcon); 132 fileLink = style->standardIcon(QStyle::SP_FileLinkIcon); 133 directoryLink = style->standardIcon(QStyle::SP_DirLinkIcon); 134 harddisk = style->standardIcon(QStyle::SP_DriveHDIcon); 135 floppy = style->standardIcon(QStyle::SP_DriveFDIcon); 136 cdrom = style->standardIcon(QStyle::SP_DriveCDIcon); 137 network = style->standardIcon(QStyle::SP_DriveNetIcon); 138 computer = style->standardIcon(QStyle::SP_ComputerIcon); 139 desktop = style->standardIcon(QStyle::SP_DesktopIcon); 140 trashcan = style->standardIcon(QStyle::SP_TrashIcon); 141 home = style->standardIcon(QStyle::SP_DirHomeIcon); 142 homePath = QDir::home().absolutePath(); 127 QFileIconProviderPrivate::QFileIconProviderPrivate() : 128 homePath(QDir::home().absolutePath()) 129 { 143 130 } 144 131 … … 147 134 switch (name) { 148 135 case QStyle::SP_FileIcon: 136 if (file.isNull()) 137 file = QApplication::style()->standardIcon(name); 149 138 return file; 150 139 case QStyle::SP_FileLinkIcon: 140 if (fileLink.isNull()) 141 fileLink = QApplication::style()->standardIcon(name); 151 142 return fileLink; 152 143 case QStyle::SP_DirIcon: 144 if (directory.isNull()) 145 directory = QApplication::style()->standardIcon(name); 153 146 return directory; 154 147 case QStyle::SP_DirLinkIcon: 148 if (directoryLink.isNull()) 149 directoryLink = QApplication::style()->standardIcon(name); 155 150 return directoryLink; 156 151 case QStyle::SP_DriveHDIcon: 152 if (harddisk.isNull()) 153 harddisk = QApplication::style()->standardIcon(name); 157 154 return harddisk; 158 155 case QStyle::SP_DriveFDIcon: 156 if (floppy.isNull()) 157 floppy = QApplication::style()->standardIcon(name); 159 158 return floppy; 160 159 case QStyle::SP_DriveCDIcon: 160 if (cdrom.isNull()) 161 cdrom = QApplication::style()->standardIcon(name); 161 162 return cdrom; 162 163 case QStyle::SP_DriveNetIcon: 164 if (network.isNull()) 165 network = QApplication::style()->standardIcon(name); 163 166 return network; 164 167 case QStyle::SP_ComputerIcon: 168 if (computer.isNull()) 169 computer = QApplication::style()->standardIcon(name); 165 170 return computer; 166 171 case QStyle::SP_DesktopIcon: 172 if (desktop.isNull()) 173 desktop = QApplication::style()->standardIcon(name); 167 174 return desktop; 168 175 case QStyle::SP_TrashIcon: 176 if (trashcan.isNull()) 177 trashcan = QApplication::style()->standardIcon(name); 169 178 return trashcan; 170 179 case QStyle::SP_DirHomeIcon: 180 if (home.isNull()) 181 home = QApplication::style()->standardIcon(name); 171 182 return home; 172 183 default:
Note:
See TracChangeset
for help on using the changeset viewer.