From 3777a11397dfb640621a041a48082422b4e15957 Mon Sep 17 00:00:00 2001 From: Dmytro Bogovych Date: Thu, 21 Apr 2022 14:51:40 +0300 Subject: [PATCH] - fix running timer in some cases + make font bigger --- app/mainwindow.cpp | 19 ++++++++----------- app/mainwindow.ui | 22 ++++++++++++++++++++++ 2 files changed, 30 insertions(+), 11 deletions(-) diff --git a/app/mainwindow.cpp b/app/mainwindow.cpp index fc61310..94dece6 100644 --- a/app/mainwindow.cpp +++ b/app/mainwindow.cpp @@ -32,7 +32,7 @@ MainWindow::~MainWindow() delete ui; } -static bool isDarkTheme() +/*static bool isDarkTheme() { // Thanks to stackoverflow ! Another idea is to use https://successfulsoftware.net/2021/03/31/how-to-add-a-dark-theme-to-your-qt-application/ auto label = QLabel("am I in the dark?"); @@ -41,7 +41,7 @@ static bool isDarkTheme() bool dark_theme_found = text_hsv_value > bg_hsv_value; return dark_theme_found; -} +}*/ QIcon MainWindow::getAppIcon() { @@ -64,15 +64,6 @@ void MainWindow::init() // Icon setWindowIcon(getAppIcon()); - // ToDo: finish the multiple monitor support - /*QDesktopWidget *widget = QApplication::desktop(); - qDebug() << "Number of screens:" << widget->screenCount(); - - connect(widget, &QDesktopWidget::screenCountChanged, this, [](int screenCount){}); - if (widget->screenCount() > 1) { - } else if (widget->screenCount() == 1){ - }*/ - // Tray icon createTrayIcon(); @@ -315,8 +306,12 @@ void MainWindow::onLongBreakEnd() // Hide the window hideMe(); + mProgressTimer->stop(); + // Start new timer + mTimer->stop(); mTimer->start(std::chrono::seconds(mAppConfig.longbreak_interval)); + mNotifyTimer->stop(); mNotifyTimer->start(std::chrono::seconds(mAppConfig.longbreak_interval - 30)); // Refresh UI @@ -334,7 +329,9 @@ void MainWindow::onLongBreakPostpone() ui->mProgressBar->setValue(0); // Start timer again + mTimer->stop(); mTimer->start(std::chrono::seconds(mAppConfig.longbreak_postpone_interval)); + mNotifyTimer->stop(); mNotifyTimer->start(std::chrono::seconds(mAppConfig.longbreak_postpone_interval - 30)); // Refresh UI diff --git a/app/mainwindow.ui b/app/mainwindow.ui index f10110e..2587865 100644 --- a/app/mainwindow.ui +++ b/app/mainwindow.ui @@ -62,6 +62,11 @@ 0 + + + 14 + + 0 @@ -69,6 +74,11 @@ + + + 14 + + Remaining: @@ -117,6 +127,12 @@ 100 + + + 14 + true + + Postpone for 10 minutes @@ -155,6 +171,12 @@ 16777215 + + + 14 + true + + Skip this break