From f3ec7b88009a6e1284bc595b1d1022d6f2e8daba Mon Sep 17 00:00:00 2001 From: Daniel Date: Tue, 3 Feb 2026 22:46:50 -0800 Subject: [PATCH] style: apply clang-format --- src/activities/apps/AppsActivity.h | 16 +++++---- src/apps/hello-world/HelloWorldActivity.cpp | 3 +- src/apps/hello-world/HelloWorldActivity.h | 6 ++-- src/extension/AppLoader.cpp | 20 +++++------ src/extension/AppLoader.h | 37 +++++++++++---------- src/main.cpp | 2 +- src/network/CrossPointWebServer.cpp | 6 ++-- 7 files changed, 45 insertions(+), 45 deletions(-) diff --git a/src/activities/apps/AppsActivity.h b/src/activities/apps/AppsActivity.h index 151915d0..dd937e30 100644 --- a/src/activities/apps/AppsActivity.h +++ b/src/activities/apps/AppsActivity.h @@ -1,33 +1,35 @@ #pragma once -#include "../Activity.h" -#include "../../extension/AppLoader.h" #include #include + #include #include +#include "../../extension/AppLoader.h" +#include "../Activity.h" + class AppsActivity : public Activity { public: using ExitCallback = std::function; - + AppsActivity(GfxRenderer& renderer, MappedInputManager& mappedInput, ExitCallback exitCallback); - + void onEnter() override; void onExit() override; void loop() override; - + private: GfxRenderer& renderer_; MappedInputManager& mappedInput_; ExitCallback exitCallback_; - + std::vector appList_; int selectedIndex_; bool needsUpdate_; bool isFlashing_; int flashProgress_; - + void scanApps(); void launchApp(); void render(); diff --git a/src/apps/hello-world/HelloWorldActivity.cpp b/src/apps/hello-world/HelloWorldActivity.cpp index b0d3b6f2..871a6434 100644 --- a/src/apps/hello-world/HelloWorldActivity.cpp +++ b/src/apps/hello-world/HelloWorldActivity.cpp @@ -4,7 +4,6 @@ #include #include #include - #include #include #include @@ -17,7 +16,7 @@ namespace { EpdFont ui12RegularFont(&ubuntu_12_regular); EpdFont ui12BoldFont(&ubuntu_12_bold); EpdFontFamily ui12FontFamily(&ui12RegularFont, &ui12BoldFont); -} +} // namespace HelloWorldActivity::HelloWorldActivity(HalDisplay& display, HalGPIO& input) : display_(display), input_(input), needsUpdate_(true) {} diff --git a/src/apps/hello-world/HelloWorldActivity.h b/src/apps/hello-world/HelloWorldActivity.h index 861deb85..b2ebdf8e 100644 --- a/src/apps/hello-world/HelloWorldActivity.h +++ b/src/apps/hello-world/HelloWorldActivity.h @@ -6,16 +6,16 @@ class HelloWorldActivity { public: HelloWorldActivity(HalDisplay& display, HalGPIO& input); - + void onEnter(); void loop(); void onExit(); - + private: HalDisplay& display_; HalGPIO& input_; bool needsUpdate_; - + void render(); void returnToLauncher(); }; diff --git a/src/extension/AppLoader.cpp b/src/extension/AppLoader.cpp index ee7f1b04..18a76d7e 100644 --- a/src/extension/AppLoader.cpp +++ b/src/extension/AppLoader.cpp @@ -1,10 +1,11 @@ #include "AppLoader.h" -#include #include #include #include +#include + #include "Battery.h" namespace CrossPoint { @@ -85,8 +86,8 @@ AppManifest AppLoader::parseManifest(const String& path) { } if (fileSize > MAX_MANIFEST_SIZE) { - Serial.printf("[%lu] [AppLoader] Manifest file too large (%u bytes, max %u): %s\n", - millis(), fileSize, MAX_MANIFEST_SIZE, path.c_str()); + Serial.printf("[%lu] [AppLoader] Manifest file too large (%u bytes, max %u): %s\n", millis(), fileSize, + MAX_MANIFEST_SIZE, path.c_str()); file.close(); return manifest; } @@ -97,8 +98,8 @@ AppManifest AppLoader::parseManifest(const String& path) { file.close(); if (bytesRead != fileSize) { - Serial.printf("[%lu] [AppLoader] Failed to read complete manifest file (read %u of %u bytes): %s\n", - millis(), bytesRead, fileSize, path.c_str()); + Serial.printf("[%lu] [AppLoader] Failed to read complete manifest file (read %u of %u bytes): %s\n", millis(), + bytesRead, fileSize, path.c_str()); return manifest; } @@ -113,8 +114,7 @@ AppManifest AppLoader::parseManifest(const String& path) { const DeserializationError error = deserializeJson(doc, json); if (error) { - Serial.printf("[%lu] [AppLoader] JSON parse error in %s: %s\n", - millis(), path.c_str(), error.c_str()); + Serial.printf("[%lu] [AppLoader] JSON parse error in %s: %s\n", millis(), path.c_str(), error.c_str()); return manifest; } @@ -307,8 +307,6 @@ String AppLoader::buildManifestPath(const String& appDir) const { return path; } -bool AppLoader::isSDReady() const { - return SdMan.ready(); -} +bool AppLoader::isSDReady() const { return SdMan.ready(); } -} +} // namespace CrossPoint diff --git a/src/extension/AppLoader.h b/src/extension/AppLoader.h index 1b2dc7b1..c75af201 100644 --- a/src/extension/AppLoader.h +++ b/src/extension/AppLoader.h @@ -1,24 +1,25 @@ #pragma once #include -#include -#include -#include #include +#include + +#include +#include namespace CrossPoint { /** * @brief App manifest data structure - * + * * Contains the metadata parsed from app.json files */ struct AppManifest { - String name; ///< Display name of the app - String version; ///< Version string (e.g., "1.0.0") - String description; ///< Brief description of the app - String author; ///< Author/creator name - String minFirmware; ///< Minimum firmware version required + String name; ///< Display name of the app + String version; ///< Version string (e.g., "1.0.0") + String description; ///< Brief description of the app + String author; ///< Author/creator name + String minFirmware; ///< Minimum firmware version required AppManifest() = default; AppManifest(const String& n, const String& v, const String& d, const String& a, const String& f) @@ -27,7 +28,7 @@ struct AppManifest { /** * @brief Complete app information including manifest and path - * + * * Combines the parsed manifest with file system path information */ struct AppInfo { @@ -40,10 +41,10 @@ struct AppInfo { /** * @brief Utility class for loading and managing apps from SD card - * + * * Handles scanning for app manifests in the /.crosspoint/apps directory, * parsing JSON manifests, and providing access to app information. - * + * * Usage: * AppLoader loader; * std::vector apps = loader.scanApps(); @@ -60,21 +61,21 @@ class AppLoader { /** * @brief Scan for apps in the /.crosspoint/apps directory - * + * * Searches for subdirectories under /.crosspoint/apps and attempts to * parse app.json files in each directory. Invalid or missing manifests * are skipped gracefully. - * + * * @return Vector of AppInfo objects for all valid apps found */ std::vector scanApps(); /** * @brief Parse an app.json manifest file - * + * * Reads and parses a JSON manifest file, extracting the required fields. * Logs errors for malformed JSON but does not throw exceptions. - * + * * @param path Full path to the app.json file * @return AppManifest object with parsed data (empty on failure) */ @@ -107,7 +108,7 @@ class AppLoader { /** * @brief Helper to build manifest file path from app directory path - * + * * @param appDir Path to the app directory * @return Full path to the app.json file */ @@ -115,7 +116,7 @@ class AppLoader { /** * @brief Check if SD card is ready - * + * * @return true if SD card is initialized and ready */ bool isSDReady() const; diff --git a/src/main.cpp b/src/main.cpp index fef8d715..9d47339a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -15,9 +15,9 @@ #include "KOReaderCredentialStore.h" #include "MappedInputManager.h" #include "RecentBooksStore.h" +#include "activities/apps/AppsActivity.h" #include "activities/boot_sleep/BootActivity.h" #include "activities/boot_sleep/SleepActivity.h" -#include "activities/apps/AppsActivity.h" #include "activities/browser/OpdsBookBrowserActivity.h" #include "activities/home/HomeActivity.h" #include "activities/home/MyLibraryActivity.h" diff --git a/src/network/CrossPointWebServer.cpp b/src/network/CrossPointWebServer.cpp index 97a4979f..750e1b55 100644 --- a/src/network/CrossPointWebServer.cpp +++ b/src/network/CrossPointWebServer.cpp @@ -9,9 +9,9 @@ #include +#include "html/AppsPageHtml.generated.h" #include "html/FilesPageHtml.generated.h" #include "html/HomePageHtml.generated.h" -#include "html/AppsPageHtml.generated.h" #include "util/StringUtils.h" namespace { @@ -525,8 +525,8 @@ static bool isValidAppId(const String& appId) { } for (size_t i = 0; i < appId.length(); i++) { const char c = appId.charAt(i); - const bool ok = (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '.' || - c == '_' || c == '-'; + const bool ok = + (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || c == '.' || c == '_' || c == '-'; if (!ok) { return false; }