1 /* 2 SPDX-FileCopyrightText: 2003 Falk Brettschneider <falkbr@kdevelop.org> 3 SPDX-FileCopyrightText: 2003 John Firebaugh <jfirebaugh@kde.org> 4 SPDX-FileCopyrightText: 2003 Amilcar do Carmo Lucas <amilcar@kdevelop.org> 5 SPDX-FileCopyrightText: 2004, 2007 Alexander Dymo <adymo@kdevelop.org> 6 SPDX-FileCopyrightText: 2006 Adam Treat <treat@kde.org> 7 8 SPDX-License-Identifier: LGPL-2.0-or-later 9 */ 10 11 #ifndef KDEVPLATFORM_MAINWINDOW_H 12 #define KDEVPLATFORM_MAINWINDOW_H 13 14 #include <sublime/mainwindow.h> 15 16 #include "shellexport.h" 17 18 namespace KTextEditor { 19 class View; 20 class Document; 21 } 22 23 namespace KTextEditorIntegration { 24 class MainWindow; 25 } 26 27 namespace KDevelop 28 { 29 30 class IDocument; 31 class MainWindowPrivate; 32 33 /** 34 KDevelop main window. 35 Provides methods to control the main window of an application. 36 */ 37 class KDEVPLATFORMSHELL_EXPORT MainWindow: public Sublime::MainWindow { 38 friend class UiController; 39 Q_OBJECT 40 Q_CLASSINFO( "D-Bus Interface", "org.kdevelop.MainWindow" ) 41 public: 42 explicit MainWindow(Sublime::Controller *parent = nullptr, Qt::WindowFlags flags = {}); 43 ~MainWindow() override; 44 45 /*! @p status must implement KDevelop::IStatus */ 46 void registerStatus(QObject* status); 47 KTextEditorIntegration::MainWindow *kateWrapper() const; 48 void split(Qt::Orientation orientation); 49 50 public Q_SLOTS: 51 /*! Shows an error message in the status bar. 52 @p message The message 53 @p timeout The timeout in milliseconds how long to show the message */ 54 void showErrorMessage(const QString& message, int timeout); 55 56 virtual Q_SCRIPTABLE void ensureVisible(); windowTitle()57 virtual Q_SCRIPTABLE QString windowTitle() { 58 return Sublime::MainWindow::windowTitle(); 59 } 60 61 void setVisible( bool visible ) override; 62 void configureShortcuts(); 63 void loadSettings() override; 64 65 Q_SIGNALS: 66 void finishedLoading(); 67 68 protected: 69 //FIXME DOCUMENT!!! queryClose() must call all of the Core cleanup() methods! 70 bool queryClose() override; 71 //reimplemented from KXMLGUIBuilder to support visible menubar separators 72 QAction *createCustomElement(QWidget *parent, int index, const QDomElement &element) override; 73 74 virtual void initialize(); 75 virtual void cleanup(); 76 void initializeStatusBar() override; 77 bool event( QEvent* ) override; 78 void dragEnterEvent( QDragEnterEvent* ) override; 79 void dropEvent( QDropEvent* ) override; 80 void applyMainWindowSettings(const KConfigGroup& config) override; 81 void createGUI(KParts::Part* part); 82 83 protected Q_SLOTS: 84 void tabContextMenuRequested(Sublime::View* , QMenu* ) override; 85 void tabToolTipRequested(Sublime::View* view, Sublime::Container* container, int tab) override; 86 void dockBarContextMenuRequested(Qt::DockWidgetArea, const QPoint&) override; 87 void newTabRequested() override; 88 89 private Q_SLOTS: 90 void documentActivated(const QPointer<KTextEditor::Document>& textDocument); 91 void updateCaption(); 92 93 void updateTabColor(IDocument* doc); 94 void updateAllTabColors(); 95 96 void shortcutsChanged(); 97 98 private: 99 void initializeCorners(); 100 101 private: 102 MainWindowPrivate* d_ptr; 103 Q_DECLARE_PRIVATE(MainWindow) 104 friend class MainWindowPrivate; 105 }; 106 107 } 108 109 #endif 110 111