From 800cea7381cbcd1e122a4d3f4ef504496b95b760 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Minh=20V=C6=B0=C6=A1ng?= Date: Thu, 8 Dec 2022 15:46:19 +0700 Subject: [PATCH] add feature: double click from taskbar icon to show the main window --- .github/workflows/release.yml | 8 ++++---- CMakeLists.txt | 2 +- README.md | 6 +++--- docs/Usage.md | 2 +- docs/Usage_vi_VN.md | 2 +- source/CMakeLists.txt | 4 ++-- source/include/UI/TaskBarIcon.hpp | 2 ++ source/src/Application.cpp | 2 +- source/src/UI/MainFrame.cpp | 2 +- source/src/UI/TaskBarIcon.cpp | 8 ++++++++ 10 files changed, 24 insertions(+), 14 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index c635c6c..33a5230 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -63,8 +63,8 @@ jobs: uses: TheDoctor0/zip-release@0.6.2 with: type: zip - filename: Eyes_Protection_Reminder_v4.1.1.Windows.${{ matrix.architecture }}.zip - path: ${{ github.workspace }}\build\source\Eyes_Protection_Reminder_v4.1.1.Windows.${{ matrix.architecture }}.exe + filename: Eyes_Protection_Reminder_v4.1.2.Windows.${{ matrix.architecture }}.zip + path: ${{ github.workspace }}\build\source\Eyes_Protection_Reminder_v4.1.2.Windows.${{ matrix.architecture }}.exe - name: Upload built executable file uses: tanyagray/action-upload-release-asset@v1.1.3 @@ -72,8 +72,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ needs.update_release_draft.outputs.upload_url }} - asset_path: ${{ github.workspace }}\Eyes_Protection_Reminder_v4.1.1.Windows.${{ matrix.architecture }}.zip - asset_name: Eyes_Protection_Reminder_v4.1.1.Windows.${{ matrix.architecture }}.zip + asset_path: ${{ github.workspace }}\Eyes_Protection_Reminder_v4.1.2.Windows.${{ matrix.architecture }}.zip + asset_name: Eyes_Protection_Reminder_v4.1.2.Windows.${{ matrix.architecture }}.zip asset_content_type: application/zip publish_release: diff --git a/CMakeLists.txt b/CMakeLists.txt index 261073d..90277a2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.10.2) -project(Eyes_Protection_Reminder VERSION 4.1.1) +project(Eyes_Protection_Reminder VERSION 4.1.2) add_subdirectory(libs/wxWidgets) add_subdirectory(source) \ No newline at end of file diff --git a/README.md b/README.md index 50e9da4..da255a4 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ![Languages](https://img.shields.io/github/languages/top/hardingadonis/Eyes_Protection_Reminder?style=flat) ![Repo Size](https://img.shields.io/github/repo-size/hardingadonis/Eyes_Protection_Reminder?style=flat) ![License](https://img.shields.io/github/license/hardingadonis/Eyes_Protection_Reminder?style=flat) -[![Download](https://img.shields.io/github/downloads/hardingadonis/Eyes_Protection_Reminder/v4.1.1/total?style=flat)](https://github.com/hardingadonis/Eyes_Protection_Reminder/releases/tag/v4.1.1) +[![Download](https://img.shields.io/github/downloads/hardingadonis/Eyes_Protection_Reminder/v4.1.2/total?style=flat)](https://github.com/hardingadonis/Eyes_Protection_Reminder/releases/tag/v4.1.2) ![EPR_banner](https://github.com/hardingadonis/Eyes_Protection_Reminder/blob/main/imgs/EPR_banner.png) @@ -60,10 +60,10 @@ cmake --build . --target EPR ``` - Run project - - Find an application that named `Eyes_Protection_Reminder_v4.1.1.Windows.x86.exe` or `Eyes_Protection_Reminder_v4.1.1.Windows.x64.exe` + - Find an application that named `Eyes_Protection_Reminder_v4.1.2.Windows.x86.exe` or `Eyes_Protection_Reminder_v4.1.2.Windows.x64.exe` - Now, run it!!! -- Or, you can download the binary in [here](https://github.com/hardingadonis/Eyes_Protection_Reminder/releases/tag/v4.1.1) +- Or, you can download the binary in [here](https://github.com/hardingadonis/Eyes_Protection_Reminder/releases/tag/v4.1.2) ## Usage diff --git a/docs/Usage.md b/docs/Usage.md index 588fdcd..0173a25 100644 --- a/docs/Usage.md +++ b/docs/Usage.md @@ -13,7 +13,7 @@ ### Download Eyes Protection Reminder -You can download the binary in [here](https://github.com/hardingadonis/Eyes_Protection_Reminder/releases/tag/v4.1.1). +You can download the binary in [here](https://github.com/hardingadonis/Eyes_Protection_Reminder/releases/tag/v4.1.2). Choose one of two: diff --git a/docs/Usage_vi_VN.md b/docs/Usage_vi_VN.md index 4172354..6ce5ad3 100644 --- a/docs/Usage_vi_VN.md +++ b/docs/Usage_vi_VN.md @@ -13,7 +13,7 @@ ### Tải Eyes Protection Reminder -Bạn có thể tải **Eyes Protection Reminder** [tại đây](https://github.com/hardingadonis/Eyes_Protection_Reminder/releases/tag/v4.1.1). +Bạn có thể tải **Eyes Protection Reminder** [tại đây](https://github.com/hardingadonis/Eyes_Protection_Reminder/releases/tag/v4.1.2). Chọn một trong hai: diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index dee5d20..0dc5265 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.10.2) -project(EPR VERSION 4.1.1) +project(EPR VERSION 4.1.2) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) @@ -34,4 +34,4 @@ set(EPR_ICON ${CMAKE_SOURCE_DIR}/assets/EPR_icon.rc) add_executable(${PROJECT_NAME} WIN32 ${EPR_SOURCES} ${EPR_ICON}) target_link_libraries(${PROJECT_NAME} PUBLIC wx::core wx::base) target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) -set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME Eyes_Protection_Reminder_v4.1.1.Windows.${EPR_ARCH}) \ No newline at end of file +set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME Eyes_Protection_Reminder_v4.1.2.Windows.${EPR_ARCH}) \ No newline at end of file diff --git a/source/include/UI/TaskBarIcon.hpp b/source/include/UI/TaskBarIcon.hpp index f06753c..4d6a0a4 100644 --- a/source/include/UI/TaskBarIcon.hpp +++ b/source/include/UI/TaskBarIcon.hpp @@ -40,6 +40,8 @@ namespace EPR void OnMenuSource(wxCommandEvent& _event); void OnMenuExit(wxCommandEvent& _event); + void OnLeftButtonDClick(wxTaskBarIconEvent& _event); + protected: wxMenu* CreatePopupMenu() override; diff --git a/source/src/Application.cpp b/source/src/Application.cpp index 7ca8e64..55b48d9 100644 --- a/source/src/Application.cpp +++ b/source/src/Application.cpp @@ -63,7 +63,7 @@ namespace EPR SetAppName("Eyes Protection Reminder"); // Create the main frame - m_mainFrame = new MainFrame("Eyes Protection Reminder - v4.1.1", wxSize(500, 350)); + m_mainFrame = new MainFrame("Eyes Protection Reminder - v4.1.2", wxSize(500, 350)); if (m_mainFrame == nullptr) { diff --git a/source/src/UI/MainFrame.cpp b/source/src/UI/MainFrame.cpp index dedf5d5..c03e960 100644 --- a/source/src/UI/MainFrame.cpp +++ b/source/src/UI/MainFrame.cpp @@ -100,7 +100,7 @@ namespace EPR // Set the information for about dialog _aboutInfo.SetName(wxTheApp->GetAppName()); - _aboutInfo.SetVersion("- v4.1.1"); + _aboutInfo.SetVersion("- v4.1.2"); _aboutInfo.SetIcon(s_EPR_icon_64); _aboutInfo.SetCopyright("Copyright (c) 2022 " + wxString::FromUTF8("Minh Vương.") + "\nAll rights reserved."); _aboutInfo.SetDescription("A small tool to remind you to\nprotect your eyes with the 20:20:20 rule."); diff --git a/source/src/UI/TaskBarIcon.cpp b/source/src/UI/TaskBarIcon.cpp index c6b3527..ed2892b 100644 --- a/source/src/UI/TaskBarIcon.cpp +++ b/source/src/UI/TaskBarIcon.cpp @@ -39,6 +39,7 @@ namespace EPR EVT_MENU(EPR_Menu_Restore, TaskBarIcon::OnMenuRestore) EVT_MENU(EPR_Menu_Source, TaskBarIcon::OnMenuSource) EVT_MENU(EPR_Menu_Exit, TaskBarIcon::OnMenuExit) + EVT_TASKBAR_LEFT_DCLICK(TaskBarIcon::OnLeftButtonDClick) wxEND_EVENT_TABLE() TaskBarIcon::TaskBarIcon(wxWindow* _parent, wxTaskBarIconType _iconType) : @@ -68,6 +69,13 @@ namespace EPR _event.Skip(); } + void TaskBarIcon::OnLeftButtonDClick(wxTaskBarIconEvent& _event) + { + m_parent->Show(); + + _event.Skip(); + } + wxMenu* TaskBarIcon::CreatePopupMenu() { wxMenu* _menu = new wxMenu();