Files
metabuilder/qml/widgets/LanguageSelector.qml
johndoe6345789 c406b8df96 refactor: Reorganize FakeMUI by implementation type
Move FakeMUI content to appropriate root-level folders by implementation:

**React Components → components/fakemui/**
- 537 components (inputs, surfaces, layout, data-display, feedback,
  navigation, utils, atoms, lab, x, email, workflows)
- 416 SVG icons
- Full barrel exports in components/fakemui/index.ts

**QML Components → qml/**
- 104 Material Design 3 components (11 categories)
- 7 hybrid application views
- 8 desktop widgets
- qmldir module registration

**Python Bindings → python/fakemui/**
- 15 PyQt6 modules (120+ components)
- Full Python package structure with pyproject.toml

**SCSS/Styles → fakemui/** (renamed purpose)
- scss/ - Material Design 3 stylesheets
- styles/ - Component SCSS modules
- src/utils/ - Accessibility utilities
- index.ts now re-exports from components/fakemui/

This separation allows:
- React: import { Button } from '@metabuilder/components/fakemui'
- QML: import QmlComponents 1.0
- Python: from fakemui import Button, Card
- Backward compat: import { Button } from '@metabuilder/fakemui'

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-02 12:59:24 +00:00

119 lines
3.9 KiB
QML

import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
Popup {
id: popup
width: 220
height: Math.min(400, langList.contentHeight + 60)
padding: 8
property string currentLanguage: "en"
property var themeColors: ({})
signal languageSelected(string langId)
// Internal colors with fallbacks
readonly property var colors: ({
background: themeColors.window || themeColors.background || "#0d0d0d",
paper: themeColors.alternateBase || "#1a1a1a",
text: themeColors.windowText || themeColors.text || "#ffffff",
textSecondary: themeColors.textSecondary || "#a0a0a0",
accent: themeColors.accent || "#10a37f",
border: themeColors.border || "#333333",
hover: themeColors.highlight || "#242424"
})
readonly property var languages: [
{ id: "en", name: "English", flag: "🇺🇸" },
{ id: "es", name: "Español", flag: "🇪🇸" },
{ id: "fr", name: "Français", flag: "🇫🇷" },
{ id: "de", name: "Deutsch", flag: "🇩🇪" },
{ id: "it", name: "Italiano", flag: "🇮🇹" },
{ id: "pt", name: "Português", flag: "🇧🇷" },
{ id: "nl", name: "Nederlands", flag: "🇳🇱" },
{ id: "pl", name: "Polski", flag: "🇵🇱" },
{ id: "sv", name: "Svenska", flag: "🇸🇪" },
{ id: "tr", name: "Türkçe", flag: "🇹🇷" },
{ id: "ru", name: "Русский", flag: "🇷🇺" },
{ id: "uk", name: "Українська", flag: "🇺🇦" },
{ id: "ar", name: "العربية", flag: "🇸🇦" },
{ id: "hi", name: "हिंदी", flag: "🇮🇳" },
{ id: "th", name: "ไทย", flag: "🇹🇭" },
{ id: "vi", name: "Tiếng Việt", flag: "🇻🇳" },
{ id: "zh", name: "中文", flag: "🇨🇳" },
{ id: "ja", name: "日本語", flag: "🇯🇵" },
{ id: "ko", name: "한국어", flag: "🇰🇷" },
]
background: Rectangle {
color: colors.background
border.color: colors.border
border.width: 1
radius: 8
}
ColumnLayout {
anchors.fill: parent
spacing: 4
Label {
text: "🌐 Language"
font.bold: true
font.pixelSize: 12
color: colors.text
Layout.bottomMargin: 4
}
ListView {
id: langList
Layout.fillWidth: true
Layout.fillHeight: true
clip: true
model: popup.languages
delegate: ItemDelegate {
width: langList.width
height: 36
highlighted: modelData.id === popup.currentLanguage
background: Rectangle {
color: parent.highlighted ? colors.accent : (parent.hovered ? colors.hover : "transparent")
radius: 4
}
contentItem: RowLayout {
spacing: 8
Label {
text: modelData.flag
font.pixelSize: 16
}
Label {
text: modelData.name
color: parent.parent.highlighted ? "#fff" : colors.text
Layout.fillWidth: true
}
Label {
text: "✓"
visible: modelData.id === popup.currentLanguage
color: "#fff"
}
}
onClicked: {
popup.languageSelected(modelData.id)
popup.close()
}
}
ScrollBar.vertical: ScrollBar {
policy: ScrollBar.AsNeeded
}
}
}
}