-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
269 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Binaries/* | ||
Config/* | ||
Intermediate/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"FileVersion": 3, | ||
"Version": 1, | ||
"VersionName": "1.0", | ||
"FriendlyName": "Qt Creator Source Code Access", | ||
"Description": "Allows access to source code in Qt Creator.", | ||
"Category": "Programming", | ||
"CreatedBy": "Vasiliy Rumyantsev", | ||
"CreatedByURL": "https://github.com/xBazilio/QtCreatorWinSourceCodeAccess", | ||
"DocsURL": "", | ||
"MarketplaceURL": "", | ||
"SupportURL": "", | ||
"CanContainContent": false, | ||
"IsBetaVersion": false, | ||
"Installed": false, | ||
"Modules": [ | ||
{ | ||
"Name": "QtCreatorSourceCodeAccess", | ||
"Type": "Developer", | ||
"LoadingPhase": "Default", | ||
"WhitelistPlatforms": [ | ||
"Win64", | ||
"Win32" | ||
] | ||
} | ||
] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions
5
Source/QtCreatorSourceCodeAccess/Private/QtCreatorSourceCodeAccessHeader.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#pragma once | ||
|
||
#include "Core.h" | ||
#include "ModuleManager.h" | ||
#include "ISourceCodeAccessModule.h" |
23 changes: 23 additions & 0 deletions
23
Source/QtCreatorSourceCodeAccess/Private/QtCreatorSourceCodeAccessModule.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved. | ||
|
||
#include "QtCreatorSourceCodeAccessHeader.h" | ||
#include "QtCreatorSourceCodeAccessModule.h" | ||
#include "Features/IModularFeatures.h" | ||
|
||
IMPLEMENT_MODULE(FQtCreatorSourceCodeAccessModule, QtCreatorSourceCodeAccess) | ||
|
||
#define LOCTEXT_NAMESPACE "FQtCreatorSourceCodeAccessModule" | ||
|
||
void FQtCreatorSourceCodeAccessModule::StartupModule() | ||
{ | ||
// Bind our source control provider to the editor | ||
IModularFeatures::Get().RegisterModularFeature(TEXT("SourceCodeAccessor"), &QtCreatorSourceCodeAccessor ); | ||
} | ||
|
||
void FQtCreatorSourceCodeAccessModule::ShutdownModule() | ||
{ | ||
// Unbind provider from editor | ||
IModularFeatures::Get().UnregisterModularFeature(TEXT("SourceCodeAccessor"), &QtCreatorSourceCodeAccessor); | ||
} | ||
|
||
#undef LOCTEXT_NAMESPACE |
19 changes: 19 additions & 0 deletions
19
Source/QtCreatorSourceCodeAccess/Private/QtCreatorSourceCodeAccessModule.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved. | ||
|
||
#pragma once | ||
|
||
#include "CoreMinimal.h" | ||
#include "Modules/ModuleInterface.h" | ||
#include "QtCreatorSourceCodeAccessor.h" | ||
|
||
class FQtCreatorSourceCodeAccessModule : public IModuleInterface | ||
{ | ||
public: | ||
|
||
/** IModuleInterface implementation */ | ||
virtual void StartupModule() override; | ||
virtual void ShutdownModule() override; | ||
|
||
private: | ||
FQtCreatorSourceCodeAccessor QtCreatorSourceCodeAccessor; | ||
}; |
116 changes: 116 additions & 0 deletions
116
Source/QtCreatorSourceCodeAccess/Private/QtCreatorSourceCodeAccessor.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
#pragma once | ||
|
||
#include "QtCreatorSourceCodeAccessHeader.h" | ||
#include "QtCreatorSourceCodeAccessor.h" | ||
#include "DesktopPlatformModule.h" | ||
|
||
DEFINE_LOG_CATEGORY_STATIC(LogQtCreatorAccessor, Log, All) | ||
|
||
#define LOCTEXT_NAMESPACE "QtCreatorSourceCodeAccessor" | ||
|
||
bool FQtCreatorSourceCodeAccessor::CanAccessSourceCode() const | ||
{ | ||
// TODO implement checking that Qt Creator is present in system | ||
return true; | ||
} | ||
|
||
FName FQtCreatorSourceCodeAccessor::GetFName() const | ||
{ | ||
return FName("QtCreatorSourceCodeAccessor"); | ||
} | ||
|
||
FText FQtCreatorSourceCodeAccessor::GetNameText() const | ||
{ | ||
return LOCTEXT("QtCreatorDisplayName", "Qt Creator 4.x"); | ||
} | ||
|
||
FText FQtCreatorSourceCodeAccessor::GetDescriptionText() const | ||
{ | ||
return LOCTEXT("QtCreatorDisplayDesc", "Open source code files in Qt Creator"); | ||
} | ||
|
||
bool FQtCreatorSourceCodeAccessor::OpenSolution() | ||
{ | ||
if (IsIDERunning()) | ||
{ | ||
// use qdbus to open the project within session? | ||
STUBBED("OpenSolution: if IsIDERunning bring it to the foreground"); | ||
return false; | ||
} | ||
|
||
FString Solution = GetSolutionPath(); | ||
FString IDEPath; | ||
// TODO implement opening Qt Creator | ||
STUBBED("OpenSolution: Lounch Qt Creator"); | ||
|
||
// if (!CanRunKDevelop(IDEPath)) | ||
// { | ||
// UE_LOG(LogKDevelopAccessor, Warning, TEXT("FKDevelopSourceCodeAccessor::OpenSourceFiles: cannot find kdevelop binary")); | ||
// return false; | ||
// } | ||
|
||
// FProcHandle Proc = FPlatformProcess::CreateProc(*IDEPath, *Solution, true, false, false, nullptr, 0, nullptr, nullptr); | ||
// if (Proc.IsValid()) | ||
// { | ||
// FPlatformProcess::CloseProc(Proc); | ||
// return true; | ||
// } | ||
return false; | ||
} | ||
|
||
bool FQtCreatorSourceCodeAccessor::OpenFileAtLine(const FString& FullPath, int32 LineNumber, int32 ColumnNumber) | ||
{ | ||
STUBBED("FQtCreatorSourceCodeAccessor::OpenFileAtLine"); | ||
return false; | ||
} | ||
|
||
bool FQtCreatorSourceCodeAccessor::OpenSourceFiles(const TArray<FString>& AbsoluteSourcePaths) | ||
{ | ||
if (IsIDERunning()) | ||
{ | ||
// use qdbus | ||
STUBBED("OpenSourceFiles: QtCreator is running"); | ||
return false; | ||
} | ||
|
||
STUBBED("FQtCreatorSourceCodeAccessor::OpenSourceFiles"); | ||
return false; | ||
} | ||
|
||
bool FQtCreatorSourceCodeAccessor::AddSourceFiles(const TArray<FString>& AbsoluteSourcePaths, const TArray<FString>& AvailableModules) | ||
{ | ||
STUBBED("FQtCreatorSourceCodeAccessor::AddSourceFiles"); | ||
return false; | ||
} | ||
|
||
bool FQtCreatorSourceCodeAccessor::SaveAllOpenDocuments() const | ||
{ | ||
STUBBED("FQtCreatorSourceCodeAccessor::SaveAllOpenDocuments"); | ||
return false; | ||
} | ||
|
||
void FQtCreatorSourceCodeAccessor::Tick(const float DeltaTime) | ||
{ | ||
} | ||
|
||
bool FQtCreatorSourceCodeAccessor::IsIDERunning() | ||
{ | ||
// TODO implement IsIDERunning | ||
STUBBED("IsIDERunning: Check if QtCreator is running?"); | ||
return false; | ||
} | ||
|
||
FString FQtCreatorSourceCodeAccessor::GetSolutionPath() const | ||
{ | ||
if(IsInGameThread()) | ||
{ | ||
FString SolutionPath; | ||
if(FDesktopPlatformModule::Get()->GetSolutionPath(SolutionPath)) | ||
{ | ||
CachedSolutionPath = FPaths::ConvertRelativePathToFull(SolutionPath); | ||
} | ||
} | ||
return CachedSolutionPath; | ||
} | ||
|
||
#undef LOCTEXT_NAMESPACE |
38 changes: 38 additions & 0 deletions
38
Source/QtCreatorSourceCodeAccess/Private/QtCreatorSourceCodeAccessor.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#pragma once | ||
|
||
#include "CoreMinimal.h" | ||
#include "ISourceCodeAccessor.h" | ||
|
||
class FQtCreatorSourceCodeAccessor : public ISourceCodeAccessor | ||
{ | ||
public: | ||
// /** Initialise internal systems, register delegates etc. */ | ||
// void Startup(); | ||
|
||
// /** Shut down internal systems, unregister delegates etc. */ | ||
// void Shutdown(); | ||
|
||
/** ISourceCodeAccessor implementation */ | ||
virtual void RefreshAvailability() override { } | ||
virtual bool CanAccessSourceCode() const override; | ||
virtual FName GetFName() const override; | ||
virtual FText GetNameText() const override; | ||
virtual FText GetDescriptionText() const override; | ||
virtual bool OpenSolution() override; | ||
virtual bool OpenFileAtLine(const FString& FullPath, int32 LineNumber, int32 ColumnNumber = 0) override; | ||
virtual bool OpenSourceFiles(const TArray<FString>& AbsoluteSourcePaths) override; | ||
virtual bool AddSourceFiles(const TArray<FString>& AbsoluteSourcePaths, const TArray<FString>& AvailableModules) override; | ||
virtual bool SaveAllOpenDocuments() const override; | ||
virtual void Tick(const float DeltaTime) override; | ||
|
||
private: | ||
|
||
/** String storing the solution path obtained from the module manager to avoid having to use it on a thread */ | ||
mutable FString CachedSolutionPath; | ||
|
||
/** Check if QtCreator is already running */ | ||
bool IsIDERunning(); | ||
|
||
/** Gets solution path */ | ||
FString GetSolutionPath() const; | ||
}; |
38 changes: 38 additions & 0 deletions
38
Source/QtCreatorSourceCodeAccess/QtCreatorSourceCodeAccess.Build.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Copyright 1998-2017 Epic Games, Inc. All Rights Reserved. | ||
|
||
using UnrealBuildTool; | ||
|
||
public class QtCreatorSourceCodeAccess : ModuleRules | ||
{ | ||
public QtCreatorSourceCodeAccess(TargetInfo Target) | ||
{ | ||
|
||
PublicIncludePaths.AddRange( | ||
new string[] { | ||
"QtCreatorSourceCodeAccess/Public" | ||
} | ||
); | ||
|
||
|
||
PrivateIncludePaths.AddRange( | ||
new string[] { | ||
"QtCreatorSourceCodeAccess/Private" | ||
} | ||
); | ||
|
||
|
||
PrivateDependencyModuleNames.AddRange( | ||
new string[] | ||
{ | ||
"Core", | ||
"SourceCodeAccess", | ||
"DesktopPlatform", | ||
} | ||
); | ||
|
||
if (UEBuildConfiguration.bBuildEditor) | ||
{ | ||
PrivateDependencyModuleNames.Add("HotReload"); | ||
} | ||
} | ||
} |