layout-templates: Split out status bar and navigation panel to separate templates

This makes it more modular, and we can use the template in the mobileshellsettings code.
This commit is contained in:
Devin Lin 2024-07-15 17:07:26 -04:00
parent 8c3a6e2b23
commit 0a09d935ac
9 changed files with 66 additions and 80 deletions

View file

@ -182,9 +182,7 @@ void MobileShellSettings::updateNavigationBarsInPlasma(bool navigationPanelEnabl
if (navigationPanelEnabled) {
QString createNavigationPanelScript = R"(
var bottomPanel = new Panel("org.kde.plasma.mobile.taskpanel")
bottomPanel.location = "bottom";
bottomPanel.height = 2 * gridUnit;
loadTemplate("org.kde.plasma.mobile.defaultNavigationPanel");
)";
message << createNavigationPanelScript;

View file

@ -1,3 +1,4 @@
# SPDX-FileCopyrightText: 2024 Devin Lin <devin@kde.org>
# SPDX-License-Identifier: GPL-2.0-or-later
plasma_install_package(org.kde.plasma.mobile.defaultMobileLayout org.kde.plasma.mobile.defaultMobileLayout layout-templates layout-template)
plasma_install_package(org.kde.plasma.mobile.defaultNavigationPanel org.kde.plasma.mobile.defaultNavigationPanel layout-templates layout-template)
plasma_install_package(org.kde.plasma.mobile.defaultStatusBar org.kde.plasma.mobile.defaultStatusBar layout-templates layout-template)

View file

@ -1,63 +0,0 @@
{
"KPackageStructure": "Plasma/LayoutTemplate",
"KPlugin": {
"Authors": [
{
"Email": "devin@kde.org",
"Name": "Devin Lin",
"Name[ar]": "ديفين لين",
"Name[he]": "דווין לין",
"Name[pa]": "ਡੇਵਿਨ ਲਿਨ",
"Name[x-test]": "xxDevin Linxx"
}
],
"Category": "",
"Description": "Default panel layout for mobile, including status bar and navigation panel",
"Description[ca@valencia]": "Disposició predeterminada del quadro per als mòbils, incloent-hi la barra d'estat i el quadro de navegació",
"Description[ca]": "Disposició predeterminada del plafó per als mòbils, incloent-hi la barra d'estat i el plafó de navegació",
"Description[eo]": "Defaŭlta panelaranĝo por poŝtelefono, inkluzive de statusbreto kaj navigada panelo",
"Description[es]": "Diseño de panel predeterminado para dispositivos móviles, incluida la barra de estado y el panel de navegación",
"Description[eu]": "Mugikorrerako panel-antolaera lehenetsia, egoera-barra eta nabigatzeko panela barne",
"Description[fr]": "Disposition du panneau par défaut pour les périphériques mobiles, y compris la barre d'état et le panneau de navigation",
"Description[he]": "פריסת לוחות כברירת מחדל למכשירים ניידים, כולל שורת מצב ולוח ניווט",
"Description[ia]": "Disposition (layout) predefinite de pannelloper mobile, includente barra de status e pannello de navigation",
"Description[is]": "Sjálfgefin framsetning skjáborðsstiku í síma, þ.m.t. stöðustika og yfirlitsstika",
"Description[ka]": "ნაგულისხმევი პანელის განლაგება მობილურისთვის, სტატუსის ზოლისა და ნავიგაციის პანელის ჩათვლით",
"Description[nl]": "Standaard indeling van paneel voor mobiel, inclusief statusbalk end navigatiepaneel",
"Description[pl]": "Domyślny układ pasków dla urządzenia przenośnego, włączając w to pasek stanu i przemieszczania się",
"Description[sl]": "Privzeta postavitev plošče za mobilne naprave, vključno z vrstico stanja in navigacijsko ploščo",
"Description[sv]": "Mobil standardlayout för paneler, inklusive statusfält och navigeringspanel",
"Description[tr]": "Durum çubuğu ve dolaşım paneli içeren, taşınabilir aygıtlar için öntanımlı panel yerleşimi",
"Description[uk]": "Типове компонування панелі для мобільних пристроїв, зокрема компонування смужки стану та панелі навігації",
"Description[x-test]": "xxDefault panel layout for mobile, including status bar and navigation panelxx",
"Description[zh_CN]": "手机的默认面板布局,包括状态栏和导航面板",
"EnabledByDefault": true,
"Id": "org.kde.plasma.mobile.defaultMobileLayout",
"License": "LGPLv2+",
"Name": "Default Mobile Layout",
"Name[ca@valencia]": "Disposició predeterminada del mòbil",
"Name[ca]": "Disposició predeterminada del mòbil",
"Name[cs]": "Výchozí mobilní rozvržení",
"Name[eo]": "Defaŭlta Poŝtelefona Aranĝo",
"Name[es]": "Diseño móvil predeterminado",
"Name[eu]": "Mugikorreko antolaera lehenetsia",
"Name[fr]": "Mise en page mobile par défaut",
"Name[he]": "פריסת ברירת מחדל לניידים",
"Name[ia]": "Disposition (layout) predefinite de Mobile",
"Name[is]": "Sjálfgefin framsetning í síma",
"Name[ka]": "ნაგულისხმევი მობილური განლაგება",
"Name[nl]": "Standaard indeling van mobiel",
"Name[pl]": "Domyślny układ przenośny",
"Name[sl]": "Privzeta postavitev za mobilne naprave",
"Name[sv]": "Mobil standardlayout",
"Name[tr]": "Öntanımlı Taşınabilir Yerleşim",
"Name[uk]": "Типове компонування для мобільних пристроїв",
"Name[x-test]": "xxDefault Mobile Layoutxx",
"Name[zh_CN]": "默认手机布局",
"Website": "https://www.kde.org/plasma-desktop"
},
"X-Plasma-ContainmentCategories": [
"panel"
],
"X-Plasma-Shell": "plasmashell"
}

View file

@ -0,0 +1,6 @@
// SPDX-FileCopyrightText: 2024 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: LGPL-2.0-or-later
const bottomPanel = new Panel("org.kde.plasma.mobile.taskpanel")
bottomPanel.location = "bottom";
bottomPanel.height = 2 * gridUnit;

View file

@ -0,0 +1,26 @@
{
"KPackageStructure": "Plasma/LayoutTemplate",
"KPlugin": {
"Authors": [
{
"Email": "devin@kde.org",
"Name": "Devin Lin",
"Name[ar]": "ديفين لين",
"Name[he]": "דווין לין",
"Name[pa]": "ਡੇਵਿਨ ਲਿਨ",
"Name[x-test]": "xxDevin Linxx"
}
],
"Category": "",
"Description": "Default navigation panel for mobile",
"EnabledByDefault": true,
"Id": "org.kde.plasma.mobile.defaultNavigationPanel",
"License": "LGPLv2+",
"Name": "Default Mobile Navigation Panel",
"Website": "https://www.kde.org/plasma-desktop"
},
"X-Plasma-ContainmentCategories": [
"panel"
],
"X-Plasma-Shell": "plasmashell"
}

View file

@ -1,11 +1,7 @@
// SPDX-FileCopyrightText: 2024 Devin Lin <devin@kde.org>
// SPDX-License-Identifier: GPL-2.0-or-later
// SPDX-License-Identifier: LGPL-2.0-or-later
const panel = new Panel("org.kde.plasma.mobile.panel");
panel.location = "top";
panel.addWidget("org.kde.plasma.notifications");
panel.height = 1.25 * gridUnit; // HACK: supposed to be gridUnit + smallSpacing, but it doesn't seem to give the correct number
const bottomPanel = new Panel("org.kde.plasma.mobile.taskpanel")
bottomPanel.location = "bottom";
bottomPanel.height = 2 * gridUnit;

View file

@ -0,0 +1,26 @@
{
"KPackageStructure": "Plasma/LayoutTemplate",
"KPlugin": {
"Authors": [
{
"Email": "devin@kde.org",
"Name": "Devin Lin",
"Name[ar]": "ديفين لين",
"Name[he]": "דווין לין",
"Name[pa]": "ਡੇਵਿਨ ਲਿਨ",
"Name[x-test]": "xxDevin Linxx"
}
],
"Category": "",
"Description": "Default status bar for mobile",
"EnabledByDefault": true,
"Id": "org.kde.plasma.mobile.defaultStatusBar",
"License": "LGPLv2+",
"Name": "Default Mobile Status Bar",
"Website": "https://www.kde.org/plasma-desktop"
},
"X-Plasma-ContainmentCategories": [
"panel"
],
"X-Plasma-Shell": "plasmashell"
}

View file

@ -6,7 +6,8 @@
// SPDX-License-Identifier: GPL-2.0-or-later
// Load panel layout
loadTemplate("org.kde.plasma.mobile.defaultMobileLayout")
loadTemplate("org.kde.plasma.mobile.defaultNavigationPanel");
loadTemplate("org.kde.plasma.mobile.defaultStatusBar");
// Set wallpaper plugin
var desktopsArray = desktopsForActivity(currentActivity());

View file

@ -17,13 +17,8 @@ for (let i in panels()) {
if (!topFound) {
// keep widget list synced with the layout.js
let topPanel = new Panel("org.kde.plasma.mobile.panel")
topPanel.addWidget("org.kde.plasma.notifications");
topPanel.location = "top";
topPanel.height = 1.25 * gridUnit;
loadTemplate("org.kde.plasma.mobile.defaultStatusBar");
}
if (!bottomFound) {
let bottomPanel = new Panel("org.kde.plasma.mobile.taskpanel")
bottomPanel.location = "bottom";
bottomPanel.height = 2 * gridUnit;
loadTemplate("org.kde.plasma.mobile.defaultNavigationPanel");
}