This repository has been archived on 2021-12-21. You can view files and clone it, but cannot push or open issues or pull requests.
Bookworm/Plugins/UE4GitPlugin-2.17-beta/Source/GitSourceControl/Private/GitSourceControlMenu.h

62 lines
1.9 KiB
C
Raw Normal View History

2021-11-02 12:06:34 +00:00
// Copyright (c) 2014-2020 Sebastien Rombauts (sebastien.rombauts@gmail.com)
//
// Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
// or copy at http://opensource.org/licenses/MIT)
#pragma once
#include "CoreMinimal.h"
#include "ISourceControlProvider.h"
class FToolBarBuilder;
class FMenuBuilder;
/** Git extension of the Source Control toolbar menu */
class FGitSourceControlMenu
{
public:
void Register();
void Unregister();
/** This functions will be bound to appropriate Command. */
void PushClicked();
void SyncClicked();
void RevertClicked();
void RefreshClicked();
private:
bool HaveRemoteUrl() const;
bool SaveDirtyPackages();
TArray<FString> ListAllPackages();
TArray<UPackage*> UnlinkPackages(const TArray<FString>& InPackageNames);
void ReloadPackages(TArray<UPackage*>& InPackagesToReload);
bool StashAwayAnyModifications();
void ReApplyStashedModifications();
void AddMenuExtension(FMenuBuilder& Builder);
TSharedRef<class FExtender> OnExtendLevelEditorViewMenu(const TSharedRef<class FUICommandList> CommandList);
void DisplayInProgressNotification(const FText& InOperationInProgressString);
void RemoveInProgressNotification();
void DisplaySucessNotification(const FName& InOperationName);
void DisplayFailureNotification(const FName& InOperationName);
private:
FDelegateHandle ViewMenuExtenderHandle;
/** Was there a need to stash away modifications before Sync? */
bool bStashMadeBeforeSync;
/** Loaded packages to reload after a Sync or Revert operation */
TArray<UPackage*> PackagesToReload;
/** Current source control operation from extended menu if any */
TWeakPtr<class SNotificationItem> OperationInProgressNotification;
/** Delegate called when a source control operation has completed */
void OnSourceControlOperationComplete(const FSourceControlOperationRef& InOperation, ECommandResult::Type InResult);
};