Skip to content
Snippets Groups Projects
Commit c3de6ca4 authored by Norwegian Rock Cat's avatar Norwegian Rock Cat
Browse files

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

Also synchronized suffixes to match what is in the xml file.
parent ccb1b6d3
No related branches found
No related tags found
No related merge requests found
......@@ -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())
......
......@@ -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++"/>
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment