File indexing completed on 2024-04-28 04:37:19
0001 /* 0002 SPDX-FileCopyrightText: 2003 Falk Brettschneider <falkbr@kdevelop.org> 0003 SPDX-FileCopyrightText: 2003 John Firebaugh <jfirebaugh@kde.org> 0004 SPDX-FileCopyrightText: 2003 Amilcar do Carmo Lucas <amilcar@kdevelop.org> 0005 SPDX-FileCopyrightText: 2004, 2007 Alexander Dymo <adymo@kdevelop.org> 0006 SPDX-FileCopyrightText: 2006 Adam Treat <treat@kde.org> 0007 0008 SPDX-License-Identifier: LGPL-2.0-or-later 0009 */ 0010 0011 #ifndef KDEVPLATFORM_MAINWINDOW_H 0012 #define KDEVPLATFORM_MAINWINDOW_H 0013 0014 #include <sublime/mainwindow.h> 0015 0016 #include "shellexport.h" 0017 0018 namespace KTextEditor { 0019 class View; 0020 class Document; 0021 } 0022 0023 namespace KTextEditorIntegration { 0024 class MainWindow; 0025 } 0026 0027 namespace KDevelop 0028 { 0029 0030 class IDocument; 0031 class MainWindowPrivate; 0032 0033 /** 0034 KDevelop main window. 0035 Provides methods to control the main window of an application. 0036 */ 0037 class KDEVPLATFORMSHELL_EXPORT MainWindow: public Sublime::MainWindow { 0038 friend class UiController; 0039 Q_OBJECT 0040 Q_CLASSINFO( "D-Bus Interface", "org.kdevelop.MainWindow" ) 0041 public: 0042 explicit MainWindow(Sublime::Controller *parent = nullptr, Qt::WindowFlags flags = {}); 0043 ~MainWindow() override; 0044 0045 /*! @p status must implement KDevelop::IStatus */ 0046 void registerStatus(QObject* status); 0047 KTextEditorIntegration::MainWindow *kateWrapper() const; 0048 void split(Qt::Orientation orientation); 0049 0050 public Q_SLOTS: 0051 /*! Shows an error message in the status bar. 0052 @p message The message 0053 @p timeout The timeout in seconds how long to show the message */ 0054 void showErrorMessage(const QString& message, int timeout); 0055 0056 virtual Q_SCRIPTABLE void ensureVisible(); 0057 virtual Q_SCRIPTABLE QString windowTitle() { 0058 return Sublime::MainWindow::windowTitle(); 0059 } 0060 0061 void setVisible( bool visible ) override; 0062 void configureShortcuts(); 0063 void loadSettings() override; 0064 0065 Q_SIGNALS: 0066 void finishedLoading(); 0067 0068 protected: 0069 //FIXME DOCUMENT!!! queryClose() must call all of the Core cleanup() methods! 0070 bool queryClose() override; 0071 //reimplemented from KXMLGUIBuilder to support visible menubar separators 0072 QAction *createCustomElement(QWidget *parent, int index, const QDomElement &element) override; 0073 0074 virtual void initialize(); 0075 virtual void cleanup(); 0076 void initializeStatusBar() override; 0077 bool event( QEvent* ) override; 0078 void dragEnterEvent( QDragEnterEvent* ) override; 0079 void dropEvent( QDropEvent* ) override; 0080 void applyMainWindowSettings(const KConfigGroup& config) override; 0081 void createGUI(KParts::Part* part); 0082 0083 protected Q_SLOTS: 0084 void tabContextMenuRequested(Sublime::View* , QMenu* ) override; 0085 void tabToolTipRequested(Sublime::View* view, Sublime::Container* container, int tab) override; 0086 void dockBarContextMenuRequested(Qt::DockWidgetArea, const QPoint&) override; 0087 void newTabRequested() override; 0088 0089 private Q_SLOTS: 0090 void documentActivated(const QPointer<KTextEditor::Document>& textDocument); 0091 void updateCaption(); 0092 0093 void updateTabColor(IDocument* doc); 0094 void updateAllTabColors(); 0095 0096 void shortcutsChanged(); 0097 0098 private: 0099 void initializeCorners(); 0100 0101 private: 0102 MainWindowPrivate* d_ptr; 0103 Q_DECLARE_PRIVATE(MainWindow) 0104 friend class MainWindowPrivate; 0105 }; 0106 0107 } 0108 0109 #endif 0110