}
};
-static void InsertTabItem(HWND hTabCtrl, UINT id, const wchar_t *itemName)
+static void InsertTabItem(HWND hTabCtrl, UINT id, const std::wstring& itemName)
{
constexpr int bufSize = 50;
- wchar_t buf[bufSize];
+ wchar_t buf[bufSize] = { L'\0' };
TC_ITEM tcItem;
ZeroMemory(&tcItem, sizeof(tcItem));
tcItem.mask |= TCIF_TEXT;
- StringCchCopy(buf, bufSize, itemName);
+ StringCchCopyW(buf, bufSize, itemName.c_str());
tcItem.pszText = buf;
tcItem.cchTextMax = bufSize;
TabCtrl_InsertItem(hTabCtrl, id, &tcItem);
}
-static void SwitchTab(AboutDlgData* dlgData, HWND hNewTab)
+static void SwitchTab(AboutDlgData* dlgData, HWND hNewTab) noexcept
{
if (dlgData->hActiveTab != nullptr) {
ShowWindow(dlgData->hActiveTab, SW_HIDE);
}
}
-static INT_PTR CALLBACK About_GeneralDlgProc(HWND hDlg, UINT msg, WPARAM, LPARAM lParam)
+static INT_PTR CALLBACK About_GeneralDlgProc(HWND hDlg, UINT msg, WPARAM, LPARAM lParam) noexcept
{
switch (msg) {
case WM_INITDIALOG:
Edit_SetText(GetDlgItem(hDlg, IDC_ABOUTTEXT), aboutText.c_str());
return TRUE;
case WM_NOTIFY: {
- PNMLINK pNmLink = reinterpret_cast<PNMLINK>(lParam);
+ const PNMLINK pNmLink = reinterpret_cast<PNMLINK>(lParam);
if (pNmLink->hdr.code == NM_CLICK || pNmLink->hdr.code == NM_RETURN) {
- UINT_PTR ctrlId = pNmLink->hdr.idFrom;
- LITEM item = pNmLink->item;
+ const UINT_PTR ctrlId = pNmLink->hdr.idFrom;
+ const LITEM item = pNmLink->item;
if ((ctrlId == IDC_LINK_HOMEPAGE
|| ctrlId == IDC_LINK_TICKETS
|| ctrlId == IDC_LINK_PROJECT)
return FALSE;
}
-static INT_PTR CALLBACK About_LicenseDlgProc(HWND hDlg, UINT msg, WPARAM, LPARAM)
+static INT_PTR CALLBACK About_LicenseDlgProc(HWND hDlg, UINT msg, WPARAM, LPARAM) noexcept
{
switch (msg) {
case WM_INITDIALOG:
DWORD dummy;
wchar_t szFileName[MAX_PATH];
GetModuleFileName(nullptr, szFileName, sizeof(szFileName)/sizeof(szFileName[0]));
- DWORD versSize = GetFileVersionInfoSizeEx(FILE_VER_GET_NEUTRAL, szFileName, &dummy);
+ const DWORD versSize = GetFileVersionInfoSizeEx(FILE_VER_GET_NEUTRAL, szFileName, &dummy);
LPVOID versData = malloc(versSize);
if (versData != nullptr) {
if (GetFileVersionInfoExW(
}
}
-void BluetoothDetector::UnloadRadioNotifications()
+void BluetoothDetector::UnloadRadioNotifications() noexcept
{
for (auto hDevNotify : notificationHandles_) {
UnregisterDeviceNotification(hDevNotify);
auto& log = WMLog::GetInstance();
notificationHandles_.clear();
- HANDLE btHandle;
- BLUETOOTH_FIND_RADIO_PARAMS bfrp = { sizeof(BLUETOOTH_FIND_RADIO_PARAMS) };
+ HANDLE btHandle = nullptr;
+ const BLUETOOTH_FIND_RADIO_PARAMS bfrp = { sizeof(BLUETOOTH_FIND_RADIO_PARAMS) };
HBLUETOOTH_RADIO_FIND hRadiosFind = BluetoothFindFirstRadio(&bfrp, &btHandle);
if (hRadiosFind == nullptr) {
log.WriteWindowsError(L"BluetoothFindFirstRadio", GetLastError());
notificationHandles_.push_back(devNotify);
}
} while (BluetoothFindNextRadio(hRadiosFind, &btHandle));
- DWORD dwLastError = GetLastError();
+ const DWORD dwLastError = GetLastError();
if (dwLastError != ERROR_NO_MORE_ITEMS) {
log.WriteWindowsError(L"BluetoothFindNextRadio", GetLastError());
UnloadRadioNotifications();
BluetoothDetector();
~BluetoothDetector();
BluetoothDetector(const WifiDetector&) = delete;
+ BluetoothDetector(WifiDetector&&) = delete;
BluetoothDetector& operator=(const WifiDetector&) = delete;
+ BluetoothDetector& operator=(WifiDetector&&) = delete;
void SetDeviceList(const std::vector<std::string>& devices, bool useDeviceList);
std::vector<HDEVNOTIFY> notificationHandles_;
bool LoadRadioNotifications();
- void UnloadRadioNotifications();
+ void UnloadRadioNotifications() noexcept;
bool initialized_;
bool useDeviceList_;
extern HINSTANCE hglobInstance;
-static const int QUIETHOURS_TIMER_START_ID = 271020;
-static const int QUIETHOURS_TIMER_END_ID = 271021;
+static constexpr int QUIETHOURS_TIMER_START_ID = 271020;
+static constexpr int QUIETHOURS_TIMER_END_ID = 271021;
-static __int64 ConvertSystemTimeTo100NS(const LPSYSTEMTIME sysTime)
+static std::int64_t ConvertSystemTimeTo100NS(const LPSYSTEMTIME sysTime) noexcept
{
FILETIME ft;
SystemTimeToFileTime(sysTime, &ft);
ULARGE_INTEGER ulInt;
ulInt.HighPart = ft.dwHighDateTime;
ulInt.LowPart = ft.dwLowDateTime;
- return static_cast<__int64>(ulInt.QuadPart);
+ return static_cast<std::int64_t>(ulInt.QuadPart);
}
static bool IsQuietHours(
const LPSYSTEMTIME qhStart,
const LPSYSTEMTIME qhEnd)
{
- __int64 iStart = ConvertSystemTimeTo100NS(qhStart);
- __int64 iEnd = ConvertSystemTimeTo100NS(qhEnd);
- __int64 iNow = ConvertSystemTimeTo100NS(now);
+ const std::int64_t iStart = ConvertSystemTimeTo100NS(qhStart);
+ std::int64_t iEnd = ConvertSystemTimeTo100NS(qhEnd);
+ const std::int64_t iNow = ConvertSystemTimeTo100NS(now);
if (iEnd < iStart) {
// Add one day
return static_cast<int>(res);
}
-static VOID CALLBACK QuietHoursTimerProc(HWND hWnd, UINT msg, UINT_PTR id, DWORD msSinceSysStart)
+static VOID CALLBACK QuietHoursTimerProc(HWND hWnd, UINT msg, UINT_PTR id, DWORD msSinceSysStart) noexcept
{
UNREFERENCED_PARAMETER(msg);
UNREFERENCED_PARAMETER(msSinceSysStart);
start.wMinute = static_cast<WORD>(((qhStart_ - start.wSecond) / 60) % 60);
start.wHour = static_cast<WORD>((qhStart_ - start.wMinute - start.wSecond) / 3600);
- int timerQhStart = GetDiffMillseconds(&start, &now);
+ const int timerQhStart = GetDiffMillseconds(&start, &now);
if (SetCoalescableTimer(
hParent_,
QUIETHOURS_TIMER_START_ID,
#include "common.h"
-static const int WM_WINMUTE_QUIETHOURS_START = WM_APP + 202;
-static const int WM_WINMUTE_QUIETHOURS_END = WM_APP + 203;
+static constexpr int WM_WINMUTE_QUIETHOURS_START = WM_APP + 202;
+static constexpr int WM_WINMUTE_QUIETHOURS_END = WM_APP + 203;
class QuietHoursTimer {
public:
case WM_COMMAND:
if (LOWORD(wParam) == IDOK) {
HWND hDevName = GetDlgItem(hDlg, IDC_BT_DEVICE_NAME);
- int textLen = Edit_GetTextLength(hDevName);
+ const int textLen = Edit_GetTextLength(hDevName);
if (textLen == 0) {
EDITBALLOONTIP ebt;
ZeroMemory(&ebt, sizeof(ebt));
ebt.ttiIcon = TTI_INFO;
Edit_ShowBalloonTip(hDevName, &ebt);
} else {
- wchar_t devNameBuf[BT_DEV_NAME_MAX_LEN + 1];
+ wchar_t devNameBuf[BT_DEV_NAME_MAX_LEN + 1] = { 'L\0' };
BtDeviceName* btDevName = reinterpret_cast<BtDeviceName*>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
if (btDevName != nullptr) {
Edit_GetText(hDevName, devNameBuf, ARRAY_SIZE(devNameBuf));
return items;
}
-static bool IsBluetoothAvailable()
+static bool IsBluetoothAvailable() noexcept
{
HANDLE btHandle;
BLUETOOTH_FIND_RADIO_PARAMS bfrp = { sizeof(BLUETOOTH_FIND_RADIO_PARAMS) };
return true;
}
-static BOOL CALLBACK ShowChildWindow(HWND hWnd, LPARAM lParam)
+static BOOL CALLBACK ShowChildWindow(HWND hWnd, LPARAM lParam) noexcept
{
ShowWindow(hWnd, static_cast<int>(lParam));
return TRUE;
HWND hBtNotAvail = GetDlgItem(hDlg, IDC_STATIC_BLUETOOTH_NOT_AVAILABLE);
RECT r;
GetClientRect(hBtNotAvail, &r);
- const int margin = 20;
+ constexpr int margin = 20;
SetWindowPos(
hBtNotAvail, HWND_TOP,
margin, margin, r.right, r.bottom,
case WM_COMMAND:
{
if (LOWORD(wParam) == IDC_ENABLE_BLUETOOTH_MUTE) {
- DWORD checked = Button_GetCheck(GetDlgItem(hDlg, IDC_ENABLE_BLUETOOTH_MUTE));
+ const DWORD checked = Button_GetCheck(GetDlgItem(hDlg, IDC_ENABLE_BLUETOOTH_MUTE));
Button_Enable(GetDlgItem(hDlg, IDC_ENABLE_BLUETOOTH_MUTE_DEVICE_LIST), checked == BST_CHECKED);
} else if (LOWORD(wParam) == IDC_BLUETOOTH_LIST) {
HWND hList = GetDlgItem(hDlg, IDC_BLUETOOTH_LIST);
if (HIWORD(wParam) == LBN_SELCHANGE || HIWORD(wParam) == LBN_SELCANCEL) {
- bool entrySelected = (ListBox_GetCurSel(hList) != LB_ERR);
+ const bool entrySelected = (ListBox_GetCurSel(hList) != LB_ERR);
Button_Enable(GetDlgItem(hDlg, IDC_BLUETOOTH_EDIT), entrySelected);
Button_Enable(GetDlgItem(hDlg, IDC_BLUETOOTH_REMOVE), entrySelected);
}
else if (HIWORD(wParam) == LBN_KILLFOCUS) {
- bool entrySelected = (ListBox_GetCurSel(hList) != LB_ERR);
+ const bool entrySelected = (ListBox_GetCurSel(hList) != LB_ERR);
Button_Enable(GetDlgItem(hDlg, IDC_BLUETOOTH_EDIT), entrySelected);
Button_Enable(GetDlgItem(hDlg, IDC_BLUETOOTH_REMOVE), entrySelected);
}
}
} else if (LOWORD(wParam) == IDC_BLUETOOTH_EDIT) {
HWND hList = GetDlgItem(hDlg, IDC_BLUETOOTH_LIST);
- WPARAM sel = ListBox_GetCurSel(hList);
+ const WPARAM sel = ListBox_GetCurSel(hList);
if (sel != LB_ERR) {
- int len = ListBox_GetTextLen(hList, sel);
+ const int len = ListBox_GetTextLen(hList, sel);
wchar_t* textBuf = nullptr;
if (len != LB_ERR) {
if ((textBuf = new wchar_t[static_cast<size_t>(len) + 1]) != nullptr) {
}
} else if (LOWORD(wParam) == IDC_BLUETOOTH_REMOVE) {
HWND hList = GetDlgItem(hDlg, IDC_BLUETOOTH_LIST);
- WPARAM sel = ListBox_GetCurSel(hList);
+ const WPARAM sel = ListBox_GetCurSel(hList);
if (sel != LB_ERR) {
ListBox_DeleteString(hList, sel);
if (ListBox_GetCount(hList) == 0) {
static void SetCheckButton(HWND hBtn, const WMSettings& settings, SettingsKey key)
{
- DWORD enabled = !!settings.QueryValue(key);
+ const DWORD enabled = !!settings.QueryValue(key);
Button_SetCheck(hBtn, enabled ? BST_CHECKED : BST_UNCHECKED);
}
static void SetOption(HWND hBtn, WMSettings& settings, SettingsKey key)
{
- int enable = Button_GetCheck(hBtn) == BST_CHECKED;
+ const int enable = Button_GetCheck(hBtn) == BST_CHECKED;
settings.SetValue(key, enable);
}
case WM_COMMAND:
{
if (LOWORD(wParam) == IDC_ENABLE_WIFI_MUTE) {
- DWORD checked = Button_GetCheck(GetDlgItem(hDlg, IDC_ENABLE_WIFI_MUTE));
+ const DWORD checked = Button_GetCheck(GetDlgItem(hDlg, IDC_ENABLE_WIFI_MUTE));
Button_Enable(GetDlgItem(hDlg, IDC_IS_PERMITLIST), checked == BST_CHECKED);
} else if (LOWORD(wParam) == IDC_WIFI_LIST) {
HWND hList = GetDlgItem(hDlg, IDC_WIFI_LIST);
if (HIWORD(wParam) == LBN_SELCHANGE || HIWORD(wParam) == LBN_SELCANCEL) {
- bool entrySelected = (ListBox_GetCurSel(hList) != LB_ERR);
+ const bool entrySelected = (ListBox_GetCurSel(hList) != LB_ERR);
Button_Enable(GetDlgItem(hDlg, IDC_WIFI_EDIT), entrySelected);
Button_Enable(GetDlgItem(hDlg, IDC_WIFI_REMOVE), entrySelected);
} else if (HIWORD(wParam) == LBN_KILLFOCUS) {
- bool entrySelected = (ListBox_GetCurSel(hList) != LB_ERR);
+ const bool entrySelected = (ListBox_GetCurSel(hList) != LB_ERR);
Button_Enable(GetDlgItem(hDlg, IDC_WIFI_EDIT), entrySelected);
Button_Enable(GetDlgItem(hDlg, IDC_WIFI_REMOVE), entrySelected);
}
}
} else if (LOWORD(wParam) == IDC_WIFI_EDIT) {
HWND hList = GetDlgItem(hDlg, IDC_WIFI_LIST);
- WPARAM sel = ListBox_GetCurSel(hList);
+ const WPARAM sel = ListBox_GetCurSel(hList);
if (sel != LB_ERR) {
- int len = ListBox_GetTextLen(hList, sel);
+ const int len = ListBox_GetTextLen(hList, sel);
wchar_t *textBuf = nullptr;
if (len != LB_ERR) {
if ((textBuf = new wchar_t[static_cast<size_t>(len) + 1]) != nullptr) {
bool show);
void Hide();
void Show();
- bool IsShown() const { return iconVisible_; }
+ bool IsShown() const noexcept { return iconVisible_; }
void ChangeIcon(HICON hNewIcon);
void ChangeText(const std::wstring& tooltip);
void ShowPopup(const std::wstring& title, const std::wstring& text) const;
#ifndef _versionhelpers_H_INCLUDED_ // avoid conflict with MS versionhelpers
-inline bool IsWindowsVersionOrGreater(WORD wMajorVersion,
+inline bool IsWindowsVersionOrGreater(
+ WORD wMajorVersion,
WORD wMinorVersion,
- WORD wServicePackMajor)
+ WORD wServicePackMajor) noexcept
{
OSVERSIONINFOEXW osvi = { sizeof(osvi), 0, 0, 0, 0, { 0 }, 0, 0 };
DWORDLONG const dwlConditionMask = VerSetConditionMask(
}
HRESULT STDMETHODCALLTYPE VistaAudioSessionEvents::OnDisplayNameChanged(
- LPCWSTR /*newDisplayName*/, LPCGUID /*eventContext*/)
+ LPCWSTR /*newDisplayName*/, LPCGUID /*eventContext*/) noexcept
{
return S_OK;
}
HRESULT STDMETHODCALLTYPE VistaAudioSessionEvents::OnIconPathChanged(
- LPCWSTR /*newIconPath*/, LPCGUID /*eventContext*/)
+ LPCWSTR /*newIconPath*/, LPCGUID /*eventContext*/) noexcept
{
return S_OK;
}
HRESULT STDMETHODCALLTYPE VistaAudioSessionEvents::OnSimpleVolumeChanged(
- float /*newVolume*/, BOOL /*newMute*/, LPCGUID /*eventContext*/)
+ float /*newVolume*/, BOOL /*newMute*/, LPCGUID /*eventContext*/) noexcept
{
return S_OK;
}
HRESULT STDMETHODCALLTYPE VistaAudioSessionEvents::OnChannelVolumeChanged(
DWORD /*channelCount*/, float* /*newChannelVolumeArray[]*/,
- DWORD /*changedChannel*/, LPCGUID /*eventContext*/)
+ DWORD /*changedChannel*/, LPCGUID /*eventContext*/) noexcept
{
return S_OK;
}
HRESULT STDMETHODCALLTYPE VistaAudioSessionEvents::OnGroupingParamChanged(
- LPCGUID /*newGroupingParam*/, LPCGUID /*eventContext*/)
+ LPCGUID /*newGroupingParam*/, LPCGUID /*eventContext*/) noexcept
{
return S_OK;
}
HRESULT STDMETHODCALLTYPE VistaAudioSessionEvents::OnStateChanged(
- AudioSessionState /*newState*/)
+ AudioSessionState /*newState*/) noexcept
{
return S_OK;
}
* http://blogs.msdn.com/b/larryosterman/archive/2007/10/31/what-happens-when-audio-rendering-fails.aspx
* for detailed information about each of these entries */
HRESULT STDMETHODCALLTYPE VistaAudioSessionEvents::OnSessionDisconnected(
- AudioSessionDisconnectReason disconnectReason)
+ AudioSessionDisconnectReason disconnectReason) noexcept
{
switch (disconnectReason) {
// Notification methods for audio session events
HRESULT STDMETHODCALLTYPE OnDisplayNameChanged(
LPCWSTR newDisplayName,
- LPCGUID eventContext);
+ LPCGUID eventContext) noexcept override;
HRESULT STDMETHODCALLTYPE OnIconPathChanged(
LPCWSTR newIconPath,
- LPCGUID eventContext);
+ LPCGUID eventContext) noexcept override;
HRESULT STDMETHODCALLTYPE OnSimpleVolumeChanged(
float newVolume,
BOOL newMute,
- LPCGUID eventContext);
+ LPCGUID eventContext) noexcept override;
HRESULT STDMETHODCALLTYPE OnChannelVolumeChanged(
DWORD channelCount,
float newChannelVolumeArray[],
DWORD changedChannel,
- LPCGUID eventContext);
+ LPCGUID eventContext) noexcept override;
HRESULT STDMETHODCALLTYPE OnGroupingParamChanged(
LPCGUID newGroupingParam,
- LPCGUID eventContext);
+ LPCGUID eventContext) noexcept override;
- HRESULT STDMETHODCALLTYPE OnStateChanged(AudioSessionState newState);
+ HRESULT STDMETHODCALLTYPE OnStateChanged(
+ AudioSessionState newState) noexcept override;
HRESULT STDMETHODCALLTYPE OnSessionDisconnected(
- AudioSessionDisconnectReason disconnectReason);
+ AudioSessionDisconnectReason disconnectReason) noexcept override;
private:
LONG ref_;
return true;
}
-void WMSettings::Unload()
+void WMSettings::Unload() noexcept
{
RegCloseKey(hSettingsKey_);
hSettingsKey_ = nullptr;
WMSettings& operator=(const WMSettings&) = delete;
bool Init();
- void Unload();
+ void Unload() noexcept;
bool IsAutostartEnabled();
void EnableAutostart(bool enable);
class WifiDetector {
public:
- WifiDetector();
+ WifiDetector() noexcept;
~WifiDetector();
WifiDetector(const WifiDetector&) = delete;
+ WifiDetector(WifiDetector&&) = delete;
WifiDetector& operator=(const WifiDetector&) = delete;
+ WifiDetector &operator=(WifiDetector&&) = delete;
bool Init(HWND hNotifyWnd);
- void Unload();
+ void Unload() noexcept;
void SetNetworkList(const std::vector<std::wstring>& networks, bool isMuteList);
void CheckNetwork();
}
-WifiDetector::WifiDetector()
+WifiDetector::WifiDetector() noexcept
: hNotifyWnd_(nullptr), wlanHandle_(nullptr), isMuteList_(true), initialized_(false)
{
}
{
}
-void WifiDetector::Unload()
+void WifiDetector::Unload() noexcept
{
if (initialized_) {
WlanRegisterNotification(wlanHandle_, WLAN_NOTIFICATION_SOURCE_NONE,
PrintWindowsError(L"WlanEnumInterfaces", wlanErr);
} else {
for (; ifList->dwIndex < ifList->dwNumberOfItems; ++ifList->dwIndex) {
- PWLAN_AVAILABLE_NETWORK_LIST availList;
+ PWLAN_AVAILABLE_NETWORK_LIST availList = nullptr;
wlanErr = WlanGetAvailableNetworkList(
wlanHandle_,
&ifList->InterfaceInfo[ifList->dwIndex].InterfaceGuid,
PrintWindowsError(L"WlanGetAvailableNetworkList", wlanErr);
} else {
for (; availList->dwIndex < availList->dwNumberOfItems; ++availList->dwIndex) {
- PWLAN_AVAILABLE_NETWORK net = &availList->Network[availList->dwIndex];
+ const PWLAN_AVAILABLE_NETWORK net = &availList->Network[availList->dwIndex];
if (net->dwFlags & WLAN_AVAILABLE_NETWORK_CONNECTED) {
const auto it = std::find(std::begin(networks_),
std::end(networks_),
net->strProfileName);
if (isMuteList_ && it != std::end(networks_)
|| !isMuteList_ && it == std::end(networks_)) {
- size_t profileNameLen = lstrlen(net->strProfileName);
+ const size_t profileNameLen = lstrlen(net->strProfileName);
wchar_t* wiFiName = new wchar_t[profileNameLen + 1];
StringCchCopy(wiFiName, profileNameLen + 1, net->strProfileName);
SendMessage(hNotifyWnd_, WM_WIFISTATUSCHANGED, 1,
// </Init Common Controls>
// <Init COM>
- if (CoInitializeEx(0, COINIT_APARTMENTTHREADED) != S_OK) {
+ if (CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED) != S_OK) {
TaskDialog(nullptr,
nullptr,
PROGRAM_NAME,
return FALSE;
}
- MSG msg = { 0 };
+ MSG msg = { nullptr };
WinMute program;
if (program.Init()) {
while (GetMessage(&msg, nullptr, 0, 0)) {
return rc;
}
-static bool IsCurrentSessionRemoteable()
+static bool IsCurrentSessionRemoteable() noexcept
{
bool isRemoteable = false;
lResult = RegOpenKeyExW(HKEY_LOCAL_MACHINE, TERMINAL_SERVER_KEY, 0, KEY_READ, &hRegKey);
if (lResult == ERROR_SUCCESS) {
- DWORD dwGlassSessionId;
+ DWORD dwGlassSessionId = 0;
DWORD cbGlassSessionId = sizeof(dwGlassSessionId);
DWORD dwType;
{
}
-WinMute::~WinMute()
+WinMute::~WinMute() noexcept
{
Unload();
}
settings_.SetValue(SettingsKey::MUTE_ON_BLUETOOTH, FALSE);
} else {
muteCtrl_.SetMuteOnBluetoothDisconnect(true);
- bool muteOnWithDeviceList = settings_.QueryValue(SettingsKey::MUTE_ON_BLUETOOTH_DEVICELIST);
+ const bool muteOnWithDeviceList = settings_.QueryValue(SettingsKey::MUTE_ON_BLUETOOTH_DEVICELIST);
btDetector_.SetDeviceList(settings_.GetBluetoothDevicesA(), muteOnWithDeviceList);
}
}
L"WLAN muting will be disabled on this computer");
settings_.SetValue(SettingsKey::MUTE_ON_WLAN, FALSE);
} else {
- bool isMuteList = !settings_.QueryValue(SettingsKey::MUTE_ON_WLAN_ALLOWLIST);
+ const bool isMuteList = !settings_.QueryValue(SettingsKey::MUTE_ON_WLAN_ALLOWLIST);
wifiDetector_.SetNetworkList(settings_.GetWifiNetworks(), isMuteList);
wifiDetector_.CheckNetwork();
}
return true;
}
-void WinMute::ToggleMenuCheck(UINT item, bool* setting)
+void WinMute::ToggleMenuCheck(UINT item, bool* setting) noexcept
{
UINT state = GetMenuState(hTrayMenu_, item, MF_BYCOMMAND);
if (state & MF_CHECKED) {
return DefWindowProc(hWnd, msg, wParam, lParam);
}
-void WinMute::Unload()
+void WinMute::Unload() noexcept
{
settings_.Unload();
}
class WinMute {
public:
WinMute();
- ~WinMute();
+ WinMute(const WinMute&) = delete;
+ WinMute(WinMute&&) = delete;
+ WinMute& operator=(const WinMute &) = delete;
+ WinMute& operator=(WinMute&&) = delete;
+ ~WinMute() noexcept;
bool Init();
void Close();
bool InitTrayMenu();
bool LoadSettings();
- void Unload();
-
- void ToggleMenuCheck(UINT item, bool* setting);
+ void Unload() noexcept;
- // Disable copying
- WinMute(const WinMute&) = delete;
- WinMute& operator=(const WinMute&) = delete;
+ void ToggleMenuCheck(UINT item, bool* setting) noexcept;
};