[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kdevplatform] /: Remove assistant popup
From:       Olivier JG <olivier.jg () gmail ! com>
Date:       2015-10-10 21:24:30
Message-ID: E1Zl1d0-0002a9-DH () scm ! kde ! org
[Download RAW message or body]

Git commit 633e3f6d0a6d885b9bc271f92c5b59c3ffc01aea by Olivier JG.
Committed on 10/10/2015 at 21:24.
Pushed by olivierjg into branch 'master'.

Remove assistant popup

M  +3    -8    interfaces/iuicontroller.h
M  +1    -1    language/assistant/staticassistantsmanager.cpp
D  +0    -101  shell/AssistantButton.qml
M  +1    -5    shell/CMakeLists.txt
D  +0    -382  shell/assistantpopup.cpp
D  +0    -134  shell/assistantpopup.h
D  +0    -89   shell/assistantpopup.qml
M  +1    -15   shell/uicontroller.cpp
M  +1    -3    shell/uicontroller.h

http://commits.kde.org/kdevplatform/633e3f6d0a6d885b9bc271f92c5b59c3ffc01aea

diff --git a/interfaces/iuicontroller.h b/interfaces/iuicontroller.h
index 41950cf..9d5fc19 100644
--- a/interfaces/iuicontroller.h
+++ b/interfaces/iuicontroller.h
@@ -130,15 +130,10 @@ public:
     virtual void registerStatus(QObject* status) = 0;
 
     /**
-     * Shows an assistant popup at bottom within the current central widget
-     * @p assistant the assistant that will be shown in a popup */
-    virtual void popUpAssistant(const QExplicitlySharedDataPointer<IAssistant>& \
                assistant) = 0;
-
-    /**
-     * Hides the assistant if it is currently being shown
+     * Show the assistant specified by @p assistant
      */
