mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-21 07:57:22 -06:00
Move some functions into Utils::OS namespace
Also remove `Utils::Misc::getUserIDString()` since there are no use of it.
This commit is contained in:
@@ -32,12 +32,41 @@
|
||||
|
||||
#include <QtSystemDetection>
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include <string>
|
||||
|
||||
#include <windows.h>
|
||||
|
||||
#include <QString>
|
||||
#endif
|
||||
|
||||
#include "base/path.h"
|
||||
|
||||
enum class ShutdownDialogAction;
|
||||
|
||||
namespace Utils::OS
|
||||
{
|
||||
void shutdownComputer(const ShutdownDialogAction &action);
|
||||
|
||||
#ifdef Q_OS_MACOS
|
||||
bool isTorrentFileAssocSet();
|
||||
void setTorrentFileAssoc();
|
||||
bool isMagnetLinkAssocSet();
|
||||
void setMagnetLinkAssoc();
|
||||
#endif // Q_OS_MACOS
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
Path windowsSystemPath();
|
||||
|
||||
template <typename T>
|
||||
T loadWinAPI(const QString &source, const char *funcName)
|
||||
{
|
||||
const std::wstring path = (windowsSystemPath() / Path(source)).toString().toStdWString();
|
||||
return reinterpret_cast<T>(::GetProcAddress(::LoadLibraryW(path.c_str()), funcName));
|
||||
}
|
||||
#endif // Q_OS_WIN
|
||||
|
||||
#if defined(Q_OS_MACOS) || defined(Q_OS_WIN)
|
||||
bool applyMarkOfTheWeb(const Path &file, const QString &url = {});
|
||||
#endif // Q_OS_MACOS || Q_OS_WIN
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user