File indexing completed on 2025-01-05 03:51:16

0001 /* ============================================================
0002  *
0003  * This file is a part of digiKam project
0004  * https://www.digikam.org
0005  *
0006  * Date        : 2004-09-09
0007  * Description : digiKam release ID header.
0008  *
0009  * SPDX-FileCopyrightText: 2004-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
0010  *
0011  * SPDX-License-Identifier: GPL-2.0-or-later
0012  *
0013  * ============================================================ */
0014 
0015 #include "digikam_version.h"
0016 
0017 // Qt includes
0018 
0019 #include <QDate>
0020 #include <QTime>
0021 #include <QLocale>
0022 
0023 // KDE includes
0024 
0025 #include <klocalizedstring.h>
0026 
0027 // Local includes
0028 
0029 #include "digikam_gitversion.h"
0030 #include "digikam_builddate.h"
0031 #include "daboutdata.h"
0032 
0033 namespace Digikam
0034 {
0035 
0036 int digiKamMakeIntegerVersion(int major, int minor, int patch)
0037 {
0038     return (((major) << 16) | ((minor) << 8) | (patch));
0039 }
0040 
0041 const QString digiKamVersion()
0042 {
0043     return QLatin1String(digikam_version);
0044 }
0045 
0046 const QDateTime digiKamBuildDate()
0047 {
0048     QDateTime dt = QDateTime::fromString(QLatin1String(BUILD_DATE), QLatin1String("yyyyMMddTHHmmss"));
0049     dt.setTimeSpec(Qt::UTC);
0050 
0051     return dt;
0052 }
0053 
0054 const QString additionalInformation()
0055 {
0056     QString gitVer       = QLatin1String(GITVERSION);
0057     QString gitBra       = QLatin1String(GITBRANCH);
0058     QString ret          = i18n("IRC: %1 - #digikam\n"
0059                                 "Feedback: %2\n"
0060                                 "Documentation: %3\n\n"
0061                                 "Build date: %4 (target: %5)",
0062                                 QString::fromLatin1("<a href='https://libera.chat/'>irc.libera.chat</a>"),
0063                                 QString::fromLatin1("<a href='https://mail.kde.org/mailman/listinfo/digikam-users'>digikam-user@kde.org</a>"),
0064                                 QString::fromLatin1("<a href='https://docs.digikam.org/en/index.html'>docs.digikam.org</a>"),
0065                                 QLocale().toString(digiKamBuildDate(), QLocale::ShortFormat),
0066                                 QLatin1String(digikam_build_type));
0067 
0068     if (
0069         !gitVer.isEmpty()                           &&
0070         !gitBra.isEmpty()                           &&
0071         !gitVer.startsWith(QLatin1String("unknow")) &&
0072         !gitVer.startsWith(QLatin1String("export")) &&
0073         !gitBra.startsWith(QLatin1String("unknow"))
0074        )
0075     {
0076         ret = i18n(
0077                    "IRC: %1 - #digikam\n"
0078                    "Feedback: %2\n"
0079                    "Documentation: %3\n\n"
0080                    "Build date: %4 (target: %5)\n"
0081                    "Revision: %6\n"
0082                    "Branch: %7",
0083                    QString::fromLatin1("<a href='https://libera.chat/'>irc.libera.chat</a>"),
0084                    QString::fromLatin1("<a href='https://mail.kde.org/mailman/listinfo/digikam-users'>digikam-user@kde.org</a>"),
0085                    QString::fromLatin1("<a href='https://docs.digikam.org/en/index.html'>docs.digikam.org</a>"),
0086                    QLocale().toString(digiKamBuildDate(), QLocale::ShortFormat),
0087                    QLatin1String(digikam_build_type),
0088                    QString::fromLatin1("<a href='https://invent.kde.org/graphics/digikam/commit/%1'>%2</a>").arg(gitVer).arg(gitVer),
0089                    gitBra
0090                   );
0091     }
0092 
0093     return ret;
0094 }
0095 
0096 } // namespace Digikam