mirror of
https://github.com/huderlem/porymap.git
synced 2026-08-24 09:36:11 -05:00
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
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:
@@ -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
33
include/core/url.h
Normal 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
|
||||
Reference in New Issue
Block a user