annotate common.h @ 79:aaeabc920ca8

* Some work toward doing the Right Thing with each possible combination of existing/nonexisting directories in Open dialog
author Chris Cannam
date Mon, 22 Nov 2010 12:30:40 +0000
parents 07405f3a428b
children 1928f9b408e6
rev   line source
Chris@57 1 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
Chris@57 2
Chris@57 3 /*
Chris@57 4 EasyMercurial
Chris@57 5
Chris@57 6 Based on HgExplorer by Jari Korhonen
Chris@57 7 Copyright (c) 2010 Jari Korhonen
Chris@57 8 Copyright (c) 2010 Chris Cannam
Chris@57 9 Copyright (c) 2010 Queen Mary, University of London
Chris@57 10
Chris@57 11 This program is free software; you can redistribute it and/or
Chris@57 12 modify it under the terms of the GNU General Public License as
Chris@57 13 published by the Free Software Foundation; either version 2 of the
Chris@57 14 License, or (at your option) any later version. See the file
Chris@57 15 COPYING included with this distribution for more information.
Chris@57 16 */
Chris@57 17
jtkorhonen@0 18 #ifndef COMMON_H
jtkorhonen@0 19 #define COMMON_H
jtkorhonen@0 20
Chris@50 21 #include <QString>
jtkorhonen@0 22
jtkorhonen@0 23 #define MY_ICON_SIZE 32
jtkorhonen@0 24 #define REPOMENU_TITLE "Repository actions"
jtkorhonen@0 25 #define WORKFOLDERMENU_TITLE "Workfolder actions"
jtkorhonen@0 26 #define EXITOK(x) ((x)==0)
jtkorhonen@0 27 #define CHGSET "changeset: "
jtkorhonen@0 28 #define REQUIRED_CHGSET_DIFF_COUNT 2
jtkorhonen@0 29
jtkorhonen@0 30 #define WORKTAB 0
Chris@58 31 #define HISTORYTAB 2
Chris@58 32 #define HEADSTAB 3
jtkorhonen@0 33
jtkorhonen@0 34 #define HGSTAT_M_BIT 1U
jtkorhonen@0 35 #define HGSTAT_A_BIT 2U
jtkorhonen@0 36 #define HGSTAT_R_BIT 4U
jtkorhonen@0 37 #define HGSTAT_D_BIT 8U
jtkorhonen@0 38 #define HGSTAT_U_BIT 16U
jtkorhonen@0 39 #define HGSTAT_C_BIT 32U
jtkorhonen@0 40 #define HGSTAT_I_BIT 64U
jtkorhonen@0 41
jtkorhonen@0 42 #define DEFAULT_HG_STAT_BITS (HGSTAT_M_BIT | HGSTAT_A_BIT | HGSTAT_R_BIT | HGSTAT_D_BIT | HGSTAT_U_BIT)
jtkorhonen@0 43
Chris@62 44 extern QString findExecutable(QString name);
jtkorhonen@0 45
jtkorhonen@0 46 extern QString getSystem();
jtkorhonen@0 47 extern QString getHgDirName();
jtkorhonen@0 48
Chris@62 49 extern QString getUserRealName();
Chris@62 50
Chris@78 51 extern void loseControllingTerminal();
Chris@78 52
Chris@79 53 /**
Chris@79 54 * Status used in testing whether a folder argument (received from the
Chris@79 55 * user) is valid for particular uses.
Chris@79 56 */
Chris@79 57 enum FolderStatus {
Chris@79 58 FolderUnknown, /// Neither the folder nor its parent exists
Chris@79 59 FolderParentExists, /// The folder is absent, but its parent exists
Chris@79 60 FolderExists, /// The folder exists and has no .hg repo in it
Chris@79 61 FolderHasRepo, /// The folder exists and has an .hg repo in it
Chris@79 62 FolderIsFile /// The "folder" is actually a file
Chris@79 63 };
Chris@79 64
Chris@79 65 FolderStatus getFolderStatus(QString path);
Chris@79 66
Chris@79 67 /**
Chris@79 68 * If the given path is somewhere within an existing repository,
Chris@79 69 * return the path of the root directory of the repository (i.e. the
Chris@79 70 * one with .hg in it).
Chris@79 71 *
Chris@79 72 * If the given path is _not_ in a repository, or the given path _is_
Chris@79 73 * the root directory of a repository, return QString(). Use
Chris@79 74 * getFolderStatus to distinguish between these cases.
Chris@79 75 */
Chris@79 76 QString getContainingRepoFolder(QString path);
Chris@79 77
Chris@79 78 QString xmlEncode(QString);
Chris@79 79
Chris@79 80
jtkorhonen@0 81 #endif //COMMON_H
jtkorhonen@0 82
jtkorhonen@0 83