Changeset View
Changeset View
Standalone View
Standalone View
shell/uicontroller.cpp
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Line(s) | |||||
44 | #include "editorconfigpage.h" | 44 | #include "editorconfigpage.h" | ||
45 | #include "shellextension.h" | 45 | #include "shellextension.h" | ||
46 | #include "partcontroller.h" | 46 | #include "partcontroller.h" | ||
47 | #include "plugincontroller.h" | 47 | #include "plugincontroller.h" | ||
48 | #include "mainwindow.h" | 48 | #include "mainwindow.h" | ||
49 | #include "partdocument.h" | 49 | #include "partdocument.h" | ||
50 | #include "textdocument.h" | 50 | #include "textdocument.h" | ||
51 | #include "documentcontroller.h" | 51 | #include "documentcontroller.h" | ||
52 | #include "assistantpopup.h" | | |||
53 | #include <ktexteditor/view.h> | 52 | #include <ktexteditor/view.h> | ||
54 | #include "workingsetcontroller.h" | 53 | #include "workingsetcontroller.h" | ||
55 | #include "workingsets/workingset.h" | 54 | #include "workingsets/workingset.h" | ||
56 | #include "settings/bgpreferences.h" | 55 | #include "settings/bgpreferences.h" | ||
57 | #include "settings/languagepreferences.h" | 56 | #include "settings/languagepreferences.h" | ||
58 | #include "settings/environmentpreferences.h" | 57 | #include "settings/environmentpreferences.h" | ||
59 | #include "settings/pluginpreferences.h" | 58 | #include "settings/pluginpreferences.h" | ||
60 | #include "settings/projectpreferences.h" | 59 | #include "settings/projectpreferences.h" | ||
▲ Show 20 Lines • Show All 80 Lines • ▼ Show 20 Line(s) | 67 | public: | |||
141 | Core *core; | 140 | Core *core; | ||
142 | QPointer<MainWindow> defaultMainWindow; | 141 | QPointer<MainWindow> defaultMainWindow; | ||
143 | 142 | | |||
144 | QHash<IToolViewFactory*, Sublime::ToolDocument*> factoryDocuments; | 143 | QHash<IToolViewFactory*, Sublime::ToolDocument*> factoryDocuments; | ||
145 | 144 | | |||
146 | QPointer<Sublime::MainWindow> activeSublimeWindow; | 145 | QPointer<Sublime::MainWindow> activeSublimeWindow; | ||
147 | bool areasRestored; | 146 | bool areasRestored; | ||
148 | 147 | | |||
149 | /// Currently shown assistant popup. | | |||
150 | QPointer<AssistantPopup> currentShownAssistant; | | |||
151 | /// QWidget implementing IToolViewActionListener interface, or null | 148 | /// QWidget implementing IToolViewActionListener interface, or null | ||
152 | QPointer<QWidget> activeActionListener; | 149 | QPointer<QWidget> activeActionListener; | ||
153 | QTimer m_assistantTimer; | 150 | QTimer m_assistantTimer; | ||
154 | 151 | | |||
155 | private: | 152 | private: | ||
156 | UiController *m_controller; | 153 | UiController *m_controller; | ||
157 | }; | 154 | }; | ||
158 | 155 | | |||
▲ Show 20 Lines • Show All 558 Lines • ▼ Show 20 Line(s) | |||||
717 | { | 714 | { | ||
718 | Sublime::MainWindow* w = activeSublimeWindow(); | 715 | Sublime::MainWindow* w = activeSublimeWindow(); | ||
719 | if (!w) return; | 716 | if (!w) return; | ||
720 | MainWindow* mw = qobject_cast<KDevelop::MainWindow*>(w); | 717 | MainWindow* mw = qobject_cast<KDevelop::MainWindow*>(w); | ||
721 | if (!mw) return; | 718 | if (!mw) return; | ||
722 | QMetaObject::invokeMethod(mw, "showErrorMessage", Q_ARG(QString, message), Q_ARG(int, timeout)); | 719 | QMetaObject::invokeMethod(mw, "showErrorMessage", Q_ARG(QString, message), Q_ARG(int, timeout)); | ||
723 | } | 720 | } | ||
724 | 721 | | |||
725 | void UiController::hideAssistant() | | |||
726 | { | | |||
727 | if (d->currentShownAssistant) { | | |||
728 | d->currentShownAssistant->hide(); | | |||
729 | } | | |||
730 | } | | |||
731 | | ||||
732 | void UiController::popUpAssistant(const KDevelop::IAssistant::Ptr& assistant) | | |||
733 | { | | |||
734 | if(!assistant) | | |||
735 | return; | | |||
736 | | ||||
737 | Sublime::View* view = d->activeSublimeWindow->activeView(); | | |||
738 | if( !view ) | | |||
739 | { | | |||
740 | qCDebug(SHELL) << "no active view in mainwindow"; | | |||
741 | return; | | |||
742 | } | | |||
743 | | ||||
744 | auto editorView = qobject_cast<KTextEditor::View*>(view->widget()); | | |||
745 | Q_ASSERT(editorView); | | |||
746 | if (editorView) { | | |||
747 | if ( !d->currentShownAssistant ) { | | |||
748 | d->currentShownAssistant = new AssistantPopup; | | |||
749 | } | | |||
750 | d->currentShownAssistant->reset(editorView, assistant); | | |||
751 | } | | |||
752 | } | | |||
753 | | ||||
754 | const QHash< IToolViewFactory*, Sublime::ToolDocument* >& UiController::factoryDocuments() const | 722 | const QHash< IToolViewFactory*, Sublime::ToolDocument* >& UiController::factoryDocuments() const | ||
755 | { | 723 | { | ||
756 | return d->factoryDocuments; | 724 | return d->factoryDocuments; | ||
757 | } | 725 | } | ||
758 | 726 | | |||
759 | QWidget* UiController::activeToolViewActionListener() const | 727 | QWidget* UiController::activeToolViewActionListener() const | ||
760 | { | 728 | { | ||
761 | return d->activeActionListener; | 729 | return d->activeActionListener; | ||
Show All 11 Lines |