]> repos.lx-s.de Git - winmute.git/commitdiff
New About Dialog.
authorAlexander Steinhöfer <alexander@steinhoefer.net>
Tue, 5 Apr 2022 12:21:07 +0000 (14:21 +0200)
committerAlexander Steinhöfer <alexander@steinhoefer.net>
Tue, 5 Apr 2022 12:21:07 +0000 (14:21 +0200)
15 files changed:
WinMute/AboutDlg.cpp
WinMute/MuteControl.cpp
WinMute/SettingsDlg.cpp
WinMute/Settings_QuietHoursDlg.cpp
WinMute/WMLog.cpp [moved from WinMute/Log.cpp with 93% similarity]
WinMute/WMLog.h [moved from WinMute/Log.h with 94% similarity]
WinMute/WMSettings.cpp [moved from WinMute/Settings.cpp with 93% similarity]
WinMute/WMSettings.h [moved from WinMute/Settings.h with 92% similarity]
WinMute/WinMute.cpp
WinMute/WinMute.h
WinMute/WinMute.rc
WinMute/WinMute.vcxproj
WinMute/WinMute.vcxproj.filters
WinMute/common.h
WinMute/resource.h

index 01ccd83851926d02f53287426c3447d126873692..1c84c297459f77baa1cf170f868326eeeb1c65c2 100644 (file)
@@ -33,35 +33,227 @@ POSSIBILITY OF SUCH DAMAGE.
 
 #include "common.h"
 
