File indexing completed on 2024-09-15 07:03:53
0001 /* 0002 * XDebug Debugger Support 0003 * 0004 * Copyright 2006 Vladimir Prus <ghost@cs.msu.su> 0005 * Copyright 2007 Hamish Rodda <rodda@kde.org> 0006 * Copyright 2009 Andreas Pakulat <apaku@gmx.de> 0007 * Copyright 2009 Niko Sams <niko.sams@gmail.com> 0008 * 0009 * This program is free software; you can redistribute it and/or modify 0010 * it under the terms of the GNU General Public License as 0011 * published by the Free Software Foundation; either version 2 of the 0012 * License, or (at your option) any later version. 0013 * 0014 * This program is distributed in the hope that it will be useful, 0015 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0016 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0017 * GNU General Public License for more details. 0018 * 0019 * You should have received a copy of the GNU General Public 0020 * License along with this program; if not, write to the 0021 * Free Software Foundation, Inc., 0022 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 0023 */ 0024 #ifndef XDEBUGDEBUGJOB 0025 #define XDEBUGDEBUGJOB 0026 0027 #include <QPointer> 0028 #include <QProcess> 0029 #include <QUrl> 0030 0031 #include <outputview/outputjob.h> 0032 0033 class KProcess; 0034 namespace KDevelop { 0035 class OutputModel; 0036 class ILaunchConfiguration; 0037 class ProcessLineMaker; 0038 } 0039 0040 namespace XDebug { 0041 class DebugSession; 0042 0043 class XDebugJob 0044 : public KDevelop::OutputJob 0045 { 0046 Q_OBJECT 0047 0048 public: 0049 XDebugJob(DebugSession* session, KDevelop::ILaunchConfiguration*, QObject* parent = nullptr); 0050 void start() override; 0051 0052 KProcess* process() const; 0053 0054 protected: 0055 bool doKill() override; 0056 0057 private: 0058 KDevelop::OutputModel* model(); 0059 0060 private slots: 0061 void processError(QProcess::ProcessError); 0062 void processFinished(int, QProcess::ExitStatus); 0063 0064 private: 0065 void appendLine(const QString& l); 0066 KProcess* m_proc; 0067 KDevelop::ProcessLineMaker* m_lineMaker; 0068 QPointer<DebugSession> m_session; 0069 }; 0070 0071 class XDebugBrowserJob 0072 : public KJob 0073 { 0074 Q_OBJECT 0075 0076 public: 0077 XDebugBrowserJob(DebugSession* session, KDevelop::ILaunchConfiguration*, QObject* parent = nullptr); 0078 void start() override; 0079 0080 protected: 0081 bool doKill() override; 0082 void launchBrowser(QUrl &url); 0083 0084 private slots: 0085 void sessionFinished(); 0086 0087 private: 0088 void processFailedToStart(); 0089 QUrl m_url; 0090 QString m_browser; 0091 DebugSession* m_session; 0092 }; 0093 } 0094 0095 #endif