Atlas Game Manager
A game manager for f95 and dlsite written in c++
Loading...
Searching...
No Matches
AtlasRemote.hpp
Go to the documentation of this file.
1//
2// Created by kj16609 on 6/6/23.
3//
4
5#pragma once
6#ifndef ATLASGAMEMANAGER_ATLASREMOTE_HPP
7#define ATLASGAMEMANAGER_ATLASREMOTE_HPP
8
9#include <QNetworkReply>
10#include <QThread>
11
12class QNetworkReply;
13
14#include <filesystem>
15
16namespace atlas
17{
19 class AtlasRemote final : public QObject
20 {
21 Q_OBJECT
22
23 QThread m_thread {};
24 QNetworkAccessManager m_manager {};
25
26 void downloadManifest();
29 void markComplete( const std::uint64_t update_time, const bool yes = true );
30
32 std::vector< std::pair< std::uint64_t, std::uint64_t > > getUpdatesList() const;
33
35 std::uint64_t getNextUpdateTime() const;
36
37 public:
38
40
41 void triggerCheckRemote();
42
43 signals:
47 void triggerDownloadFor( const std::uint64_t timestamp );
48 void triggerParseFor( const std::uint64_t timestamp );
49
50 private slots:
52 void processUpdateFile( const std::uint64_t update_time );
53
54 void downloadUpdate( const std::uint64_t update_time );
55
56 void handleManifestError( QNetworkReply::NetworkError error, QNetworkReply* reply );
57
58 void handleDownloadError( QNetworkReply::NetworkError error, QNetworkReply* reply );
59
61 void handleJsonResponse( QNetworkReply* reply );
62
64 void handleDownloader( QNetworkReply* reply );
65
67 void check();
68 };
69
70 void initRemoteHandler();
72
74} // namespace atlas
75
76#endif //ATLASGAMEMANAGER_ATLASREMOTE_HPP
Manages all remote connections to the Atlas remote server.
Definition AtlasRemote.hpp:20
void markComplete(const std::uint64_t update_time, const bool yes=true)
Definition AtlasRemote.cpp:396
QThread m_thread
Definition AtlasRemote.hpp:23
void downloadManifest()
Definition AtlasRemote.cpp:76
void handleManifestError(QNetworkReply::NetworkError error, QNetworkReply *reply)
Definition AtlasRemote.cpp:409
void handleJsonResponse(QNetworkReply *reply)
Handles manifest requests from the server.
Definition AtlasRemote.cpp:157
std::uint64_t getNextUpdateTime() const
Returns the next update to process. Returns 0 if no updates to process.
Definition AtlasRemote.cpp:245
void check()
Causes the remote to go through a full check. Asking for new updates and processing them.
Definition AtlasRemote.cpp:71
void triggerCheckRemote()
Definition AtlasRemote.cpp:66
QNetworkAccessManager m_manager
Definition AtlasRemote.hpp:24
void triggerParseFor(const std::uint64_t timestamp)
void checkRemoteSignal()
Emitted when the remote should be checked.
void handleDownloadError(QNetworkReply::NetworkError error, QNetworkReply *reply)
Definition AtlasRemote.cpp:489
std::vector< std::pair< std::uint64_t, std::uint64_t > > getUpdatesList() const
Returns a list of all updates.
Definition AtlasRemote.cpp:235
void triggerDownloadFor(const std::uint64_t timestamp)
Asks the remote to download the timestamp file.
AtlasRemote()
Definition AtlasRemote.cpp:55
void processUpdateFile(const std::uint64_t update_time)
Updates the local DB with the updates available.
Definition AtlasRemote.cpp:299
void downloadUpdate(const std::uint64_t update_time)
Definition AtlasRemote.cpp:135
void handleDownloader(QNetworkReply *reply)
Handles download responses from the remote.
Definition AtlasRemote.cpp:100
void processPendingUpdates()
Definition AtlasRemote.cpp:375
Definition Column.hpp:15
AtlasRemote & atlasRemote()
Definition AtlasRemote.cpp:48
void shutdownRemoteHandler()
Definition AtlasRemote.cpp:43
void initRemoteHandler()
Definition AtlasRemote.cpp:36