File indexing completed on 2024-04-28 04:37:20

0001 /*
0002     SPDX-FileCopyrightText: 2002 Falk Brettschneider <falkbr@kdevelop.org>
0003     SPDX-FileCopyrightText: 2003 John Firebaugh <jfirebaugh@kde.org>
0004     SPDX-FileCopyrightText: 2006 Adam Treat <treat@kde.org>
0005     SPDX-FileCopyrightText: 2006, 2007 Alexander Dymo <adymo@kdevelop.org>
0006 
0007     SPDX-License-Identifier: LGPL-2.0-or-later
0008 */
0009 
0010 #ifndef KDEVPLATFORM_MAINWINDOW_PRIVATE_H
0011 #define KDEVPLATFORM_MAINWINDOW_PRIVATE_H
0012 
0013 #include <QObject>
0014 #include <QPointer>
0015 #include <QWidget>
0016 #include <QMap>
0017 #include <KXMLGUIClient>
0018 
0019 #include <language/util/navigationtooltip.h>
0020 
0021 class KActionCollection;
0022 class QMenu;
0023 
0024 namespace Sublime {
0025 class View;
0026 class Container;
0027 }
0028 
0029 namespace KParts {
0030 class Part;
0031 }
0032 
0033 namespace KTextEditor {
0034 class View;
0035 }
0036 
0037 namespace KTextEditorIntegration {
0038 class MainWindow;
0039 }
0040 
0041 namespace KDevelop {
0042 
0043 class IPlugin;
0044 class MainWindow;
0045 class StatusBar;
0046 
0047 class MainWindowPrivate: public QObject {
0048     Q_OBJECT
0049 public:
0050     explicit MainWindowPrivate(MainWindow *mainWindow);
0051     ~MainWindowPrivate() override;
0052 
0053     QPointer<QWidget> centralPlugin;
0054     QMetaObject::Connection activeDocumentReadWriteConnection;
0055 
0056     void setupActions();
0057     void setupGui();
0058     void setupStatusBar();
0059     void registerStatus(QObject*);
0060 
0061     void tabContextMenuRequested(Sublime::View *view, QMenu* menu);
0062     void tabToolTipRequested(Sublime::View* view, Sublime::Container* container, int tab);
0063     void dockBarContextMenuRequested(Qt::DockWidgetArea area, const QPoint& position);
0064 
0065 public Q_SLOTS:
0066     void addPlugin( KDevelop::IPlugin *plugin );
0067     void removePlugin( KDevelop::IPlugin *plugin );
0068     void updateSourceFormatterGuiClient(bool hasFormatters);
0069 
0070     void activePartChanged(KParts::Part *part);
0071     void mergeView(Sublime::View *view);
0072     void changeActiveView(Sublime::View *view);
0073     void xmlguiclientDestroyed(QObject* obj);
0074 
0075     //actions
0076     void fileNew();
0077 
0078     void gotoNextWindow();
0079     void gotoPreviousWindow();
0080 
0081     void selectPrevItem();
0082     void selectNextItem();
0083 
0084     void viewAddNewToolView();
0085 
0086     void newWindow();
0087     void splitHorizontal();
0088     void splitVertical();
0089     void split(Qt::Orientation orientation);
0090     void toggleFullScreen(bool fullScreen);
0091 
0092     void gotoNextSplit();
0093     void gotoPreviousSplit();
0094 
0095     void newToolbarConfig();
0096 
0097     void settingsDialog();
0098 
0099     void quitAll();
0100 
0101 //    void fixToolbar();
0102 
0103     ///Returns true if we're currently changing the active view through changeActiveView()
0104     bool changingActiveView() const ;
0105 
0106     void configureNotifications();
0107     void showLoadedPlugins();
0108 
0109     void toggleArea(bool b);
0110     void showErrorMessage(const QString& message, int timeout);
0111     void pluginDestroyed(QObject*);
0112 
0113     /// the following slots always activate the m_tabView before calling the normal slot above
0114     /// @see m_tabView
0115     /// @see tabContextMenuRequested
0116     void contextMenuFileNew();
0117     void contextMenuSplitHorizontal();
0118     void contextMenuSplitVertical();
0119 
0120     /// reload all open documents
0121     void reloadAll();
0122 
0123     KTextEditorIntegration::MainWindow *kateWrapper() const;
0124 
0125 private:
0126     KActionCollection *actionCollection();
0127 
0128     MainWindow* const m_mainWindow;
0129     StatusBar* m_statusBar;
0130     QWidget* lastXMLGUIClientView;
0131     QPointer<QWidget> m_workingSetCornerWidget;
0132 
0133     QMap<IPlugin*, KXMLGUIClient*> m_pluginCustomClients;
0134 
0135     bool m_changingActiveView;
0136     /// the view of the tab that got it's context menu connected
0137     Sublime::View* m_tabView;
0138     QPair<Sublime::View*, QPointer<NavigationToolTip> > m_tabTooltip;
0139     KTextEditorIntegration::MainWindow* m_kateWrapper;
0140 };
0141 
0142 }
0143 
0144 #endif
0145