diff --git a/AudioManager/AudioManager.cpp b/AudioManager/AudioManager.cpp index 1e39f1a..0c367d8 100644 --- a/AudioManager/AudioManager.cpp +++ b/AudioManager/AudioManager.cpp @@ -70,6 +70,7 @@ void AudioManager::setAudioDevice(QString ID) } } +// AI generated QList AudioManager::ListAudioOutputDevices() { QList devices; diff --git a/Configurator/Configurator.cpp b/Configurator/Configurator.cpp index 9a5ee03..c492f62 100644 --- a/Configurator/Configurator.cpp +++ b/Configurator/Configurator.cpp @@ -356,7 +356,6 @@ QString Configurator::getDeviceIDFromComboBox(QComboBox* comboBox) void Configurator::selectAudioDeviceFromSettings(QComboBox *comboBox, const QString &audioDeviceKey) { - //QString deviceName = settings.value(audioDeviceKey, "").toString(); int index = comboBox->findText(audioDeviceKey); if (index != -1) { diff --git a/NightLightSwitcher/NightLightSwitcher.cpp b/NightLightSwitcher/NightLightSwitcher.cpp index b4d5ff3..13c1fe8 100644 --- a/NightLightSwitcher/NightLightSwitcher.cpp +++ b/NightLightSwitcher/NightLightSwitcher.cpp @@ -8,7 +8,8 @@ HKEY hKey = nullptr; -void init() { +void init() +{ const std::wstring keyPath = L"Software\\Microsoft\\Windows\\CurrentVersion\\CloudStore\\Store\\DefaultAccount\\Current\\default$windows.data.bluelightreduction.bluelightreductionstate\\windows.data.bluelightreduction.bluelightreductionstate"; if (RegOpenKeyEx(HKEY_CURRENT_USER, keyPath.c_str(), 0, KEY_READ | KEY_WRITE, &hKey) != ERROR_SUCCESS) { @@ -16,12 +17,14 @@ void init() { } } -bool NightLightSwitcher::supported() { +bool NightLightSwitcher::supported() +{ init(); return hKey != nullptr; } -bool NightLightSwitcher::enabled() { +bool NightLightSwitcher::enabled() +{ if (!supported()) return false; BYTE data[1024]; @@ -36,19 +39,22 @@ bool NightLightSwitcher::enabled() { return bytes[18] == 0x15; // 21 in decimal } -void NightLightSwitcher::enable() { +void NightLightSwitcher::enable() +{ if (supported() && !enabled()) { toggle(); } } -void NightLightSwitcher::disable() { +void NightLightSwitcher::disable() +{ if (supported() && enabled()) { toggle(); } } -void NightLightSwitcher::toggle() { +void NightLightSwitcher::toggle() +{ if (!supported()) return; BYTE data[1024]; @@ -93,7 +99,8 @@ void NightLightSwitcher::toggle() { } } -std::vector hexToBytes(const std::wstring& hex) { +std::vector hexToBytes(const std::wstring& hex) +{ std::vector bytes; size_t len = hex.size(); for (size_t i = 0; i < len; i += 2) { @@ -103,7 +110,8 @@ std::vector hexToBytes(const std::wstring& hex) { return bytes; } -std::wstring bytesToHex(const std::vector& bytes) { +std::wstring bytesToHex(const std::vector& bytes) +{ std::wstringstream ss; for (BYTE byte : bytes) { ss << std::hex << std::setw(2) << std::setfill(L'0') << static_cast(byte); diff --git a/Utils/Utils.cpp b/Utils/Utils.cpp index f5824ca..063d582 100644 --- a/Utils/Utils.cpp +++ b/Utils/Utils.cpp @@ -190,11 +190,7 @@ void Utils::sendMediaKey(WORD keyCode) { INPUT ip = {0}; ip.type = INPUT_KEYBOARD; ip.ki.wVk = keyCode; - - // Press the key SendInput(1, &ip, sizeof(INPUT)); - - // Release the key ip.ki.dwFlags = KEYEVENTF_KEYUP; SendInput(1, &ip, sizeof(INPUT)); }