Fix no newlines warnings. Patch by Peter Oberndorfer
[kdevelopdvcssupport.git] / interfaces / iprojectcontroller.h
blob7c5cfc45334d2bd2ca8378e7c76073ee85301f9a
1 /* This file is part of KDevelop
2 Copyright 2006 Adam Treat <treat@kde.org>
3 Copyright 2007 Anreas Pakulat <apaku@gmx.de>
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
21 #ifndef IPROJECTCONTROLLER_H
22 #define IPROJECTCONTROLLER_H
24 #include <QtCore/QObject>
25 #include <QtCore/QList>
26 #include <kurl.h>
27 #include "interfacesexport.h"
29 class QItemSelectionModel;
31 namespace KDevelop
34 class IProject;
35 class ProjectModel;
36 class ProjectBaseItem;
38 class KDEVPLATFORMINTERFACES_EXPORT IProjectController : public QObject
40 Q_OBJECT
41 public:
42 IProjectController( QObject *parent = 0 );
43 virtual ~IProjectController();
45 Q_SCRIPTABLE virtual IProject* projectAt( int ) const = 0;
46 Q_SCRIPTABLE virtual int projectCount() const = 0;
47 Q_SCRIPTABLE virtual QList<IProject*> projects() const = 0;
49 /**
50 * Provides access to the model representing the open projects
51 * @returns the model containing the projects and their items
53 Q_SCRIPTABLE virtual ProjectModel* projectModel() = 0;
55 /**
56 * Provides access to the selection model of the project view.
57 * This way its possible to fetch the list of selected items in
58 * the project view and use that to prefill some thing.
59 * @returns the selection model
61 Q_SCRIPTABLE virtual QItemSelectionModel* projectSelectionModel() = 0;
63 /**
64 * Find an open project using the name of the project
65 * @param name the name of the project to be found
66 * @returns the project or null if no project with that name is open
68 Q_SCRIPTABLE virtual IProject* findProjectByName( const QString& name ) = 0;
70 /**
71 * Finding an open project for a given file or folder in the project
72 * @param url the url of a file/folder belonging to an open project
73 * @returns the first open project containing the url or null if no such
74 * project can be found
76 Q_SCRIPTABLE virtual IProject* findProjectForUrl( const KUrl& url ) const = 0;
78 public Q_SLOTS:
79 /**
80 * open the project from the given kdev4 project file. This only reads
81 * the file and starts creating the project model from it. The opening process
82 * is finished once @ref projectOpened signal is emitted.
83 * @param url a kdev4 project file top open
84 * @returns true if the given project could be opened, false otherwise
86 virtual bool openProject( const KUrl & url = KUrl() ) = 0;
87 /**
88 * close the given project. Closing the project is done in steps and
89 * the @ref projectClosing and @ref projectClosed signals are emitted. Only when
90 * the latter signal is emitted its guaranteed that the project has been closed.
91 * The @ref IProject object will be deleted after the closing has finished.
92 * @returns true if the project could be closed, false otherwise
94 virtual bool closeProject( IProject* ) = 0;
95 virtual bool configureProject( IProject* ) = 0;
96 // virtual void changeCurrentProject( KDevelop::ProjectBaseItem* ) = 0;
98 Q_SIGNALS:
99 /**
100 * emitted after a project is completely opened and the project model
101 * has been populated.
102 * @param project the project that has been opened.
104 void projectOpened( KDevelop::IProject* project );
106 * emitted when starting to close a project.
107 * @param project the project that is going to be closed.
109 void projectClosing( KDevelop::IProject* project );
111 * emitted when a project has been closed completely. At this
112 * point the project object is still valid, the deletion will be done
113 * delayed during the next run of the event loop.
114 * @param project the project that has been closed.
116 void projectClosed( KDevelop::IProject* project );
120 #endif