2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 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
|
2011-08-16 18:55:23 +02:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2011-08-16 18:55:23 +02:00
|
|
|
|
2019-01-08 16:05:57 +01:00
|
|
|
#include "core_global.h"
|
2011-08-16 18:55:23 +02:00
|
|
|
|
2020-09-03 17:51:23 +02:00
|
|
|
#include <utils/fileutils.h>
|
|
|
|
|
|
2011-08-17 15:16:54 +02:00
|
|
|
QT_BEGIN_NAMESPACE
|
2011-08-16 18:55:23 +02:00
|
|
|
class QWidget;
|
2011-08-17 15:16:54 +02:00
|
|
|
QT_END_NAMESPACE
|
2011-08-16 18:55:23 +02:00
|
|
|
|
2018-08-31 10:54:47 +02:00
|
|
|
namespace Utils { class Environment; }
|
|
|
|
|
|
2011-08-16 18:55:23 +02:00
|
|
|
namespace Core {
|
|
|
|
|
|
2020-05-08 18:06:26 +02:00
|
|
|
enum class HandleIncludeGuards { No, Yes };
|
|
|
|
|
|
2011-08-16 18:55:23 +02:00
|
|
|
struct CORE_EXPORT FileUtils
|
|
|
|
|
{
|
|
|
|
|
// Helpers for common directory browser options.
|
2021-08-12 12:05:37 +02:00
|
|
|
static void showInGraphicalShell(QWidget *parent, const Utils::FilePath &path);
|
2021-10-28 15:54:24 +02:00
|
|
|
static void showInFileSystemView(const Utils::FilePath &path);
|
2021-08-02 18:02:10 +02:00
|
|
|
static void openTerminal(const Utils::FilePath &path, const Utils::Environment &env);
|
2013-09-24 12:12:09 +03:00
|
|
|
static QString msgFindInDirectory();
|
2021-09-17 17:33:47 +02:00
|
|
|
static QString msgFileSystemAction();
|
2011-08-16 18:55:23 +02:00
|
|
|
// Platform-dependent action descriptions
|
|
|
|
|
static QString msgGraphicalShellAction();
|
2019-04-26 20:47:23 +02:00
|
|
|
static QString msgTerminalHereAction();
|
|
|
|
|
static QString msgTerminalWithAction();
|
2012-07-18 13:41:13 +04:00
|
|
|
// File operations aware of version control and file system case-insensitiveness
|
2020-09-03 17:51:23 +02:00
|
|
|
static void removeFiles(const Utils::FilePaths &filePaths, bool deleteFromFS);
|
2021-06-11 14:34:34 +02:00
|
|
|
static bool renameFile(const Utils::FilePath &from, const Utils::FilePath &to,
|
2020-05-08 18:06:26 +02:00
|
|
|
HandleIncludeGuards handleGuards = HandleIncludeGuards::No);
|
2021-12-08 16:26:32 +01:00
|
|
|
|
|
|
|
|
static void updateHeaderFileGuardIfApplicable(const Utils::FilePath &oldFilePath,
|
|
|
|
|
const Utils::FilePath &newFilePath,
|
|
|
|
|
HandleIncludeGuards handleGuards);
|
|
|
|
|
|
|
|
|
|
private:
|
2020-05-08 18:06:26 +02:00
|
|
|
// This method is used to refactor the include guards in the renamed headers
|
2021-12-08 16:26:32 +01:00
|
|
|
static bool updateHeaderFileGuardAfterRename(const QString &headerPath,
|
|
|
|
|
const QString &oldHeaderBaseName);
|
2011-08-16 18:55:23 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Core
|