File indexing completed on 2024-04-28 04:34:22

0001 /***************************************************************************
0002  *   Copyright 2009 Sandro Andrade <sandroandrade@kde.org>                 *
0003  *                                                                         *
0004  *   This program is free software; you can redistribute it and/or modify  *
0005  *   it under the terms of the GNU Library General Public License as       *
0006  *   published by the Free Software Foundation; either version 2 of the    *
0007  *   License, or (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 Library General Public     *
0015  *   License along with this program; if not, write to the                 *
0016  *   Free Software Foundation, Inc.,                                       *
0017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
0018  ***************************************************************************/
0019 
0020 #ifndef DUCHAINCONTROLFLOWJOB_H
0021 #define DUCHAINCONTROLFLOWJOB_H
0022 
0023 #include <QPointer>
0024 
0025 #include <KJob>
0026 
0027 #include <interfaces/istatus.h>
0028 
0029 #include "duchaincontrolflowinternaljob.h"
0030 
0031 namespace ThreadWeaver
0032 {
0033     class Job;
0034 }
0035 
0036 class DUChainControlFlow;
0037 class DUChainControlFlowInternalJob;
0038 class KDevControlFlowGraphViewPlugin;
0039 
0040 using namespace KDevelop;
0041 
0042 class DUChainControlFlowJob : public KJob, public IStatus
0043 {
0044     Q_OBJECT
0045     Q_INTERFACES(KDevelop::IStatus)
0046 public:
0047     DUChainControlFlowJob(const QString &jobName, DUChainControlFlow *duchainControlFlow);
0048     DUChainControlFlowJob(const QString &jobName, KDevControlFlowGraphViewPlugin *plugin);
0049     virtual ~DUChainControlFlowJob();
0050 
0051     virtual QString statusName() const;
0052 
0053     void setControlFlowJobType(DUChainControlFlowInternalJob::ControlFlowJobType controlFlowJobType);
0054     
0055     virtual void start();
0056     virtual bool doKill();
0057 Q_SIGNALS:
0058     // Implementations of IStatus signals
0059     void clearMessage(KDevelop::IStatus *);
0060     void showMessage(KDevelop::IStatus *, const QString &message, int timeout = 0);
0061     void hideProgress(KDevelop::IStatus *);
0062     void showProgress(KDevelop::IStatus *, int minimum, int maximum, int value);
0063     void showErrorMessage(const QString &, int);
0064 private Q_SLOTS:
0065     void done(ThreadWeaver::Job *job);
0066 private:
0067     void init(const QString &jobName);
0068     DUChainControlFlow *m_duchainControlFlow;
0069     KDevControlFlowGraphViewPlugin *m_plugin;
0070     QPointer<DUChainControlFlowInternalJob> m_internalJob;
0071     DUChainControlFlowInternalJob::ControlFlowJobType m_controlFlowJobType;
0072 };
0073 
0074 #endif