annotate src/hgaction.h @ 678:c0b46d0514a7 scale

Incomplete scaling updates. Should do this differently
author Chris Cannam
date Thu, 06 Dec 2018 14:55:45 +0000
parents ae67ea0af696
children
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@644 8 Copyright (c) 2013 Chris Cannam
Chris@644 9 Copyright (c) 2013 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@506 34 ACT_QUERY_HEADS_ACTIVE,
Chris@109 35 ACT_QUERY_PARENTS,
Chris@109 36 ACT_LOG,
Chris@115 37 ACT_LOG_INCREMENTAL,
Chris@109 38 ACT_REMOVE,
Chris@109 39 ACT_ADD,
Chris@109 40 ACT_INCOMING,
Chris@109 41 ACT_PUSH,
Chris@109 42 ACT_PULL,
Chris@109 43 ACT_CLONEFROMREMOTE,
Chris@109 44 ACT_INIT,
Chris@109 45 ACT_COMMIT,
Chris@514 46 ACT_CLOSE_BRANCH,
Chris@109 47 ACT_ANNOTATE,
Chris@288 48 ACT_UNCOMMITTED_SUMMARY,
Chris@168 49 ACT_DIFF_SUMMARY,
Chris@109 50 ACT_FOLDERDIFF,
Chris@109 51 ACT_CHGSETDIFF,
Chris@109 52 ACT_UPDATE,
Chris@109 53 ACT_REVERT,
Chris@109 54 ACT_MERGE,
Chris@109 55 ACT_SERVE,
Chris@109 56 ACT_RESOLVE_MARK,
Chris@109 57 ACT_RETRY_MERGE,
Chris@109 58 ACT_TAG,
Chris@278 59 ACT_NEW_BRANCH,
Chris@109 60 ACT_HG_IGNORE,
Chris@361 61 ACT_COPY_FILE,
Chris@520 62 ACT_RENAME_FILE
Chris@109 63 };
Chris@109 64
Chris@109 65 struct HgAction
Chris@109 66 {
Chris@109 67 HGACTIONS action;
Chris@109 68 QString workingDir;
Chris@109 69 QStringList params;
Chris@113 70 QString executable; // empty for normal Hg, but gets filled in by hgrunner
Chris@289 71 void *extraData;
Chris@109 72
Chris@605 73 HgAction() : action(ACT_NONE), extraData(0) { }
Chris@109 74
Chris@109 75 HgAction(HGACTIONS _action, QString _wd, QStringList _params) :
Chris@289 76 action(_action), workingDir(_wd), params(_params), extraData(0) { }
Chris@289 77
Chris@289 78 HgAction(HGACTIONS _action, QString _wd, QStringList _params, void *_d) :
Chris@289 79 action(_action), workingDir(_wd), params(_params), extraData(_d) { }
Chris@109 80
Chris@109 81 bool operator==(const HgAction &a) {
Chris@605 82 bool equal = (a.action == action && a.workingDir == workingDir &&
Chris@605 83 a.params == params && a.executable == executable &&
Chris@605 84 a.extraData == extraData);
Chris@605 85 return equal;
Chris@109 86 }
Chris@109 87
Chris@115 88 bool shouldBeFast() const {
Chris@115 89 switch (action) {
Chris@115 90 case ACT_NONE:
Chris@200 91 case ACT_TEST_HG:
Chris@200 92 case ACT_TEST_HG_EXT:
Chris@115 93 case ACT_QUERY_PATHS:
Chris@115 94 case ACT_QUERY_BRANCH:
Chris@115 95 case ACT_STAT:
Chris@175 96 case ACT_RESOLVE_LIST:
Chris@115 97 case ACT_QUERY_HEADS:
Chris@506 98 case ACT_QUERY_HEADS_ACTIVE:
Chris@115 99 case ACT_QUERY_PARENTS:
Chris@115 100 case ACT_LOG_INCREMENTAL:
Chris@115 101 return true;
Chris@115 102 default:
Chris@115 103 return false;
Chris@115 104 }
Chris@115 105 }
Chris@115 106
Chris@109 107 bool mayBeInteractive() const {
Chris@109 108 switch (action) {
Chris@200 109 case ACT_TEST_HG_EXT: // so we force the module load to be tested
Chris@109 110 case ACT_INCOMING:
Chris@109 111 case ACT_PUSH:
Chris@109 112 case ACT_PULL:
Chris@109 113 case ACT_CLONEFROMREMOTE:
Chris@110 114 case ACT_FOLDERDIFF:
Chris@110 115 case ACT_CHGSETDIFF:
Chris@110 116 case ACT_SERVE:
Chris@109 117 return true;
Chris@109 118 default:
Chris@109 119 return false;
Chris@109 120 }
Chris@109 121 }
Chris@571 122
Chris@571 123 bool makesSenseToCancel() const {
Chris@571 124 switch (action) {
Chris@571 125 case ACT_INCOMING:
Chris@571 126 case ACT_PUSH:
Chris@571 127 case ACT_PULL:
Chris@571 128 case ACT_CLONEFROMREMOTE:
Chris@571 129 case ACT_FOLDERDIFF:
Chris@571 130 case ACT_CHGSETDIFF:
Chris@571 131 return true;
Chris@571 132 default:
Chris@571 133 return false;
Chris@571 134 }
Chris@571 135 }
Chris@109 136 };
Chris@109 137
Chris@109 138 #endif