mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
WallpaperPanel: add NTextInput for wallhaven pages
This commit is contained in:
@@ -1793,7 +1793,9 @@
|
||||
"wallhaven": {
|
||||
"loading": "Hintergrundbilder werden geladen...",
|
||||
"no-results": "Keine Hintergrundbilder gefunden. Versuchen Sie eine andere Suchanfrage.",
|
||||
"page": "{current} von {total}"
|
||||
"page": "{current} von {total}",
|
||||
"page-prefix": "Seite",
|
||||
"page-suffix": "von {total}"
|
||||
}
|
||||
},
|
||||
"weather": {
|
||||
|
||||
@@ -1793,7 +1793,9 @@
|
||||
"wallhaven": {
|
||||
"loading": "Loading wallpapers...",
|
||||
"no-results": "No wallpapers found. Try a different search query.",
|
||||
"page": "{current} of {total}"
|
||||
"page": "{current} of {total}",
|
||||
"page-prefix": "Page",
|
||||
"page-suffix": "of {total}"
|
||||
}
|
||||
},
|
||||
"weather": {
|
||||
|
||||
@@ -1793,7 +1793,9 @@
|
||||
"wallhaven": {
|
||||
"loading": "Cargando fondos de pantalla...",
|
||||
"no-results": "No se encontraron fondos de pantalla. Intenta con una búsqueda diferente.",
|
||||
"page": "{current} de {total}"
|
||||
"page": "{current} de {total}",
|
||||
"page-prefix": "Página",
|
||||
"page-suffix": "de {total}"
|
||||
}
|
||||
},
|
||||
"weather": {
|
||||
|
||||
@@ -1793,7 +1793,9 @@
|
||||
"wallhaven": {
|
||||
"loading": "Chargement des fonds d'écran...",
|
||||
"no-results": "Aucun fond d'écran trouvé. Essayez une autre requête de recherche.",
|
||||
"page": "{current} sur {total}"
|
||||
"page": "{current} sur {total}",
|
||||
"page-prefix": "Page",
|
||||
"page-suffix": "de {total}"
|
||||
}
|
||||
},
|
||||
"weather": {
|
||||
|
||||
@@ -1793,7 +1793,9 @@
|
||||
"wallhaven": {
|
||||
"loading": "Háttérképek betöltése...",
|
||||
"no-results": "Nincs háttérkép. Próbáljon másik keresést.",
|
||||
"page": "{current} / {total}"
|
||||
"page": "{current} / {total}",
|
||||
"page-prefix": "Oldal",
|
||||
"page-suffix": "{total} közül"
|
||||
}
|
||||
},
|
||||
"weather": {
|
||||
|
||||
@@ -1793,7 +1793,9 @@
|
||||
"wallhaven": {
|
||||
"loading": "壁紙を読み込み中...",
|
||||
"no-results": "壁紙が見つかりません。別の検索条件を試してください。",
|
||||
"page": "{current} / {total}"
|
||||
"page": "{current} / {total}",
|
||||
"page-prefix": "ページ",
|
||||
"page-suffix": "{total}件中"
|
||||
}
|
||||
},
|
||||
"weather": {
|
||||
|
||||
@@ -1793,7 +1793,9 @@
|
||||
"wallhaven": {
|
||||
"loading": "배경화면 로딩 중...",
|
||||
"no-results": "배경화면을 찾을 수 없습니다. 다른 검색어를 시도해 보세요.",
|
||||
"page": "{total} 중 {current}"
|
||||
"page": "{total} 중 {current}",
|
||||
"page-prefix": "페이지",
|
||||
"page-suffix": "{total}개 중"
|
||||
}
|
||||
},
|
||||
"weather": {
|
||||
|
||||
@@ -1793,7 +1793,9 @@
|
||||
"wallhaven": {
|
||||
"loading": "Achtergronden laden...",
|
||||
"no-results": "Geen achtergronden gevonden. Probeer een andere zoekopdracht.",
|
||||
"page": "{current} van {total}"
|
||||
"page": "{current} van {total}",
|
||||
"page-prefix": "Pagina",
|
||||
"page-suffix": "van {total}"
|
||||
}
|
||||
},
|
||||
"weather": {
|
||||
|
||||
@@ -1793,7 +1793,9 @@
|
||||
"wallhaven": {
|
||||
"loading": "Ładowanie tapet...",
|
||||
"no-results": "Nie znaleziono tapet. Spróbuj innego zapytania.",
|
||||
"page": "{current} z {total}"
|
||||
"page": "{current} z {total}",
|
||||
"page-prefix": "Strona",
|
||||
"page-suffix": "z {total}"
|
||||
}
|
||||
},
|
||||
"weather": {
|
||||
|
||||
@@ -1793,7 +1793,9 @@
|
||||
"wallhaven": {
|
||||
"loading": "Carregando papéis de parede...",
|
||||
"no-results": "Nenhum papel de parede encontrado. Tente uma busca diferente.",
|
||||
"page": "{current} de {total}"
|
||||
"page": "{current} de {total}",
|
||||
"page-prefix": "Página",
|
||||
"page-suffix": "de {total}"
|
||||
}
|
||||
},
|
||||
"weather": {
|
||||
|
||||
@@ -1793,7 +1793,9 @@
|
||||
"wallhaven": {
|
||||
"loading": "Загрузка обоев...",
|
||||
"no-results": "Обои не найдены. Попробуйте другой поисковый запрос.",
|
||||
"page": "{current} из {total}"
|
||||
"page": "{current} из {total}",
|
||||
"page-prefix": "Страница",
|
||||
"page-suffix": "из {total}"
|
||||
}
|
||||
},
|
||||
"weather": {
|
||||
|
||||
@@ -1793,7 +1793,9 @@
|
||||
"wallhaven": {
|
||||
"loading": "Läser in bakgrundsbilder...",
|
||||
"no-results": "Inga bakgrundsbilder hittades. Prova en annan sökfråga.",
|
||||
"page": "{current} av {total}"
|
||||
"page": "{current} av {total}",
|
||||
"page-prefix": "Sida",
|
||||
"page-suffix": "av {total}"
|
||||
}
|
||||
},
|
||||
"weather": {
|
||||
|
||||
@@ -1793,7 +1793,9 @@
|
||||
"wallhaven": {
|
||||
"loading": "Duvar kâğıtları yükleniyor...",
|
||||
"no-results": "Duvar kâğıdı bulunamadı. Farklı bir arama sorgusu deneyin.",
|
||||
"page": "{current} / {total}"
|
||||
"page": "{current} / {total}",
|
||||
"page-prefix": "Sayfa",
|
||||
"page-suffix": "{total} taneden"
|
||||
}
|
||||
},
|
||||
"weather": {
|
||||
|
||||
@@ -1793,7 +1793,9 @@
|
||||
"wallhaven": {
|
||||
"loading": "Завантаження шпалер...",
|
||||
"no-results": "Шпалери не знайдено. Спробуйте інший пошуковий запит.",
|
||||
"page": "{current} з {total}"
|
||||
"page": "{current} з {total}",
|
||||
"page-prefix": "Сторінка",
|
||||
"page-suffix": "з {total}"
|
||||
}
|
||||
},
|
||||
"weather": {
|
||||
|
||||
@@ -1793,7 +1793,9 @@
|
||||
"wallhaven": {
|
||||
"loading": "正在加载壁纸...",
|
||||
"no-results": "未找到壁纸。请尝试不同的搜索查询。",
|
||||
"page": "{current} / {total}"
|
||||
"page": "{current} / {total}",
|
||||
"page-prefix": "页面",
|
||||
"page-suffix": "共 {total} 个"
|
||||
}
|
||||
},
|
||||
"weather": {
|
||||
|
||||
@@ -1793,7 +1793,9 @@
|
||||
"wallhaven": {
|
||||
"loading": "正在載入桌布...",
|
||||
"no-results": "找不到桌布, 試著用不同的搜尋字串",
|
||||
"page": "第 {current} / {total} 頁"
|
||||
"page": "第 {current} / {total} 頁",
|
||||
"page-prefix": "頁面",
|
||||
"page-suffix": "共 {total} 個"
|
||||
}
|
||||
},
|
||||
"weather": {
|
||||
|
||||
@@ -9,8 +9,6 @@ import qs.Widgets
|
||||
Rectangle {
|
||||
id: root
|
||||
|
||||
// Whether to enable lock screen animations (avatar pulse, breathing, smooth cursor blink).
|
||||
// Defaults to false to reduce GPU usage. Set Settings.data.general.lockScreenAnimations = true to restore.
|
||||
readonly property bool animationsEnabled: Settings.data.general.lockScreenAnimations || false
|
||||
|
||||
// Use timer-driven properties instead of Time.now to avoid per-frame repaints.
|
||||
|
||||
@@ -1376,7 +1376,7 @@ SmartPanel {
|
||||
radius: Style.radiusM
|
||||
border.color: Color.mOutline
|
||||
border.width: Style.borderS
|
||||
visible: loading
|
||||
visible: loading || (typeof WallhavenService !== "undefined" && WallhavenService.fetching)
|
||||
z: 10
|
||||
|
||||
ColumnLayout {
|
||||
@@ -1493,7 +1493,7 @@ SmartPanel {
|
||||
// Pagination
|
||||
RowLayout {
|
||||
Layout.fillWidth: true
|
||||
visible: !loading && errorMessage === "" && typeof WallhavenService !== "undefined"
|
||||
visible: errorMessage === "" && typeof WallhavenService !== "undefined"
|
||||
spacing: Style.marginS
|
||||
|
||||
Item {
|
||||
@@ -1502,14 +1502,59 @@ SmartPanel {
|
||||
|
||||
NIconButton {
|
||||
icon: "chevron-left"
|
||||
enabled: WallhavenService.currentPage > 1 && !WallhavenService.fetching
|
||||
enabled: !loading && WallhavenService.currentPage > 1 && !WallhavenService.fetching
|
||||
onClicked: WallhavenService.previousPage()
|
||||
}
|
||||
|
||||
NText {
|
||||
text: I18n.tr("wallpaper.wallhaven.page").replace("{current}", WallhavenService.currentPage).replace("{total}", WallhavenService.lastPage)
|
||||
color: Color.mOnSurface
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
RowLayout {
|
||||
spacing: Style.marginXS
|
||||
|
||||
NText {
|
||||
text: I18n.tr("wallpaper.wallhaven.page-prefix")
|
||||
color: Color.mOnSurface
|
||||
}
|
||||
|
||||
NTextInput {
|
||||
id: pageInput
|
||||
text: "" + WallhavenService.currentPage
|
||||
Layout.preferredWidth: 80 * Style.uiScaleRatio
|
||||
Layout.maximumWidth: 80 * Style.uiScaleRatio
|
||||
Layout.fillWidth: false
|
||||
minimumInputWidth: 80 * Style.uiScaleRatio
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
inputMethodHints: Qt.ImhDigitsOnly
|
||||
enabled: !loading && !WallhavenService.fetching
|
||||
showClearButton: false
|
||||
|
||||
Connections {
|
||||
target: WallhavenService
|
||||
function onCurrentPageChanged() {
|
||||
pageInput.text = "" + WallhavenService.currentPage;
|
||||
}
|
||||
}
|
||||
|
||||
function submitPage() {
|
||||
var page = parseInt(text);
|
||||
if (!isNaN(page) && page >= 1 && page <= WallhavenService.lastPage) {
|
||||
if (page !== WallhavenService.currentPage) {
|
||||
WallhavenService.search(Settings.data.wallpaper.wallhavenQuery || "", page);
|
||||
}
|
||||
} else {
|
||||
// Reset to current page if invalid
|
||||
text = "" + WallhavenService.currentPage;
|
||||
}
|
||||
// Force focus loss to ensure UI updates cleanly
|
||||
pageInput.inputItem.focus = false;
|
||||
}
|
||||
|
||||
onEditingFinished: submitPage()
|
||||
onAccepted: submitPage()
|
||||
}
|
||||
|
||||
NText {
|
||||
text: I18n.tr("wallpaper.wallhaven.page-suffix").replace("{total}", WallhavenService.lastPage)
|
||||
color: Color.mOnSurface
|
||||
}
|
||||
}
|
||||
|
||||
NIconButton {
|
||||
|
||||
@@ -18,13 +18,17 @@ ColumnLayout {
|
||||
property int fontWeight: Style.fontWeightRegular
|
||||
property var defaultValue: undefined
|
||||
property string settingsPath: ""
|
||||
property real minimumInputWidth: 80 * Style.uiScaleRatio
|
||||
property bool showClearButton: true
|
||||
|
||||
property alias text: input.text
|
||||
property alias placeholderText: input.placeholderText
|
||||
property alias inputMethodHints: input.inputMethodHints
|
||||
property alias horizontalAlignment: input.horizontalAlignment
|
||||
property alias inputItem: input
|
||||
|
||||
signal editingFinished
|
||||
signal accepted
|
||||
|
||||
opacity: enabled ? 1.0 : 0.3
|
||||
spacing: Style.marginS
|
||||
@@ -50,7 +54,7 @@ ColumnLayout {
|
||||
id: frameControl
|
||||
|
||||
Layout.fillWidth: true
|
||||
Layout.minimumWidth: 80 * Style.uiScaleRatio
|
||||
Layout.minimumWidth: root.minimumInputWidth
|
||||
implicitHeight: Style.baseWidgetSize * 1.1 * Style.uiScaleRatio
|
||||
|
||||
// This is important - makes the control accept focus
|
||||
@@ -116,7 +120,7 @@ ColumnLayout {
|
||||
id: inputContainer
|
||||
anchors.fill: parent
|
||||
anchors.leftMargin: Style.marginM
|
||||
// anchors.rightMargin: Style.marginM
|
||||
anchors.rightMargin: Style.marginM
|
||||
clip: true
|
||||
z: 1
|
||||
|
||||
@@ -162,6 +166,7 @@ ColumnLayout {
|
||||
font.weight: root.fontWeight
|
||||
|
||||
onEditingFinished: root.editingFinished()
|
||||
onAccepted: root.accepted()
|
||||
|
||||
// Override mouse handling to prevent propagation
|
||||
MouseArea {
|
||||
@@ -216,7 +221,7 @@ ColumnLayout {
|
||||
colorFg: Color.mOnSurface
|
||||
colorFgHover: Color.mError
|
||||
|
||||
visible: input.text.length > 0 && !root.readOnly
|
||||
visible: root.showClearButton && input.text.length > 0 && !root.readOnly
|
||||
enabled: input.text.length > 0 && !root.readOnly && root.enabled
|
||||
|
||||
onClicked: {
|
||||
|
||||
Reference in New Issue
Block a user