forked from qt-creator/qt-creator
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:
@@ -70,7 +70,7 @@ QIcon FileIconProvider::icon(const QFileInfo &fileInfo)
|
|||||||
|
|
||||||
// Disabled since for now we'll make sure that all icons fit with our
|
// 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.
|
// 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
|
// 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 ...
|
// same suffix (Mac OS X), but should speed up the retrieval a lot ...
|
||||||
icon = m_systemIconProvider.icon(fileInfo);
|
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 FileIconProvider::iconForSuffix(const QString &suffix) const
|
||||||
{
|
{
|
||||||
QIcon icon;
|
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)
|
Q_UNUSED(suffix)
|
||||||
#else
|
#else
|
||||||
if (suffix.isEmpty())
|
if (suffix.isEmpty())
|
||||||
|
|||||||
@@ -38,6 +38,7 @@
|
|||||||
<sub-class-of type="text/x-csrc"/>
|
<sub-class-of type="text/x-csrc"/>
|
||||||
<comment>C++ source code</comment>
|
<comment>C++ source code</comment>
|
||||||
<glob pattern="*.cpp"/>
|
<glob pattern="*.cpp"/>
|
||||||
|
<glob pattern="*.cp"/>
|
||||||
<glob pattern="*.cc"/>
|
<glob pattern="*.cc"/>
|
||||||
<glob pattern="*.cxx"/>
|
<glob pattern="*.cxx"/>
|
||||||
<glob pattern="*.c++"/>
|
<glob pattern="*.c++"/>
|
||||||
|
|||||||
@@ -69,14 +69,26 @@ CppEditorFactory::CppEditorFactory(CppPlugin *owner) :
|
|||||||
<< QLatin1String(CppEditor::Constants::CPP_SOURCE_MIMETYPE)
|
<< QLatin1String(CppEditor::Constants::CPP_SOURCE_MIMETYPE)
|
||||||
<< QLatin1String(CppEditor::Constants::CPP_HEADER_MIMETYPE);
|
<< QLatin1String(CppEditor::Constants::CPP_HEADER_MIMETYPE);
|
||||||
Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
|
Core::FileIconProvider *iconProvider = Core::FileIconProvider::instance();
|
||||||
iconProvider->registerIconOverlayForSuffix(QIcon(":/cppeditor/images/qt_cpp.png"),
|
#ifndef Q_WS_MAC
|
||||||
QLatin1String("cpp"));
|
// ### It would be really cool if we could get the stuff from the XML file here and not play "catch up" all the time.
|
||||||
iconProvider->registerIconOverlayForSuffix(QIcon(":/cppeditor/images/qt_cpp.png"),
|
QIcon cppIcon(":/cppeditor/images/qt_cpp.png");
|
||||||
QLatin1String("hpp"));
|
iconProvider->registerIconOverlayForSuffix(cppIcon, QLatin1String("cpp"));
|
||||||
iconProvider->registerIconOverlayForSuffix(QIcon(":/cppeditor/images/qt_h.png"),
|
iconProvider->registerIconOverlayForSuffix(cppIcon, QLatin1String("cp"));
|
||||||
QLatin1String("h"));
|
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"),
|
iconProvider->registerIconOverlayForSuffix(QIcon(":/cppeditor/images/qt_c.png"),
|
||||||
QLatin1String("c"));
|
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
|
QString CppEditorFactory::kind() const
|
||||||
|
|||||||
Reference in New Issue
Block a user