Changeset View
Changeset View
Standalone View
Standalone View
vcs/interfaces/ipatchsource.h
Show First 20 Lines • Show All 42 Lines • ▼ Show 20 Line(s) | 34 | public: | |||
---|---|---|---|---|---|
43 | 43 | | |||
44 | ///Should tell if the patch is already applied on the local version. | 44 | ///Should tell if the patch is already applied on the local version. | ||
45 | virtual bool isAlreadyApplied() const = 0; | 45 | virtual bool isAlreadyApplied() const = 0; | ||
46 | 46 | | |||
47 | ///Explicit updating of the patch: If it is a dynamic patch, it | 47 | ///Explicit updating of the patch: If it is a dynamic patch, it | ||
48 | ///should re-compare the files or whatever needs to be done | 48 | ///should re-compare the files or whatever needs to be done | ||
49 | ///If the patch has changed, patchChanged needs to be emitted | 49 | ///If the patch has changed, patchChanged needs to be emitted | ||
50 | virtual void update() = 0; | 50 | virtual void update() = 0; | ||
51 | ///change the number of lines of context the patch should show | ||||
52 | ///virtual so it can be overridden, for instance to call update(). | ||||
53 | virtual void setContextLines(int contextLines) { m_contextLines = contextLines; } | ||||
kfunk: I really don't like this API, but can't think of anything better right now.
If at all, this… | |||||
How about the alternative virtual void update(int contextLines=-1) = 0;? Or else, make contextLines a member variable with a setter. rjvbb: How about the alternative `virtual void update(int contextLines=-1) = 0;`?
Or else, make… | |||||
51 | 54 | | |||
52 | ///Name of the patch file | 55 | ///Name of the patch file | ||
53 | virtual QUrl file() const = 0; | 56 | virtual QUrl file() const = 0; | ||
54 | 57 | | |||
55 | ///Should return the base-dir of the patch | 58 | ///Should return the base-dir of the patch | ||
56 | virtual QUrl baseDir() const = 0; | 59 | virtual QUrl baseDir() const = 0; | ||
57 | 60 | | |||
58 | ///Can return a custom widget that should be shown to the user with this patch | 61 | ///Can return a custom widget that should be shown to the user with this patch | ||
Show All 27 Lines | |||||
86 | virtual QMap<QUrl, KDevelop::VcsStatusInfo::State> additionalSelectableFiles() const; | 89 | virtual QMap<QUrl, KDevelop::VcsStatusInfo::State> additionalSelectableFiles() const; | ||
87 | 90 | | |||
88 | /// Depth - number of directories to left-strip from paths in the patch - see "patch -p" | 91 | /// Depth - number of directories to left-strip from paths in the patch - see "patch -p" | ||
89 | /// Defaults to 0 | 92 | /// Defaults to 0 | ||
90 | virtual uint depth() const; | 93 | virtual uint depth() const; | ||
91 | Q_SIGNALS: | 94 | Q_SIGNALS: | ||
92 | ///Should be emitted whenever the patch has changed. | 95 | ///Should be emitted whenever the patch has changed. | ||
93 | void patchChanged(); | 96 | void patchChanged(); | ||
97 | protected: | ||||
98 | int m_contextLines = -1; | ||||
94 | }; | 99 | }; | ||
95 | 100 | | |||
96 | class KDEVPLATFORMVCS_EXPORT IPatchReview | 101 | class KDEVPLATFORMVCS_EXPORT IPatchReview | ||
97 | { | 102 | { | ||
98 | public: | 103 | public: | ||
99 | virtual ~IPatchReview(); | 104 | virtual ~IPatchReview(); | ||
100 | 105 | | |||
101 | enum ReviewMode { | 106 | enum ReviewMode { | ||
Show All 11 Lines |
I really don't like this API, but can't think of anything better right now.
If at all, this needs better API documentation, with named arguments in the signature + @param in doxygen, etc.