Skip to content

Commit

Permalink
Merge pull request #12 from RaidcoreGG/dev
Browse files Browse the repository at this point in the history
Day 1 issues fixes
  • Loading branch information
DeltaGW2 authored Nov 15, 2023
2 parents 2150367 + b084ef3 commit 92e9533
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 48 deletions.
48 changes: 45 additions & 3 deletions src/GUI/GUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,15 +481,57 @@ namespace GUI
LastScaling = Settings::Settings[OPT_LASTUISCALE].get<float>();
Renderer::Scaling = Settings::Settings[OPT_LASTUISCALE].get<float>();
}
else
{
LastScaling = SC_NORMAL;
Renderer::Scaling = SC_NORMAL;
Settings::Settings[OPT_LASTUISCALE] = SC_NORMAL;
}

if (!Settings::Settings[OPT_QAVERTICAL].is_null())
{
QuickAccess::VerticalLayout = Settings::Settings[OPT_QAVERTICAL].get<bool>();
}
else
{
QuickAccess::VerticalLayout = false;
Settings::Settings[OPT_QAVERTICAL] = false;
}

if (!Settings::Settings[OPT_QALOCATION].is_null())
{
QuickAccess::Location = (EQAPosition)Settings::Settings[OPT_QALOCATION].get<int>();
}
else
{
QuickAccess::Location = EQAPosition::Extend;
Settings::Settings[OPT_QALOCATION] = 0;
}

if (!Settings::Settings[OPT_QAVERTICAL].is_null()) { QuickAccess::VerticalLayout = Settings::Settings[OPT_QAVERTICAL].get<bool>(); }
if (!Settings::Settings[OPT_QALOCATION].is_null()) { QuickAccess::Location = (EQAPosition)Settings::Settings[OPT_QALOCATION].get<int>(); }
if (!Settings::Settings[OPT_QAOFFSETX].is_null() && !Settings::Settings[OPT_QAOFFSETY].is_null())
{
QuickAccess::Offset = ImVec2(Settings::Settings[OPT_QAOFFSETX].get<float>(), Settings::Settings[OPT_QAOFFSETY].get<float>());
}
else
{
QuickAccess::Offset = ImVec2(0.0f, 0.0f);
Settings::Settings[OPT_QAOFFSETX] = 0.0f;
Settings::Settings[OPT_QAOFFSETY] = 0.0f;
}

if (!Settings::Settings[OPT_CLOSEMENU].is_null()) { CloseMenuAfterSelecting = Settings::Settings[OPT_CLOSEMENU].get<bool>(); }
if (!Settings::Settings[OPT_CLOSEMENU].is_null())
{
CloseMenuAfterSelecting = Settings::Settings[OPT_CLOSEMENU].get<bool>();
}
else
{
CloseMenuAfterSelecting = true;
Settings::Settings[OPT_CLOSEMENU] = true;
}
}
else
{
LogDebug("meme", "settings initially null");
}

IsSetup = true;
Expand Down
9 changes: 9 additions & 0 deletions src/GUI/Widgets/Options/OptionsWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ namespace GUI
}
ImGui::TooltipGeneric("Enables the Debug menu and some other features.");

ImGui::TextDisabled("Font Size");
if (ImGui::InputFloat("##fontsize", &GUI::FontSize, 0.0f, 0.0f, "%.1f", ImGuiInputTextFlags_EnterReturnsTrue))
{
Settings::Settings[OPT_FONTSIZE] = FontSize;
Settings::Save();
}
ImGui::TooltipGeneric("Changing font size requires a restart.");


ImGui::TextDisabled("UI/UX");
if (ImGui::Checkbox("Close Menu after selecting item", &GUI::CloseMenuAfterSelecting))
{
Expand Down
1 change: 1 addition & 0 deletions src/Keybinds/KeybindHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ namespace Keybinds
if (it->second == aKeybind)
{
kb.Key = it->first;
break;
}
}

