| 1 | /* |
| 2 | * Copyright (C) 2020-2022 Roy Qu (royqh1979@gmail.com) |
| 3 | * |
| 4 | * This program is free software: you can redistribute it and/or modify |
| 5 | * it under the terms of the GNU General Public License as published by |
| 6 | * the Free Software Foundation, either version 3 of the License, or |
| 7 | * (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 16 | */ |
| 17 | #include "runner.h" |
| 18 | #include <QDebug> |
| 19 | |
| 20 | Runner::Runner(const QString &filename, const QString &arguments, const QString &workDir |
| 21 | ,QObject *parent) : QThread(parent), |
| 22 | mPausing(false), |
| 23 | mStop(false), |
| 24 | mFilename(filename), |
| 25 | mArguments(arguments), |
| 26 | mWorkDir(workDir), |
| 27 | mWaitForFinishTime(100) |
| 28 | { |
| 29 | |
| 30 | } |
| 31 | |
| 32 | void Runner::stop() |
| 33 | { |
| 34 | mStop = true; |
| 35 | doStop(); |
| 36 | } |
| 37 | |
| 38 | void Runner::doStop() |
| 39 | { |
| 40 | |
| 41 | } |
| 42 | |
| 43 | bool Runner::pausing() const |
| 44 | { |
| 45 | return mPausing; |
| 46 | } |
| 47 | |
| 48 | void Runner::setPausing(bool newCanFinish) |
| 49 | { |
| 50 | mPausing = newCanFinish; |
| 51 | } |
| 52 | |
| 53 | int Runner::waitForFinishTime() const |
| 54 | { |
| 55 | return mWaitForFinishTime; |
| 56 | } |
| 57 | |
| 58 | void Runner::setWaitForFinishTime(int newWaitForFinishTime) |
| 59 | { |
| 60 | mWaitForFinishTime = newWaitForFinishTime; |
| 61 | } |
| 62 | |
| 63 | |