# opencloud-eu/desktop architecture

> Architecture diagram of the GitHub repository opencloud-eu/desktop, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-12). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/opencloud-eu/desktop
- Repository: https://github.com/opencloud-eu/desktop

## Overview

##### Project Type and Purpose
- OpenCloud Desktop is a native desktop client (C++/Qt) for synchronizing files between a local machine and an OpenCloud server. It provides both a GUI (Qt Widgets + QML) and CLI interface, a background sync engine, OS‐level shell integrations, crash reporting, and packaging scripts.

##### File‐Structure Analysis
- Top‐level “src/” contains all code:
- src/gui – Qt‐based desktop UI, dialogs, QML components, system tray, notifications
- src/libsync – core synchronization library: job queue, network jobs, credential managers, filesystem abstractions, sync engine
- src/csync – low‐level file‐diff and transfer library
- src/common – shared utilities (checksum, VFS, plugin loader, restart manager)
- src/crashreporter – post‐crash analytics tool
- src/cmd – command‐line client front‐end
- src/plugins – VFS plugin stubs
- shell_integration/… – OS‐specific hooks (FinderSync on macOS, Explorer overlays & context menus on Windows)
- Build and packaging: CMakeLists.txt at root, “admin/” and “.github/workflows/” for CI and installer generation, “.woodpecker/” and packaging scripts for multiple platforms.

##### README Insights
- Confirms purpose as a file‐sync tool for OpenCloud servers
- Mentions community contributions, binary releases, and licensing
- No architecture section, so rely on directory conventions

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Presentation Layer"
        GUI["GUI Layer\n(src/gui)"]:::presentation
        QML["QML Assets\n(src/gui/qml & src/resources)"]:::presentation
        CLI["CLI Layer\n(src/cmd)"]:::presentation
        CrashReporter["Crash Reporter\n(src/crashreporter)"]:::presentation
    end

    subgraph "Domain Layer"
        SyncCore["Sync Core API\n(src/libsync)"]:::domain
        CSync["Low-Level File Diff/Transfer\n(src/csync)"]:::domain
        Common["Common Utilities\n(src/common)"]:::domain
        VFSPlugins["VFS Plugin Stubs\n(src/plugins/vfs/off/)"]:::domain
    end

    subgraph "Infrastructure"
        FSWatcher["Filesystem Watcher\n(inotify/FSEvents/Win32)"]:::infrastructure
        DB["SQLite Journal DB"]:::infrastructure
        Network["Network Layer\n(libcurl/OpenSSL)"]:::infrastructure
        ShellPlatMac["FinderSync Extension\n(shell_integration/MacOSX/OpenCloudFinderExtension/FinderSyncExt/)"]:::infrastructure
        ShellWinCtx["Windows Context Menu\n(shell_integration/windows/OCContextMenu/)"]:::infrastructure
        ShellWinOv["Windows Overlays\n(shell_integration/windows/OCOverlays/)"]:::infrastructure
        ShellWinUtil["Windows IPC Utility\n(shell_integration/windows/OCUtil/)"]:::infrastructure
        Build["Build & Packaging\n(CMakeLists.txt, admin/, .github/workflows/, .woodpecker/)"]:::infrastructure
    end

    subgraph "External Systems"
        Cloud["OpenCloud Server\n(WebDAV/Graph API)"]:::external
    end

    %% Data Flows
    GUI -->|"invoke APIs"| SyncCore
    CLI -->|"invoke APIs"| SyncCore
    QML -->|"UI assets"| GUI
    CrashReporter -->|"wraps"| GUI
    CrashReporter -->|"wraps"| SyncCore

    SyncCore -->|"uses"| Common
    CSync -->|"uses"| Common
    CLI -->|"uses"| Common
    GUI -->|"uses"| Common

    SyncCore -->|"queues jobs"| Network
    Network -->|"HTTP/WebDAV"| Cloud
    FSWatcher -->|"events"| SyncCore
    SyncCore -->|"logs to"| DB
    SyncCore -->|"delegates diff"| CSync
    CSync -->|"access FS"| FSWatcher

    SyncCore <-->|"IPC socket"| ShellPlatMac
    SyncCore <-->|"IPC socket"| ShellWinCtx
    SyncCore <-->|"IPC socket"| ShellWinOv
    SyncCore <-->|"IPC socket"| ShellWinUtil

    VFSPlugins -->|"plugin pattern"| SyncCore

    %% Click Events
    click GUI "https://github.com/opencloud-eu/desktop/tree/main/src/gui/"
    click QML "https://github.com/opencloud-eu/desktop/tree/main/src/gui/qml/"
    click QML "https://github.com/opencloud-eu/desktop/tree/main/src/resources/"
    click CLI "https://github.com/opencloud-eu/desktop/tree/main/src/cmd/"
    click SyncCore "https://github.com/opencloud-eu/desktop/tree/main/src/libsync/"
    click CSync "https://github.com/opencloud-eu/desktop/tree/main/src/csync/"
    click Common "https://github.com/opencloud-eu/desktop/tree/main/src/common/"
    click CrashReporter "https://github.com/opencloud-eu/desktop/tree/main/src/crashreporter/"
    click VFSPlugins "https://github.com/opencloud-eu/desktop/tree/main/src/plugins/vfs/off/"
    click ShellPlatMac "https://github.com/opencloud-eu/desktop/tree/main/shell_integration/MacOSX/OpenCloudFinderExtension/FinderSyncExt/"
    click ShellWinCtx "https://github.com/opencloud-eu/desktop/tree/main/shell_integration/windows/OCContextMenu/"
    click ShellWinOv "https://github.com/opencloud-eu/desktop/tree/main/shell_integration/windows/OCOverlays/"
    click ShellWinUtil "https://github.com/opencloud-eu/desktop/tree/main/shell_integration/windows/OCUtil/"
    click Build "https://github.com/opencloud-eu/desktop/blob/main/CMakeLists.txt"

    %% Styles
    classDef presentation fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef domain fill:#90EE90,stroke:#333,stroke-width:1px
    classDef infrastructure fill:#FFA500,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
```
