From c3de6ca4d0d98260bba12dfc84f910c244606331 Mon Sep 17 00:00:00 2001 From: Norwegian Rock Cat Date: Tue, 14 Jul 2009 16:37:26 +0200 Subject: [PATCH] Have the file tree use the native icons on Mac OS X. Also synchronized suffixes to match what is in the xml file. --- src/plugins/coreplugin/fileiconprovider.cpp | 4 ++-- src/plugins/cppeditor/CppEditor.mimetypes.xml | 1 + src/plugins/cppeditor/cppplugin.cpp | 24 ++++++++++++++----- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/plugins/coreplugin/fileiconprovider.cpp b/src/plugins/coreplugin/fileiconprovider.cpp index 2bd0b9711e2..04f5e9589d7 100644 --- a/src/plugins/coreplugin/fileiconprovider.cpp +++ b/src/plugins/coreplugin/fileiconprovider.cpp @@ -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()) diff --git a/src/plugins/cppeditor/CppEditor.mimetypes.xml b/src/plugins/cppeditor/CppEditor.mimetypes.xml index c80af9efcaa..041f8734b3e 100644 --- a/src/plugins/cppeditor/CppEditor.mimetypes.xml +++ b/src/plugins/cppeditor/CppEditor.mimetypes.xml @@ -38,6 +38,7 @@ C++ source code + diff --git a/src/plugins/cppeditor/cppplugin.cpp b/src/plugins/cppeditor/cppplugin.cpp index 0d7989a67d8..b97918b2fc5 100644 --- a/src/plugins/cppeditor/cppplugin.cpp +++ b/src/plugins/cppeditor/cppplugin.cpp @@ -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