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

0001 /*
0002     SPDX-FileCopyrightText: 2001 Matthias Hoelzer-Kluepfel <hoelzer@kde.org>
0003     SPDX-FileCopyrightText: 2001-2002 Bernd Gehrmann <bernd@kdevelop.org>
0004     SPDX-FileCopyrightText: 2002-2003 Roberto Raggi <roberto@kdevelop.org>
0005     SPDX-FileCopyrightText: 2002 Simon Hausmann <hausmann@kde.org>
0006     SPDX-FileCopyrightText: 2003 Jens Dagerbo <jens.dagerbo@swipnet.se>
0007     SPDX-FileCopyrightText: 2003 Mario Scalas <mario.scalas@libero.it>
0008     SPDX-FileCopyrightText: 2003-2004 Alexander Dymo <adymo@kdevelop.org>
0009     SPDX-FileCopyrightText: 2006 Matt Rogers <mattr@kde.org>
0010     SPDX-FileCopyrightText: 2007 Andreas Pakulat <apaku@gmx.de>
0011 
0012     SPDX-License-Identifier: LGPL-2.0-or-later
0013 */
0014 
0015 #ifndef KDEVPLATFORM_SHELLPROJECT_H
0016 #define KDEVPLATFORM_SHELLPROJECT_H
0017 
0018 #include <interfaces/iproject.h>
0019 #include <interfaces/istatus.h>
0020 
0021 #include "shellexport.h"
0022 
0023 template<typename T> class QList;
0024 
0025 class KJob;
0026 
0027 namespace KDevelop
0028 {
0029 
0030 class IProjectFileManager;
0031 class IBuildSystemManager;
0032 class ProjectFileItem;
0033 class PersistentHash;
0034 class ProjectPrivate;
0035 
0036 /**
0037  * \brief Object which represents a KDevelop project
0038  *
0039  * Provide better descriptions
0040  */
0041 class KDEVPLATFORMSHELL_EXPORT Project : public IProject
0042 {
0043     Q_OBJECT
0044 public:
0045     /**
0046      * Constructs a project.
0047      *
0048      * @param parent The parent object for the plugin.
0049      */
0050     explicit Project(QObject *parent = nullptr);
0051     ~Project() override;
0052 
0053     QList< ProjectBaseItem* > itemsForPath(const IndexedString& path) const override;
0054     QList< ProjectFileItem* > filesForPath(const IndexedString& file) const override;
0055     QList< ProjectFolderItem* > foldersForPath(const IndexedString& folder) const override;
0056 
0057     QString projectTempFile() const;
0058     QString developerTempFile() const;
0059     Path developerFile() const;
0060     void reloadModel() override;
0061     Path projectFile() const override;
0062     KSharedConfigPtr projectConfiguration() const override;
0063 
0064     void addToFileSet( ProjectFileItem* file ) override;
0065     void removeFromFileSet( ProjectFileItem* file ) override;
0066     QSet<IndexedString> fileSet() const override;
0067 
0068     bool isReady() const override;
0069 
0070     Path path() const override;
0071 
0072     Q_SCRIPTABLE QString name() const override;
0073 
0074 public Q_SLOTS:
0075     /**
0076      * @brief Open a project
0077      *
0078      * This method opens a project and starts the process of loading the
0079      * data for the project from disk.
0080      *
0081      * @param projectFile The path pointing to the location of the project
0082      *                    file to load
0083      *
0084      * The project name is taken from the Name key in the project file in
0085      * the 'General' group
0086      */
0087     bool open(const Path &projectFile);
0088 
0089     void close() override;
0090 
0091     IProjectFileManager* projectFileManager() const override;
0092     IBuildSystemManager* buildSystemManager() const override;
0093     IPlugin* versionControlPlugin() const override;
0094 
0095     IPlugin* managerPlugin() const override;
0096 
0097     /**
0098      * Set the manager plugin for the project.
0099      */
0100     void setManagerPlugin( IPlugin* manager );
0101 
0102     ProjectFolderItem* projectItem() const override;
0103 
0104     /**
0105      * Check if the url specified by @a url is part of the project.
0106      * @a url can be either a relative url (to the project directory) or
0107      * an absolute url.
0108      *
0109      * @param url the url to check
0110      *
0111      * @return true if the url @a url is a part of the project.
0112      */
0113     bool inProject(const IndexedString &url) const override;
0114 
0115     void setReloadJob(KJob* job) override;
0116 
0117 Q_SIGNALS:
0118     /**
0119      * Internal signal to make IProjectController::projectAboutToOpen useful.
0120      */
0121     void aboutToOpen(KDevelop::IProject*);
0122 
0123 private:
0124     const QScopedPointer<class ProjectPrivate> d_ptr;
0125     Q_DECLARE_PRIVATE(Project)
0126 };
0127 
0128 } // namespace KDevelop
0129 #endif