File indexing completed on 2024-11-24 04:16:54
0001 /* 0002 SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "downloadlanguagejob.h" 0008 #include <QApplication> 0009 #include <QCommandLineParser> 0010 #include <QDebug> 0011 #include <QStandardPaths> 0012 0013 int main(int argc, char **argv) 0014 { 0015 QApplication app(argc, argv); 0016 QStandardPaths::setTestModeEnabled(true); 0017 QCommandLineParser parser; 0018 parser.addVersionOption(); 0019 parser.addHelpOption(); 0020 parser.addOption(QCommandLineOption(QStringList() << QStringLiteral("+[file]"), QStringLiteral("Add specific archive file name"))); 0021 0022 parser.process(app); 0023 if (!parser.positionalArguments().isEmpty()) { 0024 const QString fileName = parser.positionalArguments().at(0); 0025 auto download = new DownloadLanguageJob(); 0026 download->setUrl(QUrl(fileName)); 0027 QObject::connect(download, &DownloadLanguageJob::extractDone, &app, []() { 0028 qDebug() << "Extraction Done"; 0029 }); 0030 QObject::connect(download, &DownloadLanguageJob::errorText, &app, [](const QString &str) { 0031 qDebug() << "Extraction error: " << str; 0032 }); 0033 download->start(); 0034 app.exec(); 0035 } else { 0036 qWarning() << "Missing argument"; 0037 } 0038 return 0; 0039 }