2022-09-29 15:31:27 +02:00
|
|
|
// Copyright (C) 2022 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2014-04-17 12:47:38 +02:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2014-04-17 12:47:38 +02:00
|
|
|
|
2019-01-08 16:05:57 +01:00
|
|
|
#include "core_global.h"
|
2014-04-17 12:47:38 +02:00
|
|
|
|
2021-08-17 13:37:20 +02:00
|
|
|
#include <utils/filepath.h>
|
2014-04-17 12:47:38 +02:00
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
|
2022-09-29 15:31:27 +02:00
|
|
|
enum class PatchAction {
|
|
|
|
|
Apply,
|
|
|
|
|
Revert
|
|
|
|
|
};
|
|
|
|
|
|
2014-04-17 12:47:38 +02:00
|
|
|
class CORE_EXPORT PatchTool
|
|
|
|
|
{
|
|
|
|
|
public:
|
2021-08-17 13:37:20 +02:00
|
|
|
static Utils::FilePath patchCommand();
|
2014-04-17 12:47:38 +02:00
|
|
|
|
2022-10-16 04:59:51 +03:00
|
|
|
static bool confirmPatching(QWidget *parent, PatchAction patchAction, bool isModified);
|
2022-09-29 15:31:27 +02:00
|
|
|
|
2014-04-17 12:47:38 +02:00
|
|
|
// Utility to run the 'patch' command
|
2021-08-17 13:37:20 +02:00
|
|
|
static bool runPatch(const QByteArray &input, const Utils::FilePath &workingDirectory = {},
|
2022-09-29 15:31:27 +02:00
|
|
|
int strip = 0, PatchAction patchAction = PatchAction::Apply);
|
2014-04-17 12:47:38 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Core
|