annotate src/common.h @ 655:68494beada6e

Ignore .msi files
author Chris Cannam <chris.cannam@eecs.qmul.ac.uk>
date Fri, 25 Jan 2013 15:33:35 +0000
parents ae67ea0af696
children c0b46d0514a7
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@644 8 Copyright (c) 2013 Chris Cannam
Chris@644 9 Copyright (c) 2013 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
Chris@172 23 extern QString findInPath(QString name, QString installPath, bool executable);
jtkorhonen@0 24
Chris@62 25 extern QString getUserRealName();
Chris@62 26
Chris@78 27 extern void loseControllingTerminal();
Chris@78 28
Chris@105 29 void installSignalHandlers();
Chris@105 30
Chris@79 31 /**
Chris@79 32 * Status used in testing whether a folder argument (received from the
Chris@79 33 * user) is valid for particular uses.
Chris@79 34 */
Chris@79 35 enum FolderStatus {
Chris@79 36 FolderUnknown, /// Neither the folder nor its parent exists
Chris@79 37 FolderParentExists, /// The folder is absent, but its parent exists
Chris@79 38 FolderExists, /// The folder exists and has no .hg repo in it
Chris@79 39 FolderHasRepo, /// The folder exists and has an .hg repo in it
Chris@79 40 FolderIsFile /// The "folder" is actually a file
Chris@79 41 };
Chris@79 42
Chris@79 43 FolderStatus getFolderStatus(QString path);
Chris@79 44
Chris@455 45 enum ProcessStatus {
Chris@455 46 ProcessRunning,
Chris@455 47 ProcessNotRunning,
Chris@455 48 UnknownProcessStatus
Chris@455 49 };
Chris@455 50
Chris@455 51 ProcessStatus GetProcessStatus(int pid);
Chris@455 52
Chris@79 53 /**
Chris@79 54 * If the given path is somewhere within an existing repository,
Chris@79 55 * return the path of the root directory of the repository (i.e. the
Chris@79 56 * one with .hg in it).
Chris@79 57 *
Chris@79 58 * If the given path is _not_ in a repository, or the given path _is_
Chris@79 59 * the root directory of a repository, return QString(). Use
Chris@79 60 * getFolderStatus to distinguish between these cases.
Chris@79 61 */
Chris@79 62 QString getContainingRepoFolder(QString path);
Chris@79 63
Chris@79 64 QString xmlEncode(QString);
Chris@408 65
Chris@408 66 QString uniDecode(QString);
Chris@443 67
Chris@443 68 /**
Chris@443 69 * Generate a 16-byte random key using urandom or equivalent
Chris@443 70 */
Chris@443 71 QByteArray randomKey();
Chris@79 72
Chris@79 73
jtkorhonen@0 74 #endif //COMMON_H
jtkorhonen@0 75
jtkorhonen@0 76