Collect explicit URLs in one place
Some checks failed
Build Porymap / build-linux (, 5.14.2) (push) Has been cancelled
Build Porymap / build-linux (, 6.8.*) (push) Has been cancelled
Build Porymap / build-linux (minimal, 5.14.2) (push) Has been cancelled
Build Porymap / build-macos (macos-15-intel) (push) Has been cancelled
Build Porymap / build-macos (macos-latest) (push) Has been cancelled
Build Porymap / build-static-windows (push) Has been cancelled

This commit is contained in:
GriffinR
2026-04-19 15:00:54 -04:00
parent 7386af700c
commit 567e168bd5
10 changed files with 92 additions and 21 deletions

View File

@@ -26,13 +26,16 @@
});
*/
#include "url.h"
#if __has_include(<QNetworkAccessManager>)
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#endif
#include <QDateTime>
#include <QPointer>
#endif
#ifdef QT_NETWORK_LIB
@@ -95,6 +98,7 @@ private:
class Network
{
public:
static NetworkReplyData * get(Url::ID id);
static NetworkReplyData * get(const QString &url);
static NetworkReplyData * get(const QUrl &url);
};

33
include/core/url.h Normal file
View File

@@ -0,0 +1,33 @@
#pragma once
#ifndef URL_H
#define URL_H
#include <QUrl>
#include <QString>
/*
Some basic URL functions.
This mostly exists to collect all our explicit URLs in one place, in case they ever need to be changed.
*/
namespace Url {
enum ID {
Manual,
ManualProjectFiles,
ManualProjectIdentifiers,
ManualPlugins,
Releases,
};
const QUrl& get(ID id);
// Open's the specified URL using the system's default browser.
// Returns true if the request was sent (but the operation was not necessarily successful).
bool open(const QUrl& url);
bool open(ID id);
// Open's the specified local file using the system's default application.
// Returns true if the request was sent (but the operation was not necessarily successful).
bool openLocalFile(const QString& path);
};
#endif // URL_H