|
1 | 1 | # 🛠️ Common UI Components |
2 | 2 |
|
3 | | -This directory contains **shared interface widgets** that are used across multiple modes of the application (both Classification and Localization). |
| 3 | +This directory contains **shared interface widgets** that are used across all four modes of the application (**Classification, Localization, Description, and Dense Description**). |
4 | 4 |
|
5 | | -The goal of this module is to adhere to the **DRY (Don't Repeat Yourself)** principle and ensure a consistent user experience regardless of the active task. |
| 5 | +The goal of this module is to adhere to the **DRY (Don't Repeat Yourself)** principle, ensuring a consistent layout and user experience regardless of the active task. |
6 | 6 |
|
7 | | -## 📂 Files |
| 7 | +## 📂 Files & Components |
8 | 8 |
|
9 | | -### `project_controls.py` |
| 9 | +### 1. `workspace.py` |
| 10 | + |
| 11 | +* **Class:** `UnifiedTaskPanel` |
| 12 | +* **Purpose:** The fundamental **Skeleton Layout** used by every operating mode. |
| 13 | +* **Structure:** A horizontal layout composed of three distinct sections: |
| 14 | +1. **Left Panel:** Contains the `CommonProjectTreePanel` (Clip Explorer). |
| 15 | +2. **Center Panel:** A stretchable area for the Media Player and Timelines. |
| 16 | +3. **Right Panel:** A task-specific area for Event Editors, Text Inputs, or Class Selectors. |
| 17 | + |
| 18 | + |
| 19 | +* **Usage:** This widget instantiates the Left Panel automatically, while the Center and Right widgets are injected via the constructor. |
| 20 | + |
| 21 | +### 2. `main_window.py` |
| 22 | + |
| 23 | +* **Class:** `MainWindowUI` |
| 24 | +* **Purpose:** The top-level container that orchestrates the **Screen Stack**. |
| 25 | +* **Architecture:** Uses a `QStackedLayout` to switch between views without destroying them. |
| 26 | +* **View Indices:** |
| 27 | +* **Index 0:** Welcome Screen (`WelcomeWidget`) |
| 28 | +* **Index 1:** Classification Workspace |
| 29 | +* **Index 2:** Localization Workspace |
| 30 | +* **Index 3:** Description Workspace (Global Captioning) |
| 31 | +* **Index 4:** **[NEW]** Dense Description Workspace (Timestamped Captioning) |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | +### 3. `clip_explorer.py` |
| 36 | + |
| 37 | +* **Class:** `CommonProjectTreePanel` |
| 38 | +* **Purpose:** The standardized **Left Sidebar** for file navigation. |
| 39 | +* **Key Features:** |
| 40 | +* **Architecture:** Refactored to use **Qt Model/View** (`QTreeView`) instead of `QTreeWidget` for better performance and separation of data. |
| 41 | +* **Integrated Controls:** Embeds `UnifiedProjectControls` at the top. |
| 42 | +* **Filtering:** Provides a "Show All / Labelled / Unlabelled" filter combo box. |
| 43 | +* **Context Menu:** Supports right-click actions (e.g., "Remove Item"). |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | +### 4. `video_surface.py` |
| 48 | + |
| 49 | +* **Class:** `VideoSurface` |
| 50 | +* **Purpose:** A lightweight, logic-free wrapper for video rendering. |
| 51 | +* **Components:** Encapsulates `QMediaPlayer`, `QAudioOutput` (with volume preset to 100%), and `QVideoWidget`. |
| 52 | +* **Role:** Acts strictly as the **View** layer for media. Playback logic (Play/Pause/Seek) is handled externally by the `MediaController` to prevent audio/visual desync. |
| 53 | + |
| 54 | +### 5. `project_controls.py` |
10 | 55 |
|
11 | 56 | * **Class:** `UnifiedProjectControls` |
12 | | -* **Purpose:** Provides a standardized **Project Management Panel** to handle the application lifecycle. |
13 | | -* **Layout:** A 3x2 Grid Layout containing the following essential buttons: |
14 | | - * **Row 1:** `New Project`, `Load Project` |
15 | | - * **Row 2:** `Add Data`, `Close Project` |
16 | | - * **Row 3:** `Save`, `Export` |
17 | | - |
18 | | -#### 📡 Signal Interface |
19 | | -This widget contains **no business logic**. It strictly forwards user interactions to the Controllers via Qt Signals: |
20 | | - |
21 | | -| Signal | Description | |
22 | | -| :--- | :--- | |
23 | | -| `createRequested` | Triggered when "New Project" is clicked. | |
24 | | -| `loadRequested` | Triggered when "Load Project" is clicked. | |
25 | | -| `addVideoRequested`| Triggered when "Add Data" is clicked. | |
26 | | -| `closeRequested` | Triggered when "Close Project" is clicked. | |
27 | | -| `saveRequested` | Triggered when "Save" is clicked. | |
28 | | -| `exportRequested` | Triggered when "Export" is clicked. | |
| 57 | +* **Purpose:** A standardized 3x2 **Project Management Grid**. |
| 58 | +* **Layout:** |
| 59 | +* **Row 1:** `New Project`, `Load Project` |
| 60 | +* **Row 2:** `Add Data`, `Close Project` |
| 61 | +* **Row 3:** `Save JSON`, `Export JSON` |
| 62 | + |
| 63 | + |
| 64 | +* **Signals:** Emits signals (`createRequested`, `saveRequested`, etc.) to be caught by the main Controller, keeping this widget purely presentational. |
| 65 | + |
| 66 | +### 6. `dialogs.py` |
| 67 | + |
| 68 | +* **Classes:** |
| 69 | +* `ProjectTypeDialog`: The "New Project" wizard. Now updated to support **4 Modes**: Classification, Localization, Description, and **Dense Description**. |
| 70 | +* `FolderPickerDialog`: A custom file dialog allowing **Multi-Folder Selection** via a `QTreeView` with checkboxes/click-toggle. |
| 71 | + |
| 72 | + |
| 73 | + |
| 74 | +### 7. `welcome_widget.py` |
| 75 | + |
| 76 | +* **Class:** `WelcomeWidget` |
| 77 | +* **Purpose:** The landing screen displayed on application startup. |
| 78 | +* **Actions:** Provides large, accessible entry points to "Create New Project" or "Import Project JSON". |
| 79 | + |
| 80 | +--- |
| 81 | + |
| 82 | +## 🧩 Architectural Diagram (UI Composition) |
| 83 | + |
| 84 | +The `MainWindowUI` builds the application by injecting specific widgets into the `UnifiedTaskPanel` skeleton: |
| 85 | + |
| 86 | +```mermaid |
| 87 | +graph TD |
| 88 | + MW[MainWindowUI] --> Stack[QStackedLayout] |
| 89 | + |
| 90 | + Stack --> View1[Classification Mode] |
| 91 | + Stack --> View2[Localization Mode] |
| 92 | + Stack --> View3[Description Mode] |
| 93 | + Stack --> View4[Dense Description Mode] |
| 94 | + |
| 95 | + subgraph "UnifiedTaskPanel (Shared Skeleton)" |
| 96 | + Left[CommonProjectTreePanel] |
| 97 | + Center[Media Player / Timeline] |
| 98 | + Right[Task Specific Editor] |
| 99 | + end |
| 100 | + |
| 101 | + View4 --> Left |
| 102 | + View4 --> Center |
| 103 | + View4 --> Right |
0 commit comments