From 95dcded6b7540fe975cdc2448f10c87ddd990ce6 Mon Sep 17 00:00:00 2001 From: lysec Date: Thu, 9 Oct 2025 15:17:23 +0200 Subject: [PATCH] QuickSettings: add compact version i18n: add translations --- Assets/Translations/de.json | 41 +++++++++ Assets/Translations/en.json | 37 ++++++-- Assets/Translations/es.json | 41 +++++++++ Assets/Translations/fr.json | 41 +++++++++ Assets/Translations/pt.json | 41 +++++++++ Assets/Translations/zh-CN.json | 41 +++++++++ Modules/Settings/Tabs/ControlCenterTab.qml | 19 ++-- Widgets/NQuickSetting.qml | 100 +++++++++++++++++---- 8 files changed, 329 insertions(+), 32 deletions(-) diff --git a/Assets/Translations/de.json b/Assets/Translations/de.json index 021a823f..eb2f15ce 100644 --- a/Assets/Translations/de.json +++ b/Assets/Translations/de.json @@ -85,6 +85,7 @@ "reset-scaling": "Skalierung zurücksetzen" }, "control-center": { + "title": "Kontrollzentrum", "section": { "label": "Kontrollzentrum", "description": "Konfigurieren Sie die Positionierung und das Verhalten des Kontrollzentrum-Panels." @@ -92,6 +93,22 @@ "position": { "label": "Position", "description": "Wählen Sie, wo das Kontrollzentrum-Panel beim Öffnen erscheint." + }, + "quickSettingsStyle": { + "section": { + "label": "Schnelleinstellungen-Stil", + "description": "Passen Sie das Aussehen und Verhalten der Schnelleinstellungen im Kontrollzentrum an." + }, + "style": { + "label": "Schnelleinstellungen-Stil", + "description": "Wählen Sie den visuellen Stil für Schnelleinstellungs-Schalter und -Steuerungen." + } + }, + "widgets": { + "section": { + "label": "Widgets", + "description": "Konfigurieren und verwalten Sie Kontrollzentrum-Widgets und deren Anzeigeoptionen." + } } } }, @@ -709,6 +726,25 @@ } } }, + "control-center": { + "title": "Kontrollzentrum", + "quickSettingsStyle": { + "section": { + "label": "Schnelleinstellungen-Stil", + "description": "Passen Sie das Aussehen und Verhalten der Schnelleinstellungen im Kontrollzentrum an." + }, + "style": { + "label": "Schnelleinstellungen-Stil", + "description": "Wählen Sie den visuellen Stil für Schnelleinstellungs-Schalter und -Steuerungen." + } + }, + "widgets": { + "section": { + "label": "Widgets", + "description": "Konfigurieren und verwalten Sie Kontrollzentrum-Widgets und deren Anzeigeoptionen." + } + } + }, "hooks": { "title": "Hooks", "system-hooks": { @@ -1259,6 +1295,11 @@ "bottom_right": "Unten rechts", "bottom_center": "Unten mittig", "top_center": "Oben mittig" + }, + "quickSettingsStyle": { + "modern": "Modern", + "classic": "Klassisch", + "compact": "Kompakt" } }, "osd": { diff --git a/Assets/Translations/en.json b/Assets/Translations/en.json index 62d3e9c7..4d7e9b13 100644 --- a/Assets/Translations/en.json +++ b/Assets/Translations/en.json @@ -87,6 +87,7 @@ } }, "control-center": { + "title": "Control Center", "section": { "label": "Control Center", "description": "Configure the Control Center panel positioning and behavior." @@ -94,23 +95,21 @@ "position": { "label": "Position", "description": "Choose where the Control Center panel appears when opened." - } - }, - "controlCenter": { + }, "quickSettingsStyle": { "section": { "label": "Quick Settings Style", - "description": "Choose the visual style for quick settings buttons." + "description": "Customize the appearance and behavior of quick settings in the Control Center." }, "style": { - "label": "Display Style", - "description": "Select between modern card-style buttons or classic icon buttons." + "label": "Quick Settings Style", + "description": "Choose the visual style for quick settings toggles and controls." } }, "widgets": { "section": { "label": "Widgets", - "description": "Manage and configure Control Center widgets." + "description": "Configure and manage Control Center widgets and their display options." } } } @@ -725,6 +724,25 @@ } } }, + "control-center": { + "title": "Control Center", + "quickSettingsStyle": { + "section": { + "label": "Quick Settings Style", + "description": "Customize the appearance and behavior of quick settings in the Control Center." + }, + "style": { + "label": "Quick Settings Style", + "description": "Choose the visual style for quick settings toggles and controls." + } + }, + "widgets": { + "section": { + "label": "Widgets", + "description": "Configure and manage Control Center widgets and their display options." + } + } + }, "hooks": { "title": "Hooks", "system-hooks": { @@ -1261,8 +1279,9 @@ "top_center": "Top center" }, "quickSettingsStyle": { - "modern": "Modern Cards", - "classic": "Classic Icons" + "modern": "Modern", + "classic": "Classic", + "compact": "Compact" } }, "osd": { diff --git a/Assets/Translations/es.json b/Assets/Translations/es.json index f33d2e0c..5b904ade 100644 --- a/Assets/Translations/es.json +++ b/Assets/Translations/es.json @@ -85,6 +85,7 @@ "reset-scaling": "Restablecer la escala" }, "control-center": { + "title": "Centro de control", "section": { "label": "Centro de control", "description": "Configurar el posicionamiento y comportamiento del panel del centro de control." @@ -92,6 +93,22 @@ "position": { "label": "Posición", "description": "Elige dónde aparece el panel del centro de control cuando se abre." + }, + "quickSettingsStyle": { + "section": { + "label": "Estilo de configuración rápida", + "description": "Personaliza la apariencia y el comportamiento de las configuraciones rápidas en el centro de control." + }, + "style": { + "label": "Estilo de configuración rápida", + "description": "Elige el estilo visual para los interruptores y controles de configuración rápida." + } + }, + "widgets": { + "section": { + "label": "Widgets", + "description": "Configura y gestiona los widgets del centro de control y sus opciones de visualización." + } } } }, @@ -705,6 +722,25 @@ } } }, + "control-center": { + "title": "Centro de control", + "quickSettingsStyle": { + "section": { + "label": "Estilo de configuración rápida", + "description": "Personaliza la apariencia y el comportamiento de las configuraciones rápidas en el centro de control." + }, + "style": { + "label": "Estilo de configuración rápida", + "description": "Elige el estilo visual para los interruptores y controles de configuración rápida." + } + }, + "widgets": { + "section": { + "label": "Widgets", + "description": "Configura y gestiona los widgets del centro de control y sus opciones de visualización." + } + } + }, "hooks": { "title": "Hooks", "system-hooks": { @@ -1238,6 +1274,11 @@ "bottom_right": "Inferior derecha", "bottom_center": "Inferior central", "top_center": "Superior central" + }, + "quickSettingsStyle": { + "modern": "Moderno", + "classic": "Clásico", + "compact": "Compacto" } }, "osd": { diff --git a/Assets/Translations/fr.json b/Assets/Translations/fr.json index a087896a..aab3dd41 100644 --- a/Assets/Translations/fr.json +++ b/Assets/Translations/fr.json @@ -85,6 +85,7 @@ "reset-scaling": "Réinitialiser l'échelle" }, "control-center": { + "title": "Centre de contrôle", "section": { "label": "Centre de contrôle", "description": "Configurer le positionnement et le comportement du panneau du centre de contrôle." @@ -92,6 +93,22 @@ "position": { "label": "Position", "description": "Choisissez où apparaît le panneau du centre de contrôle lors de l'ouverture." + }, + "quickSettingsStyle": { + "section": { + "label": "Style des paramètres rapides", + "description": "Personnalisez l'apparence et le comportement des paramètres rapides dans le centre de contrôle." + }, + "style": { + "label": "Style des paramètres rapides", + "description": "Choisissez le style visuel pour les commutateurs et contrôles des paramètres rapides." + } + }, + "widgets": { + "section": { + "label": "Widgets", + "description": "Configurez et gérez les widgets du centre de contrôle et leurs options d'affichage." + } } } }, @@ -705,6 +722,25 @@ } } }, + "control-center": { + "title": "Centre de contrôle", + "quickSettingsStyle": { + "section": { + "label": "Style des paramètres rapides", + "description": "Personnalisez l'apparence et le comportement des paramètres rapides dans le centre de contrôle." + }, + "style": { + "label": "Style des paramètres rapides", + "description": "Choisissez le style visuel pour les commutateurs et contrôles des paramètres rapides." + } + }, + "widgets": { + "section": { + "label": "Widgets", + "description": "Configurez et gérez les widgets du centre de contrôle et leurs options d'affichage." + } + } + }, "hooks": { "title": "Hooks", "system-hooks": { @@ -1238,6 +1274,11 @@ "bottom_right": "En bas à droite", "bottom_center": "En bas au centre", "top_center": "En haut au centre" + }, + "quickSettingsStyle": { + "modern": "Moderne", + "classic": "Classique", + "compact": "Compact" } }, "osd": { diff --git a/Assets/Translations/pt.json b/Assets/Translations/pt.json index d9b1d538..ca66a0b4 100644 --- a/Assets/Translations/pt.json +++ b/Assets/Translations/pt.json @@ -85,6 +85,7 @@ "reset-scaling": "Redefinir escala" }, "control-center": { + "title": "Centro de controle", "section": { "label": "Centro de controle", "description": "Configurar o posicionamento e comportamento do painel do centro de controle." @@ -92,6 +93,22 @@ "position": { "label": "Posição", "description": "Escolha onde o painel do centro de controle aparece quando aberto." + }, + "quickSettingsStyle": { + "section": { + "label": "Estilo de configurações rápidas", + "description": "Personalize a aparência e o comportamento das configurações rápidas no centro de controle." + }, + "style": { + "label": "Estilo de configurações rápidas", + "description": "Escolha o estilo visual para os interruptores e controles de configurações rápidas." + } + }, + "widgets": { + "section": { + "label": "Widgets", + "description": "Configure e gerencie os widgets do centro de controle e suas opções de exibição." + } } } }, @@ -671,6 +688,25 @@ } } }, + "control-center": { + "title": "Centro de controle", + "quickSettingsStyle": { + "section": { + "label": "Estilo de configurações rápidas", + "description": "Personalize a aparência e o comportamento das configurações rápidas no centro de controle." + }, + "style": { + "label": "Estilo de configurações rápidas", + "description": "Escolha o estilo visual para os interruptores e controles de configurações rápidas." + } + }, + "widgets": { + "section": { + "label": "Widgets", + "description": "Configure e gerencie os widgets do centro de controle e suas opções de exibição." + } + } + }, "hooks": { "title": "Hooks", "system-hooks": { @@ -1237,6 +1273,11 @@ "bottom_right": "Inferior direito", "bottom_center": "Centro inferior", "top_center": "Centro superior" + }, + "quickSettingsStyle": { + "modern": "Moderno", + "classic": "Clássico", + "compact": "Compacto" } }, "bar": { diff --git a/Assets/Translations/zh-CN.json b/Assets/Translations/zh-CN.json index 8bdfbce4..f5ee975e 100644 --- a/Assets/Translations/zh-CN.json +++ b/Assets/Translations/zh-CN.json @@ -85,6 +85,7 @@ } }, "control-center": { + "title": "控制中心", "section": { "label": "控制中心", "description": "配置控制中心面板的定位和行为。" @@ -92,6 +93,22 @@ "position": { "label": "位置", "description": "选择控制中心面板打开时出现的位置。" + }, + "quickSettingsStyle": { + "section": { + "label": "快速设置样式", + "description": "自定义控制中心中快速设置的外观和行为。" + }, + "style": { + "label": "快速设置样式", + "description": "选择快速设置开关和控件的视觉样式。" + } + }, + "widgets": { + "section": { + "label": "小部件", + "description": "配置和管理控制中心小部件及其显示选项。" + } } } }, @@ -705,6 +722,25 @@ } } }, + "control-center": { + "title": "控制中心", + "quickSettingsStyle": { + "section": { + "label": "快速设置样式", + "description": "自定义控制中心中快速设置的外观和行为。" + }, + "style": { + "label": "快速设置样式", + "description": "选择快速设置开关和控件的视觉样式。" + } + }, + "widgets": { + "section": { + "label": "小部件", + "description": "配置和管理控制中心小部件及其显示选项。" + } + } + }, "hooks": { "title": "钩子", "system-hooks": { @@ -1238,6 +1274,11 @@ "bottom_right": "右下角", "bottom_center": "底部居中", "top_center": "顶部居中" + }, + "quickSettingsStyle": { + "modern": "现代", + "classic": "经典", + "compact": "紧凑" } }, "osd": { diff --git a/Modules/Settings/Tabs/ControlCenterTab.qml b/Modules/Settings/Tabs/ControlCenterTab.qml index 6a6a3b16..044f13c8 100644 --- a/Modules/Settings/Tabs/ControlCenterTab.qml +++ b/Modules/Settings/Tabs/ControlCenterTab.qml @@ -33,21 +33,24 @@ ColumnLayout { Layout.fillWidth: true NHeader { - label: I18n.tr("settings.controlCenter.quickSettingsStyle.section.label") - description: I18n.tr("settings.controlCenter.quickSettingsStyle.section.description") + label: I18n.tr("settings.control-center.quickSettingsStyle.section.label") + description: I18n.tr("settings.control-center.quickSettingsStyle.section.description") } NComboBox { id: quickSettingsStyle - label: I18n.tr("settings.controlCenter.quickSettingsStyle.style.label") - description: I18n.tr("settings.controlCenter.quickSettingsStyle.style.description") + label: I18n.tr("settings.control-center.quickSettingsStyle.style.label") + description: I18n.tr("settings.control-center.quickSettingsStyle.style.description") Layout.fillWidth: true model: [{ "key": "modern", - "name": I18n.tr("options.controlCenter.quickSettingsStyle.modern") + "name": I18n.tr("options.control-center.quickSettingsStyle.modern") }, { "key": "classic", - "name": I18n.tr("options.controlCenter.quickSettingsStyle.classic") + "name": I18n.tr("options.control-center.quickSettingsStyle.classic") + }, { + "key": "compact", + "name": I18n.tr("options.control-center.quickSettingsStyle.compact") }] currentKey: Settings.data.controlCenter.quickSettingsStyle || "modern" onSelected: function (key) { @@ -68,8 +71,8 @@ ColumnLayout { Layout.fillWidth: true NHeader { - label: I18n.tr("settings.controlCenter.widgets.section.label") - description: I18n.tr("settings.controlCenter.widgets.section.description") + label: I18n.tr("settings.control-center.widgets.section.label") + description: I18n.tr("settings.control-center.widgets.section.description") } // Bar Sections diff --git a/Widgets/NQuickSetting.qml b/Widgets/NQuickSetting.qml index 3c199c16..75517718 100644 --- a/Widgets/NQuickSetting.qml +++ b/Widgets/NQuickSetting.qml @@ -15,7 +15,7 @@ Rectangle { property bool enabled: true property bool active: false property bool compact: false - property string style: "modern" // "modern" or "classic" + property string style: "modern" // "modern", "classic", or "compact" // Styling properties property real fontSize: Style.fontSizeS * scaling @@ -24,14 +24,44 @@ Rectangle { property real cornerRadius: Style.radiusM * scaling // Colors - Style-dependent colors - property color backgroundColor: style === "classic" ? Color.mSurfaceVariant : Color.mSurface + property color backgroundColor: { + if (style === "classic") + return Color.mSurfaceVariant + if (style === "compact") + return Color.mSurface + return Color.mSurface + } property color textColor: Color.mOnSurface - property color iconColor: style === "classic" ? Color.mPrimary : (active ? Color.mPrimary : Color.mOnSurface) + property color iconColor: { + if (style === "classic") + return Color.mPrimary + if (style === "compact") + return active ? Color.mPrimary : Color.mOnSurface + return active ? Color.mPrimary : Color.mOnSurface + } property color borderColor: Color.mOutline - property color hoverColor: style === "classic" ? Color.mTertiary : Color.mPrimary - property color pressedColor: style === "classic" ? Color.mTertiary : Qt.darker(Color.mPrimary, 1.1) + property color hoverColor: { + if (style === "classic") + return Color.mTertiary + if (style === "compact") + return Color.mPrimary + return Color.mPrimary + } + property color pressedColor: { + if (style === "classic") + return Color.mTertiary + if (style === "compact") + return Qt.darker(Color.mPrimary, 1.1) + return Qt.darker(Color.mPrimary, 1.1) + } property color hoverTextColor: Color.mOnPrimary - property color hoverIconColor: style === "classic" ? Color.mOnTertiary : Color.mOnPrimary + property color hoverIconColor: { + if (style === "classic") + return Color.mOnTertiary + if (style === "compact") + return Color.mOnPrimary + return Color.mOnPrimary + } // Signals signal clicked @@ -48,17 +78,29 @@ Rectangle { if (style === "classic") { return Style.baseWidgetSize * scaling } + if (style === "compact") { + return Style.baseWidgetSize * 0.8 * scaling + } return compact ? Math.max(100 * scaling, contentRow.implicitWidth + (Style.marginL * scaling)) : Math.max(120 * scaling, contentRow.implicitWidth + (Style.marginL * scaling)) } implicitHeight: { if (style === "classic") { return Style.baseWidgetSize * scaling } + if (style === "compact") { + return Style.baseWidgetSize * 0.8 * scaling + } return compact ? Math.max(48 * scaling, contentRow.implicitHeight + (Style.marginM * scaling)) : Math.max(56 * scaling, contentRow.implicitHeight + (Style.marginL * scaling)) } // Appearance - Style-dependent styling - radius: style === "classic" ? width * 0.5 : cornerRadius + radius: { + if (style === "classic") + return width * 0.5 + if (style === "compact") + return Style.radiusS * scaling // Smaller radius for compact + return cornerRadius + } color: { if (!enabled) return Qt.lighter(Color.mSurface, 1.1) @@ -69,12 +111,21 @@ Rectangle { return backgroundColor } - border.width: style === "classic" ? Math.max(1, Style.borderS * scaling) : 0 - border.color: style === "classic" ? borderColor : "transparent" + border.width: { + if (style === "classic") + return Math.max(1, Style.borderS * scaling) + if (style === "compact") + return 0 + return 0 + } + border.color: { + if (style === "classic") + return borderColor + return "transparent" + } opacity: enabled ? (style === "classic" ? Style.opacityFull : 1.0) : (style === "classic" ? Style.opacityMedium : 0.6) - // Smooth animations Behavior on color { ColorAnimation { duration: style === "classic" ? Style.animationNormal : Style.animationFast @@ -120,7 +171,7 @@ Rectangle { id: contentRow anchors.centerIn: parent spacing: Style.marginXXS * scaling - visible: root.style !== "classic" + visible: root.style !== "classic" && root.style !== "compact" // Icon NIcon { @@ -169,6 +220,29 @@ Rectangle { } } + // Compact style - icon only, small square button + NIcon { + id: compactIcon + anchors.centerIn: parent + visible: root.style === "compact" && root.icon !== "" + icon: root.icon + pointSize: Style.fontSizeM * scaling // Smaller icon for compact + color: { + if (!root.enabled) + return Color.mOnSurfaceVariant + if (root.hovered) + return root.hoverIconColor + return root.iconColor + } + + Behavior on color { + ColorAnimation { + duration: Style.animationFast + easing.type: Easing.OutCubic + } + } + } + // Classic style - EXACTLY like NIconButton (icon + text) RowLayout { anchors.centerIn: parent @@ -217,7 +291,6 @@ Rectangle { } } - // Mouse interaction with enhanced feedback MouseArea { id: mouseArea anchors.fill: parent @@ -271,7 +344,6 @@ Rectangle { } } - // Ripple effect for M3-style interaction feedback Rectangle { id: ripple anchors.fill: parent @@ -306,7 +378,6 @@ Rectangle { } } - // Trigger ripple effect on click Connections { target: root function onClicked() { @@ -315,7 +386,6 @@ Rectangle { } } - // Clean up ripple after animation Connections { target: rippleAnimation function onFinished() {