From 5cabd004c1d862bddcfc1895922627a1a771a423 Mon Sep 17 00:00:00 2001 From: saturneric Date: Tue, 9 Jan 2024 20:04:06 +0800 Subject: fix: slove some of the app building issues --- src/core/utils/LocalizedUtils.cpp | 40 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/core/utils/LocalizedUtils.cpp (limited to 'src/core/utils/LocalizedUtils.cpp') diff --git a/src/core/utils/LocalizedUtils.cpp b/src/core/utils/LocalizedUtils.cpp new file mode 100644 index 00000000..e1c3d859 --- /dev/null +++ b/src/core/utils/LocalizedUtils.cpp @@ -0,0 +1,40 @@ +/** + * Copyright (C) 2021 Saturneric + * + * This file is part of GpgFrontend. + * + * GpgFrontend 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 of the License, or + * (at your option) any later version. + * + * GpgFrontend 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 GpgFrontend. If not, see . + * + * The initial version of the source code is inherited from + * the gpg4usb project, which is under GPL-3.0-or-later. + * + * All the source code of GpgFrontend was modified and released by + * Saturneric starting on May 12, 2021. + * + * SPDX-License-Identifier: GPL-3.0-or-later + * + */ + +#include "LocalizedUtils.h" + +#include "core/utils/LogUtils.h" + +namespace GpgFrontend { + +auto GetFormatedDateByTimestamp(time_t timestamp) -> std::string { + QDateTime date; + date.setSecsSinceEpoch(timestamp); + return QLocale::system().toString(date).toStdString(); +} +} // namespace GpgFrontend -- cgit v1.2.3 From bf538056b24a68b8fd235b1c50991ee8eb46a776 Mon Sep 17 00:00:00 2001 From: saturneric Date: Fri, 12 Jan 2024 14:02:37 +0800 Subject: refactor: use QString instead of std::string and improve threading system --- src/core/utils/LocalizedUtils.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'src/core/utils/LocalizedUtils.cpp') diff --git a/src/core/utils/LocalizedUtils.cpp b/src/core/utils/LocalizedUtils.cpp index e1c3d859..b8c91039 100644 --- a/src/core/utils/LocalizedUtils.cpp +++ b/src/core/utils/LocalizedUtils.cpp @@ -32,9 +32,7 @@ namespace GpgFrontend { -auto GetFormatedDateByTimestamp(time_t timestamp) -> std::string { - QDateTime date; - date.setSecsSinceEpoch(timestamp); - return QLocale::system().toString(date).toStdString(); +auto GetFormatedDateByTimestamp(time_t timestamp) -> QString { + return QLocale::system().toString(QDateTime::fromSecsSinceEpoch(timestamp)); } } // namespace GpgFrontend -- cgit v1.2.3 From e8d604cf2924ab101c2a102c23d5028473289814 Mon Sep 17 00:00:00 2001 From: saturneric Date: Thu, 18 Jan 2024 21:47:17 +0800 Subject: fix: slove discovered bugs --- src/core/utils/LocalizedUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/utils/LocalizedUtils.cpp') diff --git a/src/core/utils/LocalizedUtils.cpp b/src/core/utils/LocalizedUtils.cpp index b8c91039..6c020ed7 100644 --- a/src/core/utils/LocalizedUtils.cpp +++ b/src/core/utils/LocalizedUtils.cpp @@ -33,6 +33,6 @@ namespace GpgFrontend { auto GetFormatedDateByTimestamp(time_t timestamp) -> QString { - return QLocale::system().toString(QDateTime::fromSecsSinceEpoch(timestamp)); + return QLocale().toString(QDateTime::fromSecsSinceEpoch(timestamp)); } } // namespace GpgFrontend -- cgit v1.2.3