This commit is contained in:
Yzzi 2020-08-18 14:20:42 +08:00
parent b8f697b536
commit ab16048509
24 changed files with 581 additions and 258 deletions

14
build.sh Normal file → Executable file
View File

@ -1,12 +1,24 @@
#!/bin/bash
cd `dirname $0`
# 编译
echo "开始编译"
mkdir -p build
qmake ./one-tomato.pro -spec linux-g++ CONFIG+=qtquickcompiler -o build/
qmake src/one-tomato.pro -spec linux-g++ CONFIG+=qtquickcompiler -o build/
cd build/
make
cd ..
echo "编译完成"
echo "-------------------"
echo "更新翻译"
lrelease ./translations/*.ts
#打包
echo "构建软件包"
mv build/one-tomato dabao/extract/opt/apps/top.yzzi.tomato/files/
cp translations/*.qm dabao/extract/opt/apps/top.yzzi.tomato/files/translations/
rm -rf build
sh dabao/dabao.sh
mkdir -p outdeb
mv dabao/build/* outdeb/
rm -rf dabao/build

View File

@ -1,5 +1,5 @@
Package: top.yzzi.tomato
Version: 1.0.4
Version: 1.0.5
Architecture: amd64
Maintainer: 一只科技菌
Installed-Size: 56

View File

@ -1,4 +1,6 @@
8613dffe6811441b459c27bfa2c2f419 extract/opt/apps/top.yzzi.tomato/entries/applications/top.yzzi.tomato.desktop
7166285b603c0b163e07be5586ea9719 extract/opt/apps/top.yzzi.tomato/entries/icons/hicolor/512x512/apps/OneTomato.png
8b73954c58e1df8437e2560007e364c6 extract/opt/apps/top.yzzi.tomato/entries/icons/top.yzzi.tomato.svg
52bca8cd94c6a9d8a8efc994d8de9e1a extract/opt/apps/top.yzzi.tomato/files/one-tomato
94c821682f8d133840dddc9b99776149 extract/opt/apps/top.yzzi.tomato/info
f934fbed78deabb016fcf70281dae5a8 extract/opt/apps/top.yzzi.tomato/files/one-tomato
675f855ab7d19dc673dd2d6d144d1164 extract/opt/apps/top.yzzi.tomato/files/translations/one-tomato_zh_CN.qm
6aa9cf85416a636ed9175602c5f99272 extract/opt/apps/top.yzzi.tomato/info

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB

BIN
dabao/extract/opt/apps/top.yzzi.tomato/files/one-tomato Normal file → Executable file

Binary file not shown.

View File

@ -1,7 +1,7 @@
{
"appid": "top.yzzi.tomato",
"name": "OneTomato",
"version": "1.0.4",
"version": "1.0.5",
"arch": ["amd64"],
"permissions": {
"autostart": false,

Binary file not shown.

View File

@ -2,23 +2,25 @@
#include <QDesktopWidget>
#include <DWidgetUtil> //Dtk::Widget::moveToCenter(&w); 要调用它就得引用DWidgetUtil
#include <widget.h>
#include <QTranslator>
DWIDGET_USE_NAMESPACE
int main(int argc, char *argv[])
{
DApplication::loadDXcbPlugin(); //让bar处在标题栏中
DApplication a(argc, argv);
//加载翻译文件
QTranslator translator;
translator.load(a.applicationDirPath()+"/translations/one-tomato_" + QLocale::system().name());
a.setAttribute(Qt::AA_UseHighDpiPixmaps);
a.loadTranslator();
a.setOrganizationName("deepin");
a.setApplicationVersion(DApplication::buildVersion("1.0.3"));
a.setApplicationAcknowledgementPage("https://blog.yzzi.top");
a.setProductIcon(QIcon(":/icon/icon/top.yzzi.tomato.svg")); //设置Logo
a.setProductName("一只番茄");
a.setApplicationName("一只番茄"); //只有在这儿修改窗口标题才有效
a.setApplicationDescription("感谢deepin社区 @gbwater 提供的帮助");
a.setProductName(QObject::tr("OneTomato"));
a.setApplicationName(QObject::tr("OneTomato")); //只有在这儿修改窗口标题才有效
a.setApplicationDescription(QObject::tr("Thanks to Deepin community @gbwater for help"));
Widget w;
QDesktopWidget *s=DApplication::desktop();

View File

@ -44,6 +44,6 @@ FORMS += \
widget.ui
RESOURCES += \
assets/assets.qrc
../assets/assets.qrc
TRANSLATIONS += ../translations/one-tomato_zh_CN.ts

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 4.8.2, 2020-08-14T20:33:42. -->
<!-- Written by QtCreator 4.8.2, 2020-08-15T12:03:46. -->
<qtcreator>
<data>
<variable>EnvironmentId</variable>
@ -69,7 +69,7 @@
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/yzzi/Documents/GitHub/build-one-tomato-unknown-Debug</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/yzzi/Documents/GitHub/one-tomato-mygitee/build-one-tomato-unknown-Debug</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -125,7 +125,7 @@
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.1">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/yzzi/Documents/GitHub/build-one-tomato-unknown-Release</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/yzzi/Documents/GitHub/one-tomato-mygitee/build-one-tomato-unknown-Release</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -181,7 +181,7 @@
<value type="bool" key="Qt4ProjectManager.Qt4BuildConfiguration.UseShadowBuild">true</value>
</valuemap>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.2">
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/yzzi/Documents/GitHub/build-one-tomato-unknown-Profile</value>
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/yzzi/Documents/GitHub/one-tomato-mygitee/build-one-tomato-unknown-Profile</value>
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
@ -295,7 +295,7 @@
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">one-tomato</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/yzzi/Documents/GitHub/one-tomato-gitee/one-tomato.pro</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">Qt4ProjectManager.Qt4RunConfiguration:/home/yzzi/Documents/GitHub/one-tomato-mygitee/src/one-tomato.pro</value>
<value type="QString" key="Qt4ProjectManager.Qt4RunConfiguration.ProFile">one-tomato.pro</value>
<value type="QString" key="RunConfiguration.Arguments"></value>
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
@ -306,7 +306,7 @@
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory"></value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">/home/yzzi/Documents/GitHub/build-one-tomato-unknown-Debug</value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default"></value>
</valuemap>
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap>

52
src/tabbutton.cpp Normal file
View File

@ -0,0 +1,52 @@
#include "tabbutton.h"
#include <QHBoxLayout>
#include <DGuiApplicationHelper>
TabButton::TabButton(QWidget *parent) : QWidget(parent)
{
QHBoxLayout *layout=new QHBoxLayout;
layout->addStretch();
layout->addWidget(m_btn1);
layout->addWidget(m_btn2);
layout->addStretch();
layout->setAlignment(Qt::AlignCenter);
layout->setMargin(0);
layout->setSpacing(0);
setLayout(layout);
m_btn1->setText(tr("番茄钟"));
m_btn2->setText(tr("统计"));
m_btn1->setFixedSize(110,28);
m_btn2->setFixedSize(110,28);
setIndex(0);
connect(Dtk::Gui::DGuiApplicationHelper::instance(),&Dtk::Gui::DGuiApplicationHelper::themeTypeChanged,[=](){
maincolor=Dtk::Gui::DGuiApplicationHelper::instance()->applicationPalette().highlight().color();
if(!(Dtk::Gui::DGuiApplicationHelper::instance()->themeType()==Dtk::Gui::DGuiApplicationHelper::DarkType)){
bgcolor="#E5E5E5";
}else {
bgcolor="#444444";
}
TabButton::setIndex(index);
});
connect(m_btn1,&QPushButton::clicked,[=](){TabButton::setIndex(0);});
connect(m_btn2,&QPushButton::clicked,[=](){TabButton::setIndex(1);});
}
void TabButton::setIndex(int index_t)
{
index=index_t;
if(index==0){
m_btn2->setStyleSheet("background-color:"+bgcolor.name()+";border:0px;border-top-right-radius:12px;border-bottom-right-radius:12px");
m_btn1->setStyleSheet("background-color:"+maincolor.name()+";border:0px;border-top-left-radius:12px;border-bottom-left-radius:12px;color:#FFFFFF");
emit indexChange(0);
}else {
m_btn1->setStyleSheet("background-color:"+bgcolor.name()+";border:0px;border-top-left-radius:12px;border-bottom-left-radius:12px");
m_btn2->setStyleSheet("background-color:"+maincolor.name()+";border:0px;border-top-right-radius:12px;border-bottom-right-radius:12px;color:#FFFFFF");
emit indexChange(1);
}
}

30
src/tabbutton.h Normal file
View File

@ -0,0 +1,30 @@
#ifndef TABBUTTON_H
#define TABBUTTON_H
#include <QWidget>
#include <DPushButton>
#include <DGuiApplicationHelper>
DWIDGET_USE_NAMESPACE
class TabButton : public QWidget
{
Q_OBJECT
public:
explicit TabButton(QWidget *parent = nullptr);
void setText(QString btn1,QString btn2);
void setIndex(int index_t);
int index;
signals:
void indexChange(int index);
private:
DPushButton *m_btn1=new DPushButton;
DPushButton *m_btn2=new DPushButton;
QColor maincolor;
QColor bgcolor;
public slots:
};
#endif // TABBUTTON_H

View File

@ -1,6 +1,6 @@
#include "widget.h"
#include "ui_widget.h"
#include<QDateTime>
#include <QDateTime>
#include <QTimer>
#include <QMediaPlayer>
#include <QMediaPlaylist>
@ -10,18 +10,18 @@
#include <QDialog>
#include <DInputDialog>
#include "countdown.h"
#include <QtNetwork/QtNetwork>
#include "tabbutton.h"
#include <QDebug>
using namespace std;
Widget::Widget(DBlurEffectWidget *parent) :
DBlurEffectWidget(parent),
m_menu(new QMenu),
m_5(new QAction("5分钟")),
m_15(new QAction("15分钟")),
m_25(new QAction("25分钟")),
m_35(new QAction("35分钟")),
m_45(new QAction("45分钟")),
m_set(new QAction("自定义时间")),
m_5(new QAction(tr("5 min"))),
m_15(new QAction(tr("15 min"))),
m_25(new QAction(tr("25 min"))),
m_35(new QAction(tr("35 min"))),
m_45(new QAction(tr("45 min"))),
m_set(new QAction(tr("Custom time"))),
ui(new Ui::Widget)
@ -35,14 +35,14 @@ Widget::Widget(DBlurEffectWidget *parent) :
setMaskAlpha(190);
ui->titlebar->setMenu(m_menu);
m_menu->addMenu(menu_times);//设置菜单
menu_times->setTitle(tr("时间"));
menu_times->setTitle(tr("Time"));
menu_times->addAction(m_5);
menu_times->addAction(m_15);
menu_times->addAction(m_25);
menu_times->addAction(m_35);
menu_times->addAction(m_45);
menu_times->addAction(m_set);
setWindowIcon(QIcon("/usr/share/icons/hicolor/512x512/apps/OneTomato.png"));
timesGroup = new QActionGroup(this);//设置按钮互斥
timesGroup->addAction(m_5);
timesGroup->addAction(m_15);
@ -67,20 +67,19 @@ Widget::Widget(DBlurEffectWidget *parent) :
connect(m_45,&QAction::triggered,[=](){count->mem=count->ms = 2700;refresh();});
connect(m_set,&QAction::triggered,[=](){input();refresh();});
//软件使用量统计
QNetworkAccessManager *tongji;
tongji->get(QNetworkRequest(QUrl("http://limexb.gitee.io/one/tomato")));
//显示番茄钟页面
ui->stackedWidget->setCurrentIndex(0);
//实例化对象
count=new countDown(this);
toptime=new topTime(this);
switchbutton = new DSwitchButton (this);
ui->horizontalLayout_2->addWidget(switchbutton);
switchbutton->setChecked(false);
ui->switchbutton->setChecked(false);
setWindowFlags(windowFlags()&~Qt::WindowMaximizeButtonHint);// 禁止最大化按钮
setFixedSize(this->width(),this->height());// 禁止拖动窗口大小
connect(switchbutton, SIGNAL(checkedChanged(bool)), this, SLOT(onSBtnSwitchButtonCheckedChanged(bool)));
connect(ui->switchbutton, SIGNAL(checkedChanged(bool)), this, SLOT(onSBtnSwitchButtonCheckedChanged(bool)));
//结束时音频播放(待修改!)
player = new QMediaPlayer(this);
@ -91,7 +90,10 @@ Widget::Widget(DBlurEffectWidget *parent) :
connect(count,&countDown::refreshed,this,&Widget::refreshCount);
connect(toptime,&topTime::refreshed,this,&Widget::refreshTime);
connect(count,&countDown::ended,player,&QMediaPlayer::play);
QString notify;
notify ="notify-send \""+ tr("Congratulations! It's time to finish a tomato!")+"\" --icon=/usr/share/icons/hicolor/512x512/apps/OneTomato.png";
qDebug()<<notify;
connect(count,&countDown::ended,[=](){system(notify.toUtf8());});
//时间控制
timer->start(1000); //每隔1000ms发送timeout的信号
refreshCount();
@ -132,41 +134,11 @@ Widget::~Widget()
delete player;
delete timer;
}
void Widget::input()
{
bool isOK;
int i = DInputDialog::getInt(this, "输入时间",
"请输入时间(分钟)",
mem/60,0,100,1,&isOK);
if(isOK)
{
ms=mem=60*i+1;
}
switch (mem) {
case 300+1:
m_5->setChecked(true);
break;
case 900+1:
m_15->setChecked(true);
break;
case 1500+1:
m_25->setChecked(true);
break;
case 2100+1:
m_35->setChecked(true);
break;
case 2700+1:
m_45->setChecked(true);
break;
}
timer->start(1000);
refresh();
}
void Widget::input()//输入时间
{
bool isOK;
int i = DInputDialog::getInt(this, "输入时间",
"请输入时间分钟小于60",
int i = DInputDialog::getInt(this, tr("Input time"),
tr("Please enter time (Min, less than 60)"),
count->mem/60,0,100,1,&isOK);
if(isOK)
{

169
src/widget.cpp.autosave Normal file
View File

@ -0,0 +1,169 @@
#include "widget.h"
#include "ui_widget.h"
#include <QDateTime>
#include <QTimer>
#include <QMediaPlayer>
#include <QMediaPlaylist>
#include <sstream>
#include <QString>
#include <DApplication>
#include <QDialog>
#include <DInputDialog>
#include "countdown.h"
#include "tabbutton.h"
#include <QDebug>
using namespace std;
Widget::Widget(DBlurEffectWidget *parent) :
DBlurEffectWidget(parent),
m_menu(new QMenu),
m_5(new QAction(tr("5 min"))),
m_15(new QAction(tr("15 min"))),
m_25(new QAction(tr("25 min"))),
m_35(new QAction(tr("35 min"))),
m_45(new QAction(tr("45 min"))),
m_set(new QAction(tr("Custom time"))),
ui(new Ui::Widget)
{
ui->setupUi(this);
ui->gridLayout->setContentsMargins(0, 0, 0, 0);
ui->titlebar->setFixedHeight(50);//初始化标题栏
ui->titlebar->setBackgroundTransparent(true);//设置标题栏透明
ui->titlebar->setIcon(QIcon::fromTheme(":/icon/icon/top.yzzi.tomato.svg"));
ui->titlebar->setTitle("");
setMaskAlpha(190);
ui->titlebar->setMenu(m_menu);
m_menu->addMenu(menu_times);//设置菜单
menu_times->setTitle(tr("Time"));
menu_times->addAction(m_5);
menu_times->addAction(m_15);
menu_times->addAction(m_25);
menu_times->addAction(m_35);
menu_times->addAction(m_45);
menu_times->addAction(m_set);
timesGroup = new QActionGroup(this);//设置按钮互斥
timesGroup->addAction(m_5);
timesGroup->addAction(m_15);
timesGroup->addAction(m_25);
timesGroup->addAction(m_35);
timesGroup->addAction(m_45);
timesGroup->addAction(m_set);
m_5->setCheckable(true);
m_15->setCheckable(true);
m_25->setCheckable(true);
m_35->setCheckable(true);
m_45->setCheckable(true);
m_set->setCheckable(true);
m_25->setChecked(true);
//in->setParent(this);
//设置按钮响应
connect(m_5,&QAction::triggered,[=](){count->mem=count->ms = 300;refresh();});
connect(m_15,&QAction::triggered,[=](){count->mem=count->ms = 900;refresh();});
connect(m_25,&QAction::triggered,[=](){count->mem=count->ms = 1500;refresh();});
connect(m_35,&QAction::triggered,[=](){count->mem=count->ms = 2100;refresh();});
connect(m_45,&QAction::triggered,[=](){count->mem=count->ms = 2700;refresh();});
connect(m_set,&QAction::triggered,[=](){input();refresh();});
//显示番茄钟页面
ui->stackedWidget->setCurrentIndex(0);
//实例化对象
count=new countDown(this);
toptime=new topTime(this);
ui->switchbutton->setChecked(false);
setWindowFlags(windowFlags()&~Qt::WindowMaximizeButtonHint);// 禁止最大化按钮
setFixedSize(this->width(),this->height());// 禁止拖动窗口大小
connect(ui->switchbutton, SIGNAL(checkedChanged(bool)), this, SLOT(onSBtnSwitchButtonCheckedChanged(bool)));
//结束时音频播放(待修改!)
player = new QMediaPlayer(this);
player->setVolume(100);
player->setMedia(QUrl("qrc:/audio/ding.wav"));
//设置界面刷新和对象响应
connect(count,&countDown::refreshed,this,&Widget::refreshCount);
connect(toptime,&topTime::refreshed,this,&Widget::refreshTime);
connect(count,&countDown::ended,player,&QMediaPlayer::play);
QString notify;
notify ="notify-send \""+ tr("Congratulations! It's time to finish a tomato!")+"\" --icon=/usr/share/icons/hicolor/512x512/apps/OneTomato.png";
qDebug()<<notify;
connect(count,&countDown::ended,[=](){system(notify.toUtf8());});
//时间控制
timer->start(1000); //每隔1000ms发送timeout的信号
refreshCount();
refreshTime();
}
void Widget::refresh()//刷新count的开始结束动作
{
if(btSwitch)
{
if(!count->ms) count->reset();
count->start();
}
else
{
count->stop();
}
}
void Widget::refreshTime()//用toptime的信息刷新时间显示
{
ui->titlebar->setTitle(toptime->str);
}
void Widget::refreshCount()//用count的信息刷新倒计时显示
{
QDateTime tomato_time = QDateTime::fromTime_t(count->ms);
QString textout=tomato_time.toString("mm:ss");
ui->time->setText(textout);
}
DTitlebar* Widget::getTitlebar()
{
return ui->titlebar;
}
Widget::~Widget()
{
delete ui;
qDebug()<<"exit";
DApplication::quit();
delete player;
delete timer;
}
void Widget::input()//输入时间
{
bool isOK;
int i = DInputDialog::getInt(this, tr("Input time"),
tr("Please enter time (Min, less than 60)"),
count->mem/60,0,100,1,&isOK);
if(isOK)
{
count->ms=count->mem=60*i;
}
switch (count->mem) {
case 300+1:
m_5->setChecked(true);
break;
case 900+1:
m_15->setChecked(true);
break;
case 1500+1:
m_25->setChecked(true);
break;
case 2100+1:
m_35->setChecked(true);
break;
case 2700+1:
m_45->setChecked(true);
break;
}
}
void Widget::onSBtnSwitchButtonCheckedChanged(bool ck)
{
player->stop();
btSwitch=ck;
refresh();
}

View File

@ -14,7 +14,7 @@ DWIDGET_USE_NAMESPACE
namespace Ui {
class Widget;
}
class QNetworkAccessManager;
class Widget : public DBlurEffectWidget
{
Q_OBJECT
@ -39,12 +39,10 @@ private slots:
private:
Ui::Widget *ui;
DSwitchButton * switchbutton;
QTimer *timer = new QTimer();
DTitlebar *titlebar;
QMenu *m_menu;
QActionGroup *timesGroup;
QAction *m_full;
QAction *m_5;
QAction *m_15;
QAction *m_25;

179
src/widget.ui Normal file
View File

@ -0,0 +1,179 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Widget</class>
<widget class="QWidget" name="Widget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>470</width>
<height>265</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>470</width>
<height>265</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="DTitlebar" name="titlebar" native="true">
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>0</number>
</property>
<widget class="QWidget" name="page">
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>-30</y>
<width>452</width>
<height>181</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="time">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>431</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>72</pointsize>
</font>
</property>
<property name="text">
<string>25:00</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>150</y>
<width>454</width>
<height>31</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="DSwitchButton" name="switchbutton" native="true"/>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</widget>
<widget class="QWidget" name="page_2"/>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>DTitlebar</class>
<extends>QWidget</extends>
<header location="global">dtitlebar.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>DSwitchButton</class>
<extends>QWidget</extends>
<header>dswitchbutton.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

Binary file not shown.

View File

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="zh_CN">
<context>
<name>QObject</name>
<message>
<location filename="../src/main.cpp" line="21"/>
<location filename="../src/main.cpp" line="22"/>
<source>OneTomato</source>
<translatorcomment></translatorcomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/main.cpp" line="23"/>
<source>Thanks to Deepin community @gbwater for help</source>
<translatorcomment>deepin社区 @gbwater </translatorcomment>
<translation type="unfinished">deepin社区 @gbwater </translation>
</message>
</context>
<context>
<name>Widget</name>
<message>
<location filename="../src/widget.ui" line="26"/>
<source>Form</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/widget.ui" line="96"/>
<source>25:00</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/widget.cpp" line="19"/>
<source>5 min</source>
<translatorcomment>5</translatorcomment>
<translation type="unfinished">5</translation>
</message>
<message>
<location filename="../src/widget.cpp" line="20"/>
<source>15 min</source>
<translatorcomment>15</translatorcomment>
<translation type="unfinished">15</translation>
</message>
<message>
<location filename="../src/widget.cpp" line="21"/>
<source>25 min</source>
<translatorcomment>25</translatorcomment>
<translation type="unfinished">25</translation>
</message>
<message>
<location filename="../src/widget.cpp" line="22"/>
<source>35 min</source>
<translatorcomment>35</translatorcomment>
<translation type="unfinished">35</translation>
</message>
<message>
<location filename="../src/widget.cpp" line="23"/>
<source>45 min</source>
<translatorcomment>45</translatorcomment>
<translation type="unfinished">45</translation>
</message>
<message>
<location filename="../src/widget.cpp" line="24"/>
<source>Custom time</source>
<translatorcomment></translatorcomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/widget.cpp" line="38"/>
<source>Time</source>
<translatorcomment></translatorcomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/widget.cpp" line="94"/>
<source>Congratulations! It&apos;s time to finish a tomato!</source>
<translatorcomment></translatorcomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/widget.cpp" line="140"/>
<source>Input time</source>
<translatorcomment></translatorcomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../src/widget.cpp" line="141"/>
<source>Please enter time (Min, less than 60)</source>
<translatorcomment>60</translatorcomment>
<translation type="unfinished">60</translation>
</message>
</context>
</TS>

186
widget.ui
View File

@ -1,186 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Widget</class>
<widget class="QWidget" name="Widget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>470</width>
<height>265</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>470</width>
<height>265</height>
</size>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="DTitlebar" name="titlebar" native="true">
<property name="minimumSize">
<size>
<width>0</width>
<height>20</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="time">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>431</width>
<height>16777215</height>
</size>
</property>
<property name="font">
<font>
<pointsize>72</pointsize>
</font>
</property>
<property name="text">
<string>25:00</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="DSwitchButton" name="switchbutton" native="true"/>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="0">
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>50</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>DTitlebar</class>
<extends>QWidget</extends>
<header location="global">dtitlebar.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>DSwitchButton</class>
<extends>QWidget</extends>
<header>dswitchbutton.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>