ref Env namespace for win32/reg stuff / startup toggle

Bigger than usual commit, but all of this had to be done simultaneously
This commit is contained in:
Hane 2025-01-07 00:00:50 +01:00
commit 047808c89f
8 changed files with 293 additions and 103 deletions

View file

@ -4,10 +4,13 @@
#include "backsessionclasses.h"
#include "global.h"
#include "contclasses.h"
//#include "environment.h"
class EndpointVolumeCallback;
class Session;
std::string getPath(SettingsTargetDirectory target, bool create);
wchar_t* getExeAbsPath(uint32_t *exeAbsPathLength);
std::string getSettingsPath(SettingsTargetDirectory target, bool create);
// Convert a wide UTF16LE string to an UTF8 string
static inline std::string utf16ToUtf8(const wchar_t* wstr) {
@ -146,12 +149,6 @@ class Overseer {
public:
Overseer();
NGuid getGuid();
void populateSystemValues();
void openControlPanel();
ProcessedNativeEvent processTopLevelWindowMessage(void* msg);
ProcessedNativeEvent updateColors();
bool isLightMode();
uint32_t getAccentColor();
std::vector<Endpoint*> getPlaybackEndpoints();
std::vector<Endpoint*> getCaptureEndpoints();
@ -171,11 +168,11 @@ class Overseer {
~Overseer();
private:
std::wstring exeAbsPath;
void initCOMLibrary();
NGuid guid;
bool lightMode;
uint32_t accentColor;
IMMDeviceEnumerator *deviceEnumerator;
EndpointSituationCallback epsc;
@ -202,3 +199,22 @@ class EndpointNewSessionCallback : public IAudioSessionNotification {
ULONG ref = 1;
EndpointHandler *eph;
};
namespace Environment {
void populateSystemValues();
void openControlPanel();
ProcessedNativeEvent processTopLevelWindowMessage(void* msg);
ProcessedNativeEvent updateColors();
bool checkStartup(HKEY rootKeyFlags);
void updateStartupConfig(bool onStartup);
void setStartupConfig(bool onStartup);
bool isLightMode();
bool isToRunAtStartup();
uint32_t getAccentColor();
static std::wstring exeAbsPath;
static bool lightMode;
static bool startup = false;
static HKEY scope;
static uint32_t accentColor;
};