-    virtual void hideAssistant() = 0;
-    
+    virtual void showAssistant(const QExplicitlySharedDataPointer<IAssistant>& \
assistant) = 0; +
     /**
      * This is meant to be used by IDocument subclasses to initialize the
      * Sublime::Document.
diff --git a/language/assistant/staticassistantsmanager.cpp \
b/language/assistant/staticassistantsmanager.cpp index 4e86fdd..3aa60bf 100644
--- a/language/assistant/staticassistantsmanager.cpp
+++ b/language/assistant/staticassistantsmanager.cpp
@@ -222,7 +222,7 @@ void \
StaticAssistantsManager::Private::startAssistant(IAssistant::Ptr assistant)  \
m_activeAssistant = assistant;  if (m_activeAssistant) {
         connect(m_activeAssistant.data(), &IAssistant::hide, q, \
                &StaticAssistantsManager::hideAssistant, Qt::UniqueConnection);
-        ICore::self()->uiController()->popUpAssistant(IAssistant::Ptr(m_activeAssistant.data()));
 +        ICore::self()->uiController()->showAssistant(IAssistant::Ptr(m_activeAssistant.data()));
  
         m_assistantStartedAt =  m_currentView.data()->cursorPosition();
     }
diff --git a/shell/AssistantButton.qml b/shell/AssistantButton.qml
deleted file mode 100644
index 2d07c57..0000000
--- a/shell/AssistantButton.qml
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
-   Copyright 2014 Sven Brauch <svenbrauch@gmail.com>
-   Copyright 2014 Kevin Funk <kfunk@kde.org>
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License version 2 as published by the Free Software Foundation.
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public License
-   along with this library; see the file COPYING.LIB.  If not, write to
-   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.
-*/
-
-import QtQuick 2.2
-
-// Component which provides a single button for the assistant widget.
-
-Rectangle {
-    id: root
-
-    property color foreground
-    property color background
-    property color highlight
-
-    property bool highlighted: false
-    // text on the button
-    property string text
-    // text in the shortcut field
-    property int button
-    // emitted when the button is clicked with the mouse
-    signal triggered()
-
-    y: -1
-    width: text.width + 4
-    height: number.height + 4
-
-    color: Qt.lighter(root.background, 1.5)
-    border.color: Qt.lighter(root.foreground, 1.5)
-
-    Behavior on opacity {
-        NumberAnimation { duration: 150; }
-    }
-    MouseArea {
-        id: mouseArea
-
-        anchors.fill: parent
-        onClicked: root.triggered()
-
-        hoverEnabled: true
-
-        Row {
-            // row containing the separators, shortcut text, and button text
-            z: 3
-            id: text
-            anchors.centerIn: parent
-            spacing: 0
-            Rectangle { width: 2; height: 1; color: Qt.rgba(0, 0, 0, 0) } // padding
-            Text {
-                // shortcut key
-                anchors.verticalCenter: parent.verticalCenter
-                anchors.verticalCenterOffset: 1
-                id: number
-                color: root.foreground
-                text: button
-                z: 2
-            }
-            Rectangle { width: 3; height: 1; color: Qt.rgba(0, 0, 0, 0) } // padding
-            Rectangle { y: 1; width: 1; color: root.foreground; height: root.height \
                - 1; opacity: 0.3 } // line
-            Rectangle { width: 4; height: 1; color: Qt.rgba(0, 0, 0, 0) } // padding
-            Text {
-                // actual button text
-                anchors.verticalCenter: parent.verticalCenter
-                anchors.verticalCenterOffset: 1
-                color: root.foreground
-                text: root.text
-                textFormat: Text.PlainText
-            }
-            Rectangle { width: 2; height: 1; color: Qt.rgba(0, 0, 0, 0) } // padding
-        }
-        Rectangle {
-            // the background color for the shortcut key box, invisible by default.
-            id: highlightArea
-            Behavior on opacity {
-                NumberAnimation { duration: 200 }
-            }
-            opacity: (root.highlighted || mouseArea.containsMouse) ? 0.5 : 0.0
-            x: 1
-            y: 1
-            z: 1
-            height: text.height
-            width: number.width + 6
-            color: root.highlight
-        }
-    }
-}
diff --git a/shell/CMakeLists.txt b/shell/CMakeLists.txt
index 2ac7691..82b0690 100644
--- a/shell/CMakeLists.txt
+++ b/shell/CMakeLists.txt
@@ -11,7 +11,6 @@ set(KDevPlatformShell_LIB_SRCS
     workingsets/workingsetwidget.cpp
     workingsets/closedworkingsetswidget.cpp
     workingsets/workingsethelpers.cpp
-    assistantpopup.cpp
     mainwindow.cpp
     mainwindow_p.cpp
     plugincontroller.cpp
@@ -116,9 +115,6 @@ LINK_PUBLIC
     KDev::Debugger
     KDev::Interfaces
 LINK_PRIVATE
-    Qt5::Quick
-    Qt5::QuickWidgets
-
     KF5::GuiAddons
     KF5::IconThemes
     KF5::KIOFileWidgets
@@ -175,4 +171,4 @@ install(FILES
 install( FILES debugger/kdevdebuggershellui.rc DESTINATION \
${KDE_INSTALL_KXMLGUI5DIR}/kdevdebugger )  install( FILES kdevsessionui.rc \
DESTINATION ${KDE_INSTALL_KXMLGUI5DIR}/kdevsession )  install( FILES \
                kdevsourceformatter.rc DESTINATION \
                ${KDE_INSTALL_KXMLGUI5DIR}/kdevsourceformatter )
-install( FILES AssistantButton.qml assistantpopup.qml DESTINATION \
${KDE_INSTALL_DATADIR}/kdevelop ) +
diff --git a/shell/assistantpopup.cpp b/shell/assistantpopup.cpp
deleted file mode 100644
index 8aea1e6..0000000
--- a/shell/assistantpopup.cpp
+++ /dev/null
@@ -1,382 +0,0 @@
-/*
-   Copyright 2009 David Nolden <david.nolden.kdevelop@art-master.de>
-   Copyright 2012 Milian Wolff <mail@milianw.de>
-   Copyright 2014 Sven Brauch <svenbrauch@gmail.com>
-   Copyright 2014 Kevin Funk <kfunk@kde.org>
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License version 2 as published by the Free Software Foundation.
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public License
-   along with this library; see the file COPYING.LIB.  If not, write to
-   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.
-*/
-
-#include "assistantpopup.h"
-#include "sublime/holdupdates.h"
-#include "util/kdevstringhandler.h"
-
-#include <QAction>
-#include <QApplication>
-#include <QKeyEvent>
-#include <QDebug>
-#include <QEvent>
-#include <QTimer>
-#include <QStandardPaths>
-#include <QQmlContext>
-#include <QQuickItem>
-
-#include <KLocalizedString>
-#include <KParts/MainWindow>
-#include <KTextEditor/Document>
-#include <KTextEditor/View>
-#include <KTextEditor/ConfigInterface>
-#include <KColorUtils>
-
-#include <interfaces/icore.h>
-#include <interfaces/iuicontroller.h>
-#include <interfaces/idocumentcontroller.h>
-
-using namespace KDevelop;
-
-namespace {
-
-/// Interval after which the state of the popup is re-evaluated
-/// Used to avoid flickering caused when user is quickly inserting code
-const int UPDATE_STATE_INTERVAL = 300; // ms
-
-const int ASSISTANT_MODIFIER =
-#ifdef Q_OS_MAC
-Qt::CTRL;
-#else
-Qt::ALT;
-#endif
-
-const int ASSISTANT_MOD_KEY =
-#ifdef Q_OS_MAC
-Qt::Key_Control;
-#else
-Qt::Key_Alt;
-#endif
-
-QWidget* findByClassname(const KTextEditor::View* view, const QString& klass)
-{
-    auto children = view->findChildren<QWidget*>();
-    for ( auto child: children ) {
-        if ( child->metaObject()->className() == klass ) {
-            return child;
-        }
-    }
-    return nullptr;
-};
-
-/**
- * @brief Get the geometry of the inner part (with the text) of the \
                KTextEditor::View being used.
- */
-QRect textWidgetGeometry(const KTextEditor::View *view)
-{
-    // Subtract the width of the right scrollbar
-    int scrollbarWidth = 0;
-    if ( auto scrollbar = findByClassname(view, "KateScrollBar") ) {
-        scrollbarWidth = scrollbar->width();
-    }
-    // Subtract the width of the bottom scrollbar
-    int bottomScrollbarWidth = 0;
-    if ( auto bottom = findByClassname(view, "QScrollBar") ) {
-        bottomScrollbarWidth = bottom->height();
-    }
-    auto geom = view->geometry();
-
-    geom.adjust(0, 0, -scrollbarWidth, -bottomScrollbarWidth);
-    return geom;
-}
-
-}
-
-AssistantPopupConfig::AssistantPopupConfig(QObject *parent)
-    : QObject(parent)
-    , m_active(false)
-{
-}
-
-void AssistantPopupConfig::setColorsFromView(QObject *view)
-{
-    auto iface = dynamic_cast<KTextEditor::ConfigInterface*>(view);
-    Q_ASSERT(iface);
-    m_foreground = iface->configValue("line-number-color").value<QColor>();
-    m_background = iface->configValue("icon-border-color").value<QColor>();
-    m_highlight = iface->configValue("folding-marker-color").value<QColor>();
-    if ( KColorUtils::luma(m_background) < 0.3 ) {
-        m_foreground = KColorUtils::lighten(m_foreground, 0.7);
-    }
-    const float lumaDiff = KColorUtils::luma(m_highlight) - \
                KColorUtils::luma(m_background);
-    if ( qAbs(lumaDiff) < 0.5 ) {
-        m_highlight = QColor::fromHsv(m_highlight.hue(),
-                                    qMin(255, m_highlight.saturation() + 80),
-                                    lumaDiff > 0 ? qMin(255, m_highlight.value() + \
                120)
-                                                 : qMax(80, m_highlight.value() - \
                40));
-    }
-    emit colorsChanged();
-}
-
-bool AssistantPopupConfig::isActive() const
-{
-    return m_active;
-}
-
-void AssistantPopupConfig::setActive(bool active)
-{
-    if (m_active == active) {
-        return;
-    }
-
-    m_active = active;
-    emit activeChanged(m_active);
-}
-
-void AssistantPopupConfig::setViewSize(const QSize& size)
-{
-    if (size != m_viewSize) {
-        m_viewSize = size;
-        emit viewSizeChanged(size);
-    }
-}
-
-void AssistantPopupConfig::setTitle(const QString& title)
-{
-    if (m_title == title) {
-        return;
-    }
-
-    m_title = title;
-    emit titleChanged(m_title);
-}
-
-void AssistantPopupConfig::setModel(const QList<QObject*>& model)
-{
-    if (m_model == model) {
-        return;
-    }
-
-    qDeleteAll( m_model );
-    m_model = model;
-    emit modelChanged(model);
-}
-
-AssistantPopup::AssistantPopup()
-// main window as parent to use maximal space available in worst case
-    : QQuickWidget(ICore::self()->uiController()->activeMainWindow())
-    , m_config(new AssistantPopupConfig(this))
-    , m_firstLayoutCompleted(false)
-{
-    setAttribute(Qt::WA_ShowWithoutActivating);
-
-    rootContext()->setContextProperty("config", m_config);
-
-    setSource(QUrl::fromLocalFile(QStandardPaths::locate(QStandardPaths::GenericDataLocation, \
                "kdevelop/assistantpopup.qml")));
-    if (!rootObject()) {
-        qWarning() << "Failed to load assistant markup! The assistant will not \
                work.";
-    } else {
-        connect(rootObject(), &QQuickItem::widthChanged, this, \
                &AssistantPopup::updateLayout);
-        connect(rootObject(), &QQuickItem::heightChanged, this, \
                &AssistantPopup::updateLayout);
-    }
-
-    for (int i = Qt::Key_0; i <= Qt::Key_9; ++i) {
-        m_shortcuts.append(new QShortcut(ASSISTANT_MODIFIER + i, this));
-    }
-    setActive(false);
-
-    connect(qApp, &QApplication::applicationStateChanged, this, [this]{ \
                setActive(false); });
-}
-
-void AssistantPopup::reset(KTextEditor::View* view, const IAssistant::Ptr& \
                assistant)
-{
-    setView(view);
-    setAssistant(assistant);
-    updateState();
-}
-
-void AssistantPopup::setView(KTextEditor::View* view)
-{
-    if (m_view == view) {
-        return;
-    }
-
-    setActive(false);
-
-    if (m_view) {
-        m_view->removeEventFilter(this);
-        disconnect(m_view.data(), &KTextEditor::View::verticalScrollPositionChanged,
-                  this, &AssistantPopup::updatePosition);
-    }
-    m_view = view;
-    m_config->setViewSize(m_view ? m_view->size() : QSize());
-    if (m_view) {
-        m_view->installEventFilter(this);
-        connect(m_view.data(), &KTextEditor::View::verticalScrollPositionChanged,
-                this, &AssistantPopup::updatePosition);
-    }
-}
-
-void AssistantPopup::setAssistant(const IAssistant::Ptr& assistant)
-{
-    if (m_assistant == assistant) {
-        return;
-    }
-
-    if (m_assistant) {
-        disconnect(m_assistant.data(), &IAssistant::hide, this, \
                &AssistantPopup::hideAssistant);
-    }
-    m_assistant = assistant;
-    if (m_assistant) {
-        connect(m_assistant.data(), &IAssistant::hide, this, \
                &AssistantPopup::hideAssistant);
-    } else {
-        hide();
-    }
-}
-
-void AssistantPopup::setActive(bool active)
-{
-    m_config->setActive(active);
-    for (auto shortcut : m_shortcuts) {
-        shortcut->setEnabled(active);
-    }
-}
-
-bool AssistantPopup::eventFilter(QObject* object, QEvent* event)
-{
-    Q_UNUSED(object);
-
-    if (!m_view || (object != m_view.data()))
-        return false;
-
-    if (event->type() == QEvent::Resize) {
-        updateLayout();
-    } else if (event->type() == QEvent::Hide) {
-        executeHideAction();
-    } else if (event->type() == QEvent::KeyPress) {
-        auto keyEvent = static_cast<QKeyEvent*>(event);
-        if (keyEvent->modifiers() == ASSISTANT_MODIFIER) {
-            setActive(true);
-        }
-        if (keyEvent->key() == Qt::Key_Escape) {
-            executeHideAction();
-        }
-    } else if (event->type() == QEvent::KeyRelease) {
-        auto keyEvent = static_cast<QKeyEvent*>(event);
-        if (keyEvent->modifiers() == ASSISTANT_MODIFIER || keyEvent->key() == \
                ASSISTANT_MOD_KEY) {
-            setActive(false);
-        }
-    }
-    return false;
-}
-
-void AssistantPopup::updatePosition(KTextEditor::View* view, const \
                KTextEditor::Cursor& newPos)
-{
-    static const int MARGIN = 12;
-
-    if (newPos.isValid() && newPos.line() == 0) {
-        // the position is not going to change; don't waste time
-        return;
-    }
-
-    auto editorGeometry = textWidgetGeometry(view);
-    const auto startCursorCoordinate = \
                view->cursorToCoordinate(KTextEditor::Cursor(0, 0));
-
-    // algorithm for popup positioning:
-    // if we are scrolled to the top: show at bottom
-    // else:
-    //   if: current cursor position is in upper half => show at bottom
-    //   else: show at top
-    const bool showAtBottom = startCursorCoordinate.y() == 0 ? true :
-        view->cursorPositionCoordinates().y() < view->height()/2;
-    const QPoint targetLocation = showAtBottom ?
-        parentWidget()->mapFromGlobal(view->mapToGlobal(editorGeometry.bottomRight()
-                                      + QPoint(-width() - MARGIN, -MARGIN - \
                height()))) :
-        parentWidget()->mapFromGlobal(view->mapToGlobal(editorGeometry.topRight()
-                                      + QPoint(-width() - MARGIN, MARGIN)));
-    if (pos() == targetLocation) {
-        return;
-    }
-
-    Sublime::HoldUpdates hold(ICore::self()->uiController()->activeMainWindow());
-    move(targetLocation);
-}
-
-IAssistant::Ptr AssistantPopup::assistant() const
-{
-    return m_assistant;
-}
-
-void AssistantPopup::executeHideAction()
-{
-    if ( isVisible() ) {
-        m_assistant->doHide();
-    }
-}
-
-void AssistantPopup::hideAssistant()
-{
-    reset(nullptr, {}); // indirectly calls hide()
-}
-
-void AssistantPopup::updateLayout()
-{
-    if ( !m_view ) {
-        return;
-    }
-
-    m_config->setViewSize(m_view->size());
-    // https://bugreports.qt.io/browse/QTBUG-44876
-    resize(rootObject()->width(), rootObject()->height());
-    updatePosition(m_view, KTextEditor::Cursor::invalid());
-
-    // HACK: QQuickWidget is corrupted due to above resize on the first show
-    if (!m_firstLayoutCompleted) {
-        hide();
-        show();
-        m_firstLayoutCompleted = true;
-    }
-}
-
-void AssistantPopup::updateState()
-{
-    if (!m_assistant || m_assistant->actions().isEmpty() || !m_view) {
-        hide();
-        return;
-    }
-
-    auto curShortcut = m_shortcuts.constBegin();
-    auto hideAction = new QAction(i18n("Hide"), this);
-    connect(*curShortcut, &QShortcut::activated, hideAction, &QAction::trigger);
-    connect(hideAction, &QAction::triggered, this, \
                &AssistantPopup::executeHideAction);
-
-    QList<QObject*> items;
-    foreach (IAssistantAction::Ptr action, m_assistant->actions()) {
-        QAction* asQAction = action->toKAction();
-        items << asQAction;
-        asQAction->setParent(this);
-        //For some reason, QAction's setShortcut does nothing, so we manage with \
                QShortcut
-        if (++curShortcut != m_shortcuts.constEnd()) {
-            connect(*curShortcut, &QShortcut::activated, asQAction, \
                &QAction::trigger);
-        }
-        connect(action.data(), SIGNAL(executed(IAssistantAction*)), hideAction, \
                SLOT(trigger()));
-    }
-    items << hideAction;
-
-    auto view = ICore::self()->documentController()->activeTextDocumentView();
-    m_config->setColorsFromView(view);
-    m_config->setModel(items);
-    m_config->setTitle(m_assistant->title());
-    setActive(false);
-
-    show();
-}
-
diff --git a/shell/assistantpopup.h b/shell/assistantpopup.h
deleted file mode 100644
index 44cd167..0000000
--- a/shell/assistantpopup.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
-   Copyright 2009 David Nolden <david.nolden.kdevelop@art-master.de>
-   Copyright 2012 Milian Wolff <mail@milianw.de>
-   Copyright 2014 Sven Brauch <svenbrauch@gmail.com>
-   Copyright 2014 Kevin Funk <kfunk@kde.org>
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License version 2 as published by the Free Software Foundation.
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public License
-   along with this library; see the file COPYING.LIB.  If not, write to
-   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.
-*/
-
-#ifndef KDEVPLATFORM_ASSISTANTPOPUP_H
-#define KDEVPLATFORM_ASSISTANTPOPUP_H
-
-#include <QQuickWidget>
-#include <QShortcut>
-#include <interfaces/iassistant.h>
-
-namespace KTextEditor
-{
-class View;
-class Cursor;
-}
-
-class AssistantPopupConfig : public QObject
-{
-    Q_OBJECT
-    Q_PROPERTY(QColor foreground READ foreground NOTIFY colorsChanged)
-    Q_PROPERTY(QColor background READ background NOTIFY colorsChanged)
-    Q_PROPERTY(QColor highlight READ highlight NOTIFY colorsChanged)
-
-    Q_PROPERTY(QString title READ title NOTIFY titleChanged)
-    Q_PROPERTY(QList<QObject*> model READ model NOTIFY modelChanged)
-    Q_PROPERTY(bool active READ isActive WRITE setActive NOTIFY activeChanged)
-    Q_PROPERTY(QSize viewSize READ viewSize WRITE setViewSize NOTIFY \
                viewSizeChanged)
-
-public:
-    explicit AssistantPopupConfig(QObject *parent = 0);
-
-    QColor foreground() const { return m_foreground; }
-    QColor background() const { return m_background; }
-    QColor highlight() const { return m_highlight; }
-
-    QSize viewSize() const { return m_viewSize; };
-    void setViewSize(const QSize &size);
-
-    QString title() const { return m_title; }
-    void setTitle(const QString& title);
-    QList<QObject*> model() const { return m_model; }
-    void setModel(const QList<QObject*>& model);
-
-    void setColorsFromView(QObject *view);
-
-    bool isActive() const;
-    void setActive(bool active);
-
-signals:
-    void colorsChanged();
-
-    void titleChanged(const QString& title);
-    void modelChanged(const QList<QObject*>& model);
-    void activeChanged(bool active);
-    void viewSizeChanged(const QSize& size);
-
-private:
-    QColor m_foreground;
-    QColor m_background;
-    QColor m_highlight;
-
-    QString m_title;
-    QList<QObject*> m_model;
-    bool m_active;
-    QSize m_viewSize;
-};
-
-Q_DECLARE_METATYPE(AssistantPopupConfig*)
-
-class AssistantPopup : public QQuickWidget
-{
-    Q_OBJECT
-
-public:
-    typedef QExplicitlySharedDataPointer<AssistantPopup> Ptr;
-
-    /**
-     * The current main window will be used as parent widget for the popup.
-     * This is to make use of the maximal space available and prevent any lines
-     * in e.g. the editor to be hidden by the popup.
-     */
-    AssistantPopup();
-
-    /**
-     * Reset this popup for view @p view and show assistant @p assistant
-     *
-     * @p view The widget below which the assistant should be shown.
-     */
-    void reset(KTextEditor::View *view, const KDevelop::IAssistant::Ptr &assistant);
-
-    KDevelop::IAssistant::Ptr assistant() const;
-
-private slots:
-    void updatePosition(KTextEditor::View* view, const KTextEditor::Cursor& newPos);
-    void updateState();
-    void updateLayout();
-
-    void executeHideAction();
-    void hideAssistant();
-
-protected:
-    virtual bool eventFilter(QObject* object, QEvent* event) override;
-
-private:
-    void setView(KTextEditor::View* view);
-    void setAssistant(const KDevelop::IAssistant::Ptr& assistant);
-    void setActive( bool active );
-
-    KDevelop::IAssistant::Ptr m_assistant;
-    QPointer<KTextEditor::View> m_view;
-    AssistantPopupConfig* m_config;
-    QList<QShortcut*> m_shortcuts;
-    bool m_firstLayoutCompleted;
-};
-
-#endif // KDEVPLATFORM_ASSISTANTPOPUP_H
diff --git a/shell/assistantpopup.qml b/shell/assistantpopup.qml
deleted file mode 100644
index 63c00e8..0000000
--- a/shell/assistantpopup.qml
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
-   Copyright 2014 Sven Brauch <svenbrauch@gmail.com>
-   Copyright 2014 Kevin Funk <kfunk@kde.org>
-
-   This library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Library General Public
-   License version 2 as published by the Free Software Foundation.
-
-   This library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Library General Public License for more details.
-
-   You should have received a copy of the GNU Library General Public License
-   along with this library; see the file COPYING.LIB.  If not, write to
-   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.
-*/
-
-// This file provides the whole assistant, including title and buttons.
-
-import QtQuick 2.2
-
-Rectangle {
-    id: root
-
-    readonly property int vSpacing: 4
-    readonly property int hSpacing: 4
-    readonly property real itemsWidth: {
-        var totalWidth = title.width;
-        for (var i = 0; i < items.count; ++i) {
-            totalWidth += items.itemAt(i).width;
-        }
-        return totalWidth + (items.count + 2) * hSpacing;
-    }
-    readonly property bool useVerticalLayout: config.viewSize.width * 0.90 < \
                itemsWidth
-
-    // QQuickWidget crashes if either of these is zero
-    // Use ceil to ensure the widget always fits the non-integral content size
-    width: Math.ceil(Math.max(hSpacing, mainFlow.width + hSpacing * 2))
-    height: Math.ceil(Math.max(vSpacing, mainFlow.height + vSpacing * 2))
-
-    border.width: 1
-    border.color: Qt.lighter(config.foreground)
-    gradient: Gradient {
-        GradientStop { position: 0.0; color: Qt.lighter(config.background) }
-        GradientStop { position: 1.0; color: config.background }
-    }
-
-    Flow {
-        id: mainFlow
-
-        anchors {
-            centerIn: parent
-        }
-
-        flow: root.useVerticalLayout ? Flow.TopToBottom : Flow.LeftToRight
-        spacing: root.useVerticalLayout ? root.vSpacing : root.hSpacing
-
-        Text {
-            id: title
-
-            color: config.foreground
-            font.bold: true
-            text: config.title
-        }
-
-
-        Repeater {
-            id: items
-            objectName: "items"
-
-            y: 5
-            model: config.model
-
-            AssistantButton {
-                text: modelData.text
-                highlighted: config.active
-                // what is displayed in the hotkey field of the button
-                button: index == items.model.length - 1 ? 0 : index + 1
-                foreground: config.foreground
-                background: config.background
-                highlight: config.highlight
-
-                onTriggered: { modelData.trigger() }
-            }
-        }
-    }
-}
diff --git a/shell/uicontroller.cpp b/shell/uicontroller.cpp
index ceb631e..1df7a96 100644
--- a/shell/uicontroller.cpp
+++ b/shell/uicontroller.cpp
@@ -49,7 +49,6 @@
 #include "partdocument.h"
 #include "textdocument.h"
 #include "documentcontroller.h"
-#include "assistantpopup.h"
 #include <ktexteditor/view.h>
 #include "workingsetcontroller.h"
 #include "workingsets/workingset.h"
@@ -146,8 +145,6 @@ public:
     QPointer<Sublime::MainWindow> activeSublimeWindow;
     bool areasRestored;
 
-    /// Currently shown assistant popup.
-    QPointer<AssistantPopup> currentShownAssistant;
     /// QWidget implementing IToolViewActionListener interface, or null
     QPointer<QWidget> activeActionListener;
     QTimer m_assistantTimer;
@@ -721,14 +718,7 @@ void UiController::showErrorMessage(const QString& message, int \
                timeout)
     QMetaObject::invokeMethod(mw, "showErrorMessage", Q_ARG(QString, message), \
Q_ARG(int, timeout));  }
 
-void UiController::hideAssistant()
-{
-    if (d->currentShownAssistant) {
-        d->currentShownAssistant->hide();
-    }
-}
-
-void UiController::popUpAssistant(const KDevelop::IAssistant::Ptr& assistant)
+void UiController::showAssistant(const KDevelop::IAssistant::Ptr& assistant)
 {
     if(!assistant)
         return;
@@ -743,10 +733,6 @@ void UiController::popUpAssistant(const \
KDevelop::IAssistant::Ptr& assistant)  auto editorView = \
qobject_cast<KTextEditor::View*>(view->widget());  Q_ASSERT(editorView);
     if (editorView) {
-        if ( !d->currentShownAssistant ) {
-            d->currentShownAssistant = new AssistantPopup;
-        }
-        d->currentShownAssistant->reset(editorView, assistant);
         // TODO: See if we can use CodeCompletionInterface::startCompletion for this
         // See if we can split the assistant actions into their own model and use \
                the model param as well
         // That way we don't get unwanted completions when the assistant completions \
                are shown
diff --git a/shell/uicontroller.h b/shell/uicontroller.h
index 3d2e8dc..06b4104 100644
--- a/shell/uicontroller.h
+++ b/shell/uicontroller.h
@@ -85,7 +85,7 @@ public:
     /*! @p status must implement KDevelop::IStatus */
     virtual void registerStatus(QObject* status) override;
 
-    virtual void popUpAssistant(const KDevelop::IAssistant::Ptr& assistant) \
override; +    virtual void showAssistant(const KDevelop::IAssistant::Ptr& assistant) \
override;  
     virtual void showErrorMessage(const QString& message, int timeout) override;
 
@@ -112,8 +112,6 @@ private Q_SLOTS:
     void slotAreaChanged(Sublime::Area* area);
     void slotActiveToolViewChanged(Sublime::View* view);
 
-    void hideAssistant() override;
-
 private:
     void addToolViewIfWanted(IToolViewFactory* factory,
                            Sublime::ToolDocument* doc,


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic