diff options
author | Eike Ziller <eike.ziller@qt.io> | 2019-08-07 12:44:40 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2019-08-12 07:15:27 +0000 |
commit | c67ed4d35b4ff50a05f92a858096372e2a8eb259 (patch) | |
tree | c78f921fcf91de1e410af78d446d10f088196690 /src/plugins/welcome | |
parent | eb2f49c39826cb32a00d17c9d37824d54001a3d8 (diff) | |
download | qt-creator-c67ed4d35b4ff50a05f92a858096372e2a8eb259.tar.gz |
Add global notification area and use for UI Tour info
Adds a global info bar display above the main window's status bar that
can be accessed via ICore::infoBar().
Replace the blocking "Take UI Tour" dialog by a notification there.
Fixes: QTCREATORBUG-22819
Change-Id: I733f1bfd2d1db0295754ed2e28bb202f927d0edb
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Diffstat (limited to 'src/plugins/welcome')
-rw-r--r-- | src/plugins/welcome/introductionwidget.cpp | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/src/plugins/welcome/introductionwidget.cpp b/src/plugins/welcome/introductionwidget.cpp index 82539fd996..8eb3a268d0 100644 --- a/src/plugins/welcome/introductionwidget.cpp +++ b/src/plugins/welcome/introductionwidget.cpp @@ -25,6 +25,8 @@ #include "introductionwidget.h" +#include <coreplugin/icore.h> +#include <coreplugin/infobar.h> #include <utils/algorithm.h> #include <utils/checkablemessagebox.h> #include <utils/qtcassert.h> @@ -47,29 +49,24 @@ namespace Internal { void IntroductionWidget::askUserAboutIntroduction(QWidget *parent, QSettings *settings) { - if (!CheckableMessageBox::shouldAskAgain(settings, kTakeTourSetting)) + // CheckableMessageBox for compatibility with Qt Creator < 4.11 + if (!CheckableMessageBox::shouldAskAgain(settings, kTakeTourSetting) + || !Core::ICore::infoBar()->canInfoBeAdded(kTakeTourSetting)) return; - auto messageBox = new CheckableMessageBox(parent); - messageBox->setWindowTitle(tr("Take a UI Tour")); - messageBox->setText( - 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.")); - messageBox->setCheckBoxVisible(true); - messageBox->setCheckBoxText(CheckableMessageBox::msgDoNotAskAgain()); - messageBox->setChecked(true); - messageBox->setStandardButtons(QDialogButtonBox::Cancel); - QPushButton *tourButton = messageBox->addButton(tr("Take UI Tour"), QDialogButtonBox::AcceptRole); - connect(messageBox, &QDialog::finished, parent, [parent, settings, messageBox, tourButton]() { - if (messageBox->isChecked()) - CheckableMessageBox::doNotAskAgain(settings, kTakeTourSetting); - if (messageBox->clickedButton() == tourButton) { - auto intro = new IntroductionWidget(parent); - intro->show(); - } - messageBox->deleteLater(); + + Core::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::GlobalSuppressionEnabled); + info.setCustomButtonInfo(tr("Take UI Tour"), [parent] { + Core::ICore::infoBar()->removeInfo(kTakeTourSetting); + Core::ICore::infoBar()->globallySuppressInfo(kTakeTourSetting); + auto intro = new IntroductionWidget(parent); + intro->show(); }); - messageBox->show(); + Core::ICore::infoBar()->addInfo(info); } IntroductionWidget::IntroductionWidget(QWidget *parent) |