Mercurial > hg > easyhg
diff 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 |
line wrap: on
line diff
--- a/filestates.h Thu Mar 10 15:33:02 2011 +0000 +++ b/filestates.h Thu Mar 10 18:45:50 2011 +0000 @@ -47,10 +47,11 @@ void parseStates(QString text); - void clearBuckets(); + bool isInState(QString file, State s) const; + QStringList filesInState(State s) const; + State stateOf(QString file) const; - QStringList getFilesInState(State) const; - +/*!!! -- to remove: */ QStringList modified() const { return m_modified; } QStringList added() const { return m_added; } QStringList unknown() const { return m_unknown; } @@ -60,7 +61,34 @@ QStringList clean() const { return m_clean; } QStringList ignored() const { return m_ignored; } - State getStateOfFile(QString file) const; + enum Activity { + + // These are in the order in which they want to be listed in + // the context menu + + Annotate, + Diff, + Commit, + Revert, + Add, + Remove, + RedoMerge, + MarkResolved, + Ignore, + UnIgnore, + + FirstActivity = Commit, + LastActivity = UnIgnore + }; + + typedef QList<Activity> Activities; + + static bool supportsActivity(State s, Activity a); + static Activities activitiesSupportedBy(State s); + + bool supportsActivity(QString file, Activity a) const; + QStringList filesSupportingActivity(Activity) const; + Activities activitiesSupportedBy(QString file) const; private: QStringList m_modified; @@ -73,6 +101,8 @@ QStringList m_ignored; QMap<QString, State> m_stateMap; + void clearBuckets(); + State charToState(QChar, bool * = 0); QStringList *stateToBucket(State); };