Chris@74
|
1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
|
Chris@74
|
2
|
Chris@74
|
3 /*
|
Chris@74
|
4 EasyMercurial
|
Chris@74
|
5
|
Chris@74
|
6 Based on HgExplorer by Jari Korhonen
|
Chris@74
|
7 Copyright (c) 2010 Jari Korhonen
|
Chris@74
|
8 Copyright (c) 2010 Chris Cannam
|
Chris@74
|
9 Copyright (c) 2010 Queen Mary, University of London
|
Chris@74
|
10
|
Chris@74
|
11 This program is free software; you can redistribute it and/or
|
Chris@74
|
12 modify it under the terms of the GNU General Public License as
|
Chris@74
|
13 published by the Free Software Foundation; either version 2 of the
|
Chris@74
|
14 License, or (at your option) any later version. See the file
|
Chris@74
|
15 COPYING included with this distribution for more information.
|
Chris@74
|
16 */
|
Chris@74
|
17
|
Chris@92
|
18 #ifndef FILESTATES_H
|
Chris@92
|
19 #define FILESTATES_H
|
Chris@74
|
20
|
Chris@74
|
21 #include <QStringList>
|
Chris@94
|
22 #include <QMap>
|
Chris@94
|
23 #include <QString>
|
Chris@74
|
24
|
Chris@92
|
25 class FileStates
|
Chris@74
|
26 {
|
Chris@74
|
27 public:
|
Chris@94
|
28 FileStates();
|
Chris@92
|
29
|
Chris@92
|
30 enum State {
|
Chris@92
|
31
|
Chris@94
|
32 Clean,
|
Chris@92
|
33 Modified,
|
Chris@92
|
34 Added,
|
Chris@92
|
35 Unknown,
|
Chris@92
|
36 Removed,
|
Chris@92
|
37 Missing,
|
Chris@92
|
38
|
Chris@94
|
39 FirstState = Clean,
|
Chris@92
|
40 LastState = Missing
|
Chris@92
|
41 };
|
Chris@74
|
42
|
Chris@94
|
43 void parseStates(QString text);
|
Chris@92
|
44
|
Chris@94
|
45 void clearBuckets();
|
Chris@94
|
46
|
Chris@94
|
47 QStringList getFilesInState(State) const;
|
Chris@94
|
48
|
Chris@94
|
49 QStringList modified() const { return m_modified; }
|
Chris@94
|
50 QStringList added() const { return m_added; }
|
Chris@94
|
51 QStringList unknown() const { return m_unknown; }
|
Chris@94
|
52 QStringList removed() const { return m_removed; }
|
Chris@94
|
53 QStringList missing() const { return m_missing; }
|
Chris@94
|
54
|
Chris@94
|
55 State getStateOfFile(QString file) const;
|
Chris@94
|
56
|
Chris@94
|
57 private:
|
Chris@94
|
58 QStringList m_modified;
|
Chris@94
|
59 QStringList m_added;
|
Chris@94
|
60 QStringList m_unknown;
|
Chris@94
|
61 QStringList m_removed;
|
Chris@94
|
62 QStringList m_missing;
|
Chris@94
|
63 QMap<QString, State> m_stateMap;
|
Chris@94
|
64
|
Chris@94
|
65 State charToState(QChar, bool * = 0);
|
Chris@94
|
66 QStringList *stateToBucket(State);
|
Chris@74
|
67 };
|
Chris@74
|
68
|
Chris@92
|
69 #endif // FILESTATES_H
|