cleanup: removed comments
This commit is contained in:
parent
ef46a02b2f
commit
978a3f4302
5 changed files with 0 additions and 168 deletions
|
|
@ -2,28 +2,9 @@ pragma Singleton
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
|
||||||
/**
|
|
||||||
* PaneRegistry
|
|
||||||
*
|
|
||||||
* Centralized registry for Control Center panes. This singleton provides a single
|
|
||||||
* source of truth for pane metadata (id, label, icon, component), eliminating
|
|
||||||
* the need for manual index management and making adding/removing panes trivial.
|
|
||||||
*
|
|
||||||
* Usage:
|
|
||||||
* - Panes.qml: Dynamically creates panes from registry
|
|
||||||
* - Session.qml: Derives panes list from registry
|
|
||||||
* - NavRail.qml: Uses registry for navigation items
|
|
||||||
*/
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
/**
|
|
||||||
* Pane metadata structure:
|
|
||||||
* - id: Unique identifier for the pane (string)
|
|
||||||
* - label: Display label for the pane (string)
|
|
||||||
* - icon: Material icon name (string)
|
|
||||||
* - component: Component path relative to controlcenter module (string)
|
|
||||||
*/
|
|
||||||
readonly property list<QtObject> panes: [
|
readonly property list<QtObject> panes: [
|
||||||
QtObject {
|
QtObject {
|
||||||
readonly property string id: "network"
|
readonly property string id: "network"
|
||||||
|
|
@ -63,15 +44,8 @@ QtObject {
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the count of registered panes
|
|
||||||
*/
|
|
||||||
readonly property int count: panes.length
|
readonly property int count: panes.length
|
||||||
|
|
||||||
/**
|
|
||||||
* Get pane labels as a list of strings
|
|
||||||
* Useful for Session.qml's panes property
|
|
||||||
*/
|
|
||||||
readonly property var labels: {
|
readonly property var labels: {
|
||||||
const result = [];
|
const result = [];
|
||||||
for (let i = 0; i < panes.length; i++) {
|
for (let i = 0; i < panes.length; i++) {
|
||||||
|
|
@ -80,11 +54,6 @@ QtObject {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get pane metadata by index
|
|
||||||
* @param index The index of the pane
|
|
||||||
* @return The pane metadata object or null if index is out of bounds
|
|
||||||
*/
|
|
||||||
function getByIndex(index: int): QtObject {
|
function getByIndex(index: int): QtObject {
|
||||||
if (index >= 0 && index < panes.length) {
|
if (index >= 0 && index < panes.length) {
|
||||||
return panes[index];
|
return panes[index];
|
||||||
|
|
@ -92,11 +61,6 @@ QtObject {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get pane index by label
|
|
||||||
* @param label The label to search for
|
|
||||||
* @return The index of the pane or -1 if not found
|
|
||||||
*/
|
|
||||||
function getIndexByLabel(label: string): int {
|
function getIndexByLabel(label: string): int {
|
||||||
for (let i = 0; i < panes.length; i++) {
|
for (let i = 0; i < panes.length; i++) {
|
||||||
if (panes[i].label === label) {
|
if (panes[i].label === label) {
|
||||||
|
|
@ -106,21 +70,11 @@ QtObject {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get pane metadata by label
|
|
||||||
* @param label The label to search for
|
|
||||||
* @return The pane metadata object or null if not found
|
|
||||||
*/
|
|
||||||
function getByLabel(label: string): QtObject {
|
function getByLabel(label: string): QtObject {
|
||||||
const index = getIndexByLabel(label);
|
const index = getIndexByLabel(label);
|
||||||
return getByIndex(index);
|
return getByIndex(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get pane metadata by id
|
|
||||||
* @param id The id to search for
|
|
||||||
* @return The pane metadata object or null if not found
|
|
||||||
*/
|
|
||||||
function getById(id: string): QtObject {
|
function getById(id: string): QtObject {
|
||||||
for (let i = 0; i < panes.length; i++) {
|
for (let i = 0; i < panes.length; i++) {
|
||||||
if (panes[i].id === id) {
|
if (panes[i].id === id) {
|
||||||
|
|
|
||||||
|
|
@ -9,38 +9,6 @@ import qs.config
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|
||||||
/**
|
|
||||||
* DeviceDetails
|
|
||||||
*
|
|
||||||
* A reusable base component for displaying device/network details with a standardized
|
|
||||||
* structure. Provides a header, connection status section, and flexible sections for
|
|
||||||
* device-specific information.
|
|
||||||
*
|
|
||||||
* This component eliminates duplication across WirelessDetails, EthernetDetails, and Bluetooth Details
|
|
||||||
* by providing a common structure while allowing full customization of sections.
|
|
||||||
*
|
|
||||||
* Usage:
|
|
||||||
* ```qml
|
|
||||||
* DeviceDetails {
|
|
||||||
* session: root.session
|
|
||||||
* device: session.network.active
|
|
||||||
* headerComponent: Component {
|
|
||||||
* ConnectionHeader {
|
|
||||||
* icon: "wifi"
|
|
||||||
* title: device?.ssid ?? ""
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* sections: [
|
|
||||||
* Component {
|
|
||||||
* // Connection status section
|
|
||||||
* },
|
|
||||||
* Component {
|
|
||||||
* // Properties section
|
|
||||||
* }
|
|
||||||
* ]
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,40 +10,6 @@ import Quickshell
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|
||||||
/**
|
|
||||||
* DeviceList
|
|
||||||
*
|
|
||||||
* A reusable base component for displaying lists of devices/networks with a standardized
|
|
||||||
* structure. Provides a header with action buttons, title/subtitle, and a scrollable list
|
|
||||||
* with customizable delegates.
|
|
||||||
*
|
|
||||||
* This component eliminates duplication across WirelessList, EthernetList, and Bluetooth DeviceList
|
|
||||||
* by providing a common structure while allowing full customization of headers and delegates.
|
|
||||||
*
|
|
||||||
* Usage:
|
|
||||||
* ```qml
|
|
||||||
* DeviceList {
|
|
||||||
* session: root.session
|
|
||||||
* title: qsTr("Networks (%1)").arg(Nmcli.networks.length)
|
|
||||||
* description: qsTr("All available WiFi networks")
|
|
||||||
* model: ScriptModel {
|
|
||||||
* values: [...Nmcli.networks].sort(...)
|
|
||||||
* }
|
|
||||||
* activeItem: session.network.active
|
|
||||||
* onItemSelected: (item) => {
|
|
||||||
* session.network.active = item;
|
|
||||||
* }
|
|
||||||
* headerComponent: Component {
|
|
||||||
* RowLayout {
|
|
||||||
* // Custom header buttons
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* delegate: Component {
|
|
||||||
* // Custom delegate for each item
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,31 +5,10 @@ import qs.config
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|
||||||
/**
|
|
||||||
* SettingsHeader
|
|
||||||
*
|
|
||||||
* Reusable header component for settings panes. Displays a large icon and title
|
|
||||||
* in a consistent format across all settings screens.
|
|
||||||
*
|
|
||||||
* Usage:
|
|
||||||
* ```qml
|
|
||||||
* SettingsHeader {
|
|
||||||
* icon: "router"
|
|
||||||
* title: qsTr("Network Settings")
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
/**
|
|
||||||
* Material icon name to display
|
|
||||||
*/
|
|
||||||
required property string icon
|
required property string icon
|
||||||
|
|
||||||
/**
|
|
||||||
* Title text to display
|
|
||||||
*/
|
|
||||||
required property string title
|
required property string title
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
|
||||||
|
|
@ -9,41 +9,6 @@ import Quickshell.Widgets
|
||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
|
||||||
/**
|
|
||||||
* SplitPaneWithDetails
|
|
||||||
*
|
|
||||||
* A reusable component that provides a split-pane layout with a list on the left
|
|
||||||
* and a details/settings view on the right. The right pane automatically switches
|
|
||||||
* between details and settings views based on whether an item is selected.
|
|
||||||
*
|
|
||||||
* This component eliminates duplication across WirelessPane, EthernetPane, and BtPane
|
|
||||||
* by providing a standardized pattern for split-pane layouts with transition animations.
|
|
||||||
*
|
|
||||||
* Usage:
|
|
||||||
* ```qml
|
|
||||||
* SplitPaneWithDetails {
|
|
||||||
* activeItem: root.session.network.active
|
|
||||||
* leftContent: Component {
|
|
||||||
* WirelessList {
|
|
||||||
* session: root.session
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* rightDetailsComponent: Component {
|
|
||||||
* WirelessDetails {
|
|
||||||
* session: root.session
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* rightSettingsComponent: Component {
|
|
||||||
* StyledFlickable {
|
|
||||||
* WirelessSettings {
|
|
||||||
* session: root.session
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
* paneIdGenerator: (item) => item ? (item.ssid || item.bssid || "") : ""
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*/
|
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue