1 /***************************************************************************
2  *   Copyright (C) 2009 by Rajko Albrecht  ral@alwins-world.de             *
3  *   http://kdesvn.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 
21 #ifndef SVNTHREAD_H
22 #define SVNTHREAD_H
23 
24 #include "tcontextlistener.h"
25 #include "svnfrontend/frontendtypes.h"
26 
27 #include <QThread>
28 
29 //! Base class for creating threads holding an subversion connection
30 class SvnThread: public QThread
31 {
32     Q_OBJECT
33 public:
34     //! Creator
35     /*!
36      * \param parent A qobject derived class which should have a qt-slot slotNotifyMessage(const QString&)
37      */
38     explicit SvnThread(QObject *parent);
39     ~SvnThread();
40     void run() override = 0;
41     virtual void cancelMe();
42 
43 protected:
44     svn::ContextP m_CurrentContext;
45     svn::ClientP m_Svnclient;
46     ThreadContextListener *m_SvnContextListener;
47     QObject *m_Parent;
48 
49     //! a base method often needed
50     /*!
51      * Exceptions will NOT be caught, the caller has to do it!
52      */
53     void itemInfo(const QString &what, svn::InfoEntry &target, const svn::Revision &_rev = svn::Revision::UNDEFINED, const svn::Revision &_peg = svn::Revision::UNDEFINED);
54 };
55 
56 #endif
57