Add line for debugging
[kdevelopdvcssupport.git] / vcs / vcsjob.h
blob9e84b5c63563d59bf52aae16047891c8f8bbdf3f
1 /* This file is part of KDevelop
3 * Copyright 2007 Andreas Pakulat <apaku@gmx.de>
4 * Copyright 2007 Matthew Woehlke <mw_triad@users.sourceforge.net>
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
19 * 02110-1301, USA.
22 #ifndef VCSJOB_H
23 #define VCSJOB_H
25 #include <kjob.h>
27 #include "vcsexport.h"
29 class QVariant;
30 class QString;
31 class KUrl;
33 namespace KDevelop
36 class IPlugin;
38 /**
39 * This class provides an extension of KJob to get various Vcs
40 * specific information about the job. This includes the type, the state
41 * and the results provided by the job.
44 class KDEVPLATFORMVCS_EXPORT VcsJob : public KJob
46 Q_OBJECT
47 public:
48 VcsJob( QObject* parent = 0);
49 virtual ~VcsJob();
50 /**
51 * To easily check which type of job this is
53 * @TODO: Check how this can be extended via plugins, maybe use QFlag? (not
54 * QFlags!)
56 enum JobType
58 Add = 0 /**< An add job */,
59 Remove = 1 /**< A remove job */,
60 Copy = 2 /**< A copy job */,
61 Move = 3 /**< A move job */,
62 Diff = 4 /**< A diff job */,
63 Commit = 5 /**< A commit job */,
64 Update = 6 /**< An update job */,
65 Merge = 7 /**< A merge job */,
66 Resolve = 8 /**< A resolve job */,
67 Import = 9 /**< An import job */,
68 Checkout = 10 /**< A checkout job */,
69 Log = 11 /**< A log job */,
70 Push = 12 /**< A push job */,
71 Pull = 13 /**< A pull job */,
72 Annotate = 14 /**< An annotate job */,
73 Clone = 15 /**< A clone job */,
74 Status = 16 /**< A status job */,
75 Revert = 17 /**< A revert job */,
76 Cat = 18 /**< A cat job */,
77 UserType = 1000 /**< A custom job */
80 /**
81 * Simple enum to define how the job finished
83 enum JobStatus
85 JobRunning = 0 /**< The job is running */,
86 JobSucceeded = 1 /**< The job succeeded */,
87 JobCanceled = 2 /**< The job was cancelled */,
88 JobFailed = 3 /**< The job failed */,
89 JobNotStarted = 4 /**< The job is not yet started */
92 /**
93 * This method will return all new results of the job. The actual data
94 * type that is wrapped in the QVariant depends on the type of job.
96 * @note Results returned by a previous call to fetchResults are not
97 * returned.
99 virtual QVariant fetchResults() = 0;
102 * Find out in which state the job is, it can be running, cancelled
103 * failed or finished
105 * @return the status of the job
106 * @see JobStatus
108 virtual JobStatus status() const = 0;
111 * Used to find out about the type of job
113 * @return the type of job
115 JobType type();
118 * Used to get at the version control plugin. The plugin
119 * can be used to get one of the interfaces to execute
120 * more vcs actions, depending on this jobs results
121 * (like getting a diff for an entry in a log)
123 virtual KDevelop::IPlugin* vcsPlugin() const = 0;
125 protected:
127 * This can be used to set the type of the vcs job in subclasses
129 void setType( JobType );
131 Q_SIGNALS:
133 * This signal is emitted when new results are available. Depending on
134 * the plugin and the operation, it may be emitted only once when all
135 * results are ready, or several times.
137 void resultsReady( KDevelop::VcsJob* );
139 private:
140 class VcsJobPrivate* const d;
145 #endif