ukui-panel/plugin-calendar/calendarbuttontext.h

75 lines
2.0 KiB
C++

/*
* Copyright (C) 2023, KylinSoft 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/&gt;.
*
*/
#ifndef CALENDARBUTTONTEXT_H
#define CALENDARBUTTONTEXT_H
#include <QObject>
#include <QDateTime>
#include <QGSettings>
#include <QPushButton>
#include "../panel/iukuipanelplugin.h"
class CalendarButtonText : public QObject
{
Q_OBJECT
public:
CalendarButtonText(IUKUIPanelPlugin *plugin,QPushButton *parent);
~CalendarButtonText();
enum DateStyle{YEAR_MON_DAY=0, MON_DAY};
public:
virtual QString getBtnText() = 0;
QString getAmPm();
QString getTime();
QString getWeek();
QString getDate(DateStyle dateStyle);
void updateFontSize(QString btnText);
void setOptimalFont(QStringList textList, int btnMaxLength);
public:
QDateTime m_dataTime;
QPushButton *m_parent;
IUKUIPanelPlugin * m_plugin;
QGSettings *m_timeFormat;
QGSettings *m_fontGsettings;
QGSettings *m_panelGsettings;
};
class EnUsText : public CalendarButtonText
{
public:
EnUsText(IUKUIPanelPlugin *plugin,QPushButton *parent);
QString getBtnText() override;
};
class ZhCnText : public CalendarButtonText
{
public:
ZhCnText(IUKUIPanelPlugin *plugin,QPushButton *parent);
QString getBtnText() override;
};
class OtherLanguagText : public CalendarButtonText
{
public:
OtherLanguagText(IUKUIPanelPlugin *plugin,QPushButton *parent);
QString getBtnText() override;
};
#endif // CALENDARBUTTONTEXT_H