diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp index e742a7df47701097a9a90dce528db12784aa5be1..76a49f54f4066e6a4ad5c2b5cd328941aa53cfec 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.cpp +++ b/src/plugins/coreplugin/editormanager/editormanager.cpp @@ -1581,6 +1581,20 @@ void EditorManager::hideEditorInfoBar(const QString &kind) currentEditorView()->hideEditorInfoBar(kind); } +void EditorManager::showEditorStatusBar(const QString &kind, + const QString &infoText, + const QString &buttonText, + QObject *object, const char *member) +{ + + currentEditorView()->showEditorStatusBar(kind, infoText, buttonText, object, member); +} + +void EditorManager::hideEditorStatusBar(const QString &kind) +{ + currentEditorView()->hideEditorStatusBar(kind); +} + QString EditorManager::externalEditorHelpText() const { QString help = tr( diff --git a/src/plugins/coreplugin/editormanager/editormanager.h b/src/plugins/coreplugin/editormanager/editormanager.h index d4ed4b31bdeeccaf28efc9d6f83b6468616ccd88..1d03906bfd0c21b529078ea55b1580b0c1b82188 100644 --- a/src/plugins/coreplugin/editormanager/editormanager.h +++ b/src/plugins/coreplugin/editormanager/editormanager.h @@ -157,6 +157,13 @@ public: void hideEditorInfoBar(const QString &kind); + void showEditorStatusBar(const QString &kind, + const QString &infoText, + const QString &buttonText = QString(), + QObject *object = 0, const char *member = 0); + + void hideEditorStatusBar(const QString &kind); + EditorFactoryList editorFactories(const MimeType &mimeType, bool bestMatchOnly = true) const; void setExternalEditor(const QString &); diff --git a/src/plugins/coreplugin/editormanager/editorview.cpp b/src/plugins/coreplugin/editormanager/editorview.cpp index eb960197bcb196d77a28a5bd9a6515c064a464a6..020cb200ff3d8cbe570dca63141bbee0543561e3 100644 --- a/src/plugins/coreplugin/editormanager/editorview.cpp +++ b/src/plugins/coreplugin/editormanager/editorview.cpp @@ -207,6 +207,7 @@ EditorView::EditorView(EditorModel *model, QWidget *parent) : m_lockButton(new QToolButton), m_defaultToolBar(new QToolBar(this)), m_infoWidget(new QFrame(this)), + m_statusWidget(new QFrame(this)), m_editorForInfoWidget(0) { QVBoxLayout *tl = new QVBoxLayout(this); @@ -269,7 +270,6 @@ EditorView::EditorView(EditorModel *model, QWidget *parent) : m_infoWidget->setBackgroundRole(QPalette::ToolTipBase); m_infoWidget->setAutoFillBackground(true); - QHBoxLayout *hbox = new QHBoxLayout(m_infoWidget); hbox->setMargin(2); m_infoWidgetLabel = new QLabel("Placeholder"); @@ -289,12 +289,47 @@ EditorView::EditorView(EditorModel *model, QWidget *parent) : hbox->addWidget(closeButton); - m_infoWidget->setVisible(false); tl->addWidget(m_infoWidget); } + tl->addWidget(m_container); + { + m_statusWidget->setFrameStyle(QFrame::Panel | QFrame::Raised); + m_statusWidget->setLineWidth(1); + m_statusWidget->setForegroundRole(QPalette::ToolTipText); + m_statusWidget->setBackgroundRole(QPalette::ToolTipBase); + m_statusWidget->setAutoFillBackground(true); + + + QHBoxLayout *hbox = new QHBoxLayout(m_statusWidget); + hbox->setMargin(2); + m_statusWidgetLabel = new QLabel("Placeholder"); + m_statusWidgetLabel->setForegroundRole(QPalette::ToolTipText); + hbox->addWidget(m_statusWidgetLabel); + hbox->addStretch(1); + + m_statusWidgetButton = new QToolButton; + m_statusWidgetButton->setText(tr("Placeholder")); + hbox->addWidget(m_statusWidgetButton); + + QToolButton *closeButton = new QToolButton; + closeButton->setAutoRaise(true); + closeButton->setIcon(QIcon(":/core/images/clear.png")); + closeButton->setToolTip(tr("Close")); + connect(closeButton, SIGNAL(clicked()), m_statusWidget, SLOT(hide())); + + hbox->addWidget(closeButton); + + m_statusWidget->setVisible(false); + tl->addWidget(m_statusWidget); + } + +} + +EditorView::~EditorView() +{ } void EditorView::showEditorInfoBar(const QString &kind, @@ -318,9 +353,25 @@ void EditorView::hideEditorInfoBar(const QString &kind) m_infoWidget->setVisible(false); } +void EditorView::showEditorStatusBar(const QString &kind, + const QString &infoText, + const QString &buttonText, + QObject *object, const char *member) +{ + m_statusWidgetKind = kind; + m_statusWidgetLabel->setText(infoText); + m_statusWidgetButton->setText(buttonText); + m_statusWidgetButton->disconnect(); + if (object && member) + connect(m_infoWidgetButton, SIGNAL(clicked()), object, member); + m_statusWidget->setVisible(true); + //m_editorForInfoWidget = currentEditor(); +} -EditorView::~EditorView() +void EditorView::hideEditorStatusBar(const QString &kind) { + if (kind == m_statusWidgetKind) + m_statusWidget->setVisible(false); } void EditorView::addEditor(IEditor *editor) @@ -406,7 +457,7 @@ void EditorView::setCurrentEditor(IEditor *editor) updateEditorStatus(editor); updateToolBar(editor); - + // FIXME: this keeps the editor hidden if switching from A to B and back if (editor != m_editorForInfoWidget) { m_infoWidget->hide(); m_editorForInfoWidget = 0; @@ -415,9 +466,9 @@ void EditorView::setCurrentEditor(IEditor *editor) void EditorView::checkEditorStatus() { - IEditor *editor = qobject_cast<IEditor *>(sender()); - if (editor == currentEditor()) - updateEditorStatus(editor); + IEditor *editor = qobject_cast<IEditor *>(sender()); + if (editor == currentEditor()) + updateEditorStatus(editor); } void EditorView::updateEditorStatus(IEditor *editor) diff --git a/src/plugins/coreplugin/editormanager/editorview.h b/src/plugins/coreplugin/editormanager/editorview.h index 7204d966d8104d0908e1a75b1087373ca6478e9f..e6f7472d0d7a7508d6a42c494bb5bebe7659508e 100644 --- a/src/plugins/coreplugin/editormanager/editorview.h +++ b/src/plugins/coreplugin/editormanager/editorview.h @@ -113,6 +113,11 @@ public: QObject *object, const char *member); void hideEditorInfoBar(const QString &kind); + void showEditorStatusBar(const QString &kind, + const QString &infoText, + const QString &buttonText, + QObject *object, const char *member); + void hideEditorStatusBar(const QString &kind); public slots: void closeView(); @@ -139,8 +144,12 @@ private: QLabel *m_infoWidgetLabel; QToolButton *m_infoWidgetButton; IEditor *m_editorForInfoWidget; + QString m_statusWidgetKind; + QFrame *m_statusWidget; + QLabel *m_statusWidgetLabel; + QToolButton *m_statusWidgetButton; QSortFilterProxyModel m_proxyModel; - QList<IEditor *>m_editors; + QList<IEditor *> m_editors; QMap<QWidget *, IEditor *> m_widgetEditorMap; }; diff --git a/src/plugins/fakevim/fakevimplugin.cpp b/src/plugins/fakevim/fakevimplugin.cpp index f2ac9977c5be49db8342361087ee7e670aefcc5b..876e298e2891806fccd45269a019cd78ddb0ae4b 100644 --- a/src/plugins/fakevim/fakevimplugin.cpp +++ b/src/plugins/fakevim/fakevimplugin.cpp @@ -357,12 +357,14 @@ void FakeVimPluginPrivate::editorAboutToClose(Core::IEditor *editor) void FakeVimPluginPrivate::showCommandBuffer(const QString &contents) { - //qDebug() << "SHOW COMMAND BUFFER" << contents; FakeVimHandler *handler = qobject_cast<FakeVimHandler *>(sender()); if (handler) { - Core::EditorManager::instance()->showEditorInfoBar( + //qDebug() << "SHOW COMMAND BUFFER" << contents; + Core::EditorManager::instance()->showEditorStatusBar( QLatin1String(Constants::MINI_BUFFER), contents, tr("Quit FakeVim"), handler, SLOT(quit())); + } else { + qDebug() << "\nNO HANDLER\n"; } }