Skip to content
Snippets Groups Projects
Commit 4798c4d8 authored by Sebastian Pape's avatar Sebastian Pape
Browse files

Some Cleanups

parent 4b5e8c3f
No related branches found
No related tags found
No related merge requests found
#include "CoreMinimal.h"
#include "FileUtils.h"
#include "DasherCoreWrapper.h"
#include "HAL/FileManagerGeneric.h"
#include "Misc/FileHelper.h"
......@@ -13,8 +13,12 @@ namespace Dasher
//This doesn't actually Parse all files with the pattern, just the file with exactly the name strPattern in the Project directory
void FileUtils::ScanFiles(AbstractParser* parser, const std::string& strPattern)
{
const FString SearchPath = FPaths::ConvertRelativePathToFull(FPaths::ProjectDir(), TEXT("DasherResources"));
const TArray<FString> SearchPaths = {
FPaths::ConvertRelativePathToFull(FPaths::ProjectDir()),
FPaths::ConvertRelativePathToFull(FPaths::ProjectDir(), TEXT("DasherResources"))
};
for(FString SearchPath : SearchPaths){
//Check for explicit file
if(IFileManager::Get().FileExists(*FPaths::Combine(SearchPath, FString(strPattern.c_str()))))
{
......@@ -35,11 +39,14 @@ namespace Dasher
}
}
}
}
bool FileUtils::WriteUserDataFile(const std::string& filename, const std::string& strNewText, bool append)
{
if (strNewText.length() == 0) return true;
return FFileHelper::SaveStringToFile(FString(strNewText.c_str()), UTF8_TO_TCHAR(filename.c_str()), FFileHelper::EEncodingOptions::AutoDetect, &IFileManager::Get(), (append) ? FILEWRITE_Append : FILEWRITE_None);
FString Path = FString(filename.c_str());
if(FPaths::IsRelative(Path)) Path = UTF8_TO_TCHAR(GetFullFilenamePath(filename).c_str());
return FFileHelper::SaveStringToFile(FString(strNewText.c_str()), *Path, FFileHelper::EEncodingOptions::AutoDetect, &IFileManager::Get(), (append) ? FILEWRITE_Append : FILEWRITE_None);
}
std::string FileUtils::GetFullFilenamePath(const std::string strFilename){
......
......@@ -113,7 +113,7 @@ void SDasherWidget::Construct(const FArguments& InArgs)
//Setting up Dasher
static Dasher::XMLErrorDisplay display;
Dasher::XmlSettingsStore* Settings = new Dasher::XmlSettingsStore("Settings.xml"/*, &fileUtils*/, &display); //Gets deleted somewhere else
Dasher::XmlSettingsStore* Settings = new Dasher::XmlSettingsStore("Settings.xml", &display); //Gets deleted somewhere else
Settings->Load();
Settings->Save();
DasherMainInterface = MakeShared<Dasher::DasherInterface>(Settings);
......@@ -122,7 +122,7 @@ void SDasherWidget::Construct(const FArguments& InArgs)
DasherMainInterface->SetBoolParameter(BP_AUTO_SPEEDCONTROL, false); //Auto Speed Control
DasherMainInterface->SetLongParameter(LP_DASHER_FONTSIZE, 18);
DasherMainInterface->SetLongParameter(LP_MAX_BITRATE, 400); //Maximum Speed
DasherMainInterface->SetStringParameter(SP_INPUT_FILTER, "Stylus Control"); //On Hold
//DasherMainInterface->SetStringParameter(SP_INPUT_FILTER, "Stylus Control"); //On Hold
DasherMainInterface->SetStringParameter(SP_ALPHABET_ID, "German without punctuation");
DasherMainInterface->SetLongParameter(LP_MIN_NODE_SIZE, 15);
......
......@@ -59,6 +59,7 @@ FString UDasherWidget::GetBuffer()
void UDasherWidget::ResetBuffer()
{
DasherScreen->ResetBuffer();
BufferAltered.Broadcast("");
}
void UDasherWidget::StartTraining(FString PathToTextFile)
......
......@@ -14,17 +14,18 @@
THIRD_PARTY_INCLUDES_START
//included first to stop linker errors
#include "SettingsStore.h"
#include "AbstractXMLParser.h"
#include "DasherInterfaceBase.h"
#include "DasherScreen.h"
#include "DashIntfScreenMsgs.h"
#include "DasherInput.h"
#include "UserLog.h"
#include "XmlSettingsStore.h"
#include "Messages.h"
#include "ModuleManager.h"
#include "AppSettingsHeader.h"
#include "DasherCore/SettingsStore.h"
#include "DasherCore/AbstractXMLParser.h"
#include "DasherCore/DasherInterfaceBase.h"
#include "DasherCore/FileUtils.h"
#include "DasherCore/DasherScreen.h"
#include "DasherCore/DashIntfScreenMsgs.h"
#include "DasherCore/DasherInput.h"
#include "DasherCore/UserLog.h"
#include "DasherCore/XmlSettingsStore.h"
#include "DasherCore/Messages.h"
#include "DasherCore/ModuleManager.h"
#include "Common/AppSettingsHeader.h"
THIRD_PARTY_INCLUDES_END
#if PLATFORM_LINUX
#pragma clang diagnostic push
......
......@@ -53,7 +53,10 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/Dasher/DasherCore/CMakeLists.txt)
set(CMAKE_BUILD_TYPE Release)
set_target_properties(DasherCore PROPERTIES PREFIX "")
set_target_properties(DasherCore PROPERTIES OUTPUT_NAME "DasherCore")
set_target_properties(DasherCore PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${PROJECT_BINARY_DIR}/../Dasher/Lib)
set_target_properties(DasherCore PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/Dasher/Lib)
set_target_properties(DasherCore PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_CURRENT_SOURCE_DIR}/Dasher/Lib)
set_target_properties(pugixml-static PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/Dasher/Lib)
set_target_properties(pugixml-static PROPERTIES ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_CURRENT_SOURCE_DIR}/Dasher/Lib)
if(WIN32)
set_target_properties(DasherCore PROPERTIES MSVC_RUNTIME_LIBRARY MultiThreaded)
......
......@@ -12,19 +12,13 @@ public class Dasher : ModuleRules
Type = ModuleType.External;
PrivateDefinitions.Add("HAVE_OWN_FILEUTILS");
PublicIncludePaths.AddRange(new string[] {});
PrivateIncludePaths.AddRange(new string[] {});
PublicDependencyModuleNames.AddRange(new string[]{"Core"});
PublicDefinitions.Add("HAVE_ROUND=1");
PrivateDependencyModuleNames.AddRange(
PublicDependencyModuleNames.AddRange(
new string[]
{
"Core",
"CoreUObject",
"Engine",
"Slate",
......@@ -32,8 +26,6 @@ public class Dasher : ModuleRules
}
);
PublicDefinitions.Add("HAVE_ROUND=1");
DynamicallyLoadedModuleNames.AddRange(new string[]{});
PublicIncludePaths.Add(Path.Combine(ModuleDirectory, "DasherCore"));
......
Subproject commit 64c1349282b38d9fa4ddde9c04311ed45d689598
Subproject commit a94a47badf40d9b7f7e8c80c08b015c41d1ecc90
No preview for this file type
No preview for this file type
No preview for this file type
File added
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment