forked from qt-creator/qt-creator
rewrite editor info bar handling
the info about the bars is now stored in the IFile, not in the EditorView. this is somewhat more expensive for the bars which identically apply to all editors of one type, but fixes consistency issues between views. additionally, it is now possible to set several simultaneous info bars per file, which ensures that no information is lost. Co-authored-by: mae
This commit is contained in:
@@ -68,6 +68,7 @@
|
||||
#include <cpptools/cppcodeformatter.h>
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/infobar.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
#include <coreplugin/actionmanager/command.h>
|
||||
@@ -444,9 +445,6 @@ CPPEditorWidget::CPPEditorWidget(QWidget *parent)
|
||||
|
||||
CPPEditorWidget::~CPPEditorWidget()
|
||||
{
|
||||
if (Core::EditorManager *em = Core::EditorManager::instance())
|
||||
em->hideEditorInfoBar(QLatin1String("CppEditor.Rename"));
|
||||
|
||||
m_semanticHighlighter->abort();
|
||||
m_semanticHighlighter->wait();
|
||||
|
||||
@@ -685,10 +683,12 @@ void CPPEditorWidget::renameUsagesNow(const QString &replacement)
|
||||
if (Symbol *canonicalSymbol = cs(textCursor())) {
|
||||
if (canonicalSymbol->identifier() != 0) {
|
||||
if (showWarningMessage()) {
|
||||
Core::EditorManager::instance()->showEditorInfoBar(QLatin1String("CppEditor.Rename"),
|
||||
tr("This change cannot be undone."),
|
||||
tr("Yes, I know what I am doing."),
|
||||
this, SLOT(hideRenameNotification()));
|
||||
// FIXME: abuse
|
||||
Core::InfoBarEntry info(QLatin1String("CppEditor.Rename"),
|
||||
tr("This change cannot be undone."));
|
||||
info.setCustomButtonInfo(tr("Yes, I know what I am doing."),
|
||||
this, SLOT(hideRenameNotification()));
|
||||
file()->infoBar()->addInfo(info);
|
||||
}
|
||||
|
||||
m_modelManager->renameUsages(canonicalSymbol, cs.context(), replacement);
|
||||
@@ -727,7 +727,7 @@ void CPPEditorWidget::setShowWarningMessage(bool showWarningMessage)
|
||||
void CPPEditorWidget::hideRenameNotification()
|
||||
{
|
||||
setShowWarningMessage(false);
|
||||
Core::EditorManager::instance()->hideEditorInfoBar(QLatin1String("CppEditor.Rename"));
|
||||
file()->infoBar()->removeInfo(QLatin1String("CppEditor.Rename"));
|
||||
}
|
||||
|
||||
void CPPEditorWidget::markSymbolsNow()
|
||||
|
||||
Reference in New Issue
Block a user