File indexing completed on 2024-11-24 04:50:40
0001 // SPDX-FileCopyrightText: 2023 Carl Schwan <carl@carlschwan.eu> 0002 // SPDX-License-Identifier: LGPL-2.1-or-later 0003 0004 #pragma once 0005 0006 #include <KCalendarCore/Duration> 0007 #include <KFormat> 0008 #include <QObject> 0009 0010 class Utils : public QObject 0011 { 0012 Q_OBJECT 0013 0014 Q_PROPERTY(QStringList hourlyViewLocalisedHourLabels READ hourlyViewLocalisedHourLabels CONSTANT) 0015 0016 public: 0017 explicit Utils(QObject *parent = nullptr); 0018 0019 QStringList hourlyViewLocalisedHourLabels() const; 0020 0021 Q_INVOKABLE QDateTime addDaysToDate(const QDateTime &date, const int days); 0022 0023 /// Gives prettified time 0024 Q_INVOKABLE QString secondsToReminderLabel(const qint64 seconds) const; 0025 0026 [[nodiscard]] static QString formatSpelloutDuration(const KCalendarCore::Duration &duration, const KFormat &format, const bool allDay); 0027 0028 Q_INVOKABLE int weekNumber(const QDate &date) const; 0029 0030 private: 0031 QStringList m_hourlyViewLocalisedHourLabels; 0032 };