2 ******************************************************************************
4 * @file iversioncontrol.h
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
7 * @addtogroup GCSPlugins GCS Plugins
9 * @addtogroup CorePlugin Core Plugin
11 * @brief The Core GCS plugin
12 *****************************************************************************/
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #ifndef IVERSIONCONTROL_H
30 #define IVERSIONCONTROL_H
32 #include "core_global.h"
34 #include <QtCore/QObject>
35 #include <QtCore/QString>
38 class CORE_EXPORT IVersionControl
: public QObject
{
41 enum Operation
{ AddOperation
, DeleteOperation
, OpenOperation
};
43 IVersionControl(QObject
*parent
= 0) : QObject(parent
) {}
44 virtual ~IVersionControl() {}
46 virtual QString
name() const = 0;
48 virtual bool isEnabled() const = 0;
51 * Enable the VCS, that is, make its menu actions visible.
53 virtual void setEnabled(bool enabled
) = 0;
56 * Returns whether files in this directory should be managed with this
59 virtual bool managesDirectory(const QString
&filename
) const = 0;
62 * This function should return the topmost directory, for which this
63 * IVersionControl should be used. The VCSManager assumes that all files in
64 * the returned directory are managed by the same IVersionControl.
66 * Note that this is used as an optimization, so that the VCSManager
67 * doesn't need to call managesDirectory(..) for each directory.
69 * This function is called after finding out that the directory is managed
70 * by a specific version control.
72 virtual QString
findTopLevelForDirectory(const QString
&directory
) const = 0;
75 * Called to query whether a VCS supports the respective operations.
77 virtual bool supportsOperation(Operation operation
) const = 0;
80 * Called prior to save, if the file is read only. Should be implemented if
81 * the scc requires a operation before editing the file, e.g. 'p4 edit'
83 * \note The EditorManager calls this for the editors.
85 virtual bool vcsOpen(const QString
&fileName
) = 0;
88 * Called after a file has been added to a project If the version control
89 * needs to know which files it needs to track you should reimplement this
90 * function, e.g. 'p4 add', 'cvs add', 'svn add'.
92 * \note This function should be called from IProject subclasses after
93 * files are added to the project.
95 virtual bool vcsAdd(const QString
&filename
) = 0;
98 * Called after a file has been removed from the project (if the user
99 * wants), e.g. 'p4 delete', 'svn delete'.
101 * You probably want to call VcsManager::showDeleteDialog, which asks the
102 * user to confirm the deletion.
104 virtual bool vcsDelete(const QString
&filename
) = 0;
107 void repositoryChanged(const QString
&repository
);
108 void filesChanged(const QStringList
&files
);
110 // TODO: ADD A WAY TO DETECT WHETHER A FILE IS MANAGED, e.g
111 // virtual bool sccManaged(const QString &filename) = 0;
115 #endif // IVERSIONCONTROL_H