AusweisApp2
Lade ...
Suche ...
Keine Treffer
UpdatableFile.h
gehe zur Dokumentation dieser Datei
1
10#pragma once
11
12#include "GlobalStatus.h"
13
14#include <QObject>
15#include <QUrl>
16
17#include <functional>
18
19class test_UpdatableFile;
20class test_ReaderConfiguration;
21
22
23namespace governikus
24{
26 : public QObject
27{
28 Q_OBJECT
29
30 private:
31 friend class ::test_UpdatableFile;
32 friend class ::test_ReaderConfiguration;
33
34 const QString mSection;
35 const QString mName;
36 QString mDefaultPath;
37 const QString mSectionCachePath;
38 const QUrl mUpdateUrl;
39 bool mUpdateRunning;
40
41 [[nodiscard]] const QString& getName() const;
42 [[nodiscard]] QDateTime cacheTimestamp() const;
43 [[nodiscard]] const QString& getSectionCachePath() const;
44
45 [[nodiscard]] QString qrcPath() const;
46 [[nodiscard]] QString cachePath() const;
47 [[nodiscard]] QUrl updateUrl(const QString& pSection, const QString& pName) const;
48 [[nodiscard]] QString dirtyFilePath() const;
49 [[nodiscard]] QString sectionCachePath(const QString& pSection) const;
50 [[nodiscard]] QString makeSectionCachePath(const QString& pSection) const;
51 void cleanupAfterUpdate(const std::function<void()>& pCustomAction);
52 bool writeDataToFile(const QByteArray& pData, const QString& pFilePath, bool pOverwrite = false);
53
54 private Q_SLOTS:
55 void onDownloadSuccess(const QUrl& pUpdateUrl, const QDateTime& pNewTimestamp, const QByteArray& pData);
56 void onDownloadFailed(const QUrl& pUpdateUrl, GlobalStatus::Code pErrorCode);
57 void onDownloadUnnecessary(const QUrl& pUpdateUrl);
58
59 public:
60 UpdatableFile(const QString& pSection, const QString& pName, const QString& pDefaultPath = QString());
61 ~UpdatableFile() override = default;
62
63 QUrl lookupUrl();
64 QString lookupPath();
65 bool forEachLookupPath(const std::function<bool(const QString&)>& pValidate);
66
67 void setDefaultPath(const QString& pPath);
68 [[nodiscard]] const QString& getDefaultPath() const;
69
70 void update();
71 [[nodiscard]] bool isDirty() const;
72 void clearDirty() const;
73 void markDirty() const;
74
75 Q_SIGNALS:
78
79};
80
81} // namespace governikus
Code
Definition: GlobalStatus.h:26
Definition: UpdatableFile.h:27
void clearDirty() const
Definition: UpdatableFile.cpp:376
bool forEachLookupPath(const std::function< bool(const QString &)> &pValidate)
Definition: UpdatableFile.cpp:294
~UpdatableFile() override=default
bool isDirty() const
Definition: UpdatableFile.cpp:365
const QString & getDefaultPath() const
Definition: UpdatableFile.cpp:342
QUrl lookupUrl()
Definition: UpdatableFile.cpp:252
void update()
Definition: UpdatableFile.cpp:348
void setDefaultPath(const QString &pPath)
Definition: UpdatableFile.cpp:333
QString lookupPath()
Definition: UpdatableFile.cpp:266
void markDirty() const
Definition: UpdatableFile.cpp:394
Implementation of ActivationContext for Intent based activation on Android systems.
Definition: ActivationContext.h:15