summaryrefslogtreecommitdiff
path: root/plugins/AutoShutdown/src/settingsdlg.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/AutoShutdown/src/settingsdlg.cpp')
-rw-r--r--plugins/AutoShutdown/src/settingsdlg.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/plugins/AutoShutdown/src/settingsdlg.cpp b/plugins/AutoShutdown/src/settingsdlg.cpp
index 3109286671..bb39c0fc18 100644
--- a/plugins/AutoShutdown/src/settingsdlg.cpp
+++ b/plugins/AutoShutdown/src/settingsdlg.cpp
@@ -81,7 +81,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
}
/* read-in watcher flags */
{
- WORD watcherType = db_get_w(NULL, MODULENAME, "WatcherFlags", SETTING_WATCHERFLAGS_DEFAULT);
+ WORD watcherType = g_plugin.getWord("WatcherFlags", SETTING_WATCHERFLAGS_DEFAULT);
CheckRadioButton(hwndDlg, IDC_RADIO_STTIME, IDC_RADIO_STCOUNTDOWN, (watcherType&SDWTF_ST_TIME) ? IDC_RADIO_STTIME : IDC_RADIO_STCOUNTDOWN);
CheckDlgButton(hwndDlg, IDC_CHECK_SPECIFICTIME, (watcherType&SDWTF_SPECIFICTIME) != 0 ? BST_CHECKED : BST_UNCHECKED);
CheckDlgButton(hwndDlg, IDC_CHECK_MESSAGE, (watcherType&SDWTF_MESSAGE) != 0 ? BST_CHECKED : BST_UNCHECKED);
@@ -93,14 +93,14 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
/* read-in countdown val */
{
SYSTEMTIME st;
- if (!TimeStampToSystemTime((time_t)db_get_dw(NULL, MODULENAME, "TimeStamp", SETTING_TIMESTAMP_DEFAULT), &st))
+ if (!TimeStampToSystemTime((time_t)g_plugin.getDword("TimeStamp", SETTING_TIMESTAMP_DEFAULT), &st))
GetLocalTime(&st);
DateTime_SetSystemtime(GetDlgItem(hwndDlg, IDC_TIME_TIMESTAMP), GDT_VALID, &st);
DateTime_SetSystemtime(GetDlgItem(hwndDlg, IDC_DATE_TIMESTAMP), GDT_VALID, &st);
SendMessage(hwndDlg, M_CHECK_DATETIME, 0, 0);
}
{
- DWORD setting = db_get_dw(NULL, MODULENAME, "Countdown", SETTING_COUNTDOWN_DEFAULT);
+ DWORD setting = g_plugin.getDword("Countdown", SETTING_COUNTDOWN_DEFAULT);
if (setting < 1) setting = SETTING_COUNTDOWN_DEFAULT;
SendDlgItemMessage(hwndDlg, IDC_SPIN_COUNTDOWN, UDM_SETRANGE, 0, MAKELPARAM(UD_MAXVAL, 1));
SendDlgItemMessage(hwndDlg, IDC_EDIT_COUNTDOWN, EM_SETLIMITTEXT, (WPARAM)10, 0);
@@ -109,7 +109,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
}
{
HWND hwndCombo = GetDlgItem(hwndDlg, IDC_COMBO_COUNTDOWNUNIT);
- DWORD lastUnit = db_get_dw(NULL, MODULENAME, "CountdownUnit", SETTING_COUNTDOWNUNIT_DEFAULT);
+ DWORD lastUnit = g_plugin.getDword("CountdownUnit", SETTING_COUNTDOWNUNIT_DEFAULT);
SendMessage(hwndCombo, CB_SETLOCALE, (WPARAM)locale, 0); /* sort order */
SendMessage(hwndCombo, CB_INITSTORAGE, _countof(unitNames), _countof(unitNames) * 16); /* approx. */
for (int i = 0; i < _countof(unitNames); ++i) {
@@ -122,14 +122,14 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
}
{
DBVARIANT dbv;
- if (!db_get_ws(NULL, MODULENAME, "Message", &dbv)) {
+ if (!g_plugin.getWString("Message", &dbv)) {
SetDlgItemText(hwndDlg, IDC_EDIT_MESSAGE, dbv.pwszVal);
mir_free(dbv.pwszVal);
}
}
/* cpuusage threshold */
{
- BYTE setting = DBGetContactSettingRangedByte(NULL, MODULENAME, "CpuUsageThreshold", SETTING_CPUUSAGETHRESHOLD_DEFAULT, 1, 100);
+ BYTE setting = DBGetContactSettingRangedByte(0, MODULENAME, "CpuUsageThreshold", SETTING_CPUUSAGETHRESHOLD_DEFAULT, 1, 100);
SendDlgItemMessage(hwndDlg, IDC_SPIN_CPUUSAGE, UDM_SETRANGE, 0, MAKELPARAM(100, 1));
SendDlgItemMessage(hwndDlg, IDC_EDIT_CPUUSAGE, EM_SETLIMITTEXT, (WPARAM)3, 0);
SendDlgItemMessage(hwndDlg, IDC_SPIN_CPUUSAGE, UDM_SETPOS, 0, MAKELPARAM(setting, 0));
@@ -138,7 +138,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
/* shutdown types */
{
HWND hwndCombo = GetDlgItem(hwndDlg, IDC_COMBO_SHUTDOWNTYPE);
- BYTE lastShutdownType = db_get_b(NULL, MODULENAME, "ShutdownType", SETTING_SHUTDOWNTYPE_DEFAULT);
+ BYTE lastShutdownType = g_plugin.getByte("ShutdownType", SETTING_SHUTDOWNTYPE_DEFAULT);
SendMessage(hwndCombo, CB_SETLOCALE, (WPARAM)locale, 0); /* sort order */
SendMessage(hwndCombo, CB_SETEXTENDEDUI, TRUE, 0);
SendMessage(hwndCombo, CB_INITSTORAGE, SDSDT_MAX, SDSDT_MAX * 32);
@@ -340,7 +340,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
wchar_t *pszText = (wchar_t*)mir_alloc(len*sizeof(wchar_t));
if (pszText != nullptr && GetWindowText(hwndEdit, pszText, len + 1)) {
TrimString(pszText);
- db_set_ws(NULL, MODULENAME, "Message", pszText);
+ g_plugin.setWString("Message", pszText);
}
mir_free(pszText); /* does NULL check */
}
@@ -351,18 +351,18 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
DateTime_GetSystemtime(GetDlgItem(hwndDlg, IDC_TIME_TIMESTAMP), &st); /* time gets synchronized */
if (!SystemTimeToTimeStamp(&st, &timestamp))
timestamp = time(0);
- db_set_dw(NULL, MODULENAME, "TimeStamp", (DWORD)timestamp);
+ g_plugin.setDword("TimeStamp", (DWORD)timestamp);
}
/* shutdown type */
{
int index = SendDlgItemMessage(hwndDlg, IDC_COMBO_SHUTDOWNTYPE, CB_GETCURSEL, 0, 0);
if (index != LB_ERR)
- db_set_b(NULL, MODULENAME, "ShutdownType", (BYTE)SendDlgItemMessage(hwndDlg, IDC_COMBO_SHUTDOWNTYPE, CB_GETITEMDATA, (WPARAM)index, 0));
+ g_plugin.setByte("ShutdownType", (BYTE)SendDlgItemMessage(hwndDlg, IDC_COMBO_SHUTDOWNTYPE, CB_GETITEMDATA, (WPARAM)index, 0));
index = SendDlgItemMessage(hwndDlg, IDC_COMBO_COUNTDOWNUNIT, CB_GETCURSEL, 0, 0);
if (index != LB_ERR)
- db_set_dw(NULL, MODULENAME, "CountdownUnit", (DWORD)SendDlgItemMessage(hwndDlg, IDC_COMBO_COUNTDOWNUNIT, CB_GETITEMDATA, (WPARAM)index, 0));
- db_set_dw(NULL, MODULENAME, "Countdown", (DWORD)GetDlgItemInt(hwndDlg, IDC_EDIT_COUNTDOWN, nullptr, FALSE));
- db_set_b(NULL, MODULENAME, "CpuUsageThreshold", (BYTE)GetDlgItemInt(hwndDlg, IDC_EDIT_CPUUSAGE, nullptr, FALSE));
+ g_plugin.setDword("CountdownUnit", (DWORD)SendDlgItemMessage(hwndDlg, IDC_COMBO_COUNTDOWNUNIT, CB_GETITEMDATA, (WPARAM)index, 0));
+ g_plugin.setDword("Countdown", (DWORD)GetDlgItemInt(hwndDlg, IDC_EDIT_COUNTDOWN, nullptr, FALSE));
+ g_plugin.setByte("CpuUsageThreshold", (BYTE)GetDlgItemInt(hwndDlg, IDC_EDIT_CPUUSAGE, nullptr, FALSE));
}
/* watcher type */
{
@@ -373,7 +373,7 @@ static INT_PTR CALLBACK SettingsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L
if (IsDlgButtonChecked(hwndDlg, IDC_CHECK_IDLE)) watcherType |= SDWTF_IDLE;
if (IsDlgButtonChecked(hwndDlg, IDC_CHECK_STATUS)) watcherType |= SDWTF_STATUS;
if (IsDlgButtonChecked(hwndDlg, IDC_CHECK_CPUUSAGE)) watcherType |= SDWTF_CPUUSAGE;
- db_set_w(NULL, MODULENAME, "WatcherFlags", watcherType);
+ g_plugin.setWord("WatcherFlags", watcherType);
ServiceStartWatcher(0, watcherType);
}
DestroyWindow(hwndDlg);