Mercurial > hg > easyhg
comparison src/filestates.h @ 370:b9c153e00e84
Move source files to src/
author | Chris Cannam |
---|---|
date | Thu, 24 Mar 2011 10:27:51 +0000 |
parents | filestates.h@4cd753e083cc |
children | 653e9694a694 |
comparison
equal
deleted
inserted
replaced
369:19cce6d2c470 | 370:b9c153e00e84 |
---|---|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ | |
2 | |
3 /* | |
4 EasyMercurial | |
5 | |
6 Based on HgExplorer by Jari Korhonen | |
7 Copyright (c) 2010 Jari Korhonen | |
8 Copyright (c) 2011 Chris Cannam | |
9 Copyright (c) 2011 Queen Mary, University of London | |
10 | |
11 This program is free software; you can redistribute it and/or | |
12 modify it under the terms of the GNU General Public License as | |
13 published by the Free Software Foundation; either version 2 of the | |
14 License, or (at your option) any later version. See the file | |
15 COPYING included with this distribution for more information. | |
16 */ | |
17 | |
18 #ifndef FILESTATES_H | |
19 #define FILESTATES_H | |
20 | |
21 #include <QStringList> | |
22 #include <QMap> | |
23 #include <QString> | |
24 | |
25 class FileStates | |
26 { | |
27 public: | |
28 FileStates(); | |
29 | |
30 enum State { | |
31 | |
32 // These are in the order in which they want to be listed in | |
33 // the interface | |
34 | |
35 Modified, | |
36 Added, | |
37 Removed, | |
38 InConflict, | |
39 Missing, | |
40 Unknown, | |
41 Clean, | |
42 Ignored, | |
43 | |
44 FirstState = Modified, | |
45 LastState = Ignored | |
46 }; | |
47 | |
48 void parseStates(QString text); | |
49 | |
50 bool isInState(QString file, State s) const; | |
51 QStringList filesInState(State s) const; | |
52 State stateOf(QString file) const; | |
53 | |
54 enum Activity { | |
55 | |
56 // These are in the order in which they want to be listed in | |
57 // the context menu | |
58 | |
59 Diff, | |
60 Annotate, | |
61 | |
62 Commit, | |
63 Revert, | |
64 | |
65 Rename, | |
66 Copy, | |
67 | |
68 Add, | |
69 Remove, | |
70 | |
71 RedoMerge, | |
72 MarkResolved, | |
73 | |
74 Ignore, | |
75 UnIgnore, | |
76 | |
77 FirstActivity = Diff, | |
78 LastActivity = UnIgnore | |
79 }; | |
80 | |
81 typedef QList<Activity> Activities; | |
82 | |
83 static bool supportsActivity(State s, Activity a); | |
84 static Activities activitiesSupportedBy(State s); | |
85 static int activityGroup(Activity a); | |
86 | |
87 bool supportsActivity(QString file, Activity a) const; | |
88 QStringList filesSupportingActivity(Activity) const; | |
89 Activities activitiesSupportedBy(QString file) const; | |
90 | |
91 private: | |
92 QStringList m_modified; | |
93 QStringList m_added; | |
94 QStringList m_unknown; | |
95 QStringList m_removed; | |
96 QStringList m_missing; | |
97 QStringList m_inConflict; | |
98 QStringList m_clean; | |
99 QStringList m_ignored; | |
100 QMap<QString, State> m_stateMap; | |
101 | |
102 void clearBuckets(); | |
103 | |
104 State charToState(QChar, bool * = 0); | |
105 QStringList *stateToBucket(State); | |
106 }; | |
107 | |
108 #endif // FILESTATES_H |