2022-06-02 16:31:24 +08:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3, or (at your option)
|
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef SLEEPTIME_H
|
|
|
|
#define SLEEPTIME_H
|
|
|
|
|
2023-04-10 17:46:41 +08:00
|
|
|
#include "scconfiguration.h"
|
2022-06-02 16:31:24 +08:00
|
|
|
#include <QWidget>
|
|
|
|
#include <QLabel>
|
|
|
|
#include <QTimer>
|
|
|
|
#include <QList>
|
|
|
|
#include <QDateTime>
|
|
|
|
#include <QHBoxLayout>
|
|
|
|
|
|
|
|
class SleepTime : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
explicit SleepTime(QWidget *parent = nullptr);
|
|
|
|
~SleepTime();
|
|
|
|
int setTime(QDateTime time);
|
|
|
|
void setSmallMode();
|
|
|
|
|
|
|
|
private:
|
2023-04-10 17:46:41 +08:00
|
|
|
SCConfiguration *configuration;
|
2022-06-02 16:31:24 +08:00
|
|
|
QLabel *restTime;
|
|
|
|
QList<QLabel *> list;
|
|
|
|
QHBoxLayout *layout;
|
2022-11-01 18:14:46 +08:00
|
|
|
long long sleepTime;
|
|
|
|
long long m_nLastSleepLeave;
|
|
|
|
long long m_nLastSleepTimeSecs;
|
2022-06-02 16:31:24 +08:00
|
|
|
QDateTime initTime;
|
2022-11-01 18:14:46 +08:00
|
|
|
QDateTime m_lastTime;
|
2023-04-10 17:46:41 +08:00
|
|
|
double curFontSize;
|
|
|
|
double m_ptToPx = 1.0;
|
|
|
|
QFont sysFont;
|
2022-06-02 16:31:24 +08:00
|
|
|
|
|
|
|
void init();
|
2022-11-01 18:14:46 +08:00
|
|
|
void setHour(int hour);
|
2022-06-02 16:31:24 +08:00
|
|
|
void setSeconds(int seconds);
|
|
|
|
void setMinute(int minutes);
|
2022-11-01 18:14:46 +08:00
|
|
|
bool QLabelSetText(QLabel *label, QString string);
|
2022-06-02 16:31:24 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // SLEEPTIME_H
|