QML/JS: Fix that warnings about editing .ui.qml files accumulated

Splitting the editor would add the warning again. Since the warning is a
document property, handle it in the document instead of the widgets.

Change-Id: Ie20377b05dee14983f7ff46ba04ed2af2b737c96
Task-number: QTCREATORBUG-14923
Reviewed-by: Marco Benelli <marco.benelli@theqtcompany.com>
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
This commit is contained in:
Eike Ziller
2015-08-17 16:51:55 +02:00
committed by Thomas Hartmann
parent 53e1c84f50
commit 78e8871207
4 changed files with 18 additions and 14 deletions

View File

@@ -37,6 +37,10 @@
#include "qmljssemanticinfoupdater.h"
#include "qmloutlinemodel.h"
#include <coreplugin/coreconstants.h>
#include <coreplugin/infobar.h>
#include <coreplugin/modemanager.h>
#include <qmljstools/qmljsindenter.h>
#include <qmljstools/qmljsmodelmanager.h>
#include <qmljstools/qmljsqtstylecodeformatter.h>
@@ -520,6 +524,19 @@ void QmlJSEditorDocumentPrivate::acceptNewSemanticInfo(const SemanticInfo &seman
m_outlineModelNeedsUpdate = true;
m_semanticHighlightingNecessary = true;
if (m_firstSementicInfo) {
m_firstSementicInfo = false;
if (semanticInfo.document->language() == Dialect::QmlQtQuick2Ui
&& !q->infoBar()->containsInfo(Core::Id(Constants::QML_UI_FILE_WARNING))) {
Core::InfoBarEntry info(Core::Id(Constants::QML_UI_FILE_WARNING),
tr("This file should only be edited in <b>Design</b> mode."));
info.setCustomButtonInfo(tr("Switch Mode"), []() {
Core::ModeManager::activateMode(Core::Constants::MODE_DESIGN);
});
q->infoBar()->addInfo(info);
}
}
emit q->semanticInfoUpdated(m_semanticInfo); // calls triggerPendingUpdates as necessary
}