Move MinimizableInfoBars from CppEditorDocument to IDocument

Similar to the InfoBar.

The only thing that an editor implementation needs to do is to set a
settings group and the possible info bars in the document constructor.
And later call document->minimizableInfoBars()->setInfoVisible(id,
visible) to manage the state.

Change-Id: I23afb3639b70b1bfccd424579da018280a7fe2cb
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
Eike Ziller
2022-05-04 18:12:55 +02:00
parent b5b9b7e32c
commit 42e072f159
6 changed files with 31 additions and 25 deletions

View File

@@ -27,6 +27,7 @@
#include <utils/fileutils.h>
#include <utils/infobar.h>
#include <utils/minimizableinfobars.h>
#include <utils/optional.h>
#include <utils/qtcassert.h>
@@ -226,6 +227,7 @@ public:
QString uniqueDisplayName;
Utils::FilePath autoSavePath;
Utils::InfoBar *infoBar = nullptr;
MinimizableInfoBars *minimizableInfoBars = nullptr;
Id id;
optional<bool> fileIsReadOnly;
bool temporary = false;
@@ -678,6 +680,13 @@ Utils::InfoBar *IDocument::infoBar()
return d->infoBar;
}
MinimizableInfoBars *IDocument::minimizableInfoBars()
{
if (!d->minimizableInfoBars)
d->minimizableInfoBars = new Utils::MinimizableInfoBars(*infoBar());
return d->minimizableInfoBars;
}
/*!
Sets the absolute \a filePath of the file that backs this document. The
default implementation sets the file name and sends the filePathChanged() and