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

0001 /*
0002     SPDX-FileCopyrightText: 2006 Adam Treat <treat@kde.org>
0003     SPDX-FileCopyrightText: 2007 Alexander Dymo <adymo@kdevelop.org>
0004     SPDX-FileCopyrightText: 2015 Kevin Funk <kfunk@kde.org>
0005 
0006     SPDX-License-Identifier: LGPL-2.0-or-later
0007 */
0008 
0009 #ifndef __KDEVPARTCONTROLLER_H__
0010 #define __KDEVPARTCONTROLLER_H__
0011 
0012 #include <interfaces/ipartcontroller.h>
0013 
0014 #include <QUrl>
0015 
0016 #include <KSharedConfig>
0017 
0018 #include "core.h"
0019 
0020 class QWidget;
0021 
0022 namespace KParts
0023 {
0024 class Part;
0025 class ReadOnlyPart;
0026 class ReadWritePart;
0027 }
0028 
0029 namespace KTextEditor
0030 {
0031 class Document;
0032 class Editor;
0033 class View;
0034 }
0035 
0036 class QMimeType;
0037 
0038 Q_DECLARE_METATYPE(KSharedConfigPtr)
0039 
0040 namespace KDevelop
0041 {
0042 class PartControllerPrivate;
0043 
0044 class KDEVPLATFORMSHELL_EXPORT PartController : public IPartController
0045 {
0046     friend class Core;
0047     friend class CorePrivate;
0048     Q_OBJECT
0049 
0050 public:
0051     PartController(Core *core, QWidget *toplevel);
0052     ~PartController() override;
0053 
0054     bool showTextEditorStatusBar() const;
0055 
0056     KTextEditor::Document* createTextPart();
0057     KTextEditor::Editor* editorPart() const override;
0058 
0059     bool canCreatePart( const QUrl &url );
0060 
0061     using IPartController::createPart;
0062 
0063     KParts::Part* createPart( const QUrl &url, const QString& prefName = QString() );
0064 
0065     bool isTextType(const QMimeType& mimeType);
0066 
0067 public Q_SLOTS:
0068     void setShowTextEditorStatusBar(bool show);
0069 
0070 protected:
0071     virtual void loadSettings( bool projectIsLoaded );
0072     virtual void saveSettings( bool projectIsLoaded );
0073     virtual void initialize();
0074     virtual void cleanup();
0075 
0076 private:
0077     void setupActions();
0078 
0079 private:
0080     const QScopedPointer<class PartControllerPrivate> d_ptr;
0081     Q_DECLARE_PRIVATE(PartController)
0082 };
0083 
0084 }
0085 #endif
0086