mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
settings: fix theme flavor buttons
This commit is contained in:
@@ -259,7 +259,8 @@ Item {
|
|||||||
minButtonWidth: parent.width < 420 ? 44 : 64
|
minButtonWidth: parent.width < 420 ? 44 : 64
|
||||||
textSize: parent.width < 420 ? Theme.fontSizeSmall : Theme.fontSizeMedium
|
textSize: parent.width < 420 ? Theme.fontSizeSmall : Theme.fontSizeMedium
|
||||||
property bool isRegistryTheme: Theme.currentThemeCategory === "registry"
|
property bool isRegistryTheme: Theme.currentThemeCategory === "registry"
|
||||||
property int currentThemeIndex: {
|
property int pendingIndex: -1
|
||||||
|
property int computedIndex: {
|
||||||
if (isRegistryTheme)
|
if (isRegistryTheme)
|
||||||
return 3;
|
return 3;
|
||||||
if (Theme.currentTheme === Theme.dynamic)
|
if (Theme.currentTheme === Theme.dynamic)
|
||||||
@@ -268,20 +269,21 @@ Item {
|
|||||||
return 2;
|
return 2;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
property int pendingThemeIndex: -1
|
|
||||||
|
|
||||||
model: DMSService.dmsAvailable ? ["Generic", "Auto", "Custom", "Browse"] : ["Generic", "Auto", "Custom"]
|
model: DMSService.dmsAvailable ? ["Generic", "Auto", "Custom", "Browse"] : ["Generic", "Auto", "Custom"]
|
||||||
currentIndex: currentThemeIndex
|
currentIndex: pendingIndex >= 0 ? pendingIndex : computedIndex
|
||||||
selectionMode: "single"
|
selectionMode: "single"
|
||||||
onSelectionChanged: (index, selected) => {
|
onSelectionChanged: (index, selected) => {
|
||||||
if (!selected)
|
if (!selected)
|
||||||
return;
|
return;
|
||||||
pendingThemeIndex = index;
|
pendingIndex = index;
|
||||||
}
|
}
|
||||||
onAnimationCompleted: {
|
onAnimationCompleted: {
|
||||||
if (pendingThemeIndex === -1)
|
if (pendingIndex < 0)
|
||||||
return;
|
return;
|
||||||
switch (pendingThemeIndex) {
|
const idx = pendingIndex;
|
||||||
|
pendingIndex = -1;
|
||||||
|
switch (idx) {
|
||||||
case 0:
|
case 0:
|
||||||
Theme.switchThemeCategory("generic", "blue");
|
Theme.switchThemeCategory("generic", "blue");
|
||||||
break;
|
break;
|
||||||
@@ -300,7 +302,6 @@ Item {
|
|||||||
Theme.switchThemeCategory("registry", "");
|
Theme.switchThemeCategory("registry", "");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
pendingThemeIndex = -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -809,13 +810,21 @@ Item {
|
|||||||
buttonPadding: parent.width < 400 ? Theme.spacingS : Theme.spacingL
|
buttonPadding: parent.width < 400 ? Theme.spacingS : Theme.spacingL
|
||||||
minButtonWidth: parent.width < 400 ? 44 : 64
|
minButtonWidth: parent.width < 400 ? 44 : 64
|
||||||
textSize: parent.width < 400 ? Theme.fontSizeSmall : Theme.fontSizeMedium
|
textSize: parent.width < 400 ? Theme.fontSizeSmall : Theme.fontSizeMedium
|
||||||
|
property int pendingIndex: -1
|
||||||
model: variantSelector.flavorNames
|
model: variantSelector.flavorNames
|
||||||
currentIndex: variantSelector.flavorIndex
|
currentIndex: pendingIndex >= 0 ? pendingIndex : variantSelector.flavorIndex
|
||||||
selectionMode: "single"
|
selectionMode: "single"
|
||||||
onAnimationCompleted: {
|
onSelectionChanged: (index, selected) => {
|
||||||
if (currentIndex < 0 || currentIndex >= variantSelector.flavorOptions.length)
|
if (!selected)
|
||||||
return;
|
return;
|
||||||
const flavorId = variantSelector.flavorOptions[currentIndex]?.id;
|
pendingIndex = index;
|
||||||
|
}
|
||||||
|
onAnimationCompleted: {
|
||||||
|
if (pendingIndex < 0 || pendingIndex >= variantSelector.flavorOptions.length)
|
||||||
|
return;
|
||||||
|
const flavorId = variantSelector.flavorOptions[pendingIndex]?.id;
|
||||||
|
const idx = pendingIndex;
|
||||||
|
pendingIndex = -1;
|
||||||
if (!flavorId || flavorId === variantSelector.selectedFlavor)
|
if (!flavorId || flavorId === variantSelector.selectedFlavor)
|
||||||
return;
|
return;
|
||||||
Theme.screenTransition();
|
Theme.screenTransition();
|
||||||
@@ -909,13 +918,21 @@ Item {
|
|||||||
buttonPadding: parent.width < 400 ? Theme.spacingS : Theme.spacingL
|
buttonPadding: parent.width < 400 ? Theme.spacingS : Theme.spacingL
|
||||||
minButtonWidth: parent.width < 400 ? 44 : 64
|
minButtonWidth: parent.width < 400 ? 44 : 64
|
||||||
textSize: parent.width < 400 ? Theme.fontSizeSmall : Theme.fontSizeMedium
|
textSize: parent.width < 400 ? Theme.fontSizeSmall : Theme.fontSizeMedium
|
||||||
|
property int pendingIndex: -1
|
||||||
model: variantSelector.variantNames
|
model: variantSelector.variantNames
|
||||||
currentIndex: variantSelector.selectedIndex
|
currentIndex: pendingIndex >= 0 ? pendingIndex : variantSelector.selectedIndex
|
||||||
selectionMode: "single"
|
selectionMode: "single"
|
||||||
onAnimationCompleted: {
|
onSelectionChanged: (index, selected) => {
|
||||||
if (currentIndex < 0 || !variantSelector.activeThemeVariants?.options)
|
if (!selected)
|
||||||
return;
|
return;
|
||||||
const variantId = variantSelector.activeThemeVariants.options[currentIndex]?.id;
|
pendingIndex = index;
|
||||||
|
}
|
||||||
|
onAnimationCompleted: {
|
||||||
|
if (pendingIndex < 0 || !variantSelector.activeThemeVariants?.options)
|
||||||
|
return;
|
||||||
|
const variantId = variantSelector.activeThemeVariants.options[pendingIndex]?.id;
|
||||||
|
const idx = pendingIndex;
|
||||||
|
pendingIndex = -1;
|
||||||
if (!variantId || variantId === variantSelector.selectedVariant)
|
if (!variantId || variantId === variantSelector.selectedVariant)
|
||||||
return;
|
return;
|
||||||
Theme.screenTransition();
|
Theme.screenTransition();
|
||||||
|
|||||||
Reference in New Issue
Block a user