diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index 9858ef2..f9b7ef2 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,5 +1,5 @@ -name-template: 'Eyes_Protection_Reminder_v$NEXT_MINOR_VERSION 👀' -tag-template: v$NEXT_MINOR_VERSION +name-template: 'Eyes_Protection_Reminder_v$NEXT_PATCH_VERSION 👀' +tag-template: v$NEXT_PATCH_VERSION categories: - title: '🚀 Features' labels: @@ -18,7 +18,7 @@ template: | $CHANGES - **Full Changelog**: [`$PREVIOUS_TAG...v$NEXT_MINOR_VERSION`](https://github.com/hardingadonis/Eyes_Protection_Reminder/compare/$PREVIOUS_TAG...v$NEXT_MINOR_VERSION) + **Full Changelog**: [`$PREVIOUS_TAG...v$NEXT_PATCH_VERSION`](https://github.com/hardingadonis/Eyes_Protection_Reminder/compare/$PREVIOUS_TAG...v$NEXT_PATCH_VERSION) ## Contributors diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a484fbd..c635c6c 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.0.Windows.${{ matrix.architecture }}.zip - path: ${{ github.workspace }}\build\source\Eyes_Protection_Reminder_v4.1.0.Windows.${{ matrix.architecture }}.exe + 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 - 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.0.Windows.${{ matrix.architecture }}.zip - asset_name: Eyes_Protection_Reminder_v4.1.0.Windows.${{ matrix.architecture }}.zip + 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_content_type: application/zip publish_release: diff --git a/CMakeLists.txt b/CMakeLists.txt index 85b3db9..261073d 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.0) +project(Eyes_Protection_Reminder VERSION 4.1.1) add_subdirectory(libs/wxWidgets) add_subdirectory(source) \ No newline at end of file diff --git a/README.md b/README.md index a47b113..50e9da4 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.0/total?style=flat)](https://github.com/hardingadonis/Eyes_Protection_Reminder/releases/tag/v4.1.0) +[![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) ![EPR_banner](https://github.com/hardingadonis/Eyes_Protection_Reminder/blob/main/imgs/EPR_banner.png) @@ -60,10 +60,16 @@ cmake --build . --target EPR ``` - Run project - - Find an application that named `Eyes_Protection_Reminder_v4.1.0.Windows.x86.exe` or `Eyes_Protection_Reminder_v4.1.0.Windows.x64.exe` + - Find an application that named `Eyes_Protection_Reminder_v4.1.1.Windows.x86.exe` or `Eyes_Protection_Reminder_v4.1.1.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.0) +- Or, you can download the binary in [here](https://github.com/hardingadonis/Eyes_Protection_Reminder/releases/tag/v4.1.1) + +## Usage + +You do not know how to use this tool? + +Don't worry, click here to know usage: [Usage](https://github.com/hardingadonis/Eyes_Protection_Reminder/blob/main/docs/Usage.md) or [Usage (for Vietnamese)](https://github.com/hardingadonis/Eyes_Protection_Reminder/blob/main/docs/Usage_vi_VN.md) ## License diff --git a/docs/Usage.md b/docs/Usage.md new file mode 100644 index 0000000..588fdcd --- /dev/null +++ b/docs/Usage.md @@ -0,0 +1,52 @@ +# Eyes Protection Reminder - Usage + +## Requirements + +- Windows OS such as: + - Windows XP + - Windows 7 + - Windows 8/8.1 + - Windows 10 + - Windows 11 + +## Usage + +### Download Eyes Protection Reminder + +You can download the binary in [here](https://github.com/hardingadonis/Eyes_Protection_Reminder/releases/tag/v4.1.1). + +Choose one of two: + +- *.Windows.x86 for Windows 32 bit. +- *.Windows.x64 for Windows 64 bit. + +

+ +

+ +### Extract and open Eyes Protection Reminder + +After downloading **Eyes Protection Reminder**, we will extract and run it. + +This is the main interface of **Eyes Protection Reminder**. + +

+ +

+ +### Main functions + +- **Start** button to begin the timer. +- **Stop** button to stop the timer. +- When the timer is over, **Eyes Protection Reminder** will send a notification for you like this: + +

+ +

+ +## Hotkey + +- **F1**: to open **About Dialog**. +- **F2**: to hide **Eyes Protection Reminder**. +- **F3**: to open **Settings Dialog**. +- **Alt+F4**: to exit **Eyes Protection Reminder**. \ No newline at end of file diff --git a/docs/Usage_vi_VN.md b/docs/Usage_vi_VN.md new file mode 100644 index 0000000..4172354 --- /dev/null +++ b/docs/Usage_vi_VN.md @@ -0,0 +1,52 @@ +# Eyes Protection Reminder - Cách sử dụng + +## Yêu cầu + +- Hệ điều hành Windows: + - Windows XP + - Windows 7 + - Windows 8/8.1 + - Windows 10 + - Windows 11 + +## Cách sử dụng + +### 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). + +Chọn một trong hai: + +- *.Windows.x86 for Windows 32 bit. +- *.Windows.x64 for Windows 64 bit. + +

+ +

+ +### Giải nén và chạy Eyes Protection Reminder + +Sau khi tải xuống **Eyes Protection Reminder**, chúng ta sẽ giải nén và chạy cái tool này. + +Đây là giao diện chính của **Eyes Protection Reminder**. + +

+ +

+ +### Chức năng chính + +- Nút **Start** để bắt đầu tính giờ. +- Nút **Stop** để dừng việc tính giờ lại. +- Khi thời gian kết thúc, **Eyes Protection Reminder** gửi cho chúng ta một cái thông báo như sau: + +

+ +

+ +## Phím tắt + +- **F1**: để mở **About Dialog**. +- **F2**: để ẩn **Eyes Protection Reminder**. +- **F3**: để mở **Settings Dialog**. +- **Alt+F4**: để thoát **Eyes Protection Reminder**. \ No newline at end of file diff --git a/docs/imgs/EPR_docs_image_1.png b/docs/imgs/EPR_docs_image_1.png new file mode 100644 index 0000000..47c28ff Binary files /dev/null and b/docs/imgs/EPR_docs_image_1.png differ diff --git a/docs/imgs/EPR_docs_image_2.png b/docs/imgs/EPR_docs_image_2.png new file mode 100644 index 0000000..773cd0d Binary files /dev/null and b/docs/imgs/EPR_docs_image_2.png differ diff --git a/docs/imgs/EPR_docs_image_3.png b/docs/imgs/EPR_docs_image_3.png new file mode 100644 index 0000000..13707fa Binary files /dev/null and b/docs/imgs/EPR_docs_image_3.png differ diff --git a/imgs/EPR_showcase.png b/imgs/EPR_showcase.png index 7ea2986..af9b39f 100644 Binary files a/imgs/EPR_showcase.png and b/imgs/EPR_showcase.png differ diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index ddc474f..dee5d20 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.0) +project(EPR VERSION 4.1.1) 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.0.Windows.${EPR_ARCH}) \ No newline at end of file +set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME Eyes_Protection_Reminder_v4.1.1.Windows.${EPR_ARCH}) \ No newline at end of file diff --git a/source/include/UI/MainPanel.hpp b/source/include/UI/MainPanel.hpp index 8a6a6ee..163382d 100644 --- a/source/include/UI/MainPanel.hpp +++ b/source/include/UI/MainPanel.hpp @@ -42,11 +42,11 @@ namespace EPR void OnTimerElapsed(wxTimerEvent& _event); void OnRestedElapsed(wxTimerEvent& _event); + void ResetTimer(); + private: void CreateControls(); - void ResetTimer(); - private: wxStaticText* m_timerValue; wxStaticText* m_restedValue; diff --git a/source/include/UI/SettingsDialog.hpp b/source/include/UI/SettingsDialog.hpp index cdfe286..f46b7cc 100644 --- a/source/include/UI/SettingsDialog.hpp +++ b/source/include/UI/SettingsDialog.hpp @@ -29,12 +29,14 @@ #include #include +#include + namespace EPR { class SettingsDialog : public wxDialog { public: - SettingsDialog(wxWindow* _parent); + SettingsDialog(wxWindow* _parent, MainPanel* _mainPanel); virtual ~SettingsDialog() = default; void OnSaveButtonPressed(wxCommandEvent& _event); @@ -49,6 +51,8 @@ namespace EPR wxTextCtrl* m_stringNotification; wxCheckBox* m_startupWithWindows; + MainPanel* m_mainPanel; + public: wxDECLARE_EVENT_TABLE(); }; diff --git a/source/src/Application.cpp b/source/src/Application.cpp index 06fa5a8..7ca8e64 100644 --- a/source/src/Application.cpp +++ b/source/src/Application.cpp @@ -60,10 +60,10 @@ namespace EPR } // Set name for this tool - SetAppName("Eyes Protection Remimder"); + SetAppName("Eyes Protection Reminder"); // Create the main frame - m_mainFrame = new MainFrame("Eyes Protection Remimder - v4.1.0", wxSize(500, 350)); + m_mainFrame = new MainFrame("Eyes Protection Reminder - v4.1.1", wxSize(500, 350)); if (m_mainFrame == nullptr) { diff --git a/source/src/UI/MainFrame.cpp b/source/src/UI/MainFrame.cpp index 0ffae69..dedf5d5 100644 --- a/source/src/UI/MainFrame.cpp +++ b/source/src/UI/MainFrame.cpp @@ -89,7 +89,7 @@ namespace EPR void MainFrame::OnMenuSettings(wxCommandEvent& _event) { - (new SettingsDialog(this))->ShowModal(); + (new SettingsDialog(this, m_mainPanel))->ShowModal(); _event.Skip(); } @@ -100,7 +100,7 @@ namespace EPR // Set the information for about dialog _aboutInfo.SetName(wxTheApp->GetAppName()); - _aboutInfo.SetVersion("- v4.1.0"); + _aboutInfo.SetVersion("- v4.1.1"); _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/MainPanel.cpp b/source/src/UI/MainPanel.cpp index 17d2501..4e8785d 100644 --- a/source/src/UI/MainPanel.cpp +++ b/source/src/UI/MainPanel.cpp @@ -99,7 +99,7 @@ namespace EPR { // Show the notification m_taskBarIcon->ShowBalloon( - "Eyes Protection Remimder", + "Eyes Protection Reminder", Config::GetInstance()->GetStringNotification(), Config::GetInstance()->GetTimeNotification() * 1000, wxICON_INFORMATION, @@ -144,6 +144,28 @@ namespace EPR )); } + void MainPanel::ResetTimer() + { + s_timer_time_remaining = Config::GetInstance()->GetTimeRemaining(); + s_timer_rested_remaining = Config::GetInstance()->GetRestedRemaining(); + + m_timerValue->SetLabel(wxString::Format( + "%s%d:%s%d", + s_timer_time_remaining / 60 < 10 ? "0" : "", + s_timer_time_remaining / 60, + s_timer_time_remaining % 60 < 10 ? "0" : "", + s_timer_time_remaining % 60 + )); + + m_restedValue->SetLabel(wxString::Format( + "%s%d:%s%d", + s_timer_rested_remaining / 60 < 10 ? "0" : "", + s_timer_rested_remaining / 60, + s_timer_rested_remaining % 60 < 10 ? "0" : "", + s_timer_rested_remaining % 60 + )); + } + void MainPanel::CreateControls() { // Create label to show the value of timer @@ -195,26 +217,4 @@ namespace EPR m_timer->Bind(wxEVT_TIMER, &EPR::MainPanel::OnTimerElapsed, this); m_rested->Bind(wxEVT_TIMER, &EPR::MainPanel::OnRestedElapsed, this); } - - void MainPanel::ResetTimer() - { - s_timer_time_remaining = Config::GetInstance()->GetTimeRemaining(); - s_timer_rested_remaining = Config::GetInstance()->GetRestedRemaining(); - - m_timerValue->SetLabel(wxString::Format( - "%s%d:%s%d", - s_timer_time_remaining / 60 < 10 ? "0" : "", - s_timer_time_remaining / 60, - s_timer_time_remaining % 60 < 10 ? "0" : "", - s_timer_time_remaining % 60 - )); - - m_restedValue->SetLabel(wxString::Format( - "%s%d:%s%d", - s_timer_rested_remaining / 60 < 10 ? "0" : "", - s_timer_rested_remaining / 60, - s_timer_rested_remaining % 60 < 10 ? "0" : "", - s_timer_rested_remaining % 60 - )); - } } \ No newline at end of file diff --git a/source/src/UI/SettingsDialog.cpp b/source/src/UI/SettingsDialog.cpp index 4efad12..2185119 100644 --- a/source/src/UI/SettingsDialog.cpp +++ b/source/src/UI/SettingsDialog.cpp @@ -40,8 +40,9 @@ namespace EPR EVT_BUTTON(EPR_Button_Save, SettingsDialog::OnSaveButtonPressed) wxEND_EVENT_TABLE() - SettingsDialog::SettingsDialog(wxWindow* _parent) : - wxDialog(_parent, wxID_ANY, "Eyes Protection Remimder - Settings") + SettingsDialog::SettingsDialog(wxWindow* _parent, MainPanel* _mainPanel) : + wxDialog(_parent, wxID_ANY, "Eyes Protection Reminder - Settings"), + m_mainPanel(_mainPanel) { Center(); CreateControls(); @@ -58,6 +59,8 @@ namespace EPR Config::GetInstance()->Save(); + m_mainPanel->ResetTimer(); + Destroy(); } diff --git a/source/src/Utils/Config.cpp b/source/src/Utils/Config.cpp index d2a5043..fa7eedd 100644 --- a/source/src/Utils/Config.cpp +++ b/source/src/Utils/Config.cpp @@ -54,7 +54,7 @@ namespace EPR { std::string _executablePath = wxStandardPaths::Get().GetExecutablePath().ToStdString(); - _key = RegSetValueExA(_hkey, "Eyes Protection Remimder", 0, REG_SZ, (BYTE*)_executablePath.c_str(), strlen(_executablePath.c_str())); + _key = RegSetValueExA(_hkey, "Eyes Protection Reminder", 0, REG_SZ, (BYTE*)_executablePath.c_str(), strlen(_executablePath.c_str())); } } @@ -64,7 +64,7 @@ namespace EPR RegOpenKeyA(HKEY_CURRENT_USER, "SOFTWARE\\Microsoft\\Windows\\Currentversion\\Run", &_hkey); - RegDeleteValueA(_hkey, "Eyes Protection Remimder"); + RegDeleteValueA(_hkey, "Eyes Protection Reminder"); RegCloseKey(_hkey); } @@ -157,7 +157,7 @@ namespace EPR void Config::Save() { - wxFileConfig* _config = new wxFileConfig("Eyes Protection Remimder", wxEmptyString, Priv::PATH + Priv::FILE); + wxFileConfig* _config = new wxFileConfig("Eyes Protection Reminder", wxEmptyString, Priv::PATH + Priv::FILE); _config->SetPath("/UserData"); _config->Write("TIME_REMAINING", m_timeRemaining); @@ -199,7 +199,7 @@ namespace EPR } // If done, load config from file - wxFileConfig* _config = new wxFileConfig("Eyes Protection Remimder", wxEmptyString, Priv::PATH + Priv::FILE); + wxFileConfig* _config = new wxFileConfig("Eyes Protection Reminder", wxEmptyString, Priv::PATH + Priv::FILE); _config->SetPath("/UserData"); _config->Read("TIME_REMAINING", &m_timeRemaining); @@ -213,6 +213,11 @@ namespace EPR // Delete this pointer delete _config; _config = nullptr; + + // After load config from file, checking again + m_timeRemaining = (m_timeRemaining < 1200 || m_timeRemaining > 3600) ? Priv::TIME_REMAINING : m_timeRemaining; + m_restedRemaining = (m_restedRemaining < 20 || m_restedRemaining > 300) ? Priv::RESTED_REMAINING : m_restedRemaining; + m_timeNotification = (m_timeNotification < 10 || m_timeNotification > 60) ? Priv::TIME_NOTIFICATION : m_timeNotification; } void Config::LoadDefaultConfig()