-INT_PTR CALLBACK AboutDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+static const TCHAR *licenseText = _T("\
+WinMute\r\n\
+Copyright(c) 2022, Alexander Steinhoefer\r\n\
+\r\n\
+-----------------------------------------------------------------------------\r\n\
+Redistribution and use in source and binary forms, with or without\r\n\
+modification, are permitted provided that the following conditions are met:\r\n\
+\r\n\
+ * Redistributions of source code must retain the above copyright notice,\r\n\
+   this list of conditions and the following disclaimer.\r\n\
+\r\n\
+ * Redistributions in binary form must reproduce the above copyright\r\n\
+   notice, this list of conditions and the following disclaimer in the\r\n\
+   documentation and /or other materials provided with the distribution.\r\n\
+\r\n\
+ * Neither the name of the author nor the names of its contributors may\r\n\
+   be used to endorse or promote products derived from this software\r\n\
+   without specific prior written permission.\r\n\
+\r\n\
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\r\n\
+\"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\r\n\
+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\r\n\
+FOR A PARTICULAR PURPOSE ARE DISCLAIMED.IN NO EVENT SHALL THE\r\n\
+COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\r\n\
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING,\r\n\
+BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\r\n\
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\r\n\
+CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r\n\
+LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY\r\n\
+WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n\
+POSSIBILITY OF SUCH DAMAGE.\r\n\
+");
+
+static const TCHAR *aboutText = _T("\
+WinMute is developed by Alexander Steinhoefer\r\n\
+in his spare time.\r\n\
+\r\n\
+The code as well as new releases for this tool\r\n\
+can be found on GitHub.\r\n\
+Contributions in the form of code, tickets or\r\n\
+feature requests are very welcome.\r\n\
+\r\n\
+Thank your for using this little tool!\r\n\
+");
+
+enum AboutTabsIDs {
+   ABOUT_TAB_GENERAL = 0,
+   ABOUT_TAB_LICENSE,
+   ABOUT_TAB_COUNT
+};
+
+struct AboutDlgData {
+   HWND hTabCtrl;
+   HWND hTabs[ABOUT_TAB_COUNT];
+   HWND hActiveTab;
+   HFONT hTitleFont;
+
+   AboutDlgData()
+      : hTabCtrl(NULL), hActiveTab(NULL), hTitleFont(NULL)
+   {
+      ZeroMemory(hTabs, sizeof(hTabs));
+   }
+};
+
+static void InsertTabItem(HWND hTabCtrl, UINT id, const TCHAR* itemName)
+{
+   constexpr int bufSize = 50;
+   TCHAR buf[bufSize];
+   TC_ITEM tcItem;
+   ZeroMemory(&tcItem, sizeof(tcItem));
+   tcItem.mask |= TCIF_TEXT;
+   StringCchCopy(buf, bufSize, itemName);
+   tcItem.pszText = buf;
+   tcItem.cchTextMax = bufSize;
+
+   TabCtrl_InsertItem(hTabCtrl, id, &tcItem);
+}
+
+static void SwitchTab(AboutDlgData* dlgData, HWND hNewTab)
+{
+   if (dlgData->hActiveTab != NULL) {
+      ShowWindow(dlgData->hActiveTab, SW_HIDE);
+   }
+   dlgData->hActiveTab = hNewTab;
+   ShowWindow(dlgData->hActiveTab, SW_SHOW);
+}
+
+static void ResizeTab(HWND hTabCtrl, HWND hTabPage)
+{
+   RECT r = { 0 };
+   GetClientRect(hTabPage, &r);
+   TabCtrl_AdjustRect(hTabCtrl, FALSE, &r);
+   MoveWindow(hTabPage, r.left, r.top, r.right, r.bottom, TRUE);
+}
+
+static INT_PTR CALLBACK About_GeneralDlgProc(HWND hDlg, UINT msg, WPARAM, LPARAM lParam)
 {
    switch (msg) {
    case WM_INITDIALOG:
-      return TRUE;
-   case WM_COMMAND:
-      if (LOWORD(wParam) == IDOK) {
-         EndDialog(hDlg, 0);
+      if (IsAppThemed()) {
+         EnableThemeDialogTexture(hDlg, ETDT_ENABLETAB);
       }
-      return 0;
-   case WM_NOTIFY:
-   {
-      PNMLINK pNmLink = (PNMLINK)lParam;
-      switch (pNmLink->hdr.code) {
-      case NM_CLICK:
-      case NM_RETURN:
-      {
+      Edit_SetText(GetDlgItem(hDlg, IDC_ABOUTTEXT), aboutText);
+      return TRUE;
+   case WM_NOTIFY: {
+      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;
-         if ((ctrlId == IDC_LINK_HOMEPAGE || ctrlId == IDC_LINK_SUPPORT)
+         if ((ctrlId == IDC_LINK_HOMEPAGE
+              || ctrlId == IDC_LINK_TICKETS
+              || ctrlId == IDC_LINK_PROJECT)
             && item.iLink == 0) {
             ShellExecute(nullptr, _T("open"), item.szUrl, nullptr, nullptr,
                SW_SHOW);
          }
-         break;
       }
+      return TRUE;
+   }
+   default:
+      break;
+   }
+   return FALSE;
+}
+
+static INT_PTR CALLBACK About_LicenseDlgProc(HWND hDlg, UINT msg, WPARAM, LPARAM)
+{
+   switch (msg) {
+   case WM_INITDIALOG:
+      if (IsAppThemed()) {
+         EnableThemeDialogTexture(hDlg, ETDT_ENABLETAB);
+      }
+      Edit_SetText(GetDlgItem(hDlg, IDC_LICENSETEXT), licenseText);
+      return TRUE;
+   default:
+      break;
+   }
+   return FALSE;
+}
+
+INT_PTR CALLBACK AboutDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+   AboutDlgData* dlgData =
+      reinterpret_cast<AboutDlgData*>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
+   switch (msg) {
+   case WM_INITDIALOG: {
+      dlgData = new AboutDlgData();
+      SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(dlgData));
+
+      dlgData->hTabCtrl = GetDlgItem(hDlg, IDC_ABOUT_TAB);
+
+      InsertTabItem(dlgData->hTabCtrl, ABOUT_TAB_GENERAL, _T("WinMute"));
+      InsertTabItem(dlgData->hTabCtrl, ABOUT_TAB_LICENSE, _T("License"));
+
+      dlgData->hTabs[ABOUT_TAB_GENERAL] = CreateDialog(
+         nullptr,
+         MAKEINTRESOURCE(IDD_ABOUT_WINMUTE),
+         dlgData->hTabCtrl,
+         About_GeneralDlgProc);
+      dlgData->hTabs[ABOUT_TAB_LICENSE] = CreateDialog(
+         nullptr,
+         MAKEINTRESOURCE(IDD_ABOUT_LICENSE),
+         dlgData->hTabCtrl,
+         About_LicenseDlgProc);
+
+      // Init tab pages
+      for (int i = 0; i < ABOUT_TAB_COUNT; ++i) {
+         HWND hCurTab = dlgData->hTabs[i];
+         ShowWindow(hCurTab, SW_HIDE);
+         ResizeTab(dlgData->hTabCtrl, hCurTab);
       }
+
+      SwitchTab(dlgData, dlgData->hTabs[ABOUT_TAB_GENERAL]);
+
+      // Set title font
+      LOGFONT font;
+      font.lfHeight = 32;
+      font.lfWidth = 0;
+      font.lfEscapement = 0;
+      font.lfOrientation = 0;
+      font.lfWeight = FW_BOLD;
+      font.lfItalic = false;
+      font.lfUnderline = false;
+      font.lfStrikeOut = false;
+      font.lfEscapement = 0;
+      font.lfOrientation = 0;
+      font.lfOutPrecision = OUT_DEFAULT_PRECIS;
+      font.lfClipPrecision = CLIP_STROKE_PRECIS | CLIP_MASK | CLIP_TT_ALWAYS | CLIP_LH_ANGLES;
+      font.lfQuality = CLEARTYPE_QUALITY;
+      font.lfPitchAndFamily = VARIABLE_PITCH | FF_ROMAN;
+      lstrcpy(font.lfFaceName, _T("Segoe UI"));
+
+      dlgData->hTitleFont = CreateFontIndirect(&font);
+      SendMessage(
+         GetDlgItem(hDlg, IDC_ABOUT_TITLE),
+         WM_SETFONT,
+         reinterpret_cast<WPARAM>(dlgData->hTitleFont),
+         TRUE);
       return TRUE;
    }
+   case WM_NOTIFY: {
+      const LPNMHDR lpnmhdr = reinterpret_cast<LPNMHDR>(lParam);
+      if (lpnmhdr->code == TCN_SELCHANGE
+         && lpnmhdr->hwndFrom == dlgData->hTabCtrl) {
+         const int curSel = TabCtrl_GetCurSel(dlgData->hTabCtrl);
+         if (curSel >= 0 && curSel <= ABOUT_TAB_COUNT) {
+            SwitchTab(dlgData, dlgData->hTabs[curSel]);
+         }
+      }
+      return 0;
+   }
+   case WM_COMMAND:
+      if (LOWORD(wParam) == IDOK) {
+         EndDialog(hDlg, 0);
+      }
+      return 0;
+   case WM_DESTROY:
+      DeleteObject(dlgData->hTitleFont);
+      delete dlgData;
+      SetWindowLongPtr(hDlg, GWLP_USERDATA, NULL);
+      return 0;
    case WM_CLOSE:
       EndDialog(hDlg, 0);
       return TRUE;
index 7610c5be4bf87831a4b7089d19c5ae3d9f3d06ee..bf00b13c293f1ec7871320646ecffa320730fc23 100644 (file)
@@ -73,7 +73,7 @@ bool MuteControl::Init(HWND hParent)
 
 void MuteControl::SetMute(bool mute)
 {
-   Log::GetInstance().Write(_T("Manual muting: {}"), mute ? _T("on") : _T("off"));
+   WMLog::GetInstance().Write(_T("Manual muting: {}"), mute ? _T("on") : _T("off"));
    winAudio_->SetMute(mute);
 }
 
@@ -94,14 +94,14 @@ void MuteControl::ConfigureWasAlreadyMuted()
 void MuteControl::RestoreVolume()
 {
    if (!restoreVolume_) {
-      Log::GetInstance().Write(_T("Restore is FALSE"));
+      WMLog::GetInstance().Write(_T("Restore is FALSE"));
       return;
    }
    bool restore = true;
    int i = 0;
    for (const auto& conf : muteConfig_) {
       if (conf.shouldMute && conf.active) {
-         Log::GetInstance().Write(_T("Entry {} found with ShouldMute: Yes and Active: Yes"), i);
+         WMLog::GetInstance().Write(_T("Entry {} found with ShouldMute: Yes and Active: Yes"), i);
          restore = false;
          //break;
       }
@@ -109,10 +109,10 @@ void MuteControl::RestoreVolume()
    }
    if (restore) {
       if (winAudio_->IsMuted() && !wasAlreadyMuted_) {
-         Log::GetInstance().Write(_T("Mute: Off"));
+         WMLog::GetInstance().Write(_T("Mute: Off"));
          winAudio_->SetMute(false);
       } else {
-         Log::GetInstance().Write(
+         WMLog::GetInstance().Write(
             _T("Skipping unmute since workstation was already muted."));
       }
    }
@@ -204,14 +204,14 @@ void MuteControl::NotifyRestoreCondition(int type, bool active)
    if (active) {
       ConfigureWasAlreadyMuted();
       muteConfig_[type].active = active;
-      Log::GetInstance().Write(_T("Condition {}: ACTIVE"), type);
+      WMLog::GetInstance().Write(_T("Condition {}: ACTIVE"), type);
       if (muteConfig_[type].shouldMute &&
          !winAudio_->IsMuted()) {
-         Log::GetInstance().Write(_T("Mute: On"));
+         WMLog::GetInstance().Write(_T("Mute: On"));
          winAudio_->SetMute(true);
       }
    } else {
-      Log::GetInstance().Write(_T("Condition {}: INACTIVE"), type);
+      WMLog::GetInstance().Write(_T("Condition {}: INACTIVE"), type);
       muteConfig_[type].active = active;
       RestoreVolume();
    }
@@ -246,7 +246,7 @@ void MuteControl::NotifyLogout()
 
 void MuteControl::NotifySuspend(bool /*active*/)
 {
-   Log::GetInstance().Write(_T("Suspend: START"));
+   WMLog::GetInstance().Write(_T("Suspend: START"));
    if (muteConfig_[MuteTypeSuspend].shouldMute) {
       winAudio_->SetMute(true);
    }
@@ -263,12 +263,12 @@ void MuteControl::NotifyQuietHours(bool active)
 {
    if (active) {
       ConfigureWasAlreadyMuted();
-      Log::GetInstance().Write(L"Quiet Hours startet");
+      WMLog::GetInstance().Write(L"Quiet Hours startet");
       if (!winAudio_->IsMuted()) {
          winAudio_->SetMute(true);
       }
    } else {
-      Log::GetInstance().Write(L"Quiet Hours ended");
+      WMLog::GetInstance().Write(L"Quiet Hours ended");
       RestoreVolume();
    }
 }
index dd4364a69152f0134764241e8aa7ad62729f0a69..4fac3cf12bad6b674835581f78b9c8448708fe7d 100644 (file)
@@ -44,9 +44,9 @@ struct SettingsDlgData {
    HWND hTabs[SETTINGS_TAB_COUNT];
 
    HWND hActiveTab;
-   Settings* settings;
+   WMSettings* settings;
 
-   SettingsDlgData(Settings* settings)
+   SettingsDlgData(WMSettings* settings)
       : settings(settings), hTabCtrl(NULL), hActiveTab(NULL)
    {
       ZeroMemory(hTabs, sizeof(hTabs));
@@ -94,7 +94,7 @@ INT_PTR CALLBACK SettingsDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lPar
    switch (msg) {
    case WM_INITDIALOG: {
       assert(dlgData == nullptr);
-      Settings* settings = reinterpret_cast<Settings*>(lParam);
+      WMSettings* settings = reinterpret_cast<WMSettings*>(lParam);
       dlgData = new SettingsDlgData(settings);
       SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(dlgData));
       
index 1bd20c3f021067dcbc0467d0be8b6d2d2c30643f..4e789e7899124e1a6a516a644b5d1c4b65b5f91d 100644 (file)
@@ -47,7 +47,7 @@ static bool IsValidTimeRange(
 }
 
 static bool SaveQuietHours(
-   Settings* settings,
+   WMSettings* settings,
    const int enabled,
    const int forceUnmute,
    const int showNotifications,
@@ -105,7 +105,7 @@ INT_PTR CALLBACK Settings_QuietHoursDlgProc(HWND hDlg, UINT msg, WPARAM wParam,
       HWND hStart = GetDlgItem(hDlg, IDC_QUIETHOURS_START);
       HWND hEnd = GetDlgItem(hDlg, IDC_QUIETHOURS_END);
 
-      Settings* settings = reinterpret_cast<Settings*>(lParam);
+      WMSettings* settings = reinterpret_cast<WMSettings*>(lParam);
       assert(settings != NULL);
       SetWindowLongPtr(hDlg, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(settings));
 
@@ -159,7 +159,7 @@ INT_PTR CALLBACK Settings_QuietHoursDlgProc(HWND hDlg, UINT msg, WPARAM wParam,
       HWND hNotify = GetDlgItem(hDlg, IDC_SHOWNOTIFICATIONS);
       HWND hStart = GetDlgItem(hDlg, IDC_QUIETHOURS_START);
       HWND hEnd = GetDlgItem(hDlg, IDC_QUIETHOURS_END);
-      Settings* settings = reinterpret_cast<Settings*>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
+      WMSettings* settings = reinterpret_cast<WMSettings*>(GetWindowLongPtr(hDlg, GWLP_USERDATA));
       int qhEnabled = Button_GetCheck(hEnable) == BST_CHECKED;
       int qhForceUnmute = Button_GetCheck(hForce) == BST_CHECKED;
       int qhNotifications = Button_GetCheck(hNotify) == BST_CHECKED;
similarity index 93%
rename from WinMute/Log.cpp
rename to WinMute/WMLog.cpp
index 99694ac7dee09a519f90a2b573570f389d9be3e2..c0934ea587d321a84f15532396c29b00e861aacb 100644 (file)
@@ -45,13 +45,13 @@ static bool OpenLogFile(std::ofstream& logFile)
    return logFile.is_open();
 }
 
-Log& Log::GetInstance()
+WMLog& WMLog::GetInstance()
 {
-   static Log log;
+   static WMLog log;
    return log;
 }
 
-Log::Log() :
+WMLog::WMLog() :
    initialized_(false)
 {
    if (OpenLogFile(logFile_)) {
@@ -59,19 +59,19 @@ Log::Log() :
    }
 }
 
-Log::~Log()
+WMLog::~WMLog()
 {
    if (initialized_) {
       logFile_.close();
    }
 }
 
-void Log::SetEnabled(bool enable)
+void WMLog::SetEnabled(bool enable)
 {
    enabled_ = enable;
 }
 
-void Log::WriteMessage(const tstring& msg)
+void WMLog::WriteMessage(const tstring& msg)
 {
    struct tm tm;
    auto now = std::chrono::system_clock::now();
@@ -90,7 +90,7 @@ void Log::WriteMessage(const tstring& msg)
    logFile_.flush();
 }
 
-void Log::Write(const tstring& msg)
+void WMLog::Write(const tstring& msg)
 {
    if (!initialized_ || !enabled_) {
       return;
similarity index 94%
rename from WinMute/Log.h
rename to WinMute/WMLog.h
index 0ea0f41b3e8ffc2d0c6206a98377e7bf36957a36..de4bcb3a2e76c42982c0f2ab1ca59c56d6b8b8a7 100644 (file)
@@ -35,9 +35,9 @@ POSSIBILITY OF SUCH DAMAGE.
 
 #include "common.h"
 
-class Log {
+class WMLog {
 public:
-   static Log& GetInstance();
+   static WMLog& GetInstance();
 
    void Write(const tstring& wmsg);
 
@@ -62,10 +62,10 @@ public:
    void SetEnabled(bool enable);
 
 private:
-   Log();
-   ~Log();
-   Log(const Log&) = delete;
-   Log& operator=(const Log&) = delete;
+   WMLog();
+   ~WMLog();
+   WMLog(const WMLog&) = delete;
+   WMLog& operator=(const WMLog&) = delete;
 
    void WriteMessage(const tstring& msg);
 
similarity index 93%
rename from WinMute/Settings.cpp
rename to WinMute/WMSettings.cpp
index 9aaf5df6a24c3af1bca87f9e3342f6a8a0e4836d..e5d8dd89893c5b6ddedd36e2ba27182ec504c0dc 100644 (file)
@@ -32,11 +32,9 @@ POSSIBILITY OF SUCH DAMAGE.
 */
 
 #include "common.h"
-#include "Settings.h"
 
 static const LPCWSTR LX_SYSTEMS_SUBKEY = _T("SOFTWARE\\lx-systems\\WinMute");
 
-
 static LPCWSTR KeyToStr(SettingsKey key)
 {
    LPCWSTR keyStr = nullptr;
@@ -77,22 +75,25 @@ static LPCWSTR KeyToStr(SettingsKey key)
    case SettingsKey::QUIETHOURS_END:
       keyStr = _T("QuietHoursEnd");
       break;
+   case SettingsKey::LOGGING_ENABLED:
+      keyStr = _T("Logging");
+      break;
    }
    return keyStr;
 }
 
 
-Settings::Settings() :
+WMSettings::WMSettings() :
    hRegSettingsKey_(nullptr)
 {
 }
 
-Settings::~Settings()
+WMSettings::~WMSettings()
 {
    Unload();
 }
 
-bool Settings::Init()
+bool WMSettings::Init()
 {
    if (hRegSettingsKey_ == nullptr) {
       DWORD regError = RegCreateKeyEx(
@@ -114,13 +115,13 @@ bool Settings::Init()
    return true;
 }
 
-void Settings::Unload()
+void WMSettings::Unload()
 {
    RegCloseKey(hRegSettingsKey_);
    hRegSettingsKey_ = nullptr;
 }
 
-DWORD Settings::QueryValue(SettingsKey key, DWORD defValue)
+DWORD WMSettings::QueryValue(SettingsKey key, DWORD defValue)
 {
    auto keyStr = KeyToStr(key);
    assert(keyStr != nullptr);
@@ -144,7 +145,7 @@ DWORD Settings::QueryValue(SettingsKey key, DWORD defValue)
    return value;
 }
 
-bool Settings::SetValue(SettingsKey key, DWORD value)
+bool WMSettings::SetValue(SettingsKey key, DWORD value)
 {
    auto keyStr = KeyToStr(key);
    assert(keyStr != nullptr);
similarity index 92%
rename from WinMute/Settings.h
rename to WinMute/WMSettings.h
index 5db7ae8767985f34ad42fff26008732849b2fc1b..ea8fd5ec9c79505054b124759d378810f3f003c7 100644 (file)
@@ -48,15 +48,16 @@ enum class SettingsKey {
    , QUIETHOURS_NOTIFICATIONS
    , QUIETHOURS_START
    , QUIETHOURS_END
+   , LOGGING_ENABLED
 };
 
-class Settings {
+class WMSettings {
 public:
-   Settings();
-   ~Settings();
+   WMSettings();
+   ~WMSettings();
 
-   Settings(const Settings&) = delete;
-   Settings& operator=(const Settings&) = delete;
+   WMSettings(const WMSettings&) = delete;
+   WMSettings& operator=(const WMSettings&) = delete;
 
    bool Init();
    void Unload();
index 8d6a0693ac69275f1747e70635a1ca3debe4897d..f1f624a51b83638ca9b5312d057c5e134c9bb55c 100644 (file)
@@ -159,7 +159,7 @@ bool WinMute::InitAudio()
    if (!muteCtrl_.Init(hWnd_)) {
       return false;
    }
-   Log::GetInstance().SetEnabled(true);
+   WMLog::GetInstance().SetEnabled(true);
 
    return true;
 }
@@ -179,8 +179,7 @@ bool WinMute::InitTrayMenu()
       !CHECK_MENU_ITEM(RESTOREAUDIO, muteCtrl_.GetRestoreVolume()) ||
       !CHECK_MENU_ITEM(MUTEONSUSPEND, muteCtrl_.GetMuteOnSuspend()) ||
       !CHECK_MENU_ITEM(MUTEONSHUTDOWN, muteCtrl_.GetMuteOnShutdown()) ||
-      !CHECK_MENU_ITEM(MUTEONLOGOUT, muteCtrl_.GetMuteOnLogout()) ||
-      !CHECK_MENU_ITEM(CONFIGUREQUIETHOURS, muteConfig_.quietHours.enabled)) {
+      !CHECK_MENU_ITEM(MUTEONLOGOUT, muteCtrl_.GetMuteOnLogout())) {
       return false;
    }
    return true;
@@ -295,14 +294,6 @@ LRESULT CALLBACK WinMute::WindowProc(
             hWnd_,
             AboutDlgProc);
          break;
-      case ID_TRAYMENU_CONFIGUREQUIETHOURS:
-         DialogBoxParam(
-            hglobInstance,
-            MAKEINTRESOURCE(IDD_QUIETHOURS),
-            hWnd_,
-            QuietHoursDlgProc,
-            reinterpret_cast<LPARAM>(&settings_));
-         break;
       case ID_TRAYMENU_EXIT:
          SendMessage(hWnd, WM_CLOSE, 0, 0);
          break;
@@ -594,7 +585,7 @@ void WinMute::ResetQuietHours()
 
       if (QuietHoursShouldAlreadyHaveStarted(&now, &start, &end)) {
          int timerQhEnd = GetDiffMillseconds(&end, &now);
-         Log::GetInstance().Write(L"Mute: On | Quiet hours have already started");
+         WMLog::GetInstance().Write(L"Mute: On | Quiet hours have already started");
          muteCtrl_.NotifyQuietHours(true);
          if (SetTimer(hWnd_, QUIETHOURS_TIMER_END_ID, timerQhEnd, QuietHoursTimer) == 0) {
             MessageBox(hWnd_, L"Failed to create Timer", PROGRAM_NAME, MB_OK);
index ff8a8c531837b8b91db85c56f0e2d8b440f5d85f..0db8eefa024b380dd629603bc84305a4ef696e42 100644 (file)
@@ -82,7 +82,7 @@ private:
 
    TrayIcon trayIcon_;
    ScreensaverNotifier scrnSaverNoti_;
-   Settings settings_;
+   WMSettings settings_;
    MuteControl muteCtrl_;
 
    bool RegisterWindowClass();
index 225ce8d68edf94116f66112778211a6d2b210d35..d7a318d40cba26d563104b571e9c57235699043b 100644 (file)
@@ -50,19 +50,15 @@ END
 // Dialog
 //
 
-IDD_ABOUT DIALOGEX 0, 0, 236, 56
+IDD_ABOUT DIALOGEX 0, 0, 313, 269
 STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_CAPTION
 CAPTION "About WinMute"
 FONT 8, "MS Shell Dlg", 400, 0, 0x1
 BEGIN
-    DEFPUSHBUTTON   "OK",IDOK,178,7,50,14
-    LTEXT           "WinMute v1.6.0",IDC_STATIC,35,7,82,10
-    LTEXT           "Copyright (c) 2020, Alexander Steinhöfer",IDC_STATIC,35,20,135,8
-    ICON            IDI_APP,IDC_STATIC,7,7,20,20,SS_CENTERIMAGE
-    CONTROL         "<a href=""https://lx-s.de"">lx-systems - lx-s.de</a>",IDC_LINK_HOMEPAGE,
-                    "SysLink",WS_TABSTOP,34,33,82,14
-    CONTROL         "<a href=""https://github.com/lx-s/WinMute/issues/"">Support</a>",IDC_LINK_SUPPORT,
-                    "SysLink",WS_TABSTOP,106,33,60,14
+    CONTROL         "",IDC_ABOUT_TAB,"SysTabControl32",0x0,7,34,299,202
+    PUSHBUTTON      "OK",IDOK,242,246,64,16
+    LTEXT           "WinMute 2.0",IDC_ABOUT_TITLE,41,7,193,23
+    ICON            IDI_APP,IDC_STATIC,13,7,21,20,SS_CENTERIMAGE
 END
 
 IDD_SETTINGS DIALOGEX 0, 0, 269, 253
@@ -100,6 +96,26 @@ BEGIN
     LTEXT           "End time:",IDC_STATIC,24,73,32,16
 END
 
+IDD_ABOUT_LICENSE DIALOGEX 0, 0, 300, 181
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+    EDITTEXT        IDC_LICENSETEXT,7,7,286,167,ES_CENTER | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER | WS_VSCROLL
+END
+
+IDD_ABOUT_WINMUTE DIALOGEX 0, 0, 298, 176
+STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
+FONT 8, "MS Shell Dlg", 400, 0, 0x1
+BEGIN
+    CONTROL         "<a href=""https://lx-s.de"">Author Site: www.lx-s.de</a>",IDC_LINK_HOMEPAGE,
+                    "SysLink",WS_TABSTOP,197,14,94,14
+    CONTROL         "<a href=""https://github.com/lx-s/WinMute/"">Project Site && Code</a>",IDC_LINK_PROJECT,
+                    "SysLink",WS_TABSTOP,197,32,94,14
+    EDITTEXT        IDC_ABOUTTEXT,7,14,182,155,ES_MULTILINE | ES_AUTOHSCROLL | ES_READONLY | NOT WS_BORDER
+    CONTROL         "<a href=""https://github.com/lx-s/WinMute/issues/"">Support</a>",IDC_LINK_TICKETS,
+                    "SysLink",WS_TABSTOP,197,49,94,14
+END
+
 
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -112,9 +128,9 @@ BEGIN
     IDD_ABOUT, DIALOG
     BEGIN
         LEFTMARGIN, 7
-        RIGHTMARGIN, 229
+        RIGHTMARGIN, 306
         TOPMARGIN, 7
-        BOTTOMMARGIN, 49
+        BOTTOMMARGIN, 262
     END
 
     IDD_SETTINGS, DIALOG
@@ -140,6 +156,22 @@ BEGIN
         TOPMARGIN, 7
         BOTTOMMARGIN, 170
     END
+
+    IDD_ABOUT_LICENSE, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 293
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 174
+    END
+
+    IDD_ABOUT_WINMUTE, DIALOG
+    BEGIN
+        LEFTMARGIN, 7
+        RIGHTMARGIN, 291
+        TOPMARGIN, 7
+        BOTTOMMARGIN, 169
+    END
 END
 #endif    // APSTUDIO_INVOKED
 
@@ -169,6 +201,17 @@ BEGIN
     0
 END
 
+IDD_ABOUT_LICENSE AFX_DIALOG_LAYOUT
+BEGIN
+    0,
+    100, 100, 100, 100
+END
+
+IDD_ABOUT_WINMUTE AFX_DIALOG_LAYOUT
+BEGIN
+    0
+END
+
 
 /////////////////////////////////////////////////////////////////////////////
 //
@@ -201,14 +244,13 @@ BEGIN
         MENUITEM SEPARATOR
         MENUITEM "Restore volume when returning", ID_TRAYMENU_RESTOREAUDIO, CHECKED
         MENUITEM SEPARATOR
-        MENUITEM "Configure Quiet Hours...",    ID_TRAYMENU_CONFIGUREQUIETHOURS
+        MENUITEM "Settings...",                 ID_TRAYMENU_SETTINGS
         MENUITEM SEPARATOR
         MENUITEM "Mute on (no volume restore)", ID_TRAYMENU_AFTERWARDS, INACTIVE
         MENUITEM "... Shutdown",                ID_TRAYMENU_MUTEONSHUTDOWN
         MENUITEM "... Sleep",                   ID_TRAYMENU_MUTEONSUSPEND
         MENUITEM "... Logout",                  ID_TRAYMENU_MUTEONLOGOUT
         MENUITEM SEPARATOR
-        MENUITEM "Settings...",                 ID_TRAYMENU_SETTINGS
         MENUITEM "Mute now",                    ID_TRAYMENU_MUTE
         MENUITEM SEPARATOR
         MENUITEM "Exit",                        ID_TRAYMENU_EXIT
index 4a6b042135fc35e29a937a82efe315d92552e68d..cac3d0264361bd690b93d9566a0bb43d0fe031e1 100644 (file)
   <ItemGroup>
     <ClInclude Include="BaseTypes.h" />
     <ClInclude Include="common.h" />
-    <ClInclude Include="Log.h" />
+    <ClInclude Include="WMLog.h" />
     <ClInclude Include="MMNotificationClient.h" />
     <ClInclude Include="MuteControl.h" />
     <ClInclude Include="QuietHours.h" />
     <ClInclude Include="resource.h" />
     <ClInclude Include="ScreensaverNotifier.h" />
-    <ClInclude Include="settings.h" />
+    <ClInclude Include="WMSettings.h" />
     <ClInclude Include="TrayIcon.h" />
     <ClInclude Include="VersionHelper.h" />
     <ClInclude Include="VistaAudioSessionEvents.h" />
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
     </ClCompile>
-    <ClCompile Include="Log.cpp" />
+    <ClCompile Include="WMLog.cpp" />
     <ClCompile Include="MMNotificationClient.cpp" />
     <ClCompile Include="MuteControl.cpp" />
     <ClCompile Include="QuietHours.cpp" />
-    <ClCompile Include="QuietHoursDlg.cpp" />
     <ClCompile Include="ScreensaverNotifier.cpp" />
-    <ClCompile Include="Settings.cpp" />
+    <ClCompile Include="WMSettings.cpp" />
     <ClCompile Include="SettingsDlg.cpp" />
     <ClCompile Include="Settings_GeneralDlg.cpp" />
     <ClCompile Include="Settings_QuietHoursDlg.cpp" />
index a6f7fa0fcadce4903603aa93995501c01c7817d4..5e7880228900a80514eba9d8a6611d778652dfc9 100644 (file)
     <ClInclude Include="ScreensaverNotifier.h">
       <Filter>Source Files\Base\Helper</Filter>
     </ClInclude>
-    <ClInclude Include="Log.h">
+    <ClInclude Include="WMLog.h">
       <Filter>Source Files\Base\Log</Filter>
     </ClInclude>
-    <ClInclude Include="settings.h">
+    <ClInclude Include="WMSettings.h">
       <Filter>Source Files\Base\Settings</Filter>
     </ClInclude>
     <ClInclude Include="VersionHelper.h">
     <ClCompile Include="Utility.cpp">
       <Filter>Source Files\Base\Helper</Filter>
     </ClCompile>
-    <ClCompile Include="Log.cpp">
+    <ClCompile Include="WMLog.cpp">
       <Filter>Source Files\Base\Log</Filter>
     </ClCompile>
-    <ClCompile Include="Settings.cpp">
+    <ClCompile Include="WMSettings.cpp">
       <Filter>Source Files\Base\Settings</Filter>
     </ClCompile>
     <ClCompile Include="WinMain.cpp">
     <ClCompile Include="AboutDlg.cpp">
       <Filter>Source Files\UI\Dialogs</Filter>
     </ClCompile>
-    <ClCompile Include="QuietHoursDlg.cpp">
-      <Filter>Source Files\UI\Dialogs</Filter>
-    </ClCompile>
     <ClCompile Include="TrayIcon.cpp">
       <Filter>Source Files\UI\TrayIcon</Filter>
     </ClCompile>
index 766268dbb22681bec71746c90b6067354ef03913..685a4396fcbb54e5bf89fb79dc5797568bc4a20e 100644 (file)
@@ -74,9 +74,9 @@ POSSIBILITY OF SUCH DAMAGE.
 #include "resource.h"
 
 #include "BaseTypes.h"
+#include "WMSettings.h"
 #include "ScreensaverNotifier.h"
-#include "Settings.h"
-#include "Log.h"
+#include "WMLog.h"
 #include "TrayIcon.h"
 #include "WinAudio.h"
 #include "MuteControl.h"
index f72273307c77fb7084152de15891293074972301..e818d52b100f6258903b987bb54843ef48c489a6 100644 (file)
 #define IDD_SETTINGS                    109
 #define IDD_SETTINGS_GENERAL            114
 #define IDD_SETTINGS_QUIETHOURS         116
+#define IDD_ABOUT_LICENSE               118
+#define IDD_ABOUT_WINMUTE               120
 #define IDC_LINK_HOMEPAGE               1001
 #define IDC_LINK_SUPPORT                1002
+#define IDC_LINK_PROJECT                1002
 #define IDC_ENABLEQUIETHOURS            1003
+#define IDC_LINK_TICKETS                1003
 #define IDC_QUIETHOURS_START            1004
 #define IDC_QUIETHOURS_END              1005
 #define IDC_FORCEUNMUTE                 1006
 #define IDC_CHECK1                      1011
 #define IDC_ENABLELOGGING               1012
 #define IDC_CHECK3                      1013
-#define IDC_BUTTON1                     1014
 #define IDC_OPENLOG                     1014
+#define IDC_LICENSETEXT                 1015
+#define IDC_ABOUT_TAB                   1016
+#define IDC_ABOUTTEXT                   1019
+#define IDC_TITLE                       1020
+#define IDC_ABOUT_TITLE                 1020
 #define ID_TRAYMENU_INFO                40001
 #define ID_TRAYMENU_                    40002
 #define ID_TRAYMENU_MUTEON              40003
@@ -55,9 +63,9 @@
 // 
 #ifdef APSTUDIO_INVOKED
 #ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE        118
+#define _APS_NEXT_RESOURCE_VALUE        122
 #define _APS_NEXT_COMMAND_VALUE         40026
-#define _APS_NEXT_CONTROL_VALUE         1015
+#define _APS_NEXT_CONTROL_VALUE         1021
 #define _APS_NEXT_SYMED_VALUE           101
 #endif
 #endif