comparison filestates.h @ 324:306ffd913071 filelist_right_button_menu

Introduce "activities" enum and functions
author Chris Cannam
date Thu, 10 Mar 2011 18:45:50 +0000
parents 8fd71f570884
children 5fa5c908ca00
comparison
equal deleted inserted replaced
323:adb14d3f780f 324:306ffd913071
45 LastState = Ignored 45 LastState = Ignored
46 }; 46 };
47 47
48 void parseStates(QString text); 48 void parseStates(QString text);
49 49
50 void clearBuckets(); 50 bool isInState(QString file, State s) const;
51 QStringList filesInState(State s) const;
52 State stateOf(QString file) const;
51 53
52 QStringList getFilesInState(State) const; 54 /*!!! -- to remove: */
53
54 QStringList modified() const { return m_modified; } 55 QStringList modified() const { return m_modified; }
55 QStringList added() const { return m_added; } 56 QStringList added() const { return m_added; }
56 QStringList unknown() const { return m_unknown; } 57 QStringList unknown() const { return m_unknown; }
57 QStringList removed() const { return m_removed; } 58 QStringList removed() const { return m_removed; }
58 QStringList missing() const { return m_missing; } 59 QStringList missing() const { return m_missing; }
59 QStringList inConflict() const { return m_inConflict; } 60 QStringList inConflict() const { return m_inConflict; }
60 QStringList clean() const { return m_clean; } 61 QStringList clean() const { return m_clean; }
61 QStringList ignored() const { return m_ignored; } 62 QStringList ignored() const { return m_ignored; }
62 63
63 State getStateOfFile(QString file) const; 64 enum Activity {
65
66 // These are in the order in which they want to be listed in
67 // the context menu
68
69 Annotate,
70 Diff,
71 Commit,
72 Revert,
73 Add,
74 Remove,
75 RedoMerge,
76 MarkResolved,
77 Ignore,
78 UnIgnore,
79
80 FirstActivity = Commit,
81 LastActivity = UnIgnore
82 };
83
84 typedef QList<Activity> Activities;
85
86 static bool supportsActivity(State s, Activity a);
87 static Activities activitiesSupportedBy(State s);
88
89 bool supportsActivity(QString file, Activity a) const;
90 QStringList filesSupportingActivity(Activity) const;
91 Activities activitiesSupportedBy(QString file) const;
64 92
65 private: 93 private:
66 QStringList m_modified; 94 QStringList m_modified;
67 QStringList m_added; 95 QStringList m_added;
68 QStringList m_unknown; 96 QStringList m_unknown;
71 QStringList m_inConflict; 99 QStringList m_inConflict;
72 QStringList m_clean; 100 QStringList m_clean;
73 QStringList m_ignored; 101 QStringList m_ignored;
74 QMap<QString, State> m_stateMap; 102 QMap<QString, State> m_stateMap;
75 103
104 void clearBuckets();
105
76 State charToState(QChar, bool * = 0); 106 State charToState(QChar, bool * = 0);
77 QStringList *stateToBucket(State); 107 QStringList *stateToBucket(State);
78 }; 108 };
79 109
80 #endif // FILESTATES_H 110 #endif // FILESTATES_H