Have the file tree use the native icons on Mac OS X.

Also synchronized suffixes to match what is in the xml file.
This commit is contained in:
Norwegian Rock Cat
2009-07-14 16:37:26 +02:00
parent ccb1b6d3c5
commit c3de6ca4d0
3 changed files with 21 additions and 8 deletions

View File

@@ -70,7 +70,7 @@ QIcon FileIconProvider::icon(const QFileInfo &fileInfo)
// Disabled since for now we'll make sure that all icons fit with our
// own custom icons by returning an empty one if we don't know it.
#ifdef Q_WS_WIN
#if defined(Q_WS_WIN) || defined(Q_WS_MAC)
// This is incorrect if the OS does not always return the same icon for the
// same suffix (Mac OS X), but should speed up the retrieval a lot ...
icon = m_systemIconProvider.icon(fileInfo);
@@ -123,7 +123,7 @@ void FileIconProvider::registerIconOverlayForSuffix(const QIcon &icon, const QSt
QIcon FileIconProvider::iconForSuffix(const QString &suffix) const
{
QIcon icon;
#ifdef Q_WS_WIN // On windows we use the file system icons
#if defined(Q_WS_WIN) || defined(Q_WS_MAC) // On windows we use the file system icons
Q_UNUSED(suffix)
#else
if (suffix.isEmpty())

View File

@@ -38,6 +38,7 @@
<sub-class-of type="text/x-csrc"/>
<comment>C++ source code</comment>
<glob pattern="*.cpp"/>
<glob pattern="*.cp"/>
<glob pattern="*.cc"/>
<glob pattern="*.cxx"/>
<glob pattern="*.c++"/>

View File

@@ -69,14 +69,26 @@ CppEditorFactory::CppEditorFactory(CppPlugin *owner) :
<< QLatin1String(CppEditor::Constants::CPP_SOURCE_MIMETYPE)
<< QLatin1String(CppEditor::Constants::CPP_HEADER_MIMETYPE);
Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
iconProvider->registerIconOverlayForSuffix(QIcon(":/cppeditor/images/qt_cpp.png"),
QLatin1String("cpp"));
iconProvider->registerIconOverlayForSuffix(QIcon(":/cppeditor/images/qt_cpp.png"),
QLatin1String("hpp"));
iconProvider->registerIconOverlayForSuffix(QIcon(":/cppeditor/images/qt_h.png"),
QLatin1String("h"));
#ifndef Q_WS_MAC
// ### It would be really cool if we could get the stuff from the XML file here and not play "catch up" all the time.
QIcon cppIcon(":/cppeditor/images/qt_cpp.png");
iconProvider->registerIconOverlayForSuffix(cppIcon, QLatin1String("cpp"));
iconProvider->registerIconOverlayForSuffix(cppIcon, QLatin1String("cp"));
iconProvider->registerIconOverlayForSuffix(cppIcon, QLatin1String("cc"));
iconProvider->registerIconOverlayForSuffix(cppIcon, QLatin1String("cxx"));
iconProvider->registerIconOverlayForSuffix(cppIcon, QLatin1String("C"));
iconProvider->registerIconOverlayForSuffix(cppIcon, QLatin1String("c++"));
iconProvider->registerIconOverlayForSuffix(QIcon(":/cppeditor/images/qt_c.png"),
QLatin1String("c"));
QIcon headerIcon(":/cppeditor/images/qt_h.png");
iconProvider->registerIconOverlayForSuffix(headerIcon, QLatin1String("hpp"));
iconProvider->registerIconOverlayForSuffix(headerIcon, QLatin1String("hh"));
iconProvider->registerIconOverlayForSuffix(headerIcon, QLatin1String("h"));
iconProvider->registerIconOverlayForSuffix(headerIcon, QLatin1String("hxx"));
iconProvider->registerIconOverlayForSuffix(headerIcon, QLatin1String("H"));
iconProvider->registerIconOverlayForSuffix(headerIcon, QLatin1String("hp"));
iconProvider->registerIconOverlayForSuffix(headerIcon, QLatin1String("h++"));
#endif
}
QString CppEditorFactory::kind() const