Add a setter on Record
[vng.git] / src / commands / Record.h
blob6158fa72cd4ec19d65e0b689ee16054217fa96ed
1 /*
2 * This file is part of the vng project
3 * Copyright (C) 2008 Thomas Zander <tzander@trolltech.com>
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program 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
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 #ifndef RECORD_H
19 #define RECORD_H
21 #include "AbstractCommand.h"
23 class ChangeSet;
25 /// The command to record a set of changes into a patch.
26 class Record : public AbstractCommand
28 public:
29 enum UsageMode {
30 Unset, ///< Use the command line options for usage mode
31 InteractiveSelection, ///< give the user a prompt to select which hunks to record
32 AllChanges, ///< Add all changes to the patch
33 Index ///< Use the git index without change
36 Record();
38 /**
39 * Set the message that will be placed in the recorded patch.
41 void setPatchName(const QByteArray &patchName);
42 /// returns the message
43 QByteArray patchName() const;
45 /**
46 * Set the way that the patches to be recorded will be decided based on the usage mode.
48 void setUsageMode(UsageMode mode);
49 /// retuns the sha1 of the recorded patch after run() has successfully concluded.
50 QString sha1() const;
52 // is set to true, force the editor to be started, if false use the command line options
53 void setEditComment(bool on) { m_editComment = on; }
55 virtual ReturnCodes run();
57 protected:
58 virtual QString argumentDescription() const;
59 virtual QString commandDescription() const;
61 private:
62 ReturnCodes addFilesPerAcceptance(const ChangeSet &changeSet, bool allChanges);
64 UsageMode m_mode;
65 QByteArray m_patchName;
66 QString m_sha1;
67 bool m_editComment;
70 #endif