aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2020-06-17 12:23:44 +0200
committerEike Ziller <eike.ziller@qt.io>2020-06-18 06:39:54 +0000
commit7c5ed6f7d99362af743f30916d031d441abc1984 (patch)
tree7b8ef47da6e256e79f2e0034c0334350907c3057 /src/plugins
parentc70c6ded30610afff34447a65da905e993e0e9b6 (diff)
Move InfoBar to Utils
The only reason it was required to be in Core plugin, was its use of Id, which now is available in Utils. Change-Id: I66ce863c24924e6448d339b3422538a7fe167336 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/android/androidmanifesteditorwidget.cpp10
-rw-r--r--src/plugins/android/androidplugin.cpp14
-rw-r--r--src/plugins/clearcase/clearcaseplugin.cpp2
-rw-r--r--src/plugins/coreplugin/CMakeLists.txt1
-rw-r--r--src/plugins/coreplugin/coreplugin.cpp4
-rw-r--r--src/plugins/coreplugin/coreplugin.pro2
-rw-r--r--src/plugins/coreplugin/coreplugin.qbs2
-rw-r--r--src/plugins/coreplugin/editormanager/editormanager.cpp2
-rw-r--r--src/plugins/coreplugin/editormanager/editorview.cpp6
-rw-r--r--src/plugins/coreplugin/editormanager/editorview.h7
-rw-r--r--src/plugins/coreplugin/fancytabwidget.h8
-rw-r--r--src/plugins/coreplugin/find/searchresultwidget.h6
-rw-r--r--src/plugins/coreplugin/generalsettings.cpp2
-rw-r--r--src/plugins/coreplugin/icore.cpp2
-rw-r--r--src/plugins/coreplugin/icore.h7
-rw-r--r--src/plugins/coreplugin/idocument.cpp15
-rw-r--r--src/plugins/coreplugin/idocument.h8
-rw-r--r--src/plugins/coreplugin/infobar.cpp361
-rw-r--r--src/plugins/coreplugin/infobar.h148
-rw-r--r--src/plugins/coreplugin/mainwindow.h7
-rw-r--r--src/plugins/coreplugin/vcsmanager.cpp14
-rw-r--r--src/plugins/cppeditor/cppeditordocument.cpp12
-rw-r--r--src/plugins/cppeditor/cppeditorwidget.cpp2
-rw-r--r--src/plugins/cppeditor/cppminimizableinfobars.cpp5
-rw-r--r--src/plugins/cppeditor/cppminimizableinfobars.h6
-rw-r--r--src/plugins/designer/formeditorw.cpp20
-rw-r--r--src/plugins/diffeditor/diffeditorwidgetcontroller.cpp12
-rw-r--r--src/plugins/git/gitplugin.cpp5
-rw-r--r--src/plugins/mcusupport/mcusupportplugin.cpp12
-rw-r--r--src/plugins/projectexplorer/projecttree.cpp11
-rw-r--r--src/plugins/python/pythonutils.cpp24
-rw-r--r--src/plugins/qmljseditor/qmljseditordocument.cpp7
-rw-r--r--src/plugins/qtsupport/qtsupportplugin.cpp6
-rw-r--r--src/plugins/scxmleditor/scxmleditordata.cpp8
-rw-r--r--src/plugins/texteditor/plaintexteditorfactory.cpp2
-rw-r--r--src/plugins/texteditor/texteditor.cpp10
-rw-r--r--src/plugins/updateinfo/updateinfoplugin.cpp5
-rw-r--r--src/plugins/welcome/introductionwidget.cpp6
38 files changed, 140 insertions, 641 deletions
diff --git a/src/plugins/android/androidmanifesteditorwidget.cpp b/src/plugins/android/androidmanifesteditorwidget.cpp
index 61d7007140d..de38f3200a0 100644
--- a/src/plugins/android/androidmanifesteditorwidget.cpp
+++ b/src/plugins/android/androidmanifesteditorwidget.cpp
@@ -34,7 +34,6 @@
#include "splashiconcontainerwidget.h"
#include <coreplugin/icore.h>
-#include <coreplugin/infobar.h>
#include <coreplugin/editormanager/ieditor.h>
#include <qtsupport/qtkitinformation.h>
@@ -53,6 +52,7 @@
#include <utils/algorithm.h>
#include <utils/fileutils.h>
+#include <utils/infobar.h>
#include <utils/stylehelper.h>
#include <utils/utilsicons.h>
@@ -721,13 +721,13 @@ void AndroidManifestEditorWidget::updateSdkVersions()
void AndroidManifestEditorWidget::updateInfoBar(const QString &errorMessage, int line, int column)
{
- Core::InfoBar *infoBar = m_textEditorWidget->textDocument()->infoBar();
+ Utils::InfoBar *infoBar = m_textEditorWidget->textDocument()->infoBar();
QString text;
if (line < 0)
text = tr("Could not parse file: \"%1\".").arg(errorMessage);
else
text = tr("%2: Could not parse file: \"%1\".").arg(errorMessage).arg(line);
- Core::InfoBarEntry infoBarEntry(infoBarId, text);
+ Utils::InfoBarEntry infoBarEntry(infoBarId, text);
infoBarEntry.setCustomButtonInfo(tr("Goto error"), [this]() {
m_textEditorWidget->gotoLine(m_errorLine, m_errorColumn);
});
@@ -741,7 +741,7 @@ void AndroidManifestEditorWidget::updateInfoBar(const QString &errorMessage, int
void AndroidManifestEditorWidget::hideInfoBar()
{
- Core::InfoBar *infoBar = m_textEditorWidget->textDocument()->infoBar();
+ Utils::InfoBar *infoBar = m_textEditorWidget->textDocument()->infoBar();
infoBar->removeInfo(infoBarId);
m_timerParseCheck.stop();
}
@@ -753,7 +753,7 @@ void AndroidManifestEditorWidget::setInvalidServiceInfo()
Core::Id id(kServicesInvalid);
if (m_textEditorWidget->textDocument()->infoBar()->containsInfo(id))
return;
- Core::InfoBarEntry info(id,
+ Utils::InfoBarEntry info(id,
tr("Services invalid. "
"Manifest cannot be saved. Correct the service definitions before saving."));
m_textEditorWidget->textDocument()->infoBar()->addInfo(info);
diff --git a/src/plugins/android/androidplugin.cpp b/src/plugins/android/androidplugin.cpp
index 7b5a99f6587..187146a6367 100644
--- a/src/plugins/android/androidplugin.cpp
+++ b/src/plugins/android/androidplugin.cpp
@@ -47,8 +47,8 @@
#endif
#include <coreplugin/icore.h>
-#include <coreplugin/infobar.h>
#include <utils/checkablemessagebox.h>
+#include <utils/infobar.h>
#include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/buildconfiguration.h>
@@ -194,12 +194,12 @@ void AndroidPlugin::askUserAboutAndroidSetup()
|| !Core::ICore::infoBar()->canInfoBeAdded(kSetupAndroidSetting))
return;
- Core::InfoBarEntry info(
- kSetupAndroidSetting,
- tr("Would you like to configure Android options? This will ensure "
- "Android kits can be usable and all essential packages are installed. "
- "To do it later, select Options > Devices > Android."),
- Core::InfoBarEntry::GlobalSuppression::Enabled);
+ Utils::InfoBarEntry
+ info(kSetupAndroidSetting,
+ tr("Would you like to configure Android options? This will ensure "
+ "Android kits can be usable and all essential packages are installed. "
+ "To do it later, select Options > Devices > Android."),
+ Utils::InfoBarEntry::GlobalSuppression::Enabled);
info.setCustomButtonInfo(tr("Configure Android"), [this] {
Core::ICore::infoBar()->removeInfo(kSetupAndroidSetting);
Core::ICore::infoBar()->globallySuppressInfo(kSetupAndroidSetting);
diff --git a/src/plugins/clearcase/clearcaseplugin.cpp b/src/plugins/clearcase/clearcaseplugin.cpp
index 7c0c95c6323..227ff5419a6 100644
--- a/src/plugins/clearcase/clearcaseplugin.cpp
+++ b/src/plugins/clearcase/clearcaseplugin.cpp
@@ -44,7 +44,6 @@
#include <coreplugin/editormanager/documentmodel.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h>
-#include <coreplugin/infobar.h>
#include <coreplugin/locator/commandlocator.h>
#include <coreplugin/messagemanager.h>
#include <coreplugin/progressmanager/progressmanager.h>
@@ -58,6 +57,7 @@
#include <utils/algorithm.h>
#include <utils/fileutils.h>
#include <utils/hostosinfo.h>
+#include <utils/infobar.h>
#include <utils/parameteraction.h>
#include <utils/qtcassert.h>
#include <utils/runextensions.h>
diff --git a/src/plugins/coreplugin/CMakeLists.txt b/src/plugins/coreplugin/CMakeLists.txt
index 937a9b0befd..1faf28e4884 100644
--- a/src/plugins/coreplugin/CMakeLists.txt
+++ b/src/plugins/coreplugin/CMakeLists.txt
@@ -91,7 +91,6 @@ add_qtc_plugin(Core
ifilewizardextension.h
imode.cpp imode.h
inavigationwidgetfactory.cpp inavigationwidgetfactory.h
- infobar.cpp infobar.h
ioutputpane.cpp ioutputpane.h
iversioncontrol.cpp iversioncontrol.h
iwelcomepage.cpp iwelcomepage.h
diff --git a/src/plugins/coreplugin/coreplugin.cpp b/src/plugins/coreplugin/coreplugin.cpp
index ba2b91cc6ed..bb63869fa8b 100644
--- a/src/plugins/coreplugin/coreplugin.cpp
+++ b/src/plugins/coreplugin/coreplugin.cpp
@@ -29,7 +29,6 @@
#include "helpmanager.h"
#include "icore.h"
#include "idocument.h"
-#include "infobar.h"
#include "iwizardfactory.h"
#include "mainwindow.h"
#include "modemanager.h"
@@ -50,9 +49,10 @@
#include <extensionsystem/pluginmanager.h>
#include <extensionsystem/pluginspec.h>
#include <utils/algorithm.h>
-#include <utils/pathchooser.h>
+#include <utils/infobar.h>
#include <utils/macroexpander.h>
#include <utils/mimetypes/mimedatabase.h>
+#include <utils/pathchooser.h>
#include <utils/savefile.h>
#include <utils/stringutils.h>
#include <utils/theme/theme.h>
diff --git a/src/plugins/coreplugin/coreplugin.pro b/src/plugins/coreplugin/coreplugin.pro
index cbcb94d0745..ffa9eeeb4a7 100644
--- a/src/plugins/coreplugin/coreplugin.pro
+++ b/src/plugins/coreplugin/coreplugin.pro
@@ -71,7 +71,6 @@ SOURCES += corejsextensions.cpp \
sidebar.cpp \
fileiconprovider.cpp \
icore.cpp \
- infobar.cpp \
editormanager/ieditor.cpp \
dialogs/ioptionspage.cpp \
settingsdatabase.cpp \
@@ -168,7 +167,6 @@ HEADERS += corejsextensions.h \
reaper_p.h \
icontext.h \
icore.h \
- infobar.h \
imode.h \
ioutputpane.h \
coreconstants.h \
diff --git a/src/plugins/coreplugin/coreplugin.qbs b/src/plugins/coreplugin/coreplugin.qbs
index 55fbd945b01..49d2c270b5e 100644
--- a/src/plugins/coreplugin/coreplugin.qbs
+++ b/src/plugins/coreplugin/coreplugin.qbs
@@ -102,8 +102,6 @@ Project {
"imode.h",
"inavigationwidgetfactory.cpp",
"inavigationwidgetfactory.h",
- "infobar.cpp",
- "infobar.h",
"ioutputpane.cpp",
"ioutputpane.h",
"iversioncontrol.cpp",
diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp
index 08f771b519c..c0300900d23 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.cpp
+++ b/src/plugins/coreplugin/editormanager/editormanager.cpp
@@ -52,7 +52,6 @@
#include <coreplugin/find/searchresultitem.h>
#include <coreplugin/icore.h>
#include <coreplugin/imode.h>
-#include <coreplugin/infobar.h>
#include <coreplugin/iversioncontrol.h>
#include <coreplugin/modemanager.h>
#include <coreplugin/outputpane.h>
@@ -68,6 +67,7 @@
#include <utils/executeondestruction.h>
#include <utils/fileutils.h>
#include <utils/hostosinfo.h>
+#include <utils/infobar.h>
#include <utils/macroexpander.h>
#include <utils/mimetypes/mimedatabase.h>
#include <utils/mimetypes/mimetype.h>
diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp
index 2822bc7caab..f4aa4812069 100644
--- a/src/plugins/coreplugin/editormanager/editorview.cpp
+++ b/src/plugins/coreplugin/editormanager/editorview.cpp
@@ -31,13 +31,13 @@
#include "documentmodel_p.h"
#include <coreplugin/actionmanager/actionmanager.h>
+#include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/editortoolbar.h>
+#include <coreplugin/findplaceholder.h>
#include <coreplugin/icore.h>
-#include <coreplugin/infobar.h>
#include <coreplugin/locator/locatorconstants.h>
#include <coreplugin/minisplitter.h>
-#include <coreplugin/editormanager/ieditor.h>
-#include <coreplugin/findplaceholder.h>
+#include <utils/infobar.h>
#include <utils/qtcassert.h>
#include <utils/theme/theme.h>
#include <utils/utilsicons.h>
diff --git a/src/plugins/coreplugin/editormanager/editorview.h b/src/plugins/coreplugin/editormanager/editorview.h
index 752addecb3a..528a7cf07d1 100644
--- a/src/plugins/coreplugin/editormanager/editorview.h
+++ b/src/plugins/coreplugin/editormanager/editorview.h
@@ -50,10 +50,13 @@ class QStackedWidget;
class QToolButton;
QT_END_NAMESPACE
+namespace Utils {
+class InfoBarDisplay;
+}
+
namespace Core {
class IDocument;
class IEditor;
-class InfoBarDisplay;
class EditorToolBar;
namespace Internal {
@@ -130,7 +133,7 @@ private:
EditorToolBar *m_toolBar;
QStackedWidget *m_container;
- InfoBarDisplay *m_infoBarDisplay;
+ Utils::InfoBarDisplay *m_infoBarDisplay;
QString m_statusWidgetId;
QFrame *m_statusHLine;
QFrame *m_statusWidget;
diff --git a/src/plugins/coreplugin/fancytabwidget.h b/src/plugins/coreplugin/fancytabwidget.h
index 00d04f376b5..92f2b49e69f 100644
--- a/src/plugins/coreplugin/fancytabwidget.h
+++ b/src/plugins/coreplugin/fancytabwidget.h
@@ -25,7 +25,7 @@
#pragma once
-#include "infobar.h"
+#include <utils/infobar.h>
#include <QIcon>
#include <QWidget>
@@ -159,7 +159,7 @@ public:
int currentIndex() const;
QStatusBar *statusBar() const;
- InfoBar *infoBar();
+ Utils::InfoBar *infoBar();
void setTabEnabled(int index, bool enable);
bool isTabEnabled(int index) const;
@@ -186,8 +186,8 @@ private:
QStackedLayout *m_modesStack;
QWidget *m_selectionWidget;
QStatusBar *m_statusBar;
- InfoBarDisplay m_infoBarDisplay;
- InfoBar m_infoBar;
+ Utils::InfoBarDisplay m_infoBarDisplay;
+ Utils::InfoBar m_infoBar;
};
} // namespace Internal
diff --git a/src/plugins/coreplugin/find/searchresultwidget.h b/src/plugins/coreplugin/find/searchresultwidget.h
index a2c63af482e..be563a5bc1b 100644
--- a/src/plugins/coreplugin/find/searchresultwidget.h
+++ b/src/plugins/coreplugin/find/searchresultwidget.h
@@ -27,7 +27,7 @@
#include "searchresultwindow.h"
-#include <coreplugin/infobar.h>
+#include <utils/infobar.h>
#include <QWidget>
@@ -127,8 +127,8 @@ private:
int m_count = 0;
QString m_dontAskAgainGroup;
QFrame *m_messageWidget = nullptr;
- InfoBar m_infoBar;
- InfoBarDisplay m_infoBarDisplay;
+ Utils::InfoBar m_infoBar;
+ Utils::InfoBarDisplay m_infoBarDisplay;
QWidget *m_topReplaceWidget = nullptr;
QLabel *m_replaceLabel = nullptr;
QLineEdit *m_replaceTextEdit = nullptr;
diff --git a/src/plugins/coreplugin/generalsettings.cpp b/src/plugins/coreplugin/generalsettings.cpp
index 13cb8259170..35f2cd4d39f 100644
--- a/src/plugins/coreplugin/generalsettings.cpp
+++ b/src/plugins/coreplugin/generalsettings.cpp
@@ -26,7 +26,6 @@
#include "generalsettings.h"
#include "coreconstants.h"
#include "icore.h"
-#include "infobar.h"
#include "ui_generalsettings.h"
@@ -34,6 +33,7 @@
#include <utils/checkablemessagebox.h>
#include <utils/hostosinfo.h>
+#include <utils/infobar.h>
#include <utils/stylehelper.h>
#include <QCoreApplication>
diff --git a/src/plugins/coreplugin/icore.cpp b/src/plugins/coreplugin/icore.cpp
index abd06580498..7311e7b1746 100644
--- a/src/plugins/coreplugin/icore.cpp
+++ b/src/plugins/coreplugin/icore.cpp
@@ -654,7 +654,7 @@ QStatusBar *ICore::statusBar()
Use for notifying the user of something without interrupting with
dialog. Use sparingly.
*/
-InfoBar *ICore::infoBar()
+Utils::InfoBar *ICore::infoBar()
{
return m_mainwindow->infoBar();
}
diff --git a/src/plugins/coreplugin/icore.h b/src/plugins/coreplugin/icore.h
index d39055a57e9..261fd99b34a 100644
--- a/src/plugins/coreplugin/icore.h
+++ b/src/plugins/coreplugin/icore.h
@@ -42,10 +42,13 @@ class QStatusBar;
class QWidget;
QT_END_NAMESPACE
+namespace Utils {
+class InfoBar;
+}
+
namespace Core {
class Context;
class IContext;
-class InfoBar;
class IWizardFactory;
class SettingsDatabase;
@@ -100,7 +103,7 @@ public:
static QMainWindow *mainWindow();
static QWidget *dialogParent();
- static InfoBar *infoBar();
+ static Utils::InfoBar *infoBar();
static void raiseWindow(QWidget *widget);
diff --git a/src/plugins/coreplugin/idocument.cpp b/src/plugins/coreplugin/idocument.cpp
index e24f1107e8c..adedc523899 100644
--- a/src/plugins/coreplugin/idocument.cpp
+++ b/src/plugins/coreplugin/idocument.cpp
@@ -25,9 +25,8 @@
#include "idocument.h"
-#include "infobar.h"
-
#include <utils/fileutils.h>
+#include <utils/infobar.h>
#include <utils/qtcassert.h>
#include <QFile>
@@ -76,7 +75,7 @@ public:
QString preferredDisplayName;
QString uniqueDisplayName;
QString autoSaveName;
- InfoBar *infoBar = nullptr;
+ Utils::InfoBar *infoBar = nullptr;
Id id;
bool temporary = false;
bool hasWriteWarning = false;
@@ -286,9 +285,9 @@ void IDocument::setRestoredFrom(const QString &name)
{
d->autoSaveName = name;
d->restored = true;
- InfoBarEntry info(Id(kRestoredAutoSave),
- tr("File was restored from auto-saved copy. "
- "Select Save to confirm or Revert to Saved to discard changes."));
+ Utils::InfoBarEntry info(Id(kRestoredAutoSave),
+ tr("File was restored from auto-saved copy. "
+ "Select Save to confirm or Revert to Saved to discard changes."));
infoBar()->addInfo(info);
}
@@ -314,10 +313,10 @@ void IDocument::setWriteWarning(bool has)
d->hasWriteWarning = has;
}
-InfoBar *IDocument::infoBar()
+Utils::InfoBar *IDocument::infoBar()
{
if (!d->infoBar)
- d->infoBar = new InfoBar;
+ d->infoBar = new Utils::InfoBar;
return d->infoBar;
}
diff --git a/src/plugins/coreplugin/idocument.h b/src/plugins/coreplugin/idocument.h
index 3e16881cf35..206cac981af 100644
--- a/src/plugins/coreplugin/idocument.h
+++ b/src/plugins/coreplugin/idocument.h
@@ -30,10 +30,12 @@
#include <QObject>
-namespace Utils { class FilePath; }
+namespace Utils {
+class FilePath;
+class InfoBar;
+} // namespace Utils
namespace Core {
-class InfoBar;
namespace Internal {
class IDocumentPrivate;
@@ -130,7 +132,7 @@ public:
bool hasWriteWarning() const;
void setWriteWarning(bool has);
- InfoBar *infoBar();
+ Utils::InfoBar *infoBar();
signals:
// For meta data changes: file name, modified state, ...
diff --git a/src/plugins/coreplugin/infobar.cpp b/src/plugins/coreplugin/infobar.cpp
deleted file mode 100644
index 93f051e1581..00000000000
--- a/src/plugins/coreplugin/infobar.cpp
+++ /dev/null
@@ -1,361 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#include "infobar.h"
-
-#include <utils/algorithm.h>
-#include <utils/qtcassert.h>
-#include <utils/theme/theme.h>
-#include <utils/utilsicons.h>
-
-#include <QHBoxLayout>
-#include <QSettings>
-#include <QVBoxLayout>
-#include <QLabel>
-#include <QToolButton>
-#include <QComboBox>
-
-static const char C_SUPPRESSED_WARNINGS[] = "SuppressedWarnings";
-
-using namespace Utils;
-
-namespace Core {
-
-QSet<Id> InfoBar::globallySuppressed;
-QSettings *InfoBar::m_settings = nullptr;
-Utils::Theme *InfoBar::m_theme = nullptr;
-
-InfoBarEntry::InfoBarEntry(Id _id, const QString &_infoText, GlobalSuppression _globalSuppression)
- : m_id(_id)
- , m_infoText(_infoText)
- , m_globalSuppression(_globalSuppression)
-{
-}
-
-void InfoBarEntry::setCustomButtonInfo(const QString &_buttonText, CallBack callBack)
-{
- m_buttonText = _buttonText;
- m_buttonCallBack = callBack;
-}
-
-void InfoBarEntry::setCancelButtonInfo(CallBack callBack)
-{
- m_useCancelButton = true;
- m_cancelButtonCallBack = callBack;
-}
-
-void InfoBarEntry::setCancelButtonInfo(const QString &_cancelButtonText, CallBack callBack)
-{
- m_useCancelButton = true;
- m_cancelButtonText = _cancelButtonText;
- m_cancelButtonCallBack = callBack;
-}
-
-void InfoBarEntry::setComboInfo(const QStringList &list, InfoBarEntry::ComboCallBack callBack)
-{
- m_comboCallBack = callBack;
- m_comboInfo = list;
-}
-
-void InfoBarEntry::removeCancelButton()
-{
- m_useCancelButton = false;
- m_cancelButtonText.clear();
- m_cancelButtonCallBack = nullptr;
-}
-
-void InfoBarEntry::setDetailsWidgetCreator(const InfoBarEntry::DetailsWidgetCreator &creator)
-{
- m_detailsWidgetCreator = creator;
-}
-
-void InfoBar::addInfo(const InfoBarEntry &info)
-{
- m_infoBarEntries << info;
- emit changed();
-}
-
-void InfoBar::removeInfo(Id id)
-{
- const int size = m_infoBarEntries.size();
- Utils::erase(m_infoBarEntries, Utils::equal(&InfoBarEntry::m_id, id));
- if (size != m_infoBarEntries.size())
- emit changed();
-}
-
-bool InfoBar::containsInfo(Id id) const
-{
- return Utils::anyOf(m_infoBarEntries, Utils::equal(&InfoBarEntry::m_id, id));
-}
-
-// Remove and suppress id
-void InfoBar::suppressInfo(Id id)
-{
- removeInfo(id);
- m_suppressed << id;
-}
-
-// Info cannot be added more than once, or if it is suppressed
-bool InfoBar::canInfoBeAdded(Id id) const
-{
- return !containsInfo(id) && !m_suppressed.contains(id) && !globallySuppressed.contains(id);
-}
-
-void InfoBar::unsuppressInfo(Id id)
-{
- m_suppressed.remove(id);
-}
-
-void InfoBar::clear()
-{
- if (!m_infoBarEntries.isEmpty()) {
- m_infoBarEntries.clear();
- emit changed();
- }
-}
-
-void InfoBar::globallySuppressInfo(Id id)
-{
- globallySuppressed.insert(id);
- writeGloballySuppressedToSettings();
-}
-
-void InfoBar::globallyUnsuppressInfo(Id id)
-{
- globallySuppressed.remove(id);
- writeGloballySuppressedToSettings();
-}
-
-void InfoBar::initialize(QSettings *settings, Theme *theme)
-{
- m_settings = settings;
- m_theme = theme;
-
- if (QTC_GUARD(m_settings)) {
- const QStringList list = m_settings->value(QLatin1String(C_SUPPRESSED_WARNINGS)).toStringList();
- globallySuppressed = Utils::transform<QSet>(list, Id::fromString);
- }
-}
-
-void InfoBar::clearGloballySuppressed()
-{
- globallySuppressed.clear();
- if (m_settings)
- m_settings->setValue(QLatin1String(C_SUPPRESSED_WARNINGS), QStringList());
-}
-
-bool InfoBar::anyGloballySuppressed()
-{
- return !globallySuppressed.isEmpty();
-}
-
-void InfoBar::writeGloballySuppressedToSettings()
-{
- if (!m_settings)
- return;
- const QStringList list = Utils::transform<QList>(globallySuppressed, &Id::toString);
- m_settings->setValue(QLatin1String(C_SUPPRESSED_WARNINGS), list);
-}
-
-
-InfoBarDisplay::InfoBarDisplay(QObject *parent)
- : QObject(parent)
-{
-}
-
-void InfoBarDisplay::setTarget(QBoxLayout *layout, int index)
-{
- m_boxLayout = layout;
- m_boxIndex = index;
-}
-
-void InfoBarDisplay::setInfoBar(InfoBar *infoBar)
-{
- if (m_infoBar == infoBar)
- return;
-
- if (m_infoBar)
- m_infoBar->disconnect(this);
- m_infoBar = infoBar;
- if (m_infoBar) {
- connect(m_infoBar, &InfoBar::changed, this, &InfoBarDisplay::update);
- connect(m_infoBar, &QObject::destroyed, this, &InfoBarDisplay::infoBarDestroyed);
- }
- update();
-}
-
-void InfoBarDisplay::setStyle(QFrame::Shadow style)
-{
- m_style = style;
- update();
-}
-
-InfoBar *InfoBarDisplay::infoBar() const
-{
- return m_infoBar;
-}
-
-void InfoBarDisplay::infoBarDestroyed()
-{
- m_infoBar = nullptr;
- // Calling update() here causes a complicated crash on shutdown.
- // So instead we rely on the view now being either destroyed (in which case it
- // will delete the widgets itself) or setInfoBar() being called explicitly.
-}
-
-void InfoBarDisplay::update()
-{
- for (QWidget *widget : m_infoWidgets) {
- widget->disconnect(this); // We want no destroyed() signal now
- delete widget;
- }
- m_infoWidgets.clear();
-
- if (!m_infoBar)
- return;
-
- for (const InfoBarEntry &info : m_infoBar->m_infoBarEntries) {
- QFrame *infoWidget = new QFrame;
-
- QPalette pal;
- if (QTC_GUARD(InfoBar::m_theme)) {
- pal.setColor(QPalette::Window, InfoBar::m_theme->color(Theme::InfoBarBackground));
- pal.setColor(QPalette::WindowText, InfoBar::m_theme->color(Theme::InfoBarText));
- }
-
- infoWidget->setPalette(pal);
- infoWidget->setFrameStyle(QFrame::Panel | m_style);
- infoWidget->setLineWidth(1);
- infoWidget->setAutoFillBackground(true);
-
- auto hbox = new QHBoxLayout;
- hbox->setContentsMargins(2, 2, 2, 2);
-
- auto vbox = new QVBoxLayout(infoWidget);
- vbox->setContentsMargins(0, 0, 0, 0);
- vbox->addLayout(hbox);
-
- QLabel *infoWidgetLabel = new QLabel(info.m_infoText);
- infoWidgetLabel->setWordWrap(true);
- hbox->addWidget(infoWidgetLabel, 1);
-
- if (info.m_detailsWidgetCreator) {
- if (m_isShowingDetailsWidget) {
- QWidget *detailsWidget = info.m_detailsWidgetCreator();
- vbox->addWidget(detailsWidget);
- }
-
- auto showDetailsButton = new QToolButton;
- showDetailsButton->setCheckable(true);
- showDetailsButton->setChecked(m_isShowingDetailsWidget);
- showDetailsButton->setText(tr("&Show Details"));
- connect(showDetailsButton, &QToolButton::clicked, [this, vbox, info] (bool) {
- QWidget *detailsWidget = vbox->count() == 2 ? vbox->itemAt(1)->widget() : nullptr;
- if (!detailsWidget) {
- detailsWidget = info.m_detailsWidgetCreator();
- vbox->addWidget(detailsWidget);
- }
-
- m_isShowingDetailsWidget = !m_isShowingDetailsWidget;
- detailsWidget->setVisible(m_isShowingDetailsWidget);
- });
-
- hbox->addWidget(showDetailsButton);
- } else {
- m_isShowingDetailsWidget = false;
- }
-
- if (!info.m_comboInfo.isEmpty()) {
- auto cb = new QComboBox();
- cb->addItems(info.m_comboInfo);
- connect(cb, &QComboBox::currentTextChanged, [info](const QString &text) {
- info.m_comboCallBack(text);
- });
-
- hbox->addWidget(cb);
- }
-
- if (!info.m_buttonText.isEmpty()) {
- auto infoWidgetButton = new QToolButton;
- infoWidgetButton->setText(info.m_buttonText);
- connect(infoWidgetButton, &QAbstractButton::clicked, [info]() { info.m_buttonCallBack(); });
-
- hbox->addWidget(infoWidgetButton);
- }
-
- const Id id = info.m_id;
- QToolButton *infoWidgetSuppressButton = nullptr;
- if (info.m_globalSuppression == InfoBarEntry::GlobalSuppression::Enabled) {
- infoWidgetSuppressButton = new QToolButton;
- infoWidgetSuppressButton->setText(tr("Do Not Show Again"));
- connect(infoWidgetSuppressButton, &QAbstractButton::clicked, this, [this, id] {
- m_infoBar->removeInfo(id);
- InfoBar::globallySuppressInfo(id);
- });
- }
-
- QToolButton *infoWidgetCloseButton = nullptr;
- if (info.m_useCancelButton) {
- infoWidgetCloseButton = new QToolButton;
- // need to connect to cancelObjectbefore connecting to cancelButtonClicked,
- // because the latter removes the button and with it any connect
- if (info.m_cancelButtonCallBack)
- connect(infoWidgetCloseButton, &QAbstractButton::clicked, info.m_cancelButtonCallBack);
- connect(infoWidgetCloseButton, &QAbstractButton::clicked, this, [this, id] {
- m_infoBar->suppressInfo(id);
- });
- }
-
- if (info.m_cancelButtonText.isEmpty()) {
- if (infoWidgetCloseButton) {
- infoWidgetCloseButton->setAutoRaise(true);
- infoWidgetCloseButton->setIcon(Utils::Icons::CLOSE_FOREGROUND.icon());
- infoWidgetCloseButton->setToolTip(tr("Close"));
- }
-
- if (infoWidgetSuppressButton)
- hbox->addWidget(infoWidgetSuppressButton);
-
- if (infoWidgetCloseButton)
- hbox->addWidget(infoWidgetCloseButton);
- } else {
- infoWidgetCloseButton->setText(info.m_cancelButtonText);
- hbox->addWidget(infoWidgetCloseButton);
- if (infoWidgetSuppressButton)
- hbox->addWidget(infoWidgetSuppressButton);
- }
-
- connect(infoWidget, &QObject::destroyed, this, &InfoBarDisplay::widgetDestroyed);
- m_boxLayout->insertWidget(m_boxIndex, infoWidget);
- m_infoWidgets << infoWidget;
- }
-}
-
-void InfoBarDisplay::widgetDestroyed()
-{
- m_infoWidgets.removeOne(static_cast<QWidget *>(sender()));
-}
-
-} // namespace Core
diff --git a/src/plugins/coreplugin/infobar.h b/src/plugins/coreplugin/infobar.h
deleted file mode 100644
index 5f0a7472bd1..00000000000
--- a/src/plugins/coreplugin/infobar.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#pragma once
-
-#include "core_global.h"
-#include <coreplugin/id.h>
-
-#include <QFrame>
-#include <QObject>
-#include <QSet>
-
-#include <functional>
-
-QT_BEGIN_NAMESPACE
-class QBoxLayout;
-class QSettings;
-QT_END_NAMESPACE
-
-namespace Utils { class Theme; }
-
-namespace Core {
-
-class InfoBar;
-class InfoBarDisplay;
-
-class CORE_EXPORT InfoBarEntry
-{
-public:
- enum class GlobalSuppression
- {
- Disabled,
- Enabled
- };
-
- InfoBarEntry(Id _id, const QString &_infoText, GlobalSuppression _globalSuppression = GlobalSuppression::Disabled);
-
- using CallBack = std::function<void()>;
- void setCustomButtonInfo(const QString &_buttonText, CallBack callBack);
- void setCancelButtonInfo(CallBack callBack);
- void setCancelButtonInfo(const QString &_cancelButtonText, CallBack callBack);
- using ComboCallBack = std::function<void(const QString &)>;
- void setComboInfo(const QStringList &list, ComboCallBack callBack);
- void removeCancelButton();
-
- using DetailsWidgetCreator = std::function<QWidget*()>;
- void setDetailsWidgetCreator(const DetailsWidgetCreator &creator);
-
-private:
- Id m_id;
- QString m_infoText;
- QString m_buttonText;
- CallBack m_buttonCallBack;
- QString m_cancelButtonText;
- CallBack m_cancelButtonCallBack;
- GlobalSuppression m_globalSuppression;
- DetailsWidgetCreator m_detailsWidgetCreator;
- bool m_useCancelButton = true;
- ComboCallBack m_comboCallBack;
- QStringList m_comboInfo;
- friend class InfoBar;
- friend class InfoBarDisplay;
-};
-
-class CORE_EXPORT InfoBar : public QObject
-{
- Q_OBJECT
-
-public:
- void addInfo(const InfoBarEntry &info);
- void removeInfo(Id id);
- bool containsInfo(Id id) const;
- void suppressInfo(Id id);
- bool canInfoBeAdded(Id id) const;
- void unsuppressInfo(Id id);
- void clear();
- static void globallySuppressInfo(Id id);
- static void globallyUnsuppressInfo(Id id);
- static void clearGloballySuppressed();
- static bool anyGloballySuppressed();
-
- static void initialize(QSettings *settings, Utils::Theme *theme);
-
-signals:
- void changed();
-
-private:
- static void writeGloballySuppressedToSettings();
-
-private:
- QList<InfoBarEntry> m_infoBarEntries;
- QSet<Id> m_suppressed;
-
- static QSet<Id> globallySuppressed;
- static QSettings *m_settings;
- static Utils::Theme *m_theme;
-
- friend class InfoBarDisplay;
-};
-
-class CORE_EXPORT InfoBarDisplay : public QObject
-{
- Q_OBJECT
-
-public:
- InfoBarDisplay(QObject *parent = nullptr);
- void setTarget(QBoxLayout *layout, int index);
- void setInfoBar(InfoBar *infoBar);
- void setStyle(QFrame::Shadow style);
-
- InfoBar *infoBar() const;
-
-private:
- void update();
- void infoBarDestroyed();
- void widgetDestroyed();
-
- QList<QWidget *> m_infoWidgets;
- InfoBar *m_infoBar = nullptr;
- QBoxLayout *m_boxLayout = nullptr;
- QFrame::Shadow m_style = QFrame::Raised;
- int m_boxIndex = 0;
- bool m_isShowingDetailsWidget = false;
-};
-
-} // namespace Core
diff --git a/src/plugins/coreplugin/mainwindow.h b/src/plugins/coreplugin/mainwindow.h
index 78ec6495d62..2847b341cb4 100644
--- a/src/plugins/coreplugin/mainwindow.h
+++ b/src/plugins/coreplugin/mainwindow.h
@@ -41,12 +41,15 @@ class QPrinter;
class QToolButton;
QT_END_NAMESPACE
+namespace Utils {
+class InfoBar;
+}
+
namespace Core {
class EditorManager;
class ExternalToolManager;
class IDocument;
-class InfoBar;
class JsExpander;
class MessageManager;
class ModeManager;
@@ -94,7 +97,7 @@ public:
virtual QPrinter *printer() const;
IContext * currentContextObject() const;
QStatusBar *statusBar() const;
- InfoBar *infoBar() const;
+ Utils::InfoBar *infoBar() const;
void updateAdditionalContexts(const Context &remove, const Context &add,
ICore::ContextPriority priority);
diff --git a/src/plugins/coreplugin/vcsmanager.cpp b/src/plugins/coreplugin/vcsmanager.cpp
index d8668363add..eebdbde441f 100644
--- a/src/plugins/coreplugin/vcsmanager.cpp
+++ b/src/plugins/coreplugin/vcsmanager.cpp
@@ -28,17 +28,17 @@
#include "icore.h"
#include "documentmanager.h"
#include "idocument.h"
-#include "infobar.h"
#include <coreplugin/dialogs/addtovcsdialog.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h>
-#include <vcsbase/vcsbaseconstants.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/algorithm.h>
+#include <utils/infobar.h>
#include <utils/optional.h>
#include <utils/qtcassert.h>
+#include <vcsbase/vcsbaseconstants.h>
#include <QDir>
#include <QString>
@@ -296,12 +296,12 @@ IVersionControl* VcsManager::findVersionControlForDirectory(const QString &input
}
return versionControl;
} else {
- InfoBar *infoBar = curDocument ? curDocument->infoBar() : nullptr;
+ Utils::InfoBar *infoBar = curDocument ? curDocument->infoBar() : nullptr;
if (infoBar && infoBar->canInfoBeAdded(vcsWarning)) {
- InfoBarEntry info(vcsWarning,
- tr("%1 repository was detected but %1 is not configured.")
- .arg(versionControl->displayName()),
- InfoBarEntry::GlobalSuppression::Enabled);
+ Utils::InfoBarEntry info(vcsWarning,
+ tr("%1 repository was detected but %1 is not configured.")
+ .arg(versionControl->displayName()),
+ Utils::InfoBarEntry::GlobalSuppression::Enabled);
d->m_unconfiguredVcs = versionControl;
info.setCustomButtonInfo(ICore::msgShowOptionsDialog(), []() {
QTC_ASSERT(d->m_unconfiguredVcs, return);
diff --git a/src/plugins/cppeditor/cppeditordocument.cpp b/src/plugins/cppeditor/cppeditordocument.cpp
index 5d85bd638c3..d0a2133a457 100644
--- a/src/plugins/cppeditor/cppeditordocument.cpp
+++ b/src/plugins/cppeditor/cppeditordocument.cpp
@@ -30,7 +30,7 @@
#include "cpphighlighter.h"
#include "cppquickfixassistant.h"
-#include <coreplugin/infobar.h>
+#include <coreplugin/editormanager/editormanager.h>
#include <cpptools/baseeditordocumentparser.h>
#include <cpptools/builtineditordocumentprocessor.h>
@@ -48,8 +48,8 @@
#include <texteditor/textdocumentlayout.h>
#include <texteditor/texteditorsettings.h>
-#include <coreplugin/editormanager/editormanager.h>
#include <utils/executeondestruction.h>
+#include <utils/infobar.h>
#include <utils/mimetypes/mimedatabase.h>
#include <utils/qtcassert.h>
#include <utils/runextensions.h>
@@ -354,10 +354,10 @@ void CppEditorDocument::showHideInfoBarAboutMultipleParseContexts(bool show)
const Core::Id id = Constants::MULTIPLE_PARSE_CONTEXTS_AVAILABLE;
if (show) {
- Core::InfoBarEntry info(id,
- tr("Note: Multiple parse contexts are available for this file. "
- "Choose the preferred one from the editor toolbar."),
- Core::InfoBarEntry::GlobalSuppression::Enabled);
+ Utils::InfoBarEntry info(id,
+ tr("Note: Multiple parse contexts are available for this file. "
+ "Choose the preferred one from the editor toolbar."),
+ Utils::InfoBarEntry::GlobalSuppression::Enabled);
info.removeCancelButton();
if (infoBar()->canInfoBeAdded(id))
infoBar()->addInfo(info);
diff --git a/src/plugins/cppeditor/cppeditorwidget.cpp b/src/plugins/cppeditor/cppeditorwidget.cpp
index f13d6d5a024..7b3a1b2c926 100644
--- a/src/plugins/cppeditor/cppeditorwidget.cpp
+++ b/src/plugins/cppeditor/cppeditorwidget.cpp
@@ -45,7 +45,6 @@
#include <coreplugin/editormanager/documentmodel.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/find/searchresultwindow.h>
-#include <coreplugin/infobar.h>
#include <cpptools/cppcanonicalsymbol.h>
#include <cpptools/cppchecksymbols.h>
@@ -83,6 +82,7 @@
#include <cplusplus/ASTPath.h>
#include <cplusplus/FastPreprocessor.h>
#include <cplusplus/MatchingText.h>
+#include <utils/infobar.h>
#include <utils/progressindicator.h>
#include <utils/qtcassert.h>
#include <utils/textutils.h>
diff --git a/src/plugins/cppeditor/cppminimizableinfobars.cpp b/src/plugins/cppeditor/cppminimizableinfobars.cpp
index 7e658292198..114f7109f91 100644
--- a/src/plugins/cppeditor/cppminimizableinfobars.cpp
+++ b/src/plugins/cppeditor/cppminimizableinfobars.cpp
@@ -31,15 +31,16 @@
#include <QToolButton>
#include <coreplugin/id.h>
-#include <coreplugin/infobar.h>
#include <cpptools/cpptoolssettings.h>
-#include <utils/utilsicons.h>
+#include <utils/infobar.h>
#include <utils/qtcassert.h>
+#include <utils/utilsicons.h>
using namespace Core;
using namespace CppTools;
+using namespace Utils;
namespace CppEditor {
namespace Internal {
diff --git a/src/plugins/cppeditor/cppminimizableinfobars.h b/src/plugins/cppeditor/cppminimizableinfobars.h
index 9425be54a30..9e21f30ec2d 100644
--- a/src/plugins/cppeditor/cppminimizableinfobars.h
+++ b/src/plugins/cppeditor/cppminimizableinfobars.h
@@ -33,7 +33,7 @@
#include <functional>
-namespace Core {
+namespace Utils {
class InfoBar;
}
@@ -52,7 +52,7 @@ public:
static Actions createShowInfoBarActions(const ActionCreator &actionCreator);
public:
- explicit MinimizableInfoBars(Core::InfoBar &infoBar, QObject *parent = nullptr);
+ explicit MinimizableInfoBars(Utils::InfoBar &infoBar, QObject *parent = nullptr);
// Expected call order: processHasProjectPart(), processHeaderDiagnostics()
void processHasProjectPart(bool hasProjectPart);
@@ -70,7 +70,7 @@ private:
const DiagnosticWidgetCreator &diagnosticWidgetCreator);
private:
- Core::InfoBar &m_infoBar;
+ Utils::InfoBar &m_infoBar;
bool m_hasProjectPart = true;
DiagnosticWidgetCreator m_diagnosticWidgetCreator;
diff --git a/src/plugins/designer/formeditorw.cpp b/src/plugins/designer/formeditorw.cpp
index 0076d62134b..3bcecb05ee5 100644
--- a/src/plugins/designer/formeditorw.cpp
+++ b/src/plugins/designer/formeditorw.cpp
@@ -34,19 +34,19 @@
#include "designercontext.h"
#include <widgethost.h>
-#include <coreplugin/editortoolbar.h>
-#include <coreplugin/designmode.h>
+#include <coreplugin/actionmanager/actioncontainer.h>
+#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/coreconstants.h>
+#include <coreplugin/designmode.h>
#include <coreplugin/dialogs/ioptionspage.h>
-#include <coreplugin/icore.h>
-#include <coreplugin/infobar.h>
-#include <coreplugin/helpmanager.h>
-#include <coreplugin/actionmanager/actionmanager.h>
-#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/editormanager/editormanager.h>
-#include <coreplugin/modemanager.h>
+#include <coreplugin/editortoolbar.h>
+#include <coreplugin/helpmanager.h>
+#include <coreplugin/icore.h>
#include <coreplugin/minisplitter.h>
+#include <coreplugin/modemanager.h>
#include <coreplugin/outputpane.h>
+#include <utils/infobar.h>
#include <utils/qtcassert.h>
#include <QDesignerFormEditorPluginInterface>
@@ -774,8 +774,8 @@ IEditor *FormEditorData::createEditor()
m_toolBar->addEditor(formWindowEditor);
if (formWindowEditor) {
- InfoBarEntry info(Id(Constants::INFO_READ_ONLY),
- tr("This file can only be edited in <b>Design</b> mode."));
+ Utils::InfoBarEntry info(Id(Constants::INFO_READ_ONLY),
+ tr("This file can only be edited in <b>Design</b> mode."));
info.setCustomButtonInfo(tr("Switch Mode"), []() { ModeManager::activateMode(Core::Constants::MODE_DESIGN); });
formWindowEditor->document()->infoBar()->addInfo(info);
}
diff --git a/src/plugins/diffeditor/diffeditorwidgetcontroller.cpp b/src/plugins/diffeditor/diffeditorwidgetcontroller.cpp
index 8c408ae3891..253bf67a61a 100644
--- a/src/plugins/diffeditor/diffeditorwidgetcontroller.cpp
+++ b/src/plugins/diffeditor/diffeditorwidgetcontroller.cpp
@@ -30,7 +30,6 @@
#include <coreplugin/documentmanager.h>
#include <coreplugin/editormanager/editormanager.h>
-#include <coreplugin/infobar.h>
#include <coreplugin/patchtool.h>
#include <texteditor/fontsettings.h>
@@ -40,6 +39,7 @@
#include <cpaster/codepasterservice.h>
+#include <utils/infobar.h>
#include <utils/progressindicator.h>
#include <utils/qtcassert.h>
#include <utils/temporaryfile.h>
@@ -307,15 +307,15 @@ void DiffEditorWidgetController::updateCannotDecodeInfo()
if (!m_document)
return;
- InfoBar *infoBar = m_document->infoBar();
+ Utils::InfoBar *infoBar = m_document->infoBar();
Id selectEncodingId(Constants::SELECT_ENCODING);
if (m_document->hasDecodingError()) {
if (!infoBar->canInfoBeAdded(selectEncodingId))
return;
- InfoBarEntry info(selectEncodingId,
- tr("<b>Error:</b> Could not decode \"%1\" with \"%2\"-encoding.")
- .arg(m_document->displayName(),
- QString::fromLatin1(m_document->codec()->name())));
+ Utils::InfoBarEntry info(selectEncodingId,
+ tr("<b>Error:</b> Could not decode \"%1\" with \"%2\"-encoding.")
+ .arg(m_document->displayName(),
+ QString::fromLatin1(m_document->codec()->name())));
info.setCustomButtonInfo(tr("Select Encoding"), [this]() { m_document->selectEncoding(); });
infoBar->addInfo(info);
} else {
diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp
index 2fb41dd1b85..d256ff4e2f4 100644
--- a/src/plugins/git/gitplugin.cpp
+++ b/src/plugins/git/gitplugin.cpp
@@ -50,7 +50,6 @@
#include <coreplugin/actionmanager/command.h>
#include <coreplugin/id.h>
#include <coreplugin/idocument.h>
-#include <coreplugin/infobar.h>
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/locator/commandlocator.h>
@@ -60,12 +59,14 @@
#include <coreplugin/vcsmanager.h>
#include <aggregation/aggregate.h>
+
+#include <texteditor/texteditor.h>
+#include <utils/infobar.h>
#include <utils/parameteraction.h>
#include <utils/pathchooser.h>
#include <utils/qtcassert.h>
#include <utils/stringutils.h>
#include <utils/utilsicons.h>
-#include <texteditor/texteditor.h>
#include <vcsbase/basevcseditorfactory.h>
#include <vcsbase/submitfilemodel.h>
diff --git a/src/plugins/mcusupport/mcusupportplugin.cpp b/src/plugins/mcusupport/mcusupportplugin.cpp
index 07f54e061a6..ea2ea3b8265 100644
--- a/src/plugins/mcusupport/mcusupportplugin.cpp
+++ b/src/plugins/mcusupport/mcusupportplugin.cpp
@@ -33,12 +33,13 @@
#include <coreplugin/coreconstants.h>
#include <coreplugin/icontext.h>
#include <coreplugin/icore.h>
-#include <coreplugin/infobar.h>
#include <projectexplorer/devicesupport/devicemanager.h>
#include <projectexplorer/jsonwizard/jsonwizardfactory.h>
#include <projectexplorer/kitmanager.h>
+#include <utils/infobar.h>
+
#include <QTimer>
using namespace Core;
@@ -107,11 +108,10 @@ void McuSupportPlugin::askUserAboutMcuSupportKitsSetup()
|| !McuSupportOptions::existingKits(nullptr).isEmpty())
return;
- InfoBarEntry info(
- setupMcuSupportKits,
- tr("Create Kits for Qt for MCUs? "
- "To do it later, select Options > Devices > MCU."),
- InfoBarEntry::GlobalSuppression::Enabled);
+ Utils::InfoBarEntry info(setupMcuSupportKits,
+ tr("Create Kits for Qt for MCUs? "
+ "To do it later, select Options > Devices > MCU."),
+ Utils::InfoBarEntry::GlobalSuppression::Enabled);
info.setCustomButtonInfo(tr("Create Kits for Qt for MCUs"), [setupMcuSupportKits] {
ICore::infoBar()->removeInfo(setupMcuSupportKits);
QTimer::singleShot(0, []() { ICore::showOptionsDialog(Constants::SETTINGS_ID); });
diff --git a/src/plugins/projectexplorer/projecttree.cpp b/src/plugins/projectexplorer/projecttree.cpp
index 204c53e6caa..f17e02ac8bc 100644
--- a/src/plugins/projectexplorer/projecttree.cpp
+++ b/src/plugins/projectexplorer/projecttree.cpp
@@ -39,12 +39,12 @@
#include <coreplugin/editormanager/ieditor.h>
#include <coreplugin/icore.h>
#include <coreplugin/idocument.h>
-#include <coreplugin/infobar.h>
#include <coreplugin/modemanager.h>
#include <coreplugin/navigationwidget.h>
#include <coreplugin/vcsmanager.h>
#include <utils/algorithm.h>
+#include <utils/infobar.h>
#include <utils/qtcassert.h>
#include <QApplication>
@@ -314,7 +314,7 @@ void ProjectTree::updateExternalFileWarning()
auto document = qobject_cast<Core::IDocument *>(sender());
if (!document || document->filePath().isEmpty())
return;
- Core::InfoBar *infoBar = document->infoBar();
+ Utils::InfoBar *infoBar = document->infoBar();
Core::Id externalFileId(EXTERNAL_FILE_WARNING);
if (!document->isModified()) {
infoBar->removeInfo(externalFileId);
@@ -339,9 +339,10 @@ void ProjectTree::updateExternalFileWarning()
return;
}
}
- infoBar->addInfo(Core::InfoBarEntry(externalFileId,
- tr("<b>Warning:</b> This file is outside the project directory."),
- Core::InfoBarEntry::GlobalSuppression::Enabled));
+ infoBar->addInfo(
+ Utils::InfoBarEntry(externalFileId,
+ tr("<b>Warning:</b> This file is outside the project directory."),
+ Utils::InfoBarEntry::GlobalSuppression::Enabled));
}
bool ProjectTree::hasFocus(ProjectTreeWidget *widget)
diff --git a/src/plugins/python/pythonutils.cpp b/src/plugins/python/pythonutils.cpp
index 364b97017ce..6cf646a27a7 100644
--- a/src/plugins/python/pythonutils.cpp
+++ b/src/plugins/python/pythonutils.cpp
@@ -32,7 +32,6 @@
#include "pythonsettings.h"
#include <coreplugin/editormanager/editormanager.h>
-#include <coreplugin/infobar.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <languageclient/languageclientmanager.h>
@@ -44,6 +43,7 @@
#include <texteditor/textdocument.h>
#include <utils/consoleprocess.h>
+#include <utils/infobar.h>
#include <utils/mimetypes/mimedatabase.h>
#include <utils/qtcassert.h>
#include <utils/runextensions.h>
@@ -412,15 +412,15 @@ void PyLSConfigureAssistant::handlePyLSState(const FilePath &python,
}
resetEditorInfoBar(document);
- Core::InfoBar *infoBar = document->infoBar();
+ Utils::InfoBar *infoBar = document->infoBar();
if (state.state == PythonLanguageServerState::CanBeInstalled
&& infoBar->canInfoBeAdded(installPylsInfoBarId)) {
auto message = tr("Install and set up Python language server (PyLS) for %1 (%2). "
"The language server provides Python specific completion and annotation.")
.arg(pythonName(python), python.toUserOutput());
- Core::InfoBarEntry info(installPylsInfoBarId,
- message,
- Core::InfoBarEntry::GlobalSuppression::Enabled);
+ Utils::InfoBarEntry info(installPylsInfoBarId,
+ message,
+ Utils::InfoBarEntry::GlobalSuppression::Enabled);
info.setCustomButtonInfo(tr("Install"),
[=]() { installPythonLanguageServer(python, document); });
infoBar->addInfo(info);
@@ -430,9 +430,9 @@ void PyLSConfigureAssistant::handlePyLSState(const FilePath &python,
auto message = tr("Found a Python language server for %1 (%2). "
"Set it up for this document?")
.arg(pythonName(python), python.toUserOutput());
- Core::InfoBarEntry info(startPylsInfoBarId,
- message,
- Core::InfoBarEntry::GlobalSuppression::Enabled);
+ Utils::InfoBarEntry info(startPylsInfoBarId,
+ message,
+ Utils::InfoBarEntry::GlobalSuppression::Enabled);
info.setCustomButtonInfo(tr("Setup"),
[=]() { setupPythonLanguageServer(python, document); });
infoBar->addInfo(info);
@@ -441,9 +441,9 @@ void PyLSConfigureAssistant::handlePyLSState(const FilePath &python,
&& infoBar->canInfoBeAdded(enablePylsInfoBarId)) {
auto message = tr("Enable Python language server for %1 (%2)?")
.arg(pythonName(python), python.toUserOutput());
- Core::InfoBarEntry info(enablePylsInfoBarId,
- message,
- Core::InfoBarEntry::GlobalSuppression::Enabled);
+ Utils::InfoBarEntry info(enablePylsInfoBarId,
+ message,
+ Utils::InfoBarEntry::GlobalSuppression::Enabled);
info.setCustomButtonInfo(tr("Enable"),
[=]() { enablePythonLanguageServer(python, document); });
infoBar->addInfo(info);
@@ -464,7 +464,7 @@ void PyLSConfigureAssistant::resetEditorInfoBar(TextEditor::TextDocument *docume
{
for (QList<TextEditor::TextDocument *> &documents : m_infoBarEntries)
documents.removeAll(document);
- Core::InfoBar *infoBar = document->infoBar();
+ Utils::InfoBar *infoBar = document->infoBar();
infoBar->removeInfo(installPylsInfoBarId);
infoBar->removeInfo(startPylsInfoBarId);
infoBar->removeInfo(enablePylsInfoBarId);
diff --git a/src/plugins/qmljseditor/qmljseditordocument.cpp b/src/plugins/qmljseditor/qmljseditordocument.cpp
index b600af61c07..b6edc2fd892 100644
--- a/src/plugins/qmljseditor/qmljseditordocument.cpp
+++ b/src/plugins/qmljseditor/qmljseditordocument.cpp
@@ -36,13 +36,14 @@
#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>
+#include <utils/infobar.h>
+
#include <QDebug>
const char QML_UI_FILE_WARNING[] = "QmlJSEditor.QmlUiFileWarning";
@@ -692,8 +693,8 @@ void QmlJSEditorDocument::setIsDesignModePreferred(bool value)
d->m_isDesignModePreferred = value;
if (value) {
if (infoBar()->canInfoBeAdded(QML_UI_FILE_WARNING)) {
- Core::InfoBarEntry info(QML_UI_FILE_WARNING,
- tr("This file should only be edited in <b>Design</b> mode."));
+ Utils::InfoBarEntry info(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);
});
diff --git a/src/plugins/qtsupport/qtsupportplugin.cpp b/src/plugins/qtsupport/qtsupportplugin.cpp
index b389e8cf298..38c83d11e84 100644
--- a/src/plugins/qtsupport/qtsupportplugin.cpp
+++ b/src/plugins/qtsupport/qtsupportplugin.cpp
@@ -40,7 +40,6 @@
#include "uicgenerator.h"
#include <coreplugin/icore.h>
-#include <coreplugin/infobar.h>
#include <coreplugin/jsexpander.h>
#include <projectexplorer/jsonwizard/jsonwizardfactory.h>
@@ -50,6 +49,7 @@
#include <projectexplorer/runcontrol.h>
#include <projectexplorer/target.h>
+#include <utils/infobar.h>
#include <utils/macroexpander.h>
const char kHostBins[] = "CurrentProject:QT_HOST_BINS";
@@ -126,12 +126,12 @@ static void askAboutQtInstallation()
|| !ICore::infoBar()->canInfoBeAdded(kLinkWithQtInstallationSetting))
return;
- InfoBarEntry info(
+ Utils::InfoBarEntry info(
kLinkWithQtInstallationSetting,
QtSupportPlugin::tr(
"Link with a Qt installation to automatically register Qt versions and kits? To do "
"this later, select Options > Kits > Qt Versions > Link with Qt."),
- InfoBarEntry::GlobalSuppression::Enabled);
+ Utils::InfoBarEntry::GlobalSuppression::Enabled);
info.setCustomButtonInfo(QtSupportPlugin::tr("Link with Qt"), [] {
ICore::infoBar()->removeInfo(kLinkWithQtInstallationSetting);
ICore::infoBar()->globallySuppressInfo(kLinkWithQtInstallationSetting);
diff --git a/src/plugins/scxmleditor/scxmleditordata.cpp b/src/plugins/scxmleditor/scxmleditordata.cpp
index 01e39b22bb4..ae7379a3e1e 100644
--- a/src/plugins/scxmleditor/scxmleditordata.cpp
+++ b/src/plugins/scxmleditor/scxmleditordata.cpp
@@ -36,15 +36,15 @@
#include <coreplugin/editormanager/editormanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/idocument.h>
-#include <coreplugin/infobar.h>
#include <coreplugin/minisplitter.h>
#include <coreplugin/modemanager.h>
#include <coreplugin/outputpane.h>
#include <projectexplorer/projectexplorerconstants.h>
-#include <utils/qtcassert.h>
#include <utils/icon.h>
+#include <utils/infobar.h>
+#include <utils/qtcassert.h>
#include <utils/utilsicons.h>
#include <QVBoxLayout>
@@ -160,8 +160,8 @@ IEditor *ScxmlEditorData::createEditor()
m_mainToolBar->addEditor(xmlEditor);
if (xmlEditor) {
- InfoBarEntry info(Id(Constants::INFO_READ_ONLY),
- tr("This file can only be edited in <b>Design</b> mode."));
+ Utils::InfoBarEntry info(Id(Constants::INFO_READ_ONLY),
+ tr("This file can only be edited in <b>Design</b> mode."));
info.setCustomButtonInfo(tr("Switch Mode"), []() { ModeManager::activateMode(Core::Constants::MODE_DESIGN); });
xmlEditor->document()->infoBar()->addInfo(info);
}
diff --git a/src/plugins/texteditor/plaintexteditorfactory.cpp b/src/plugins/texteditor/plaintexteditorfactory.cpp
index f87165b7981..6d58087d465 100644
--- a/src/plugins/texteditor/plaintexteditorfactory.cpp
+++ b/src/plugins/texteditor/plaintexteditorfactory.cpp
@@ -34,7 +34,7 @@
#include "textindenter.h"
#include <coreplugin/coreconstants.h>
-#include <coreplugin/infobar.h>
+#include <utils/infobar.h>
#include <utils/qtcassert.h>
#include <QCoreApplication>
diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp
index 7dea27a544f..397281b8b5e 100644
--- a/src/plugins/texteditor/texteditor.cpp
+++ b/src/plugins/texteditor/texteditor.cpp
@@ -58,17 +58,16 @@
#include <texteditor/codeassist/completionassistprovider.h>
#include <texteditor/codeassist/documentcontentcompletion.h>
-#include <coreplugin/dialogs/codecselector.h>
-#include <coreplugin/icore.h>
#include <aggregation/aggregate.h>
-#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/actioncontainer.h>
+#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/command.h>
#include <coreplugin/coreconstants.h>
-#include <coreplugin/infobar.h>
-#include <coreplugin/manhattanstyle.h>
+#include <coreplugin/dialogs/codecselector.h>
#include <coreplugin/find/basetextfind.h>
#include <coreplugin/find/highlightscrollbarcontroller.h>
+#include <coreplugin/icore.h>
+#include <coreplugin/manhattanstyle.h>
#include <utils/algorithm.h>
#include <utils/camelcasecursor.h>
#include <utils/dropsupport.h>
@@ -78,6 +77,7 @@
#include <utils/fileutils.h>
#include <utils/fixedsizeclicklabel.h>
#include <utils/hostosinfo.h>
+#include <utils/infobar.h>
#include <utils/mimetypes/mimedatabase.h>
#include <utils/qtcassert.h>
#include <utils/styledbar.h>
diff --git a/src/plugins/updateinfo/updateinfoplugin.cpp b/src/plugins/updateinfo/updateinfoplugin.cpp
index a5d2b2d3e82..0abba718efb 100644
--- a/src/plugins/updateinfo/updateinfoplugin.cpp
+++ b/src/plugins/updateinfo/updateinfoplugin.cpp
@@ -30,10 +30,10 @@
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/icore.h>
-#include <coreplugin/infobar.h>
#include <coreplugin/settingsdatabase.h>
#include <coreplugin/shellcommand.h>
#include <utils/fileutils.h>
+#include <utils/infobar.h>
#include <utils/synchronousprocess.h>
#include <QDate>
@@ -192,8 +192,7 @@ void UpdateInfoPlugin::checkForUpdatesFinished()
if (d->m_progress)
d->m_progress->setKeepOnFinish(FutureProgress::HideOnFinish);
emit newUpdatesAvailable(true);
- Core::InfoBarEntry info(InstallUpdates,
- tr("New updates are available. Start the update?"));
+ Utils::InfoBarEntry info(InstallUpdates, tr("New updates are available. Start the update?"));
info.setCustomButtonInfo(tr("Start Update"), [this] {
Core::ICore::infoBar()->removeInfo(InstallUpdates);
startUpdater();
diff --git a/src/plugins/welcome/introductionwidget.cpp b/src/plugins/welcome/introductionwidget.cpp
index a29b5e4f57a..83ee58e277f 100644
--- a/src/plugins/welcome/introductionwidget.cpp
+++ b/src/plugins/welcome/introductionwidget.cpp
@@ -26,9 +26,9 @@
#include "introductionwidget.h"
#include <coreplugin/icore.h>
-#include <coreplugin/infobar.h>
#include <utils/algorithm.h>
#include <utils/checkablemessagebox.h>
+#include <utils/infobar.h>
#include <utils/qtcassert.h>
#include <utils/stylehelper.h>
@@ -54,12 +54,12 @@ void IntroductionWidget::askUserAboutIntroduction(QWidget *parent, QSettings *se
|| !Core::ICore::infoBar()->canInfoBeAdded(kTakeTourSetting))
return;
- Core::InfoBarEntry
+ Utils::InfoBarEntry
info(kTakeTourSetting,
tr("Would you like to take a quick UI tour? This tour highlights important user "
"interface elements and shows how they are used. To take the tour later, "
"select Help > UI Tour."),
- Core::InfoBarEntry::GlobalSuppression::Enabled);
+ Utils::InfoBarEntry::GlobalSuppression::Enabled);
info.setCustomButtonInfo(tr("Take UI Tour"), [parent] {
Core::ICore::infoBar()->removeInfo(kTakeTourSetting);
Core::ICore::infoBar()->globallySuppressInfo(kTakeTourSetting);