annotate src/filestates.h @ 737:4f3a8aa8d384 tip

Markdown
author Chris Cannam
date Wed, 28 Aug 2019 17:40:54 +0100
parents ae67ea0af696
children
rev   line source
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@644 8 Copyright (c) 2013 Chris Cannam
Chris@644 9 Copyright (c) 2013 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@163 32 // These are in the order in which they want to be listed in
Chris@163 33 // the interface
Chris@163 34
Chris@92 35 Modified,
Chris@92 36 Added,
Chris@163 37 Removed,
Chris@163 38 InConflict,
Chris@163 39 Missing,
Chris@202 40 Unknown,
Chris@163 41 Clean,
Chris@199 42 Ignored,
Chris@92 43
Chris@163 44 FirstState = Modified,
Chris@199 45 LastState = Ignored
Chris@92 46 };
Chris@74 47
Chris@94 48 void parseStates(QString text);
Chris@92 49
Chris@324 50 bool isInState(QString file, State s) const;
Chris@324 51 QStringList filesInState(State s) const;
Chris@324 52 State stateOf(QString file) const;
Chris@421 53 bool isKnown(QString file) const;
Chris@94 54
Chris@541 55 QStringList trackedFiles() const;
Chris@541 56
Chris@324 57 enum Activity {
Chris@324 58
Chris@324 59 // These are in the order in which they want to be listed in
Chris@324 60 // the context menu
Chris@324 61
Chris@326 62 Diff,
Chris@324 63 Annotate,
Chris@325 64
Chris@324 65 Commit,
Chris@324 66 Revert,
Chris@325 67
Chris@361 68 Rename,
Chris@361 69 Copy,
Chris@361 70
Chris@324 71 Add,
Chris@324 72 Remove,
Chris@325 73
Chris@324 74 RedoMerge,
Chris@324 75 MarkResolved,
Chris@325 76
Chris@324 77 Ignore,
Chris@324 78 UnIgnore,
Chris@324 79
sam@624 80 ShowIn,
sam@624 81
Chris@326 82 FirstActivity = Diff,
Chris@324 83 LastActivity = UnIgnore
Chris@324 84 };
Chris@324 85
Chris@324 86 typedef QList<Activity> Activities;
Chris@324 87
Chris@324 88 static bool supportsActivity(State s, Activity a);
Chris@324 89 static Activities activitiesSupportedBy(State s);
Chris@325 90 static int activityGroup(Activity a);
Chris@324 91
Chris@324 92 bool supportsActivity(QString file, Activity a) const;
Chris@324 93 QStringList filesSupportingActivity(Activity) const;
Chris@324 94 Activities activitiesSupportedBy(QString file) const;
Chris@94 95
Chris@94 96 private:
Chris@94 97 QStringList m_modified;
Chris@94 98 QStringList m_added;
Chris@94 99 QStringList m_unknown;
Chris@94 100 QStringList m_removed;
Chris@94 101 QStringList m_missing;
Chris@159 102 QStringList m_inConflict;
Chris@199 103 QStringList m_clean;
Chris@199 104 QStringList m_ignored;
Chris@94 105 QMap<QString, State> m_stateMap;
Chris@94 106
Chris@324 107 void clearBuckets();
Chris@324 108
Chris@94 109 State charToState(QChar, bool * = 0);
Chris@94 110 QStringList *stateToBucket(State);
Chris@74 111 };
Chris@74 112
Chris@92 113 #endif // FILESTATES_H