Files
metabuilder/fakemui/widgets/LanguageSelector.qml
JohnDoe6345789 59714ca814 Add new widgets for language selection, nerd panel, patch dialog, and prompt submission
- Introduced `LanguageSelector.qml` for selecting application languages with a user-friendly interface.
- Created `NerdPanel.qml` to display API logs, session information, and keyboard shortcuts in a dedicated panel.
- Implemented `PatchDialog.qml` for viewing and managing Git patches, including copy and save functionalities.
- Developed `SendPromptDialog.qml` for sending prompts to Codex, featuring environment selection and input validation.
- Added `TaskListItem.qml` to represent individual tasks with detailed information and PR indicators.
- Introduced `ThemeSelector.qml` for selecting application themes with visual indicators.
2025-12-30 02:35:35 +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
}
}
}
}