Skip to content
Snippets Groups Projects
Commit 8d48b3a0 authored by Leandro Melo's avatar Leandro Melo
Browse files

Generic highlighter: Don't nag about the missing definition if info bar was once closed.

Reviewed-by: con
parent f5877071
No related branches found
No related tags found
No related merge requests found
...@@ -410,12 +410,6 @@ bool Manager::isDownloadingDefinitions() const ...@@ -410,12 +410,6 @@ bool Manager::isDownloadingDefinitions() const
return m_downloadingDefinitions; return m_downloadingDefinitions;
} }
void Manager::showGenericHighlighterOptions() const
{
Core::ICore::instance()->showOptionsDialog(Constants::TEXT_EDITOR_SETTINGS_CATEGORY,
Constants::TEXT_EDITOR_HIGHLIGHTER_SETTINGS);
}
void Manager::clear() void Manager::clear()
{ {
m_idByName.clear(); m_idByName.clear();
......
...@@ -82,7 +82,6 @@ public: ...@@ -82,7 +82,6 @@ public:
public slots: public slots:
void registerMimeTypes(); void registerMimeTypes();
void showGenericHighlighterOptions() const;
private slots: private slots:
void registerMimeType(int index) const; void registerMimeType(int index) const;
......
...@@ -62,7 +62,8 @@ PlainTextEditorEditable::PlainTextEditorEditable(PlainTextEditor *editor) ...@@ -62,7 +62,8 @@ PlainTextEditorEditable::PlainTextEditorEditable(PlainTextEditor *editor)
PlainTextEditor::PlainTextEditor(QWidget *parent) PlainTextEditor::PlainTextEditor(QWidget *parent)
: BaseTextEditor(parent), : BaseTextEditor(parent),
m_isMissingSyntaxDefinition(false) m_isMissingSyntaxDefinition(false),
m_ignoreMissingSyntaxDefinition(false)
{ {
setRevisionsVisible(true); setRevisionsVisible(true);
setMarksVisible(true); setMarksVisible(true);
...@@ -225,6 +226,11 @@ bool PlainTextEditor::isMissingSyntaxDefinition() const ...@@ -225,6 +226,11 @@ bool PlainTextEditor::isMissingSyntaxDefinition() const
return m_isMissingSyntaxDefinition; return m_isMissingSyntaxDefinition;
} }
bool PlainTextEditor::ignoreMissingSyntaxDefinition() const
{
return m_ignoreMissingSyntaxDefinition;
}
QString PlainTextEditor::findDefinitionId(const Core::MimeType &mimeType, QString PlainTextEditor::findDefinitionId(const Core::MimeType &mimeType,
bool considerParents) const bool considerParents) const
{ {
...@@ -246,3 +252,14 @@ void PlainTextEditor::indentBlock(QTextDocument *doc, QTextBlock block, QChar ty ...@@ -246,3 +252,14 @@ void PlainTextEditor::indentBlock(QTextDocument *doc, QTextBlock block, QChar ty
{ {
m_indenter->indentBlock(doc, block, typedChar, tabSettings()); m_indenter->indentBlock(doc, block, typedChar, tabSettings());
} }
void PlainTextEditor::acceptMissingSyntaxDefinitionInfo()
{
Core::ICore::instance()->showOptionsDialog(Constants::TEXT_EDITOR_SETTINGS_CATEGORY,
Constants::TEXT_EDITOR_HIGHLIGHTER_SETTINGS);
}
void PlainTextEditor::ignoreMissingSyntaxDefinitionInfo()
{
m_ignoreMissingSyntaxDefinition = true;
}
...@@ -72,6 +72,7 @@ public: ...@@ -72,6 +72,7 @@ public:
void configure(const Core::MimeType &mimeType); void configure(const Core::MimeType &mimeType);
bool isMissingSyntaxDefinition() const; bool isMissingSyntaxDefinition() const;
bool ignoreMissingSyntaxDefinition() const;
public slots: public slots:
virtual void unCommentSelection(); virtual void unCommentSelection();
...@@ -80,6 +81,8 @@ public slots: ...@@ -80,6 +81,8 @@ public slots:
private slots: private slots:
void configure(); void configure();
void acceptMissingSyntaxDefinitionInfo();
void ignoreMissingSyntaxDefinitionInfo();
signals: signals:
void configured(Core::IEditor *editor); void configured(Core::IEditor *editor);
...@@ -92,6 +95,7 @@ private: ...@@ -92,6 +95,7 @@ private:
QString findDefinitionId(const Core::MimeType &mimeType, bool considerParents) const; QString findDefinitionId(const Core::MimeType &mimeType, bool considerParents) const;
bool m_isMissingSyntaxDefinition; bool m_isMissingSyntaxDefinition;
bool m_ignoreMissingSyntaxDefinition;
Utils::CommentDefinition m_commentDefinition; Utils::CommentDefinition m_commentDefinition;
QScopedPointer<Indenter> m_indenter; QScopedPointer<Indenter> m_indenter;
}; };
......
...@@ -94,14 +94,16 @@ void PlainTextEditorFactory::updateEditorInfoBar(Core::IEditor *editor) ...@@ -94,14 +94,16 @@ void PlainTextEditorFactory::updateEditorInfoBar(Core::IEditor *editor)
if (editorEditable) { if (editorEditable) {
PlainTextEditor *textEditor = static_cast<PlainTextEditor *>(editorEditable->editor()); PlainTextEditor *textEditor = static_cast<PlainTextEditor *>(editorEditable->editor());
if (textEditor->isMissingSyntaxDefinition() && if (textEditor->isMissingSyntaxDefinition() &&
!textEditor->ignoreMissingSyntaxDefinition() &&
TextEditorSettings::instance()->highlighterSettings().alertWhenNoDefinition()) { TextEditorSettings::instance()->highlighterSettings().alertWhenNoDefinition()) {
Core::EditorManager::instance()->showEditorInfoBar( Core::EditorManager::instance()->showEditorInfoBar(
Constants::INFO_SYNTAX_DEFINITION, Constants::INFO_SYNTAX_DEFINITION,
tr("A highlight definition was not found for this file. " tr("A highlight definition was not found for this file. "
"Would you like to try to find one?"), "Would you like to try to find one?"),
tr("Show highlighter options"), tr("Show highlighter options"),
Manager::instance(), textEditor,
SLOT(showGenericHighlighterOptions())); SLOT(acceptMissingSyntaxDefinitionInfo()),
SLOT(ignoreMissingSyntaxDefinitionInfo()));
return; return;
} }
} }
......
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