Expand Down
42 changes: 5 additions & 37 deletions src/Logging/LogHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ namespace LogHandler
std::vector<LogEntry> LogEntries;
std::vector<std::string> Channels;

bool IsRunning = false;
int IndexProcessed = 0;
std::thread LoggingThread;

void Initialize()
{
Expand All @@ -24,14 +21,6 @@ namespace LogHandler

FileLogger* fLog = new FileLogger(ELogLevel::ALL, Path::F_LOG);
RegisterLogger(fLog);

IsRunning = true;
LoggingThread = std::thread(ProcessQueueLoop);
LoggingThread.detach();
}
void Shutdown()
{
IsRunning = false;
}

void RegisterLogger(ILogger* aLogger)
Expand Down Expand Up @@ -87,37 +76,16 @@ namespace LogHandler
Mutex.lock();
{
LogEntries.push_back(entry);
}
Mutex.unlock();
}
void ProcessQueueLoop()
{
for (;;)
{
if (!IsRunning) { return; }

while (LogEntries.size() > IndexProcessed + 1)
for (ILogger* logger : Registry)
{
Mutex.lock();
/* send logged message to logger if message log level is lower than logger level */
if (entry.LogLevel <= logger->GetLogLevel())
{
LogEntry& entry = LogEntries[IndexProcessed + 1];

for (ILogger* logger : Registry)
{
ELogLevel level = logger->GetLogLevel();

/* send logged message to logger if message log level is lower than logger level */
if (entry.LogLevel <= level)
{
logger->LogMessage(entry);
}
}

IndexProcessed++;
logger->LogMessage(entry);
}
Mutex.unlock();
}
}
Mutex.unlock();
}

int Verify(void* aStartAddress, void* aEndAddress)
Expand Down
5 changes: 0 additions & 5 deletions src/Logging/LogHandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,7 @@ namespace LogHandler
extern std::vector<LogEntry> LogEntries;
extern std::vector<std::string> Channels;

extern bool IsRunning;
extern int IndexProcessed;
extern std::thread LoggingThread;

void Initialize();
void Shutdown();

void RegisterLogger(ILogger* aLogger);
void UnregisterLogger(ILogger* aLogger);
Expand Down
4 changes: 4 additions & 0 deletions src/State.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@ namespace State
if ((subpos = cmp.find("mumble ")) != std::string::npos)
{
subtoken = token.substr(7, token.length() - subpos);
if (std::regex_match(subtoken, std::regex("\"(.*?)\"")))
{
subtoken = subtoken.substr(1, subtoken.length() - 2);
}
//Log("dbg", "subtoken: \"%s\" @ %d", subtoken.c_str(), subpos);

customMumble = true;
Expand Down
1 change: 1 addition & 0 deletions src/State.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <string>
#include <algorithm>
#include <shellapi.h>
#include <regex>

#include "Consts.h"
#include "Shared.h"
Expand Down
5 changes: 5 additions & 0 deletions src/Updater/Updater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,10 @@ namespace Updater
}
}
}

if (std::filesystem::exists(Path::F_UPDATE_DLL))
{
std::filesystem::remove(Path::F_UPDATE_DLL);
}
}
}
12 changes: 9 additions & 3 deletions src/entry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,15 @@ void Initialize()
Keybinds::Load();
Settings::Load();

if (!Settings::Settings[OPT_DEVMODE].is_null()) { State::IsDeveloperMode = Settings::Settings[OPT_DEVMODE].get<bool>(); }
if (!Settings::Settings[OPT_DEVMODE].is_null())
{
State::IsDeveloperMode = Settings::Settings[OPT_DEVMODE].get<bool>();
}
else
{
State::IsDeveloperMode = false;
Settings::Settings[OPT_DEVMODE] = false;
}
//API::Initialize();

Mumble::Initialize();
Expand Down Expand Up @@ -110,8 +118,6 @@ void Shutdown()
//API::Save();

MH_Uninitialize();

LogHandler::Shutdown();
}

// free libs
Expand Down

0 comments on commit 92e9533

Please sign in to comment.