File indexing completed on 2024-05-12 05:44:27

0001 /***************************************************************************
0002  *   Copyright (C) 2007 by Rajko Albrecht  ral@alwins-world.de             *
0003  *   https://kde.org/applications/development/org.kde.kdesvn               *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  *                                                                         *
0010  *   This program is distributed in the hope that it will be useful,       *
0011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0013  *   GNU General Public License for more details.                          *
0014  *                                                                         *
0015  *   You should have received a copy of the GNU General Public License     *
0016  *   along with this program; if not, write to the                         *
0017  *   Free Software Foundation, Inc.,                                       *
0018  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
0019  ***************************************************************************/
0020 #ifndef LOGMODELHELPER_H
0021 #define LOGMODELHELPER_H
0022 
0023 #include <QString>
0024 #include <QTreeWidgetItem>
0025 
0026 #include "svnqt/log_entry.h"
0027 #include "svnqt/svnqttypes.h"
0028 
0029 class LogChangePathItem : public QTreeWidgetItem
0030 {
0031 public:
0032     explicit LogChangePathItem(const svn::LogChangePathEntry &, QTreeWidget *view = nullptr);
0033     ~LogChangePathItem() override
0034     {
0035     }
0036 
0037     char action() const
0038     {
0039         return _action;
0040     }
0041     const QString &path() const
0042     {
0043         return _path;
0044     }
0045     const QString &source() const
0046     {
0047         return _source;
0048     }
0049     qlonglong revision() const
0050     {
0051         return _revision;
0052     }
0053 
0054 protected:
0055     QString _path, _source;
0056     char _action;
0057     qlonglong _revision;
0058 
0059     void init(const svn::LogChangePathEntry &);
0060 };
0061 
0062 class SvnLogModelNode
0063 {
0064 public:
0065     explicit SvnLogModelNode(const svn::LogEntry &_entry);
0066 
0067     const svn::LogChangePathEntries &changedPaths() const;
0068     void setChangedPaths(const svn::LogEntry &);
0069 
0070     qlonglong revision() const
0071     {
0072         return _data.revision;
0073     }
0074     const QString &author() const
0075     {
0076         return _data.author;
0077     }
0078     const QString &message() const
0079     {
0080         return _data.message;
0081     }
0082     const QString &shortMessage() const
0083     {
0084         return _shortMessage;
0085     }
0086     const QDateTime &date() const
0087     {
0088         return _date;
0089     }
0090     const qlonglong &dateMSec() const
0091     {
0092         return _data.date;
0093     }
0094     void setRealName(const QString &_n)
0095     {
0096         _realName = _n;
0097     }
0098     const QString &realName() const
0099     {
0100         return _realName;
0101     }
0102 
0103     bool copiedFrom(QString &_n, qlonglong &_rev) const;
0104     static bool isParent(const QString &_par, const QString &tar);
0105 
0106 protected:
0107     // we require the ownership!
0108     svn::LogEntry _data;
0109     QString _realName;
0110     QDateTime _date;
0111     QString _shortMessage;
0112 };
0113 
0114 #endif