summaryrefslogtreecommitdiff
path: root/archived/projt-launcher/docs/contributing/ARCHITECTURE.md
diff options
context:
space:
mode:
authorMehmet Samet Duman <yongdohyun@projecttick.org>2026-04-02 18:51:45 +0300
committerMehmet Samet Duman <yongdohyun@projecttick.org>2026-04-02 18:51:45 +0300
commitd3261e64152397db2dca4d691a990c6bc2a6f4dd (patch)
treefac2f7be638651181a72453d714f0f96675c2b8b /archived/projt-launcher/docs/contributing/ARCHITECTURE.md
parent31b9a8949ed0a288143e23bf739f2eb64fdc63be (diff)
downloadProject-Tick-d3261e64152397db2dca4d691a990c6bc2a6f4dd.tar.gz
Project-Tick-d3261e64152397db2dca4d691a990c6bc2a6f4dd.zip
NOISSUE add archived projects
Signed-off-by: Mehmet Samet Duman <yongdohyun@projecttick.org>
Diffstat (limited to 'archived/projt-launcher/docs/contributing/ARCHITECTURE.md')
-rw-r--r--archived/projt-launcher/docs/contributing/ARCHITECTURE.md177
1 files changed, 177 insertions, 0 deletions
diff --git a/archived/projt-launcher/docs/contributing/ARCHITECTURE.md b/archived/projt-launcher/docs/contributing/ARCHITECTURE.md
new file mode 100644
index 0000000000..a83334e604
--- /dev/null
+++ b/archived/projt-launcher/docs/contributing/ARCHITECTURE.md
@@ -0,0 +1,177 @@
+# Architecture
+
+High-level design and component interaction in ProjT Launcher.
+
+---
+
+## Layers
+
+```
+┌─────────────────────────────────────────┐
+│ UI Layer │
+│ launcher/ui/ (Qt Widgets) │
+├─────────────────────────────────────────┤
+│ Core Layer │
+│ launcher/minecraft/, net/, java/ │
+├─────────────────────────────────────────┤
+│ Task System │
+│ launcher/tasks/ │
+└─────────────────────────────────────────┘
+```
+
+### UI Layer
+
+**Location**: `launcher/ui/`
+
+- Qt Widgets interface
+- Renders state, handles user input
+- No direct I/O or network access
+
+### Core Layer
+
+**Location**: `launcher/`, `launcher/minecraft/`, `launcher/net/`, `launcher/java/`
+
+- Business logic
+- Data models
+- Network operations
+- No UI dependencies
+
+### Task System
+
+**Location**: `launcher/tasks/`
+
+- Long-running operations
+- Async work (downloads, extraction)
+- Progress reporting
+
+---
+
+## Key Principles
+
+### Separation of Concerns
+
+UI classes display state and forward user intent. They do not perform:
+
+- File I/O
+- Network requests
+- Long computations
+
+### Communication Pattern
+
+UI communicates with core via signals/slots:
+
+```cpp
+auto task = makeShared<DownloadTask>(url);
+connect(task.get(), &Task::progress, this, &MainWindow::updateProgress);
+connect(task.get(), &Task::finished, this, &MainWindow::onDownloadComplete);
+task->start();
+```
+
+### Threading
+
+| Thread | Purpose |
+|--------|---------|
+| Main | UI rendering only |
+| Worker | File I/O, networking, hashing |
+
+Operations > 10ms should be async.
+
+---
+
+## Task System
+
+### Creating a Task
+
+```cpp
+class MyTask : public Task {
+ Q_OBJECT
+
+protected:
+ void executeTask() override {
+ setStatus("Working...");
+ setProgress(0);
+
+ // Do work
+ for (int i = 0; i < 100; i++) {
+ if (isCancelled()) {
+ emitFailed("Cancelled");
+ return;
+ }
+ setProgress(i);
+ }
+
+ emitSucceeded();
+ }
+};
+```
+
+### Running a Task
+
+```cpp
+auto task = makeShared<MyTask>();
+connect(task.get(), &Task::succeeded, this, &MyClass::onSuccess);
+connect(task.get(), &Task::failed, this, &MyClass::onFailure);
+task->start();
+```
+
+---
+
+## Application Lifecycle
+
+1. **Startup**: `main.cpp` creates `Application` singleton
+2. **Setup**: Load settings, accounts, instances
+3. **UI Launch**: Create `MainWindow`
+4. **Runtime**: Event loop processes user actions
+5. **Shutdown**: Save state, release resources
+
+---
+
+## Service Objects
+
+Long-lived non-UI classes owned by Application:
+
+- `AccountManager` - Microsoft/offline accounts
+- `InstanceManager` - Minecraft instances
+- `NetworkManager` - HTTP operations
+- `SettingsManager` - Configuration
+
+Access via `Application::instance()->serviceName()`.
+
+---
+
+## Common Violations
+
+**Don't do these**:
+
+| Violation | Fix |
+|-----------|-----|
+| `sleep()` in UI | Use Task |
+| Network in UI class | Move to core service |
+| UI import in core | Remove dependency |
+| Direct file I/O in UI | Use Task |
+
+---
+
+## Module Dependencies
+
+```
+ui/ ──→ minecraft/ ──→ net/
+ │ │
+ └──→ tasks/ ←──┘
+ │
+ └──→ java/
+```
+
+**Rules**:
+
+- No circular dependencies
+- `ui/` depends on everything
+- Core modules are independent
+- `tasks/` is a utility layer
+
+---
+
+## Related
+
+- [Project Structure](./PROJECT_STRUCTURE.md)
+- [Testing](./TESTING.md)