2023-04-01 07:09:57 +00:00
|
|
|
// SPDX-FileCopyrightText: 2023 by Devin Lin <devin@kde.org>
|
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <QObject>
|
|
|
|
|
#include <QProcess>
|
|
|
|
|
|
|
|
|
|
#include "timezonemodel.h"
|
|
|
|
|
|
|
|
|
|
class TimeUtil : public QObject
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
Q_PROPERTY(bool is24HourTime READ is24HourTime WRITE setIs24HourTime NOTIFY is24HourTimeChanged);
|
|
|
|
|
Q_PROPERTY(QString currentTimeZone READ currentTimeZone WRITE setCurrentTimeZone NOTIFY currentTimeZoneChanged);
|
2026-05-11 08:03:20 +00:00
|
|
|
Q_PROPERTY(QString timeZoneStatus READ timeZoneStatus NOTIFY timeZoneStatusChanged);
|
2023-04-01 07:09:57 +00:00
|
|
|
Q_PROPERTY(TimeZoneFilterProxy *timeZones READ timeZones CONSTANT);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
TimeUtil(QObject *parent = nullptr);
|
|
|
|
|
|
|
|
|
|
bool is24HourTime() const;
|
|
|
|
|
void setIs24HourTime(bool is24HourTime);
|
|
|
|
|
|
|
|
|
|
QString currentTimeZone() const;
|
|
|
|
|
void setCurrentTimeZone(QString timeZone);
|
|
|
|
|
|
2026-05-11 08:03:20 +00:00
|
|
|
QString timeZoneStatus() const;
|
|
|
|
|
|
2023-04-01 07:09:57 +00:00
|
|
|
TimeZoneFilterProxy *timeZones() const;
|
|
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
|
void is24HourTimeChanged();
|
|
|
|
|
void currentTimeZoneChanged();
|
2026-05-11 08:03:20 +00:00
|
|
|
void timeZoneStatusChanged();
|
2023-04-01 07:09:57 +00:00
|
|
|
|
|
|
|
|
private:
|
2026-05-11 08:03:20 +00:00
|
|
|
bool m_is24HourTime = false;
|
|
|
|
|
QString m_currentTimeZone;
|
|
|
|
|
QString m_timeZoneStatus;
|
2023-04-01 07:09:57 +00:00
|
|
|
|
|
|
|
|
TimeZoneModel *m_timeZoneModel;
|
|
|
|
|
TimeZoneFilterProxy *m_filterModel;
|
|
|
|
|
};
|