forked from qt-creator/qt-creator
Generic highlighter: Notify editors when mime type registration is done.
Now it is no longer necessary to close the editor for the highlighting to take effect.
This commit is contained in:
@@ -236,6 +236,8 @@ void Manager::registerMimeTypesFinished()
|
|||||||
if (m_queuedMimeTypeRegistrations > 0) {
|
if (m_queuedMimeTypeRegistrations > 0) {
|
||||||
--m_queuedMimeTypeRegistrations;
|
--m_queuedMimeTypeRegistrations;
|
||||||
registerMimeTypes();
|
registerMimeTypes();
|
||||||
|
} else {
|
||||||
|
emit mimeTypesRegistered();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -88,6 +88,9 @@ private slots:
|
|||||||
void downloadAvailableDefinitionsListFinished();
|
void downloadAvailableDefinitionsListFinished();
|
||||||
void downloadDefinitionsFinished();
|
void downloadDefinitionsFinished();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void mimeTypesRegistered();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Manager();
|
Manager();
|
||||||
Q_DISABLE_COPY(Manager)
|
Q_DISABLE_COPY(Manager)
|
||||||
|
@@ -74,7 +74,8 @@ PlainTextEditor::PlainTextEditor(QWidget *parent)
|
|||||||
|
|
||||||
m_commentDefinition.clearCommentStyles();
|
m_commentDefinition.clearCommentStyles();
|
||||||
|
|
||||||
connect(file(), SIGNAL(changed()), this, SLOT(fileChanged()));
|
connect(file(), SIGNAL(changed()), this, SLOT(configure()));
|
||||||
|
connect(Manager::instance(), SIGNAL(mimeTypesRegistered()), this, SLOT(configure()));
|
||||||
}
|
}
|
||||||
|
|
||||||
PlainTextEditor::~PlainTextEditor()
|
PlainTextEditor::~PlainTextEditor()
|
||||||
@@ -161,7 +162,7 @@ void PlainTextEditor::setTabSettings(const TextEditor::TabSettings &ts)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlainTextEditor::fileChanged()
|
void PlainTextEditor::configure()
|
||||||
{
|
{
|
||||||
configure(Core::ICore::instance()->mimeDatabase()->findByFile(file()->fileName()));
|
configure(Core::ICore::instance()->mimeDatabase()->findByFile(file()->fileName()));
|
||||||
}
|
}
|
||||||
|
@@ -79,7 +79,7 @@ public slots:
|
|||||||
virtual void setTabSettings(const TextEditor::TabSettings &);
|
virtual void setTabSettings(const TextEditor::TabSettings &);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void fileChanged();
|
void configure();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual BaseTextEditorEditable *createEditableInterface() { return new PlainTextEditorEditable(this); }
|
virtual BaseTextEditorEditable *createEditableInterface() { return new PlainTextEditorEditable(this); }
|
||||||
|
Reference in New Issue
Block a user