forked from qt-creator/qt-creator
CppEditor: Delay mime initialization on startup
Plugins register their mime types on initialize(). If a plugin *reads* from the mime database on initialize(), and plugins that follow it register new mime types, the next read forces reload of the database, which is expensive. Change-Id: Ifd5f1bfea17faf2be25846d954d66884b6fbb204 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
This commit is contained in:
committed by
Orgad Shaneh
parent
70b714d3ae
commit
8c53ff79ab
@@ -107,18 +107,6 @@ public:
|
|||||||
| TextEditorActionHandler::FollowSymbolUnderCursor);
|
| TextEditorActionHandler::FollowSymbolUnderCursor);
|
||||||
|
|
||||||
addHoverHandler(new CppHoverHandler);
|
addHoverHandler(new CppHoverHandler);
|
||||||
|
|
||||||
if (!HostOsInfo::isMacHost() && !HostOsInfo::isWindowsHost()) {
|
|
||||||
FileIconProvider::registerIconOverlayForMimeType(
|
|
||||||
QIcon(creatorTheme()->imageFile(Theme::IconOverlayCppSource, QLatin1String(":/cppeditor/images/qt_cpp.png"))),
|
|
||||||
Constants::CPP_SOURCE_MIMETYPE);
|
|
||||||
FileIconProvider::registerIconOverlayForMimeType(
|
|
||||||
QIcon(creatorTheme()->imageFile(Theme::IconOverlayCSource, QLatin1String(":/cppeditor/images/qt_c.png"))),
|
|
||||||
Constants::C_SOURCE_MIMETYPE);
|
|
||||||
FileIconProvider::registerIconOverlayForMimeType(
|
|
||||||
QIcon(creatorTheme()->imageFile(Theme::IconOverlayCppHeader, QLatin1String(":/cppeditor/images/qt_h.png"))),
|
|
||||||
Constants::CPP_HEADER_MIMETYPE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -280,6 +268,17 @@ bool CppEditorPlugin::initialize(const QStringList & /*arguments*/, QString *err
|
|||||||
|
|
||||||
void CppEditorPlugin::extensionsInitialized()
|
void CppEditorPlugin::extensionsInitialized()
|
||||||
{
|
{
|
||||||
|
if (!HostOsInfo::isMacHost() && !HostOsInfo::isWindowsHost()) {
|
||||||
|
FileIconProvider::registerIconOverlayForMimeType(
|
||||||
|
QIcon(creatorTheme()->imageFile(Theme::IconOverlayCppSource, QLatin1String(":/cppeditor/images/qt_cpp.png"))),
|
||||||
|
Constants::CPP_SOURCE_MIMETYPE);
|
||||||
|
FileIconProvider::registerIconOverlayForMimeType(
|
||||||
|
QIcon(creatorTheme()->imageFile(Theme::IconOverlayCSource, QLatin1String(":/cppeditor/images/qt_c.png"))),
|
||||||
|
Constants::C_SOURCE_MIMETYPE);
|
||||||
|
FileIconProvider::registerIconOverlayForMimeType(
|
||||||
|
QIcon(creatorTheme()->imageFile(Theme::IconOverlayCppHeader, QLatin1String(":/cppeditor/images/qt_h.png"))),
|
||||||
|
Constants::CPP_HEADER_MIMETYPE);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtensionSystem::IPlugin::ShutdownFlag CppEditorPlugin::aboutToShutdown()
|
ExtensionSystem::IPlugin::ShutdownFlag CppEditorPlugin::aboutToShutdown()
|
||||||
|
|||||||
Reference in New Issue
Block a user