bug fixes
This commit is contained in:
@@ -26,7 +26,11 @@ AudioDevice::AudioDevice(IMMDevice* device, LPCWSTR deviceId) : device(device)
|
|||||||
err = device->Activate(__uuidof(IAudioMeterInformation), CLSCTX_INPROC_SERVER, NULL, (LPVOID*)&meterInterface);
|
err = device->Activate(__uuidof(IAudioMeterInformation), CLSCTX_INPROC_SERVER, NULL, (LPVOID*)&meterInterface);
|
||||||
isError(err, "Failed to get audio meter interface: ");
|
isError(err, "Failed to get audio meter interface: ");
|
||||||
|
|
||||||
|
if (volumeInterface != nullptr && meterInterface != nullptr)
|
||||||
|
{
|
||||||
getVolumeLimit(volumeInterface, &minVolumeDb, &maxVolumeDb);
|
getVolumeLimit(volumeInterface, &minVolumeDb, &maxVolumeDb);
|
||||||
|
isInitialized = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (propertyStore)
|
if (propertyStore)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
class AudioDevice {
|
class AudioDevice {
|
||||||
public:
|
public:
|
||||||
|
bool isInitialized = false;
|
||||||
IMMDevice* device = nullptr;
|
IMMDevice* device = nullptr;
|
||||||
IAudioEndpointVolume* volumeInterface = nullptr;
|
IAudioEndpointVolume* volumeInterface = nullptr;
|
||||||
IAudioMeterInformation* meterInterface = nullptr;
|
IAudioMeterInformation* meterInterface = nullptr;
|
||||||
@@ -52,6 +53,7 @@ public:
|
|||||||
std::vector<std::string> taskNames = {};
|
std::vector<std::string> taskNames = {};
|
||||||
std::unordered_map<std::string, std::vector<time_t>> tasks = {};
|
std::unordered_map<std::string, std::vector<time_t>> tasks = {};
|
||||||
std::vector<std::string> baseStationMacAdresses = {};
|
std::vector<std::string> baseStationMacAdresses = {};
|
||||||
|
bool baseStationShowConsole;
|
||||||
float timerDuration = 5.f * 60.f;
|
float timerDuration = 5.f * 60.f;
|
||||||
float timerRepeatDuration = 2.f * 60.f;
|
float timerRepeatDuration = 2.f * 60.f;
|
||||||
bool timerRepeating = false;
|
bool timerRepeating = false;
|
||||||
|
|||||||
@@ -363,7 +363,6 @@ ImVec2 timerWindow(DrawData& drawData, ApplicationData& appData)
|
|||||||
ImGui::OpenPopup(SETTINGS_POPUP_NAME);
|
ImGui::OpenPopup(SETTINGS_POPUP_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
float timerDisplayMinutes = appData.settings.timerDuration / 60.f;
|
float timerDisplayMinutes = appData.settings.timerDuration / 60.f;
|
||||||
|
|
||||||
if (timerData.isTimerActive)
|
if (timerData.isTimerActive)
|
||||||
@@ -529,7 +528,7 @@ ImVec2 checklistWindow(ApplicationData& appData, const char* title)
|
|||||||
double timeDiffSeconds = difftime(today, getDayStartOf(mostRecentDoneDate));
|
double timeDiffSeconds = difftime(today, getDayStartOf(mostRecentDoneDate));
|
||||||
int timeDiffDays = timeDiffSeconds / (60 * 60 * 24);
|
int timeDiffDays = timeDiffSeconds / (60 * 60 * 24);
|
||||||
|
|
||||||
bool highlightButton = timeDiffDays >= appData.checklistHighlightDurationDays;
|
bool highlightButton = timeDiffDays > appData.checklistHighlightDurationDays;
|
||||||
if (highlightButton)
|
if (highlightButton)
|
||||||
{
|
{
|
||||||
ImGui::PushStyleColor(ImGuiCol_FrameBg, { .5f, .2f, .15f, 0.54f });
|
ImGui::PushStyleColor(ImGuiCol_FrameBg, { .5f, .2f, .15f, 0.54f });
|
||||||
@@ -580,7 +579,7 @@ ImVec2 checklistWindow(ApplicationData& appData, const char* title)
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
void startBaseStationProc(const char* args)
|
void startBaseStationProc(const char* args, DWORD flags = 0)
|
||||||
{
|
{
|
||||||
// additional information
|
// additional information
|
||||||
STARTUPINFOA si;
|
STARTUPINFOA si;
|
||||||
@@ -592,11 +591,7 @@ void startBaseStationProc(const char* args)
|
|||||||
ZeroMemory(&pi, sizeof(pi));
|
ZeroMemory(&pi, sizeof(pi));
|
||||||
|
|
||||||
// start the program up
|
// start the program up
|
||||||
DWORD creationFlags = 0;
|
CreateProcessA("lighthouse-v2-manager.exe", const_cast<LPSTR>(args), NULL, NULL, FALSE, flags, NULL, NULL, &si, &pi);
|
||||||
#ifdef _DEBUG
|
|
||||||
creationFlags = CREATE_NEW_CONSOLE;
|
|
||||||
#endif
|
|
||||||
CreateProcessA("lighthouse-v2-manager.exe", const_cast<LPSTR>(args), NULL, NULL, FALSE, creationFlags, NULL, NULL, &si, &pi);
|
|
||||||
|
|
||||||
// Close process and thread handles.
|
// Close process and thread handles.
|
||||||
CloseHandle(pi.hProcess);
|
CloseHandle(pi.hProcess);
|
||||||
@@ -620,7 +615,7 @@ ImVec2 baseStationWindow(ApplicationData& appData)
|
|||||||
params.append(" ");
|
params.append(" ");
|
||||||
params.append(mac.c_str());
|
params.append(mac.c_str());
|
||||||
}
|
}
|
||||||
startBaseStationProc(params.c_str());
|
startBaseStationProc(params.c_str(), appData.settings.baseStationShowConsole ? CREATE_NEW_CONSOLE : CREATE_NO_WINDOW);
|
||||||
}
|
}
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
if (ImGui::Button("Shutdown"))
|
if (ImGui::Button("Shutdown"))
|
||||||
@@ -631,12 +626,13 @@ ImVec2 baseStationWindow(ApplicationData& appData)
|
|||||||
params.append(" ");
|
params.append(" ");
|
||||||
params.append(mac.c_str());
|
params.append(mac.c_str());
|
||||||
}
|
}
|
||||||
startBaseStationProc(params.c_str());
|
startBaseStationProc(params.c_str(), appData.settings.baseStationShowConsole ? CREATE_NEW_CONSOLE : CREATE_NO_WINDOW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ImGui::BeginPopup(SETTINGS_POPUP_NAME))
|
if (ImGui::BeginPopup(SETTINGS_POPUP_NAME))
|
||||||
{
|
{
|
||||||
|
ImGui::Checkbox("Show Console", &appData.settings.baseStationShowConsole);
|
||||||
if (ImGui::Button("Search"))
|
if (ImGui::Button("Search"))
|
||||||
{
|
{
|
||||||
startBaseStationProc("discover");
|
startBaseStationProc("discover");
|
||||||
|
|||||||
@@ -92,8 +92,11 @@ void loadAudioDevices(AudioData& audioData, std::vector<AudioDevice>& deviceList
|
|||||||
audioDevice.isDefaultCommunication = wcscmp(defaultCommunicationId, deviceId) == 0;
|
audioDevice.isDefaultCommunication = wcscmp(defaultCommunicationId, deviceId) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (audioDevice.isInitialized)
|
||||||
|
{
|
||||||
deviceList.push_back(std::move(audioDevice));
|
deviceList.push_back(std::move(audioDevice));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
CoTaskMemFree(deviceId);
|
CoTaskMemFree(deviceId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,6 +76,13 @@ void settingsReadLine(ImGuiContext* ctx, ImGuiSettingsHandler* handler, void* en
|
|||||||
settings->baseStationMacAdresses.push_back(baseStationMac);
|
settings->baseStationMacAdresses.push_back(baseStationMac);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// baseStationShowConsole
|
||||||
|
int baseStationShowConsole;
|
||||||
|
if (sscanf_s(line, "baseStationShowConsole=%i", &baseStationShowConsole))
|
||||||
|
{
|
||||||
|
settings->baseStationShowConsole = (bool)baseStationShowConsole;
|
||||||
|
}
|
||||||
|
|
||||||
float timerDuration;
|
float timerDuration;
|
||||||
if (sscanf_s(line, "timerDuration=%f", &timerDuration))
|
if (sscanf_s(line, "timerDuration=%f", &timerDuration))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -84,13 +84,15 @@ void initShell(DrawData& drawData)
|
|||||||
|
|
||||||
void showToastNotification(TimerToastHandler* handler, const wchar_t* title, const wchar_t* text)
|
void showToastNotification(TimerToastHandler* handler, const wchar_t* title, const wchar_t* text)
|
||||||
{
|
{
|
||||||
WinToastTemplate templ = WinToastTemplate(WinToastTemplate::ImageAndText02);
|
WinToastTemplate templ = WinToastTemplate(WinToastTemplate::ImageAndText01);
|
||||||
|
templ.setScenario(WinToastTemplate::Scenario::Alarm);
|
||||||
templ.setImagePath(L"E:\\Code\\AsuroImgui\\x64\\Debug\\kaiju.ico");
|
templ.setImagePath(L"E:\\Code\\AsuroImgui\\x64\\Debug\\kaiju.ico");
|
||||||
templ.setTextField(title, WinToastTemplate::FirstLine);
|
templ.setTextField(title, WinToastTemplate::FirstLine);
|
||||||
templ.setTextField(text, WinToastTemplate::SecondLine);
|
templ.setAttributionText(text);
|
||||||
templ.addAction(L"Stop");
|
templ.addAction(L"Stop");
|
||||||
|
templ.addAction(L"Dismiss");
|
||||||
if (!WinToast::instance()->showToast(templ, handler)) {
|
if (!WinToast::instance()->showToast(templ, handler)) {
|
||||||
OutputDebugString(L"Error: Could not launch your toast notification!\n");
|
OutputDebugString(L"Error: Could not launch toast!\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user