Files
AsuroImgui/AsuroTool/ApplicationData.h

91 lines
2.4 KiB
C++

#pragma once
#include "AudioNotificationListener.h"
#include "WindowsShell.h"
#include <endpointvolume.h>
#include <string>
#include <vector>
#include <unordered_map>
#include <chrono>
class AudioDevice {
public:
bool isInitialized = false;
IMMDevice* device = nullptr;
IAudioEndpointVolume* volumeInterface = nullptr;
IAudioMeterInformation* meterInterface = nullptr;
std::wstring id = {};
std::string name = {};
unsigned long state = {};
bool isDefaultConsole = false;
bool isDefaultMedia = false;
bool isDefaultCommunication = false;
float minVolumeDb = 0.f;
float maxVolumeDb = 0.f;
AudioDevice(IMMDevice* device, LPCWSTR deviceId);
AudioDevice(AudioDevice&& other) noexcept;
AudioDevice& operator=(AudioDevice&& other) noexcept;
~AudioDevice();
};
class AudioData {
public:
std::vector<AudioDevice> playbackDevices = {};
std::vector<AudioDevice> recordingDevices = {};
IMMDeviceEnumerator* deviceEnumerator = nullptr;
AudioNotificationListener* audioNotificationListener = nullptr;
AudioData();
AudioData(AudioData&& other) noexcept;
AudioData& operator=(AudioData&& other) noexcept;
~AudioData();
};
class ApplicationSettings {
public:
bool autostart = false;
bool docked = false;
bool showDisabledDevices = false;
bool showChecklistExtras = false;
std::vector<std::string> taskNames = {};
std::unordered_map<std::string, std::vector<std::chrono::year_month_day>> tasks = {};
std::vector<std::string> baseStationMacAdresses = {};
bool baseStationShowConsole;
float timerDuration = 5.f * 60.f;
float timerRepeatDuration = 2.f * 60.f;
bool timerRepeating = false;
};
enum class HoverTargetType
{
HOVER_TARGET_NONE = 0,
HOVER_TARGET_CHECKLIST_DAY = 1,
};
struct TimerData {
bool isTimerActive = false;
std::chrono::system_clock::time_point timerStartTimestamp;
bool timerHasNotified = false;
float lastNotifySeconds;
TimerToastHandler toastHandler = {};
};
class ApplicationData {
public:
ApplicationSettings settings = {};
size_t checklistLength = 0;
int checklistHighlightDurationDays = 3;
std::shared_ptr<AudioData> audioData = std::make_shared<AudioData>();
HoverTargetType hoverTargetType = HoverTargetType::HOVER_TARGET_NONE;
std::chrono::year_month_day hoverTargetDay = {};
TimerData timerData{};
std::mutex timerMutex{};
bool lighthouseProcActive = false;
//ApplicationData(const ApplicationData&) = delete;
//ApplicationData& operator=(const ApplicationData&) = delete;
};