diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index 048e8a57c5c337ab99a200d248329980d0500378..e59c376efef3b25887df3f400cf71b5b171be84b 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -1770,9 +1770,10 @@ void EditorManager::revertToSaved() void EditorManager::showEditorInfoBar(const QString &id, const QString &infoText, const QString &buttonText, - QObject *object, const char *member) + QObject *object, const char *buttonPressMember, + const char *cancelButtonPressMember) { - currentEditorView()->showEditorInfoBar(id, infoText, buttonText, object, member); + currentEditorView()->showEditorInfoBar(id, infoText, buttonText, object, buttonPressMember, cancelButtonPressMember); } diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h index a762364f6ccd74fc201fe2643f4a44d6b78685af..c14860618eac46473bf284836f5e6205231e4b16 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.h +++ b/src/plugins/coreplugin/editormanager/editormanager.h @@ -166,7 +166,8 @@ public: void showEditorInfoBar(const QString &id, const QString &infoText, const QString &buttonText = QString(), - QObject *object = 0, const char *member = 0); + QObject *object = 0, const char *buttonPressMember = 0, + const char *cancelButtonPressMember = 0); void hideEditorInfoBar(const QString &id); diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp index 24cbd1fe51b120d7a0b2178e605c7c3f842f8745..48363270cce734e8673f32f72e0b7e9a6bade459 100644 --- a/src/plugins/coreplugin/editormanager/editorview.cpp +++ b/src/plugins/coreplugin/editormanager/editorview.cpp @@ -112,13 +112,12 @@ EditorView::EditorView(QWidget *parent) : m_infoWidgetButton->setText(tr("Placeholder")); hbox->addWidget(m_infoWidgetButton); - QToolButton *closeButton = new QToolButton; - closeButton->setAutoRaise(true); - closeButton->setIcon(QIcon(":/core/images/clear.png")); - closeButton->setToolTip(tr("Close")); - connect(closeButton, SIGNAL(clicked()), m_infoWidget, SLOT(hide())); + m_infoWidgetCloseButton = new QToolButton; + m_infoWidgetCloseButton->setAutoRaise(true); + m_infoWidgetCloseButton->setIcon(QIcon(":/core/images/clear.png")); + m_infoWidgetCloseButton->setToolTip(tr("Close")); - hbox->addWidget(closeButton); + hbox->addWidget(m_infoWidgetCloseButton); m_infoWidget->setVisible(false); tl->addWidget(m_infoWidget); @@ -173,14 +172,22 @@ void EditorView::closeView() void EditorView::showEditorInfoBar(const QString &id, const QString &infoText, const QString &buttonText, - QObject *object, const char *member) + QObject *object, const char *buttonPressMember, + const char *cancelButtonPressMember) { m_infoWidgetId = id; m_infoWidgetLabel->setText(infoText); m_infoWidgetButton->setText(buttonText); + m_infoWidgetButton->disconnect(); - if (object && member) - connect(m_infoWidgetButton, SIGNAL(clicked()), object, member); + if (object && buttonPressMember) + connect(m_infoWidgetButton, SIGNAL(clicked()), object, buttonPressMember); + + m_infoWidgetCloseButton->disconnect(); + if (object && cancelButtonPressMember) + connect(m_infoWidgetCloseButton, SIGNAL(clicked()), object, cancelButtonPressMember); + connect(m_infoWidgetCloseButton, SIGNAL(clicked()), m_infoWidget, SLOT(hide())); + m_infoWidget->setVisible(true); m_editorForInfoWidget = currentEditor(); } diff --git a/src/plugins/coreplugin/editormanager/editorview.h b/src/plugins/coreplugin/editormanager/editorview.h index 8bc153d692cd4050c7d78c76b9e7fc5ec0771e2c..e483e3da2dbc4c72d87b2f8c65ea08ce6890e9c4 100644 --- a/src/plugins/coreplugin/editormanager/editorview.h +++ b/src/plugins/coreplugin/editormanager/editorview.h @@ -84,7 +84,8 @@ public: void showEditorInfoBar(const QString &id, const QString &infoText, const QString &buttonText, - QObject *object, const char *member); + QObject *object, const char *buttonPressMember, + const char *cancelButtonPressMember = 0); void hideEditorInfoBar(const QString &id); void showEditorStatusBar(const QString &id, @@ -109,6 +110,7 @@ private: QFrame *m_infoWidget; QLabel *m_infoWidgetLabel; QToolButton *m_infoWidgetButton; + QToolButton *m_infoWidgetCloseButton; IEditor *m_editorForInfoWidget; QString m_statusWidgetId; QFrame *m_statusHLine; diff --git a/src/plugins/qmljseditor/qmljseditorfactory.cpp b/src/plugins/qmljseditor/qmljseditorfactory.cpp index 4a053fa0e628eb2b6aeb9f4de7e9d7d3f89b9c29..99bea71fb0e1e884436984ca0d940fc7c91c54ca 100644 --- a/src/plugins/qmljseditor/qmljseditorfactory.cpp +++ b/src/plugins/qmljseditor/qmljseditorfactory.cpp @@ -139,7 +139,9 @@ void QmlJSEditorFactory::updateEditorInfoBar(Core::IEditor *editor) if (qobject_cast<QmlJSEditorEditable *>(editor)) { Core::EditorManager::instance()->showEditorInfoBar(QMLDESIGNER_INFO_BAR, tr("Do you want to enable the experimental Qt Quick Designer?"), - tr("Enable Qt Quick Designer"), this, SLOT(activateQmlDesigner())); + tr("Enable Qt Quick Designer"), this, + SLOT(activateQmlDesigner()), + SLOT(neverAskAgainAboutQmlDesigner())); } else { Core::EditorManager::instance()->hideEditorInfoBar(QMLDESIGNER_INFO_BAR); } @@ -161,7 +163,6 @@ void QmlJSEditorFactory::activateQmlDesigner() "To disable Qt Quick Designer again, visit the menu '%1' and disable 'QmlDesigner'.").arg(menu)); message.setIcon(QMessageBox::Question); QPushButton *enable = message.addButton(tr("Enable Qt Quick Designer"), QMessageBox::AcceptRole); - QPushButton *dontNag = message.addButton(tr("Never ask me again"), QMessageBox::ActionRole); message.addButton(tr("Cancel"), QMessageBox::RejectRole); message.exec(); if (message.clickedButton() == enable) { @@ -178,13 +179,15 @@ void QmlJSEditorFactory::activateQmlDesigner() return; } } - } else if (message.clickedButton() == dontNag) { - QSettings *settings = Core::ICore::instance()->settings(); - settings->beginGroup(QLatin1String(KEY_QMLGROUP)); - settings->setValue(QLatin1String(KEY_NAGABOUTDESIGNER), false); - settings->endGroup(); - disconnect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)), - this, SLOT(updateEditorInfoBar(Core::IEditor*))); - Core::EditorManager::instance()->hideEditorInfoBar(QMLDESIGNER_INFO_BAR); } } + +void QmlJSEditorFactory::neverAskAgainAboutQmlDesigner() +{ + QSettings *settings = Core::ICore::instance()->settings(); + settings->beginGroup(QLatin1String(KEY_QMLGROUP)); + settings->setValue(QLatin1String(KEY_NAGABOUTDESIGNER), false); + settings->endGroup(); + disconnect(Core::EditorManager::instance(), SIGNAL(currentEditorChanged(Core::IEditor*)), + this, SLOT(updateEditorInfoBar(Core::IEditor*))); +} diff --git a/src/plugins/qmljseditor/qmljseditorfactory.h b/src/plugins/qmljseditor/qmljseditorfactory.h index 5527a93c8c19f4cfa060e67269df8a4322f442d7..8bdf55d55b03703882285f5c0ddaa9d0eefd5a27 100644 --- a/src/plugins/qmljseditor/qmljseditorfactory.h +++ b/src/plugins/qmljseditor/qmljseditorfactory.h @@ -60,6 +60,7 @@ public: private slots: void activateQmlDesigner(); + void neverAskAgainAboutQmlDesigner(); void updateEditorInfoBar(Core::IEditor *editor); private: