File indexing completed on 2024-11-24 04:16:55
0001 /* 0002 SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 #include "libbergamot_private_export.h" 0009 #include <QCryptographicHash> 0010 #include <QObject> 0011 #include <QUrl> 0012 class QTemporaryFile; 0013 class LIBBERGAMOT_TESTS_EXPORT DownloadLanguageJob : public QObject 0014 { 0015 Q_OBJECT 0016 public: 0017 explicit DownloadLanguageJob(QObject *parent = nullptr); 0018 ~DownloadLanguageJob() override; 0019 void start(); 0020 0021 [[nodiscard]] bool canStart() const; 0022 0023 [[nodiscard]] QUrl url() const; 0024 void setUrl(const QUrl &newUrl); 0025 0026 [[nodiscard]] QString checkSum() const; 0027 void setCheckSum(const QString &newCheckSum); 0028 0029 Q_SIGNALS: 0030 void errorText(const QString &str); 0031 void downloadProgress(qint64 bytesReceived, qint64 bytesTotal); 0032 void extractDone(); 0033 0034 private: 0035 void slotExtractDone(); 0036 void extractLanguage(); 0037 QCryptographicHash *mHash = nullptr; 0038 QUrl mUrl; 0039 QString mCheckSum; 0040 QTemporaryFile *mDestination = nullptr; 0041 };