PatchTool: Introduce PatchAction enum

Add static PatchTool::confirmPatching() and reuse it
in two places.

Use Tr::tr() inside PatchTool.

Change-Id: I70779619dbb58ab6e46a585bbeff51588ccb2f53
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Jarek Kobus
2022-09-29 15:31:27 +02:00
parent 2d360db2c3
commit b67c868f75
14 changed files with 140 additions and 131 deletions

View File

@@ -1,4 +1,4 @@
// Copyright (C) 2016 The Qt Company Ltd.
// Copyright (C) 2022 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#pragma once
@@ -9,15 +9,22 @@
namespace Core {
enum class PatchAction {
Apply,
Revert
};
class CORE_EXPORT PatchTool
{
public:
static Utils::FilePath patchCommand();
static void setPatchCommand(const Utils::FilePath &newCommand);
static bool confirmPatching(QWidget *parent, PatchAction patchAction);
// Utility to run the 'patch' command
static bool runPatch(const QByteArray &input, const Utils::FilePath &workingDirectory = {},
int strip = 0, bool reverse = false);
int strip = 0, PatchAction patchAction = PatchAction::Apply);
};
} // namespace Core