Warning, file /sdk/cervisia/loginfo.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002  * Copyright (c) 2003-2008 André Wöbbeking <Woebbeking@kde.org>
0003  *
0004  * This program is free software; you can redistribute it and/or modify
0005  * it under the terms of the GNU General Public License as published by
0006  * the Free Software Foundation; either version 2 of the License, or
0007  * (at your option) any later version.
0008  *
0009  * This program is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012  * GNU General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU General Public License
0015  * along with this program; if not, write to the Free Software
0016  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
0017  */
0018 
0019 #ifndef CERVISIA_LOGINFO_H
0020 #define CERVISIA_LOGINFO_H
0021 
0022 #include <QList>
0023 #include <qdatetime.h>
0024 #include <qstring.h>
0025 
0026 namespace Cervisia
0027 {
0028 
0029 /**
0030  * Dumb data struct to store information of the tags plus some
0031  * convenience methods. The struct is used by the LogInfo struct.
0032  */
0033 struct TagInfo {
0034     /**
0035      * The types of a tag.
0036      */
0037     enum Type {
0038         /**
0039          * Branchpoint.
0040          */
0041         Branch = 1 << 0,
0042 
0043         /**
0044          * This type is for internal use. If the revision is in a branch
0045          * this tag represents the branch.
0046          */
0047         OnBranch = 1 << 1,
0048 
0049         /**
0050          * Normal tag.
0051          */
0052         Tag = 1 << 2
0053     };
0054 
0055     explicit TagInfo(const QString &name = QString(), Type type = Tag);
0056 
0057     /**
0058      * @param prefixWithType prefix the string with the type of the tag
0059      * (e.g. Tag: KDE_3_1_3_RELEASE).
0060      *
0061      * @return tag as string.
0062      */
0063     QString toString(bool prefixWithType = true) const;
0064 
0065     /**
0066      * @return type of tag as string.
0067      */
0068     QString typeToString() const;
0069 
0070     /**
0071      * The name of the tag.
0072      */
0073     QString m_name;
0074 
0075     /**
0076      * The type of the tag.
0077      */
0078     Type m_type;
0079 };
0080 
0081 /**
0082  * Dumb data struct to store the results of the log command plus some
0083  * convenience methods.
0084  */
0085 struct LogInfo {
0086     using TTagInfoSeq = QList<TagInfo>;
0087 
0088     /**
0089      * @param showTime show commit time in tooltip.
0090      *
0091      * @return rich text formatted tooltip text.
0092      */
0093     QString createToolTipText(bool showTime = true) const;
0094 
0095     /**
0096      * Calls KLocale::formatDateTime() to create a formatted string.
0097      *
0098      * @param showTime show commit time in tooltip.
0099      * @param shortFormat using the short date format.
0100      *
0101      * @return The date/time formatted to the user's locale's conventions.
0102      */
0103     QString dateTimeToString(bool showTime = true, bool shortFormat = true) const;
0104 
0105     enum { NoTagType = 0, AllTagTypes = TagInfo::Branch | TagInfo::OnBranch | TagInfo::Tag };
0106 
0107     /**
0108      * Creates a single string from alls tags.
0109      *
0110      * @param types tags that should be taken into account.
0111      * @param prefixWithType tags that should be prefixed with their type
0112      * (see TagInfo::toString()).
0113      * @param separator string to separate the tags.
0114      *
0115      * @return string of joined tags.
0116      */
0117     QString tagsToString(unsigned int types = AllTagTypes, unsigned int prefixWithType = AllTagTypes, const QString &separator = QString(QChar('\n'))) const;
0118 
0119     /**
0120      * The revision of this entry.
0121      */
0122     QString m_revision;
0123 
0124     /**
0125      * The author who committed.
0126      */
0127     QString m_author;
0128 
0129     /**
0130      * The commit message.
0131      */
0132     QString m_comment;
0133 
0134     /**
0135      * The date/time of the commit.
0136      */
0137     QDateTime m_dateTime;
0138 
0139     /**
0140      * Sequence of tags of this entry.
0141      */
0142     TTagInfoSeq m_tags;
0143 };
0144 
0145 } // namespace Cervisia
0146 
0147 #endif // CERVISIA_LOGINFO_H