annotate hgaction.h @ 344:ccc55539e066

If the user cancels the first startup dialog (it has no cancel button, but they could use the WM close button), go no further
author Chris Cannam
date Wed, 16 Mar 2011 10:25:06 +0000
parents 5b4aa1c24407
children 4cd753e083cc
rev   line source
Chris@109 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@109 2
Chris@109 3 /*
Chris@109 4 EasyMercurial
Chris@109 5
Chris@109 6 Based on HgExplorer by Jari Korhonen
Chris@109 7 Copyright (c) 2010 Jari Korhonen
Chris@244 8 Copyright (c) 2011 Chris Cannam
Chris@244 9 Copyright (c) 2011 Queen Mary, University of London
Chris@109 10
Chris@109 11 This program is free software; you can redistribute it and/or
Chris@109 12 modify it under the terms of the GNU General Public License as
Chris@109 13 published by the Free Software Foundation; either version 2 of the
Chris@109 14 License, or (at your option) any later version. See the file
Chris@109 15 COPYING included with this distribution for more information.
Chris@109 16 */
Chris@109 17
Chris@109 18 #ifndef HGACTION_H
Chris@109 19 #define HGACTION_H
Chris@109 20
Chris@109 21 #include <QString>
Chris@109 22 #include <QStringList>
Chris@109 23
Chris@109 24 enum HGACTIONS
Chris@109 25 {
Chris@109 26 ACT_NONE,
Chris@175 27 ACT_TEST_HG,
Chris@200 28 ACT_TEST_HG_EXT,
Chris@109 29 ACT_QUERY_PATHS,
Chris@109 30 ACT_QUERY_BRANCH,
Chris@109 31 ACT_STAT,
Chris@163 32 ACT_RESOLVE_LIST,
Chris@109 33 ACT_QUERY_HEADS,
Chris@109 34 ACT_QUERY_PARENTS,
Chris@109 35 ACT_LOG,
Chris@115 36 ACT_LOG_INCREMENTAL,
Chris@109 37 ACT_REMOVE,
Chris@109 38 ACT_ADD,
Chris@109 39 ACT_INCOMING,
Chris@109 40 ACT_PUSH,
Chris@109 41 ACT_PULL,
Chris@109 42 ACT_CLONEFROMREMOTE,
Chris@109 43 ACT_INIT,
Chris@109 44 ACT_COMMIT,
Chris@109 45 ACT_ANNOTATE,
Chris@288 46 ACT_UNCOMMITTED_SUMMARY,
Chris@168 47 ACT_DIFF_SUMMARY,
Chris@109 48 ACT_FOLDERDIFF,
Chris@109 49 ACT_CHGSETDIFF,
Chris@109 50 ACT_UPDATE,
Chris@109 51 ACT_REVERT,
Chris@109 52 ACT_MERGE,
Chris@109 53 ACT_SERVE,
Chris@109 54 ACT_RESOLVE_MARK,
Chris@109 55 ACT_RETRY_MERGE,
Chris@109 56 ACT_TAG,
Chris@278 57 ACT_NEW_BRANCH,
Chris@109 58 ACT_HG_IGNORE,
Chris@109 59 };
Chris@109 60
Chris@109 61 struct HgAction
Chris@109 62 {
Chris@109 63 HGACTIONS action;
Chris@109 64 QString workingDir;
Chris@109 65 QStringList params;
Chris@113 66 QString executable; // empty for normal Hg, but gets filled in by hgrunner
Chris@289 67 void *extraData;
Chris@109 68
Chris@109 69 HgAction() : action(ACT_NONE) { }
Chris@109 70
Chris@109 71 HgAction(HGACTIONS _action, QString _wd, QStringList _params) :
Chris@289 72 action(_action), workingDir(_wd), params(_params), extraData(0) { }
Chris@289 73
Chris@289 74 HgAction(HGACTIONS _action, QString _wd, QStringList _params, void *_d) :
Chris@289 75 action(_action), workingDir(_wd), params(_params), extraData(_d) { }
Chris@109 76
Chris@109 77 bool operator==(const HgAction &a) {
Chris@109 78 return (a.action == action && a.workingDir == workingDir &&
Chris@289 79 a.params == params && a.executable == executable &&
Chris@289 80 a.extraData == extraData);
Chris@109 81 }
Chris@109 82
Chris@115 83 bool shouldBeFast() const {
Chris@115 84 switch (action) {
Chris@115 85 case ACT_NONE:
Chris@200 86 case ACT_TEST_HG:
Chris@200 87 case ACT_TEST_HG_EXT:
Chris@115 88 case ACT_QUERY_PATHS:
Chris@115 89 case ACT_QUERY_BRANCH:
Chris@115 90 case ACT_STAT:
Chris@175 91 case ACT_RESOLVE_LIST:
Chris@115 92 case ACT_QUERY_HEADS:
Chris@115 93 case ACT_QUERY_PARENTS:
Chris@115 94 case ACT_LOG_INCREMENTAL:
Chris@115 95 return true;
Chris@115 96 default:
Chris@115 97 return false;
Chris@115 98 }
Chris@115 99 }
Chris@115 100
Chris@109 101 bool mayBeInteractive() const {
Chris@109 102 switch (action) {
Chris@200 103 case ACT_TEST_HG_EXT: // so we force the module load to be tested
Chris@109 104 case ACT_INCOMING:
Chris@109 105 case ACT_PUSH:
Chris@109 106 case ACT_PULL:
Chris@109 107 case ACT_CLONEFROMREMOTE:
Chris@110 108 case ACT_FOLDERDIFF:
Chris@110 109 case ACT_CHGSETDIFF:
Chris@110 110 case ACT_SERVE:
Chris@109 111 return true;
Chris@109 112 default:
Chris@109 113 return false;
Chris@109 114 }
Chris@109 115 }
Chris@109 116 };
Chris@109 117
Chris@109 118 #endif