1 /*
2     SPDX-FileCopyrightText: 2002 Falk Brettschneider <falkbr@kdevelop.org>
3     SPDX-FileCopyrightText: 2003 John Firebaugh <jfirebaugh@kde.org>
4     SPDX-FileCopyrightText: 2006 Adam Treat <treat@kde.org>
5     SPDX-FileCopyrightText: 2006, 2007 Alexander Dymo <adymo@kdevelop.org>
6 
7     SPDX-License-Identifier: LGPL-2.0-or-later
8 */
9 
10 #ifndef KDEVPLATFORM_MAINWINDOW_PRIVATE_H
11 #define KDEVPLATFORM_MAINWINDOW_PRIVATE_H
12 
13 #include <QObject>
14 #include <QPointer>
15 #include <QWidget>
16 #include <QMap>
17 #include <KXMLGUIClient>
18 
19 #include <language/util/navigationtooltip.h>
20 
21 class KActionCollection;
22 class QMenu;
23 
24 namespace Sublime {
25 class View;
26 class Container;
27 }
28 
29 namespace KParts {
30 class Part;
31 }
32 
33 namespace KTextEditor {
34 class View;
35 }
36 
37 namespace KTextEditorIntegration {
38 class MainWindow;
39 }
40 
41 namespace KDevelop {
42 
43 class IPlugin;
44 class MainWindow;
45 class StatusBar;
46 
47 class MainWindowPrivate: public QObject {
48     Q_OBJECT
49 public:
50     explicit MainWindowPrivate(MainWindow *mainWindow);
51     ~MainWindowPrivate() override;
52 
53     QPointer<QWidget> centralPlugin;
54     QMetaObject::Connection activeDocumentReadWriteConnection;
55 
56     void setupActions();
57     void setupGui();
58     void setupStatusBar();
59     void registerStatus(QObject*);
60 
61     void tabContextMenuRequested(Sublime::View *view, QMenu* menu);
62     void tabToolTipRequested(Sublime::View* view, Sublime::Container* container, int tab);
63     void dockBarContextMenuRequested(Qt::DockWidgetArea area, const QPoint& position);
64 
65 public Q_SLOTS:
66     void addPlugin( KDevelop::IPlugin *plugin );
67     void removePlugin( KDevelop::IPlugin *plugin );
68     void updateSourceFormatterGuiClient(bool hasFormatters);
69 
70     void activePartChanged(KParts::Part *part);
71     void mergeView(Sublime::View *view);
72     void changeActiveView(Sublime::View *view);
73     void xmlguiclientDestroyed(QObject* obj);
74 
75     //actions
76     void fileNew();
77 
78     void gotoNextWindow();
79     void gotoPreviousWindow();
80 
81     void selectPrevItem();
82     void selectNextItem();
83 
84     void viewAddNewToolView();
85 
86     void newWindow();
87     void splitHorizontal();
88     void splitVertical();
89     void split(Qt::Orientation orientation);
90     void toggleFullScreen(bool fullScreen);
91 
92     void gotoNextSplit();
93     void gotoPreviousSplit();
94 
95     void newToolbarConfig();
96 
97     void settingsDialog();
98 
99     void quitAll();
100 
101 //    void fixToolbar();
102 
103     ///Returns true if we're currently changing the active view through changeActiveView()
104     bool changingActiveView() const ;
105 
106     void configureNotifications();
107     void showLoadedPlugins();
108 
109     void toggleArea(bool b);
110     void showErrorMessage(const QString& message, int timeout);
111     void pluginDestroyed(QObject*);
112 
113     /// the following slots always activate the m_tabView before calling the normal slot above
114     /// @see m_tabView
115     /// @see tabContextMenuRequested
116     void contextMenuFileNew();
117     void contextMenuSplitHorizontal();
118     void contextMenuSplitVertical();
119 
120     /// reload all open documents
121     void reloadAll();
122 
123     KTextEditorIntegration::MainWindow *kateWrapper() const;
124 
125 private:
126     KActionCollection *actionCollection();
127 
128     MainWindow* const m_mainWindow;
129     StatusBar* m_statusBar;
130     QWidget* lastXMLGUIClientView;
131     QPointer<QWidget> m_workingSetCornerWidget;
132 
133     QMap<IPlugin*, KXMLGUIClient*> m_pluginCustomClients;
134 
135     bool m_changingActiveView;
136     /// the view of the tab that got it's context menu connected
137     Sublime::View* m_tabView;
138     QPair<Sublime::View*, QPointer<NavigationToolTip> > m_tabTooltip;
139     KTextEditorIntegration::MainWindow* m_kateWrapper;
140 };
141 
142 }
143 
144 #endif
145 
146