Core: Make InfoBar::GlobalSuppressionMode an enum class

Change-Id: I859a727196a887f7699a667fbe07e1bfead4cb2b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Andre Hartmann
2019-08-15 20:41:31 +02:00
committed by André Hartmann
parent 545552cc13
commit b292c30a13
9 changed files with 13 additions and 13 deletions

View File

@@ -257,7 +257,7 @@ void SearchResultWidget::addResults(const QList<SearchResultItem> &items, Search
Id undoWarningId = Id("warninglabel/").withSuffix(m_dontAskAgainGroup);
if (m_infoBar.canInfoBeAdded(undoWarningId)) {
InfoBarEntry info(undoWarningId, tr("This change cannot be undone."),
InfoBarEntry::GlobalSuppressionEnabled);
InfoBarEntry::GlobalSuppression::Enabled);
m_infoBar.addInfo(info);
}
}

View File

@@ -47,7 +47,7 @@ QSet<Id> InfoBar::globallySuppressed;
QSettings *InfoBar::m_settings = nullptr;
Utils::Theme *InfoBar::m_theme = nullptr;
InfoBarEntry::InfoBarEntry(Id _id, const QString &_infoText, GlobalSuppressionMode _globalSuppression)
InfoBarEntry::InfoBarEntry(Id _id, const QString &_infoText, GlobalSuppression _globalSuppression)
: m_id(_id)
, m_infoText(_infoText)
, m_globalSuppression(_globalSuppression)
@@ -307,7 +307,7 @@ void InfoBarDisplay::update()
const Id id = info.m_id;
QToolButton *infoWidgetSuppressButton = nullptr;
if (info.m_globalSuppression == InfoBarEntry::GlobalSuppressionEnabled) {
if (info.m_globalSuppression == InfoBarEntry::GlobalSuppression::Enabled) {
infoWidgetSuppressButton = new QToolButton;
infoWidgetSuppressButton->setText(tr("Do Not Show Again"));
connect(infoWidgetSuppressButton, &QAbstractButton::clicked, this, [this, id] {

View File

@@ -49,13 +49,13 @@ class InfoBarDisplay;
class CORE_EXPORT InfoBarEntry
{
public:
enum GlobalSuppressionMode
enum class GlobalSuppression
{
GlobalSuppressionDisabled,
GlobalSuppressionEnabled
Disabled,
Enabled
};
InfoBarEntry(Id _id, const QString &_infoText, GlobalSuppressionMode _globalSuppression = GlobalSuppressionDisabled);
InfoBarEntry(Id _id, const QString &_infoText, GlobalSuppression _globalSuppression = GlobalSuppression::Disabled);
using CallBack = std::function<void()>;
void setCustomButtonInfo(const QString &_buttonText, CallBack callBack);

View File

@@ -301,7 +301,7 @@ IVersionControl* VcsManager::findVersionControlForDirectory(const QString &input
InfoBarEntry info(vcsWarning,
tr("%1 repository was detected but %1 is not configured.")
.arg(versionControl->displayName()),
InfoBarEntry::GlobalSuppressionEnabled);
InfoBarEntry::GlobalSuppression::Enabled);
d->m_unconfiguredVcs = versionControl;
info.setCustomButtonInfo(ICore::msgShowOptionsDialog(), []() {
QTC_ASSERT(d->m_unconfiguredVcs, return);

View File

@@ -357,7 +357,7 @@ void CppEditorDocument::showHideInfoBarAboutMultipleParseContexts(bool 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::GlobalSuppressionEnabled);
Core::InfoBarEntry::GlobalSuppression::Enabled);
info.removeCancelButton();
if (infoBar()->canInfoBeAdded(id))
infoBar()->addInfo(info);

View File

@@ -988,7 +988,7 @@ void GitPlugin::updateVersionWarning()
infoBar->addInfo(InfoBarEntry(gitVersionWarning,
tr("Unsupported version of Git found. Git %1 or later required.")
.arg(versionString(minimumRequiredVersion)),
InfoBarEntry::GlobalSuppressionEnabled));
InfoBarEntry::GlobalSuppression::Enabled));
}
IEditor *GitPlugin::openSubmitEditor(const QString &fileName, const CommitData &cd)

View File

@@ -321,7 +321,7 @@ void ProjectTree::updateExternalFileWarning()
}
infoBar->addInfo(Core::InfoBarEntry(externalFileId,
tr("<b>Warning:</b> This file is outside the project directory."),
Core::InfoBarEntry::GlobalSuppressionEnabled));
Core::InfoBarEntry::GlobalSuppression::Enabled));
}
bool ProjectTree::hasFocus(ProjectTreeWidget *widget)

View File

@@ -3101,7 +3101,7 @@ void TextEditorWidgetPrivate::updateSyntaxInfoBar(const Highlighter::Definitions
InfoBarEntry info(missing,
BaseTextEditor::tr("A highlight definition was not found for this file. "
"Would you like to update highlight definition files?"),
InfoBarEntry::GlobalSuppressionEnabled);
InfoBarEntry::GlobalSuppression::Enabled);
info.setCustomButtonInfo(BaseTextEditor::tr("Update Definitions"), [missing, this]() {
m_document->infoBar()->removeInfo(missing);
Highlighter::updateDefinitions([widget = QPointer<TextEditorWidget>(q)]() {

View File

@@ -59,7 +59,7 @@ void IntroductionWidget::askUserAboutIntroduction(QWidget *parent, QSettings *se
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::GlobalSuppressionEnabled);
Core::InfoBarEntry::GlobalSuppression::Enabled);
info.setCustomButtonInfo(tr("Take UI Tour"), [parent] {
Core::ICore::infoBar()->removeInfo(kTakeTourSetting);
Core::ICore::infoBar()->globallySuppressInfo(kTakeTourSetting);