forked from qt-creator/qt-creator
Highlighter: clarify 'Update Definitions' action
by renaming it to Download Definitions and adding a tooltip stating that it collects all definitions that are missing or were updated after the release and downloads it to the ksyntax highlighting user folder. Also adding a separate reload definitions button in the settings behind the user path. Change-Id: I059cc98e33147cae910fa4fdb35631d1dca81448 Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -29,7 +29,9 @@
|
||||
#include "textdocumentlayout.h"
|
||||
#include "tabsettings.h"
|
||||
#include "texteditorsettings.h"
|
||||
#include "texteditor.h"
|
||||
|
||||
#include <coreplugin/editormanager/documentmodel.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/messagemanager.h>
|
||||
#include <utils/mimetypes/mimedatabase.h>
|
||||
@@ -250,7 +252,7 @@ void Highlighter::addCustomHighlighterPath(const Utils::FilePath &path)
|
||||
highlightRepository()->addCustomSearchPath(path.toString());
|
||||
}
|
||||
|
||||
void Highlighter::updateDefinitions(std::function<void()> callback) {
|
||||
void Highlighter::downloadDefinitions(std::function<void()> callback) {
|
||||
auto downloader =
|
||||
new KSyntaxHighlighting::DefinitionDownloader(highlightRepository());
|
||||
connect(downloader, &KSyntaxHighlighting::DefinitionDownloader::done,
|
||||
@@ -271,6 +273,17 @@ void Highlighter::updateDefinitions(std::function<void()> callback) {
|
||||
downloader->start();
|
||||
}
|
||||
|
||||
void Highlighter::reload()
|
||||
{
|
||||
highlightRepository()->reload();
|
||||
for (auto editor : Core::DocumentModel::editorsForOpenedDocuments()) {
|
||||
if (auto textEditor = qobject_cast<BaseTextEditor *>(editor)) {
|
||||
if (qobject_cast<Highlighter *>(textEditor->textDocument()->syntaxHighlighter()))
|
||||
textEditor->editorWidget()->configureGenericHighlighter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Highlighter::handleShutdown()
|
||||
{
|
||||
delete highlightRepository();
|
||||
|
||||
Reference in New Issue
Block a user