- fix translations + cleanups in source code + fix the tray icon tooltip after interval change in settings + version switch to 0.0.8
This commit is contained in:
parent
371a105f84
commit
3175b435a2
11
app/config.h
11
app/config.h
@ -4,6 +4,15 @@
|
||||
// App version
|
||||
#define QBREAK_VERSION_MAJOR 0
|
||||
#define QBREAK_VERSION_MINOR 0
|
||||
#define QBREAK_VERSION_SUFFIX 7
|
||||
#define QBREAK_VERSION_SUFFIX 8
|
||||
|
||||
// How often UI is updated - interval in seconds
|
||||
#define INTERVAL_UPDATE_UI (60)
|
||||
|
||||
// How often progress bar is updated - interval in milliseconds
|
||||
#define INTERVAL_UPDATE_PROGRESS (1000)
|
||||
|
||||
// How long notification is shown - in milliseconds
|
||||
#define INTERVAL_NOTIFICATION (30000)
|
||||
|
||||
#endif // CONFIG_H
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#include "settings.h"
|
||||
#include "autostart.h"
|
||||
#include "aboutdlg.h"
|
||||
#include "config.h"
|
||||
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
@ -81,6 +82,9 @@ void MainWindow::init()
|
||||
// Settings dialog
|
||||
mSettingsDialog = nullptr;
|
||||
|
||||
// No postpone attempts yet
|
||||
mPostponeCount = 0;
|
||||
|
||||
// Timer
|
||||
mTimer = new QTimer(this);
|
||||
mTimer->setTimerType(Qt::TimerType::CoarseTimer);
|
||||
@ -96,16 +100,17 @@ void MainWindow::init()
|
||||
mUpdateUITimer = new QTimer(this);
|
||||
mUpdateUITimer->setTimerType(Qt::TimerType::CoarseTimer);
|
||||
mUpdateUITimer->setSingleShot(false);
|
||||
mUpdateUITimer->setInterval(std::chrono::minutes(1));
|
||||
mUpdateUITimer->setInterval(std::chrono::seconds(INTERVAL_UPDATE_UI));
|
||||
connect(mUpdateUITimer, SIGNAL(timeout()), this, SLOT(onUpdateUI()));
|
||||
mUpdateUITimer->start();
|
||||
|
||||
mProgressTimer = new QTimer(this);
|
||||
mProgressTimer->setInterval(std::chrono::milliseconds(1000));
|
||||
mProgressTimer->setInterval(std::chrono::milliseconds(INTERVAL_UPDATE_PROGRESS));
|
||||
mProgressTimer->setSingleShot(false);
|
||||
connect(mProgressTimer, SIGNAL(timeout()), this, SLOT(onProgress()));
|
||||
|
||||
connect(ui->mPostponeButton, SIGNAL(clicked()), this, SLOT(onLongBreakPostpone()));
|
||||
connect(ui->mSkipButton, SIGNAL(clicked()), this, SLOT(onLongBreakEnd()));
|
||||
|
||||
// Use the latest config
|
||||
applyConfig();
|
||||
@ -164,7 +169,8 @@ void MainWindow::test_1()
|
||||
|
||||
mAppConfig.window_on_top = true;
|
||||
mAppConfig.verbose = true;
|
||||
|
||||
applyConfig();
|
||||
onUpdateUI();
|
||||
onLongBreakStart();
|
||||
}
|
||||
|
||||
@ -173,12 +179,13 @@ void MainWindow::test_2()
|
||||
// 60 seconds test break
|
||||
mAppConfig.longbreak_length = 60;
|
||||
mAppConfig.longbreak_postpone_interval = 60;
|
||||
mAppConfig.longbreak_interval = 60;
|
||||
mAppConfig.longbreak_interval = 240;
|
||||
|
||||
mAppConfig.window_on_top = true;
|
||||
mAppConfig.verbose = true;
|
||||
|
||||
applyConfig();
|
||||
onUpdateUI();
|
||||
}
|
||||
|
||||
void MainWindow::showMe()
|
||||
@ -215,9 +222,9 @@ void MainWindow::hideMe()
|
||||
static QString secondsToText(int seconds)
|
||||
{
|
||||
if (seconds < 60)
|
||||
return QString("%1s").arg(seconds);
|
||||
return QObject::tr("%1 seconds").arg(seconds);
|
||||
else
|
||||
return QString("%1m %2s").arg(seconds / 60).arg(seconds % 60);
|
||||
return QObject::tr("%1 minutes").arg(seconds / 60);
|
||||
}
|
||||
|
||||
void MainWindow::createTrayIcon()
|
||||
@ -260,13 +267,15 @@ void MainWindow::onUpdateUI()
|
||||
else
|
||||
if (mTimer->isActive())
|
||||
{
|
||||
auto remaining = std::chrono::duration_cast<std::chrono::minutes>(mTimer->remainingTimeAsDuration());
|
||||
if (remaining.count() == 0)
|
||||
auto remaining_milliseconds = mTimer->remainingTime();
|
||||
if (remaining_milliseconds == 0)
|
||||
mTrayIcon->setToolTip(tr("Less than a minute left until the next break."));
|
||||
else
|
||||
mTrayIcon->setToolTip(tr("There are %1 minutes left until the next break.").arg(remaining.count()));
|
||||
mTrayIcon->setToolTip(tr("There are %1 minutes left until the next break.").arg(remaining_milliseconds / 1000 / 60));
|
||||
}
|
||||
}
|
||||
|
||||
ui->mSkipButton->setVisible(mPostponeCount > 0);
|
||||
}
|
||||
|
||||
void MainWindow::onLongBreakNotify()
|
||||
@ -274,7 +283,7 @@ void MainWindow::onLongBreakNotify()
|
||||
mTrayIcon->showMessage(tr("New break"),
|
||||
tr("New break will start in %1 secs").arg(Default_Notify_Length),
|
||||
getAppIcon(),
|
||||
30000);
|
||||
INTERVAL_NOTIFICATION);
|
||||
}
|
||||
|
||||
void MainWindow::onLongBreakStart()
|
||||
@ -297,6 +306,9 @@ void MainWindow::onLongBreakEnd()
|
||||
{
|
||||
qDebug() << "Long break ends.";
|
||||
|
||||
// Reset postpone counter
|
||||
mPostponeCount = 0;
|
||||
|
||||
// Prepare to next triggering
|
||||
ui->mProgressBar->setValue(0);
|
||||
|
||||
@ -314,6 +326,8 @@ void MainWindow::onLongBreakEnd()
|
||||
void MainWindow::onLongBreakPostpone()
|
||||
{
|
||||
qDebug() << "Long break postponed.";
|
||||
mPostponeCount++;
|
||||
|
||||
hideMe();
|
||||
|
||||
mProgressTimer->stop();
|
||||
@ -368,6 +382,7 @@ void MainWindow::onSettings()
|
||||
mAppConfig = app_settings::load();
|
||||
applyConfig();
|
||||
mSettingsDialog->hide();
|
||||
onUpdateUI();
|
||||
});
|
||||
|
||||
connect(mSettingsDialog, &QDialog::rejected, [this]()
|
||||
|
||||
@ -38,6 +38,7 @@ private:
|
||||
SettingsDialog* mSettingsDialog;
|
||||
std::chrono::steady_clock::time_point mBreakStartTime;
|
||||
app_settings::config mAppConfig;
|
||||
int mPostponeCount;
|
||||
|
||||
void init();
|
||||
void loadConfig();
|
||||
@ -58,6 +59,7 @@ public slots:
|
||||
void onLongBreakStart();
|
||||
void onLongBreakPostpone();
|
||||
void onLongBreakEnd();
|
||||
|
||||
void onProgress();
|
||||
void onNextBreak();
|
||||
void onSettings();
|
||||
|
||||
@ -107,7 +107,7 @@
|
||||
<widget class="QPushButton" name="mPostponeButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>150</width>
|
||||
<width>200</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
@ -120,6 +120,47 @@
|
||||
<property name="text">
|
||||
<string notr="true">Postpone for 10 minutes</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item alignment="Qt::AlignHCenter">
|
||||
<widget class="QPushButton" name="mSkipButton">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>200</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Skip this break</string>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
|
||||
@ -4,22 +4,27 @@
|
||||
<context>
|
||||
<name>AboutDlg</name>
|
||||
<message>
|
||||
<location filename="aboutdlg.ui" line="20"/>
|
||||
<location filename="aboutdlg.ui" line="26"/>
|
||||
<source>Dialog</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="aboutdlg.ui" line="32"/>
|
||||
<source>TextLabel</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="aboutdlg.ui" line="48"/>
|
||||
<source>QBreak.</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="aboutdlg.ui" line="51"/>
|
||||
<location filename="aboutdlg.ui" line="67"/>
|
||||
<source>Version</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="aboutdlg.ui" line="70"/>
|
||||
<location filename="aboutdlg.ui" line="86"/>
|
||||
<source>App to make breaks in work. Thanks to the authors of similar apps which inspired me to make this one.</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
@ -32,51 +37,69 @@
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="213"/>
|
||||
<location filename="mainwindow.ui" line="159"/>
|
||||
<source>Skip this break</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="235"/>
|
||||
<source>Start next break</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="216"/>
|
||||
<location filename="mainwindow.cpp" line="238"/>
|
||||
<source>Settings</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="219"/>
|
||||
<location filename="mainwindow.cpp" line="241"/>
|
||||
<source>About</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="222"/>
|
||||
<location filename="mainwindow.cpp" line="244"/>
|
||||
<source>Exit</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="250"/>
|
||||
<location filename="mainwindow.cpp" line="272"/>
|
||||
<source>Less than a minute left until the next break.</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="252"/>
|
||||
<location filename="mainwindow.cpp" line="274"/>
|
||||
<source>There are %1 minutes left until the next break.</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="259"/>
|
||||
<location filename="mainwindow.cpp" line="283"/>
|
||||
<source>New break</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="260"/>
|
||||
<location filename="mainwindow.cpp" line="284"/>
|
||||
<source>New break will start in %1 secs</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="269"/>
|
||||
<location filename="mainwindow.cpp" line="293"/>
|
||||
<source>Postpone for </source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="225"/>
|
||||
<source>%1 seconds</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="227"/>
|
||||
<source>%1 minutes</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsDialog</name>
|
||||
<message>
|
||||
@ -109,5 +132,10 @@
|
||||
<source>Postpone time (minutes)</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog.ui" line="110"/>
|
||||
<source>Preferred monitor</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
||||
@ -4,22 +4,27 @@
|
||||
<context>
|
||||
<name>AboutDlg</name>
|
||||
<message>
|
||||
<location filename="aboutdlg.ui" line="20"/>
|
||||
<location filename="aboutdlg.ui" line="26"/>
|
||||
<source>Dialog</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="aboutdlg.ui" line="32"/>
|
||||
<source>TextLabel</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="aboutdlg.ui" line="48"/>
|
||||
<source>QBreak.</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="aboutdlg.ui" line="51"/>
|
||||
<location filename="aboutdlg.ui" line="67"/>
|
||||
<source>Version</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="aboutdlg.ui" line="70"/>
|
||||
<location filename="aboutdlg.ui" line="86"/>
|
||||
<source>App to make breaks in work. Thanks to the authors of similar apps which inspired me to make this one.</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
@ -32,51 +37,69 @@
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="213"/>
|
||||
<location filename="mainwindow.ui" line="159"/>
|
||||
<source>Skip this break</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="235"/>
|
||||
<source>Start next break</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="216"/>
|
||||
<location filename="mainwindow.cpp" line="238"/>
|
||||
<source>Settings</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="219"/>
|
||||
<location filename="mainwindow.cpp" line="241"/>
|
||||
<source>About</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="222"/>
|
||||
<location filename="mainwindow.cpp" line="244"/>
|
||||
<source>Exit</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="250"/>
|
||||
<location filename="mainwindow.cpp" line="272"/>
|
||||
<source>Less than a minute left until the next break.</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="252"/>
|
||||
<location filename="mainwindow.cpp" line="274"/>
|
||||
<source>There are %1 minutes left until the next break.</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="259"/>
|
||||
<location filename="mainwindow.cpp" line="283"/>
|
||||
<source>New break</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="260"/>
|
||||
<location filename="mainwindow.cpp" line="284"/>
|
||||
<source>New break will start in %1 secs</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="269"/>
|
||||
<location filename="mainwindow.cpp" line="293"/>
|
||||
<source>Postpone for </source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="225"/>
|
||||
<source>%1 seconds</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="227"/>
|
||||
<source>%1 minutes</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsDialog</name>
|
||||
<message>
|
||||
@ -109,5 +132,10 @@
|
||||
<source>Postpone time (minutes)</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog.ui" line="110"/>
|
||||
<source>Preferred monitor</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
</context>
|
||||
</TS>
|
||||
|
||||
@ -4,22 +4,27 @@
|
||||
<context>
|
||||
<name>AboutDlg</name>
|
||||
<message>
|
||||
<location filename="aboutdlg.ui" line="20"/>
|
||||
<location filename="aboutdlg.ui" line="26"/>
|
||||
<source>Dialog</source>
|
||||
<translation>О программе</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="aboutdlg.ui" line="32"/>
|
||||
<source>TextLabel</source>
|
||||
<translation> </translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="aboutdlg.ui" line="48"/>
|
||||
<source>QBreak.</source>
|
||||
<translation>QBreak.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="aboutdlg.ui" line="51"/>
|
||||
<location filename="aboutdlg.ui" line="67"/>
|
||||
<source>Version</source>
|
||||
<translation>Версия</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="aboutdlg.ui" line="70"/>
|
||||
<location filename="aboutdlg.ui" line="86"/>
|
||||
<source>App to make breaks in work. Thanks to the authors of similar apps which inspired me to make this one.</source>
|
||||
<translation>Приложение чтобы устраивать себе перерывы в работе. Спасибо авторам аналогичных приложений которые вдохновили меня сделать это приложение.</translation>
|
||||
</message>
|
||||
@ -32,51 +37,69 @@
|
||||
<translation>QBreak</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="213"/>
|
||||
<location filename="mainwindow.ui" line="159"/>
|
||||
<source>Skip this break</source>
|
||||
<translation>Пропустить</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="235"/>
|
||||
<source>Start next break</source>
|
||||
<translation>Начать перерыв</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="216"/>
|
||||
<location filename="mainwindow.cpp" line="238"/>
|
||||
<source>Settings</source>
|
||||
<translation>Настройки</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="219"/>
|
||||
<location filename="mainwindow.cpp" line="241"/>
|
||||
<source>About</source>
|
||||
<translation>О программе</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="222"/>
|
||||
<location filename="mainwindow.cpp" line="244"/>
|
||||
<source>Exit</source>
|
||||
<translation>Выход</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="250"/>
|
||||
<location filename="mainwindow.cpp" line="272"/>
|
||||
<source>Less than a minute left until the next break.</source>
|
||||
<translation>До перерыва осталось меньше минуты.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="252"/>
|
||||
<location filename="mainwindow.cpp" line="274"/>
|
||||
<source>There are %1 minutes left until the next break.</source>
|
||||
<translation>Осталось %1 минут до перерыва.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="259"/>
|
||||
<location filename="mainwindow.cpp" line="283"/>
|
||||
<source>New break</source>
|
||||
<translation>Скоро перерыв</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="260"/>
|
||||
<location filename="mainwindow.cpp" line="284"/>
|
||||
<source>New break will start in %1 secs</source>
|
||||
<translation>Перерыв начнется через %1 секунд.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="269"/>
|
||||
<location filename="mainwindow.cpp" line="293"/>
|
||||
<source>Postpone for </source>
|
||||
<translation>Отложить на</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>QObject</name>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="225"/>
|
||||
<source>%1 seconds</source>
|
||||
<translation>%1 секунд</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="mainwindow.cpp" line="227"/>
|
||||
<source>%1 minutes</source>
|
||||
<translation>%1 минут</translation>
|
||||
</message>
|
||||
</context>
|
||||
<context>
|
||||
<name>SettingsDialog</name>
|
||||
<message>
|
||||
@ -109,6 +132,11 @@
|
||||
<source>Postpone time (minutes)</source>
|
||||
<translation>Насколько можно отложить перерыв (в минутах)</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="settingsdialog.ui" line="110"/>
|
||||
<source>Preferred monitor</source>
|
||||
<translation>Предпочитаемый монитор</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Break interval (seconds)</source>
|
||||
<translation type="vanished">Промежуток между перерывами в секундах</translation>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user