1 /***************************************************************************
2  *   Copyright (C) 2005-2009 by Rajko Albrecht                             *
3  *   ral@alwins-world.de                                                   *
4  *                                                                         *
5  *   This program is free software; you can redistribute it and/or modify  *
6  *   it under the terms of the GNU General Public License as published by  *
7  *   the Free Software Foundation; either version 2 of the License, or     *
8  *   (at your option) any later version.                                   *
9  *                                                                         *
10  *   This program is distributed in the hope that it will be useful,       *
11  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
12  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
13  *   GNU General Public License for more details.                          *
14  *                                                                         *
15  *   You should have received a copy of the GNU General Public License     *
16  *   along with this program; if not, write to the                         *
17  *   Free Software Foundation, Inc.,                                       *
18  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
19  ***************************************************************************/
20 #ifndef SVNLOGDLGIMP_H
21 #define SVNLOGDLGIMP_H
22 
23 #include "ui_svnlogdlg.h"
24 #include "simple_logcb.h"
25 #include "svnqt/log_entry.h"
26 #include "svnqt/client.h"
27 
28 #include <QRegExp>
29 
30 class QDialogButtonBox;
31 class QKeyEvent;
32 class QTreeWidgetItem;
33 class SvnActions;
34 class SvnLogModel;
35 class QSortFilterProxyModel;
36 class QModelIndex;
37 
38 class SvnLogDlgImp: public QDialog, public Ui::LogDialog, public SimpleLogCb
39 {
40     Q_OBJECT
41 public:
42     SvnLogDlgImp(SvnActions *ac, bool modal, QWidget *parent = nullptr);
43     ~SvnLogDlgImp();
44     void dispLog(const svn::LogEntriesMapPtr &log, const QString &what, const QString &root, const svn::Revision &peg, const QString &pegUrl);
45     void saveSize();
46     bool getSingleLog(svn::LogEntry &t, const svn::Revision &r, const QString &what, const svn::Revision &peg, QString &root) override;
47 
48 signals:
49     void makeDiff(const QString &, const svn::Revision &, const QString &, const svn::Revision &, QWidget *);
50     void makeCat(const svn::Revision &, const QString &, const QString &, const svn::Revision &, QWidget *);
51 
52 protected:
53     void keyPressEvent(QKeyEvent *e) override;
54     void keyReleaseEvent(QKeyEvent *e) override;
55     void showEvent(QShowEvent *e) override;
56 
57 protected slots:
58     void slotDispPrevious();
59     void slotDispSelected();
60     void slotRevisionSelected();
61     void slotPrevFifty();
62     void slotBeginHead();
63     void slotHelpRequested();
64 
65 private:
66     QString _name;
67     QString _base;
68     SvnActions *m_Actions;
69     bool m_ControlKeyDown;
70     svn::LogEntriesMapPtr m_Entries;
71     SvnLogModel *m_CurrentModel;
72     QSortFilterProxyModel *m_SortModel;
73 
74     QString _bugurl;
75 
76     void dispLog(const svn::LogEntriesMapPtr &);
77 
78     QRegExp _r1, _r2;
79 
80 protected slots:
81     void slotListEntries();
82     void slotChangedPathContextMenu(const QPoint &);
83     void slotSingleDoubleClicked(QTreeWidgetItem *, int);
84     void slotGetLogs();
85     void slotBlameItem();
86     void slotSelectionChanged(const QItemSelection &, const QItemSelection &);
87     void slotCustomContextMenu(const QPoint &);
88 
89 protected:
90     /* it works 'cause we use single selection only */
91     QModelIndex selectedRow(int column = 0);
92     void replaceBugids(QString &msg);
93     QString genReplace(const QString &);
94     svn::Revision m_peg;
95     svn::Path m_PegUrl;
96 };
97 
98 #endif
99