Apply 'static' pattern to MimeDatabase

Also adjust and streamline using and surrounding code.

Change-Id: I6a8b05126bdcbb74ff611b21c7cb3c5902a2d5ca
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
hjk
2013-08-30 16:38:57 +02:00
committed by Tobias Hunger
parent 1226400af3
commit a37589d431
57 changed files with 362 additions and 466 deletions

View File

@@ -266,14 +266,12 @@ void MultiHighlighter::setDocuments(const QList<QPair<DiffEditorWidget::DiffFile
qDeleteAll(m_highlighters);
m_highlighters.clear();
const MimeDatabase *mimeDatabase = ICore::mimeDatabase();
// create new documents
for (int i = 0; i < documents.count(); i++) {
DiffEditorWidget::DiffFileInfo fileInfo = documents.at(i).first;
const QString contents = documents.at(i).second;
QTextDocument *document = new QTextDocument(contents);
const MimeType mimeType = mimeDatabase->findByFile(QFileInfo(fileInfo.fileName));
const MimeType mimeType = MimeDatabase::findByFile(QFileInfo(fileInfo.fileName));
SyntaxHighlighter *highlighter = 0;
if (const IHighlighterFactory *factory = m_mimeTypeToHighlighterFactory.value(mimeType.type())) {
highlighter = factory->createHighlighter();