From c67ed4d35b4ff50a05f92a858096372e2a8eb259 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Wed, 7 Aug 2019 12:44:40 +0200 Subject: Add global notification area and use for UI Tour info MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: André Hartmann --- src/plugins/welcome/introductionwidget.cpp | 39 ++++++++++++++---------------- 1 file changed, 18 insertions(+), 21 deletions(-) (limited to 'src/plugins/welcome') 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 +#include #include #include #include @@ -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) -- cgit v1.2.3