1 /****************************************************************************
2 **
3 ** Copyright (C) 2016 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of Qt Creator.
7 **
8 ** Commercial License Usage
9 ** Licensees holding valid commercial Qt licenses may use this file in
10 ** accordance with the commercial license agreement provided with the
11 ** Software or, alternatively, in accordance with the terms contained in
12 ** a written agreement between you and The Qt Company. For licensing terms
13 ** and conditions see https://www.qt.io/terms-conditions. For further
14 ** information use the contact form at https://www.qt.io/contact-us.
15 **
16 ** GNU General Public License Usage
17 ** Alternatively, this file may be used under the terms of the GNU
18 ** General Public License version 3 as published by the Free Software
19 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
20 ** included in the packaging of this file. Please review the following
21 ** information to ensure the GNU General Public License requirements will
22 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
23 **
24 ****************************************************************************/
25 
26 #include "fakeprocess.h"
27 
FakeProcess()28 FakeProcess::FakeProcess()
29 {
30 }
31 
~FakeProcess()32 FakeProcess::~FakeProcess()
33 {
34     if (m_isStarted && !m_isFinished)
35         emit finished(0, QProcess::NormalExit);
36 }
37 
finishUnsuccessfully()38 void FakeProcess::finishUnsuccessfully()
39 {
40     m_isFinished = true;
41     emit finished(1, QProcess::NormalExit);
42 }
43 
finishByCrash()44 void FakeProcess::finishByCrash()
45 {
46     m_isFinished = true;
47     emit finished(0, QProcess::CrashExit);
48 }
49 
finish()50 void FakeProcess::finish()
51 {
52     m_isFinished = true;
53     emit finished(0, QProcess::NormalExit);
54 }
55 
setArguments(const QStringList & arguments)56 void FakeProcess::setArguments(const QStringList &arguments)
57 {
58     m_arguments = arguments;
59 }
60 
setProgram(const QString & program)61 void FakeProcess::setProgram(const QString &program)
62 {
63     m_applicationPath = program;
64 }
65 
setProcessChannelMode(QProcess::ProcessChannelMode)66 void FakeProcess::setProcessChannelMode(QProcess::ProcessChannelMode)
67 {
68 }
69 
start()70 void FakeProcess::start()
71 {
72     m_isStarted = true;
73 }
74 
isStarted() const75 bool FakeProcess::isStarted() const
76 {
77     return m_isStarted;
78 }
79 
arguments() const80 const QStringList &FakeProcess::arguments() const
81 {
82     return m_arguments;
83 }
84 
applicationPath() const85 const QString &FakeProcess::applicationPath() const
86 {
87     return m_applicationPath;
88 }
89