File indexing completed on 2025-03-02 05:10:50
0001 // SPDX-FileCopyrightText: 2023 by Devin Lin <devin@kde.org> 0002 // SPDX-License-Identifier: GPL-2.0-or-later 0003 0004 #pragma once 0005 0006 #include <QObject> 0007 #include <QProcess> 0008 0009 #include "timezonemodel.h" 0010 0011 class TimeUtil : public QObject 0012 { 0013 Q_OBJECT 0014 Q_PROPERTY(bool is24HourTime READ is24HourTime WRITE setIs24HourTime NOTIFY is24HourTimeChanged); 0015 Q_PROPERTY(QString currentTimeZone READ currentTimeZone WRITE setCurrentTimeZone NOTIFY currentTimeZoneChanged); 0016 Q_PROPERTY(TimeZoneFilterProxy *timeZones READ timeZones CONSTANT); 0017 0018 public: 0019 TimeUtil(QObject *parent = nullptr); 0020 0021 bool is24HourTime() const; 0022 void setIs24HourTime(bool is24HourTime); 0023 0024 QString currentTimeZone() const; 0025 void setCurrentTimeZone(QString timeZone); 0026 0027 TimeZoneFilterProxy *timeZones() const; 0028 0029 Q_SIGNALS: 0030 void is24HourTimeChanged(); 0031 void currentTimeZoneChanged(); 0032 0033 private: 0034 bool m_is24HourTime; 0035 0036 TimeZoneModel *m_timeZoneModel; 0037 TimeZoneFilterProxy *m_filterModel; 0038 };