From 9cfc4bb154b509f11fa4b0e6464642612b6588e3 Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Sat, 21 Jan 2023 11:12:04 +0100 Subject: [PATCH] Formatting with clang 15 --- .../ScreenPlayUtil/AutoPropertyHelpers.h | 9 +++-- .../ScreenPlayUtil/ConstRefPropertyHelpers.h | 9 +++-- .../ScreenPlayUtil/ListPropertyHelper.h | 17 +++++---- .../public/ScreenPlayUtil/PropertyHelpers.h | 9 +++-- .../ScreenPlayUtil/PtrPropertyHelpers.h | 18 ++++++---- .../inc/public/ScreenPlayUtil/projectfile.h | 10 +++--- ScreenPlayWallpaper/src/basewindow.cpp | 9 ++--- ScreenPlayWidget/main.cpp | 4 +-- ScreenPlayWidget/src/widgetwindow.cpp | 7 ++-- .../SteamSDK/public/steam/isteaminventory.h | 36 +++++++++---------- .../public/steam/steam_api_internal.h | 20 ++++++++--- ScreenPlayWorkshop/src/installedlistmodel.cpp | 6 ++-- ScreenPlayWorkshop/src/installedlistmodel.h | 2 +- 13 files changed, 91 insertions(+), 65 deletions(-) diff --git a/ScreenPlayUtil/inc/public/ScreenPlayUtil/AutoPropertyHelpers.h b/ScreenPlayUtil/inc/public/ScreenPlayUtil/AutoPropertyHelpers.h index eca0a787..b6cecf09 100644 --- a/ScreenPlayUtil/inc/public/ScreenPlayUtil/AutoPropertyHelpers.h +++ b/ScreenPlayUtil/inc/public/ScreenPlayUtil/AutoPropertyHelpers.h @@ -4,9 +4,12 @@ #include "HelpersCommon.h" -#define AUTO_GETTER(type, name) \ -public: \ - CheapestType::type_def MAKE_GETTER_NAME(name)() const { return m_##name; } +#define AUTO_GETTER(type, name) \ +public: \ + CheapestType::type_def MAKE_GETTER_NAME(name)() const \ + { \ + return m_##name; \ + } #define AUTO_SETTER(type, name) \ public: \ diff --git a/ScreenPlayUtil/inc/public/ScreenPlayUtil/ConstRefPropertyHelpers.h b/ScreenPlayUtil/inc/public/ScreenPlayUtil/ConstRefPropertyHelpers.h index ea3ef2a5..90b4b398 100644 --- a/ScreenPlayUtil/inc/public/ScreenPlayUtil/ConstRefPropertyHelpers.h +++ b/ScreenPlayUtil/inc/public/ScreenPlayUtil/ConstRefPropertyHelpers.h @@ -14,9 +14,12 @@ public: \ } \ } -#define CONST_GETTER(type, name) \ -public: \ - const type& MAKE_GETTER_NAME(name)() const { return m_##name; } +#define CONST_GETTER(type, name) \ +public: \ + const type& MAKE_GETTER_NAME(name)() const \ + { \ + return m_##name; \ + } #define W_CREF_PROPERTY(type, name) \ protected: \ diff --git a/ScreenPlayUtil/inc/public/ScreenPlayUtil/ListPropertyHelper.h b/ScreenPlayUtil/inc/public/ScreenPlayUtil/ListPropertyHelper.h index b63381b0..725b5ded 100644 --- a/ScreenPlayUtil/inc/public/ScreenPlayUtil/ListPropertyHelper.h +++ b/ScreenPlayUtil/inc/public/ScreenPlayUtil/ListPropertyHelper.h @@ -56,11 +56,14 @@ private: CppListType m_items; }; -#define LIST_PROPERTY(TYPE, NAME) \ -private: \ - Q_PROPERTY(QQmlListProperty NAME READ MAKE_GETTER_NAME(NAME) CONSTANT) \ -public: \ - const QQmlSmartListWrapper& MAKE_GETTER_NAME(NAME)() const { return m_##NAME; } \ - \ -private: \ +#define LIST_PROPERTY(TYPE, NAME) \ +private: \ + Q_PROPERTY(QQmlListProperty NAME READ MAKE_GETTER_NAME(NAME) CONSTANT) \ +public: \ + const QQmlSmartListWrapper& MAKE_GETTER_NAME(NAME)() const \ + { \ + return m_##NAME; \ + } \ + \ +private: \ QQmlSmartListWrapper m_##NAME; diff --git a/ScreenPlayUtil/inc/public/ScreenPlayUtil/PropertyHelpers.h b/ScreenPlayUtil/inc/public/ScreenPlayUtil/PropertyHelpers.h index 908d563f..2d0f9c3e 100644 --- a/ScreenPlayUtil/inc/public/ScreenPlayUtil/PropertyHelpers.h +++ b/ScreenPlayUtil/inc/public/ScreenPlayUtil/PropertyHelpers.h @@ -4,9 +4,12 @@ #include "HelpersCommon.h" -#define PROP_GETTER(type, name) \ -public: \ - type MAKE_GETTER_NAME(name)() const { return m_##name; } +#define PROP_GETTER(type, name) \ +public: \ + type MAKE_GETTER_NAME(name)() const \ + { \ + return m_##name; \ + } #define PROP_SETTER(type, name) \ public: \ diff --git a/ScreenPlayUtil/inc/public/ScreenPlayUtil/PtrPropertyHelpers.h b/ScreenPlayUtil/inc/public/ScreenPlayUtil/PtrPropertyHelpers.h index 7df55db5..1249adeb 100644 --- a/ScreenPlayUtil/inc/public/ScreenPlayUtil/PtrPropertyHelpers.h +++ b/ScreenPlayUtil/inc/public/ScreenPlayUtil/PtrPropertyHelpers.h @@ -5,9 +5,12 @@ #include "HelpersCommon.h" -#define PTR_GETTER(type, name) \ -public: \ - type* MAKE_GETTER_NAME(name)() const { return m_##name; } +#define PTR_GETTER(type, name) \ +public: \ + type* MAKE_GETTER_NAME(name)() const \ + { \ + return m_##name; \ + } #define PTR_SETTER(type, name) \ public: \ @@ -19,9 +22,12 @@ public: \ } \ } -#define SMART_PTR_GETTER(type, name) \ -public: \ - type* MAKE_GETTER_NAME(name)() const { return m_##name.get(); } +#define SMART_PTR_GETTER(type, name) \ +public: \ + type* MAKE_GETTER_NAME(name)() const \ + { \ + return m_##name.get(); \ + } #define SMART_PTR_SETTER(type, name) \ public: \ diff --git a/ScreenPlayUtil/inc/public/ScreenPlayUtil/projectfile.h b/ScreenPlayUtil/inc/public/ScreenPlayUtil/projectfile.h index c1cfe5c9..c951c694 100644 --- a/ScreenPlayUtil/inc/public/ScreenPlayUtil/projectfile.h +++ b/ScreenPlayUtil/inc/public/ScreenPlayUtil/projectfile.h @@ -4,20 +4,20 @@ #include #include -#include +#include +#include #include #include #include +#include +#include #include #include -#include #include #include -#include -#include -#include "ScreenPlayUtil/util.h" #include "ScreenPlayUtil/PropertyHelpers.h" +#include "ScreenPlayUtil/util.h" /*! \class ProjectFile diff --git a/ScreenPlayWallpaper/src/basewindow.cpp b/ScreenPlayWallpaper/src/basewindow.cpp index 9582c9b4..12c3aa3e 100644 --- a/ScreenPlayWallpaper/src/basewindow.cpp +++ b/ScreenPlayWallpaper/src/basewindow.cpp @@ -68,12 +68,9 @@ BaseWindow::ExitCode BaseWindow::setup() // directly without an running ScreenPlay if (!debugMode()) { m_sdk = std::make_unique(appID(), QVariant::fromValue(type()).toString()); - // QObject::connect(m_sdk.get(), &ScreenPlaySDK::sdkDisconnected, this, [this]() { - // destroyThis(); - // }); - connect(sdk(), &ScreenPlaySDK::sdkDisconnected, this, &BaseWindow::destroyThis); - connect(sdk(), &ScreenPlaySDK::incommingMessage, this, &BaseWindow::messageReceived); - connect(sdk(), &ScreenPlaySDK::replaceWallpaper, this, &BaseWindow::replaceWallpaper); + connect(m_sdk.get(), &ScreenPlaySDK::sdkDisconnected, this, &BaseWindow::destroyThis); + connect(m_sdk.get(), &ScreenPlaySDK::incommingMessage, this, &BaseWindow::messageReceived); + connect(m_sdk.get(), &ScreenPlaySDK::replaceWallpaper, this, &BaseWindow::replaceWallpaper); sdk()->start(); } diff --git a/ScreenPlayWidget/main.cpp b/ScreenPlayWidget/main.cpp index ea48b42a..a777bda3 100644 --- a/ScreenPlayWidget/main.cpp +++ b/ScreenPlayWidget/main.cpp @@ -24,8 +24,8 @@ int main(int argc, char* argv[]) // If we start with only one argument (path, appID, type), // it means we want to test a single widget if (argumentList.length() == 1) { - WidgetWindow spwmw("test", "appid", "qmlWidget", { 100, 100 }, true); - //WidgetWindow spwmw("C:/Program Files (x86)/Steam/steamapps/workshop/content/672870/2136442401", "appid", "qmlWidget", { 0, 0 }, true); + WidgetWindow spwmw("test", "appid", "qmlWidget", { 100, 100 }, true); + // WidgetWindow spwmw("C:/Program Files (x86)/Steam/steamapps/workshop/content/672870/2136442401", "appid", "qmlWidget", { 0, 0 }, true); return app.exec(); } diff --git a/ScreenPlayWidget/src/widgetwindow.cpp b/ScreenPlayWidget/src/widgetwindow.cpp index 6ba68b62..bf7b9bb6 100644 --- a/ScreenPlayWidget/src/widgetwindow.cpp +++ b/ScreenPlayWidget/src/widgetwindow.cpp @@ -40,10 +40,10 @@ WidgetWindow::WidgetWindow( "Error: only enums"); Qt::WindowFlags flags = m_window.flags(); - if(QSysInfo::productType() == "macos") { + if (QSysInfo::productType() == "macos") { // Setting it as a SlashScreen causes the window to hide on focus lost - m_window.setFlags(flags | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint ); - } else if(QSysInfo::productType() == "windows") { + m_window.setFlags(flags | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint); + } else if (QSysInfo::productType() == "windows") { // Must be splash screen to not show up in the taskbar m_window.setFlags(flags | Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint | Qt::BypassWindowManagerHint | Qt::SplashScreen); } @@ -220,4 +220,3 @@ void WidgetWindow::setupLiveReloading() QObject::connect(&m_liveReloadLimiter, &QTimer::timeout, this, reloadQMLLambda); m_fileSystemWatcher.addPaths({ projectPath() }); } - diff --git a/ScreenPlayWorkshop/SteamSDK/public/steam/isteaminventory.h b/ScreenPlayWorkshop/SteamSDK/public/steam/isteaminventory.h index fc1e6b1f..37baf67b 100644 --- a/ScreenPlayWorkshop/SteamSDK/public/steam/isteaminventory.h +++ b/ScreenPlayWorkshop/SteamSDK/public/steam/isteaminventory.h @@ -364,9 +364,9 @@ STEAM_DEFINE_GAMESERVER_INTERFACE_ACCESSOR(ISteamInventory*, SteamGameServerInve // results transition from "Pending" to "OK" or an error state. There will // always be exactly one callback per handle. struct SteamInventoryResultReady_t { - enum { k_iCallback = k_iSteamInventoryCallbacks + 0 }; - SteamInventoryResult_t m_handle; - EResult m_result; + enum { k_iCallback = k_iSteamInventoryCallbacks + 0 }; + SteamInventoryResult_t m_handle; + EResult m_result; }; // SteamInventoryFullUpdate_t callbacks are triggered when GetAllItems @@ -377,8 +377,8 @@ struct SteamInventoryResultReady_t { // The normal ResultReady callback will still be triggered immediately // afterwards; this is an additional notification for your convenience. struct SteamInventoryFullUpdate_t { - enum { k_iCallback = k_iSteamInventoryCallbacks + 1 }; - SteamInventoryResult_t m_handle; + enum { k_iCallback = k_iSteamInventoryCallbacks + 1 }; + SteamInventoryResult_t m_handle; }; // A SteamInventoryDefinitionUpdate_t callback is triggered whenever @@ -386,31 +386,31 @@ struct SteamInventoryFullUpdate_t { // LoadItemDefinitions() or any other async request which required // a definition update in order to process results from the server. struct SteamInventoryDefinitionUpdate_t { - enum { k_iCallback = k_iSteamInventoryCallbacks + 2 }; + enum { k_iCallback = k_iSteamInventoryCallbacks + 2 }; }; // Returned struct SteamInventoryEligiblePromoItemDefIDs_t { - enum { k_iCallback = k_iSteamInventoryCallbacks + 3 }; - EResult m_result; - CSteamID m_steamID; - int m_numEligiblePromoItemDefs; - bool m_bCachedData; // indicates that the data was retrieved from the cache and not the server + enum { k_iCallback = k_iSteamInventoryCallbacks + 3 }; + EResult m_result; + CSteamID m_steamID; + int m_numEligiblePromoItemDefs; + bool m_bCachedData; // indicates that the data was retrieved from the cache and not the server }; // Triggered from StartPurchase call struct SteamInventoryStartPurchaseResult_t { - enum { k_iCallback = k_iSteamInventoryCallbacks + 4 }; - EResult m_result; - uint64 m_ulOrderID; - uint64 m_ulTransID; + enum { k_iCallback = k_iSteamInventoryCallbacks + 4 }; + EResult m_result; + uint64 m_ulOrderID; + uint64 m_ulTransID; }; // Triggered from RequestPrices struct SteamInventoryRequestPricesResult_t { - enum { k_iCallback = k_iSteamInventoryCallbacks + 5 }; - EResult m_result; - char m_rgchCurrency[4]; + enum { k_iCallback = k_iSteamInventoryCallbacks + 5 }; + EResult m_result; + char m_rgchCurrency[4]; }; #pragma pack(pop) diff --git a/ScreenPlayWorkshop/SteamSDK/public/steam/steam_api_internal.h b/ScreenPlayWorkshop/SteamSDK/public/steam/steam_api_internal.h index 1f4b52b9..218a040d 100644 --- a/ScreenPlayWorkshop/SteamSDK/public/steam/steam_api_internal.h +++ b/ScreenPlayWorkshop/SteamSDK/public/steam/steam_api_internal.h @@ -31,7 +31,10 @@ S_API void* S_CALLTYPE SteamInternal_FindOrCreateGameServerInterface(HSteamUser // struct { void (*pFn)(void* pCtx); uintptr_t counter; void *ptr; } // Do not change layout or add non-pointer aligned data! #define STEAM_DEFINE_INTERFACE_ACCESSOR(type, name, expr, kind, version) \ - inline void S_CALLTYPE SteamInternal_Init_##name(type* p) { *p = (type)(expr); } \ + inline void S_CALLTYPE SteamInternal_Init_##name(type* p) \ + { \ + *p = (type)(expr); \ + } \ STEAM_CLANG_ATTR("interface_accessor_kind:" kind ";interface_accessor_version:" version ";") \ inline type name() \ { \ @@ -66,9 +69,18 @@ S_API void S_CALLTYPE SteamAPI_UnregisterCallResult(class CCallbackBase* pCallba #define _STEAM_CALLBACK_SELECT(X, Y) _STEAM_CALLBACK_HELPER X Y #define _STEAM_CALLBACK_3(extra_code, thisclass, func, param) \ struct CCallbackInternal_##func : private CCallbackImpl { \ - CCallbackInternal_##func() { extra_code SteamAPI_RegisterCallback(this, param::k_iCallback); } \ - CCallbackInternal_##func(const CCallbackInternal_##func&) { extra_code SteamAPI_RegisterCallback(this, param::k_iCallback); } \ - CCallbackInternal_##func& operator=(const CCallbackInternal_##func&) { return *this; } \ + CCallbackInternal_##func() \ + { \ + extra_code SteamAPI_RegisterCallback(this, param::k_iCallback); \ + } \ + CCallbackInternal_##func(const CCallbackInternal_##func&) \ + { \ + extra_code SteamAPI_RegisterCallback(this, param::k_iCallback); \ + } \ + CCallbackInternal_##func& operator=(const CCallbackInternal_##func&) \ + { \ + return *this; \ + } \ \ private: \ virtual void Run(void* pvParam) \ diff --git a/ScreenPlayWorkshop/src/installedlistmodel.cpp b/ScreenPlayWorkshop/src/installedlistmodel.cpp index 565aaab4..31110257 100644 --- a/ScreenPlayWorkshop/src/installedlistmodel.cpp +++ b/ScreenPlayWorkshop/src/installedlistmodel.cpp @@ -50,7 +50,7 @@ QVariant InstalledListModel::data(const QModelIndex& index, int role) const return m_screenPlayFiles.at(row).folderName; case static_cast(ScreenPlayItem::FileId): return m_screenPlayFiles.at(row).file; - case static_cast(ScreenPlayItem::AbsoluteStoragePath): + case static_cast(ScreenPlayItem::AbsoluteStoragePath): return QUrl::fromLocalFile(m_screenPlayFiles.at(row).projectJsonFilePath.dir().path()); case static_cast(ScreenPlayItem::PublishedFileID): return m_screenPlayFiles.at(row).publishedFileID; @@ -86,8 +86,8 @@ void InstalledListModel::append(const QString& projectJsonFilePath) using namespace ScreenPlay; ProjectFile projectFile; projectFile.projectJsonFilePath = QFileInfo(projectJsonFilePath); - if(!projectFile.init()){ - qWarning() << "Invalid project at "<< projectJsonFilePath; + if (!projectFile.init()) { + qWarning() << "Invalid project at " << projectJsonFilePath; return; } m_screenPlayFiles.append(std::move(projectFile)); diff --git a/ScreenPlayWorkshop/src/installedlistmodel.h b/ScreenPlayWorkshop/src/installedlistmodel.h index 85c893bf..7603c259 100644 --- a/ScreenPlayWorkshop/src/installedlistmodel.h +++ b/ScreenPlayWorkshop/src/installedlistmodel.h @@ -19,9 +19,9 @@ #include #include #include -#include #include #include +#include #include "ScreenPlayUtil/projectfile.h"