From 722ce1efbac31c61b1d4b13f7e075c9f311e3e73 Mon Sep 17 00:00:00 2001 From: Darrell Anderson Date: Sun, 2 Mar 2014 20:05:33 +0100 Subject: Finish renaming tdevelop components --- lib/interfaces/extensions/tdevversioncontrol.h | 239 +++++++++++++++++++++++++ 1 file changed, 239 insertions(+) create mode 100644 lib/interfaces/extensions/tdevversioncontrol.h (limited to 'lib/interfaces/extensions/tdevversioncontrol.h') diff --git a/lib/interfaces/extensions/tdevversioncontrol.h b/lib/interfaces/extensions/tdevversioncontrol.h new file mode 100644 index 00000000..d796e31f --- /dev/null +++ b/lib/interfaces/extensions/tdevversioncontrol.h @@ -0,0 +1,239 @@ +/* This file is part of the KDE project + Copyright (C) 2001 Matthias Hoelzer-Kluepfel + Copyright (C) 2002-2003 Roberto Raggi + Copyright (C) 2002 Simon Hausmann + Copyright (C) 2003 Mario Scalas + Copyright (C) 2004 Alexander Dymo + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef TDEVVERSIONCONTROL_H +#define TDEVVERSIONCONTROL_H + +#include +#include +#include +#include +#include + +#include + +/** +@file tdevversioncontrol.h +Version control system interface and utility classes. +*/ + +/** +Info about file state in VCS. + +Used, for example in file views to display VCS related information about files. +*/ +struct VCSFileInfo +{ + /**State of the file.*/ + enum FileState { + Unknown /** VCSFileInfoMap; @endcode +*/ +typedef TQMap VCSFileInfoMap; + +class TDevVCSFileInfoProvider; + + +/** +KDevelop version control system interface. +This is the abstract base class which encapsulates everything +necessary for communicating with version control systems. +VCS support plugins should implement this interface. + +Instances that implement this interface are available through extension architecture: +@code +TDevVersionControl *vcs = extension("TDevelop/VersionControl"); +if (vcs) { + // do something +} else { + // fail +} +@endcode +@sa TDevPlugin::extension method documentation. +*/ +class TDevVersionControl: public TDevPlugin +{ + Q_OBJECT + + +public: + /**Constructs a VCS plugin. + @param info Important information about the plugin - plugin internal and generic + (GUI) name, description, a list of authors, etc. That information is used to show + plugin information in various places like "about application" dialog, plugin selector + dialog, etc. Plugin does not take ownership on info object, also its lifetime should + be equal to the lifetime of the plugin. + @param parent The parent object for the plugin. Parent object must implement @ref TDevApi + interface. Otherwise the plugin will not be constructed. + @param name The internal name which identifies the plugin.*/ + TDevVersionControl(const TDevPluginInfo *info, TQObject *parent, const char *name ) + :TDevPlugin(info, parent, name ) {} + + /**Creates a new project in the passed path @p dir. This should instantiate + VCS infrastructure and import a project into the VCS in that directory. + @param dir The absolute path to the directory where VCS infrastructure should be + created.*/ + virtual void createNewProject(const TQString& dir) = 0; + + /**Fetches a module from remote repository, so it can be used for importing. + @return true in case of success.*/ + virtual bool fetchFromRepository() = 0; + + /**@return The file info provider for this version control (0 if none is available).*/ + virtual TDevVCSFileInfoProvider *fileInfoProvider() const = 0; + + /**Checks if the directory is valid for this version control (for example + CVS may check for the presence of "/CVS/" subdir and something else) + @param dirPath The absolute path of the directory. + @return true if the directory is valid for this version control + warning: this returns false by default.*/ + virtual bool isValidDirectory(const TQString &dirPath) const = 0; + + +signals: + /**Emitted when the Version Control has finished importing a module from remote + repository + @param destinationDir The directory where the module has been fetched.*/ + void finishedFetching(TQString destinationDir); + +}; + +/** +Basic interface for providing info on file registered in a version control repository repository. +*/ +class TDevVCSFileInfoProvider: public TQObject +{ + Q_OBJECT + +public: + /**Constructor. + @param parent The parent VCS plugin. + @param name The name of a provider object.*/ + TDevVCSFileInfoProvider(TDevVersionControl *parent, const char *name) + : TQObject( parent, name ), m_owner(parent) {} + + /**Gets the status for local files in the specified directory: + the info are collected locally so they are necessarily in sync with the repository + + This is a synchronous operation (blocking). + @param dirPath The relative (to project dir) directory path to stat. + @return Status for all registered files.*/ + virtual const VCSFileInfoMap *status(const TQString &dirPath) = 0; + + /**Starts a request for directory status to the remote repository. + Requests and answers are asynchronous. + + This is an asynchronous operation for requesting data, so + for obvious reasons: the caller must connect the statusReady() signal and + check for the return value of this method. + @param dirPath The (relative to project directory) directory which status you are asking for. + @param callerData The pointer to some data you want the provider will return + to you when it has done. + @param recursive If false, retrieve information only for dirPath's immediate children. + @param checkRepos If true, contact remote repository and augment repository's status. + If false, retrieve only for local modification information. + @return true if the request has been successfully started, false otherwise.*/ + virtual bool requestStatus( const TQString &dirPath, void *callerData, bool recursive = true, bool checkRepos = true ) = 0; + +signals: + /**Emitted when the status request to remote repository has finished. + @param fileInfoMap The status for registered in repository files. + @param callerData The pointer to some data you want the provider will return + to you when it has done + @see requestStatus for to find out when this signal should be used.*/ + void statusReady(const VCSFileInfoMap &fileInfoMap, void *callerData); + +protected: + /**@return The version control which owns this provider.*/ + TDevVersionControl *owner() const { return m_owner; } + +private: + TDevVersionControl *m_owner; + +private: + TDevVCSFileInfoProvider( const TDevVCSFileInfoProvider & ); + TDevVCSFileInfoProvider &operator=( const TDevVCSFileInfoProvider & ); +}; + +#endif -- cgit v1.2.1