File indexing completed on 2024-06-02 04:17:21
0001 /* ============================================================ 0002 * 0003 * This file is a part of digiKam project 0004 * https://www.digikam.org 0005 * 0006 * Date : 2021-01-05 0007 * Description : an unit test to check version online. 0008 * 0009 * SPDX-FileCopyrightText: 2021-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 // Qt includes 0016 0017 #include <QApplication> 0018 #include <QTest> 0019 #include <QDateTime> 0020 #include <QCommandLineParser> 0021 0022 // KDE includes 0023 0024 #include <kaboutdata.h> 0025 0026 // Local includes 0027 0028 #include "digikam_debug.h" 0029 #include "digikam_config.h" 0030 #include "digikam_version.h" 0031 #include "daboutdata.h" 0032 #include "onlineversiondlg.h" 0033 0034 using namespace Digikam; 0035 0036 int main(int argc, char* argv[]) 0037 { 0038 QApplication app(argc, argv); 0039 0040 if (argc < 3) 0041 { 0042 qCDebug(DIGIKAM_TESTS_LOG) << "onlinecheck <bool> <bool> - Check if new version is online"; 0043 qCDebug(DIGIKAM_TESTS_LOG) << "Usage: <bool> 0 for stable release only, 1 for pre-release."; 0044 qCDebug(DIGIKAM_TESTS_LOG) << " <bool> 0 without debug symbols, 1 with debug symbols."; 0045 return -1; 0046 } 0047 0048 bool preRelease = QString::fromLatin1(argv[1]).toInt(); 0049 bool withDebug = QString::fromLatin1(argv[2]).toInt(); 0050 0051 qCDebug(DIGIKAM_TESTS_LOG) << "Check for pre-release :" << preRelease; 0052 qCDebug(DIGIKAM_TESTS_LOG) << "Version with debug symbols:" << withDebug; 0053 0054 KAboutData aboutData(QLatin1String("digikam"), 0055 QLatin1String("digiKam"), // No need i18n here. 0056 digiKamVersion()); 0057 0058 QCommandLineParser parser; 0059 KAboutData::setApplicationData(aboutData); 0060 parser.addVersionOption(); 0061 parser.addHelpOption(); 0062 aboutData.setupCommandLine(&parser); 0063 parser.process(app); 0064 aboutData.processCommandLine(&parser); 0065 0066 OnlineVersionDlg* const dlg = new OnlineVersionDlg(nullptr, 0067 QLatin1String("7.0.0"), 0068 QDateTime::fromString(QLatin1String("2021-01-01T00:00:00"), Qt::ISODate), 0069 preRelease, 0070 withDebug); 0071 0072 return (dlg->exec()); 0073 }