Add label,description for Toast
This commit is contained in:
parent
8b3945b612
commit
40d6595f5d
5 changed files with 105 additions and 85 deletions
|
|
@ -152,7 +152,7 @@ ColumnLayout {
|
||||||
matugenCheck.running = true
|
matugenCheck.running = true
|
||||||
} else {
|
} else {
|
||||||
Settings.data.colorSchemes.useWallpaperColors = false
|
Settings.data.colorSchemes.useWallpaperColors = false
|
||||||
ToastService.showNotice("Matugen:\nDisabled")
|
ToastService.showNotice("Matugen", "Disabled")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -352,10 +352,10 @@ ColumnLayout {
|
||||||
// Matugen exists, enable it
|
// Matugen exists, enable it
|
||||||
Settings.data.colorSchemes.useWallpaperColors = true
|
Settings.data.colorSchemes.useWallpaperColors = true
|
||||||
ColorSchemeService.changedWallpaper()
|
ColorSchemeService.changedWallpaper()
|
||||||
ToastService.showNotice("Matugen:\nEnabled!")
|
ToastService.showNotice("Matugen", "Enabled!")
|
||||||
} else {
|
} else {
|
||||||
// Matugen not found
|
// Matugen not found
|
||||||
ToastService.showWarning("Matugen:\nNot installed!")
|
ToastService.showWarning("Matugen", "Not installed!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8,70 +8,69 @@ import qs.Services
|
||||||
import qs.Widgets
|
import qs.Widgets
|
||||||
|
|
||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: root
|
id: root
|
||||||
|
spacing: 0
|
||||||
|
|
||||||
spacing: 0
|
ScrollView {
|
||||||
|
id: scrollView
|
||||||
ScrollView {
|
|
||||||
id: scrollView
|
|
||||||
|
|
||||||
Layout.fillWidth: true
|
|
||||||
Layout.fillHeight: true
|
|
||||||
padding: Style.marginM * scaling
|
|
||||||
clip: true
|
|
||||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
|
||||||
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
|
||||||
|
|
||||||
ColumnLayout {
|
|
||||||
width: scrollView.availableWidth
|
|
||||||
spacing: 0
|
|
||||||
|
|
||||||
Item {
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.preferredHeight: 0
|
Layout.fillHeight: true
|
||||||
}
|
padding: Style.marginM * scaling
|
||||||
|
clip: true
|
||||||
|
|
||||||
ColumnLayout {
|
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||||
spacing: Style.marginL * scaling
|
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
||||||
Layout.fillWidth: true
|
|
||||||
|
|
||||||
NText {
|
ColumnLayout {
|
||||||
text: "Interfaces"
|
width: scrollView.availableWidth
|
||||||
font.pointSize: Style.fontSizeXXL * scaling
|
spacing: 0
|
||||||
font.weight: Style.fontWeightBold
|
|
||||||
color: Color.mOnSurface
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
Layout.preferredHeight: 0
|
||||||
|
}
|
||||||
|
|
||||||
|
ColumnLayout {
|
||||||
|
spacing: Style.marginL * scaling
|
||||||
|
Layout.fillWidth: true
|
||||||
|
|
||||||
|
NText {
|
||||||
|
text: "Interfaces"
|
||||||
|
font.pointSize: Style.fontSizeXXL * scaling
|
||||||
|
font.weight: Style.fontWeightBold
|
||||||
|
color: Color.mOnSurface
|
||||||
|
}
|
||||||
|
|
||||||
|
NToggle {
|
||||||
|
label: "WiFi Enabled"
|
||||||
|
description: "Enable WiFi connectivity."
|
||||||
|
checked: Settings.data.network.wifiEnabled
|
||||||
|
onToggled: checked => {
|
||||||
|
Settings.data.network.wifiEnabled = checked
|
||||||
|
NetworkService.setWifiEnabled(checked)
|
||||||
|
if (checked) {
|
||||||
|
ToastService.showNotice("WiFi", "Enabled")
|
||||||
|
} else {
|
||||||
|
ToastService.showNotice("WiFi", "Disabled")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NToggle {
|
||||||
|
label: "Bluetooth Enabled"
|
||||||
|
description: "Enable Bluetooth connectivity."
|
||||||
|
checked: Settings.data.network.bluetoothEnabled
|
||||||
|
onToggled: checked => {
|
||||||
|
Settings.data.network.bluetoothEnabled = checked
|
||||||
|
BluetoothService.setBluetoothEnabled(checked)
|
||||||
|
if (checked) {
|
||||||
|
ToastService.showNotice("Bluetooth", "Enabled")
|
||||||
|
} else {
|
||||||
|
ToastService.showNotice("Bluetooth", "Disabled")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NToggle {
|
|
||||||
label: "WiFi Enabled"
|
|
||||||
description: "Enable WiFi connectivity."
|
|
||||||
checked: Settings.data.network.wifiEnabled
|
|
||||||
onToggled: checked => {
|
|
||||||
Settings.data.network.wifiEnabled = checked
|
|
||||||
NetworkService.setWifiEnabled(checked)
|
|
||||||
if (checked) {
|
|
||||||
ToastService.showNotice("WiFi:\nEnabled")
|
|
||||||
} else {
|
|
||||||
ToastService.showNotice("WiFi:\nDisabled")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NToggle {
|
|
||||||
label: "Bluetooth Enabled"
|
|
||||||
description: "Enable Bluetooth connectivity."
|
|
||||||
checked: Settings.data.network.bluetoothEnabled
|
|
||||||
onToggled: checked => {
|
|
||||||
Settings.data.network.bluetoothEnabled = checked
|
|
||||||
BluetoothService.setBluetoothEnabled(checked)
|
|
||||||
if (checked) {
|
|
||||||
ToastService.showNotice("Bluetooth:\nEnabled")
|
|
||||||
} else {
|
|
||||||
ToastService.showNotice("Bluetooth:\nDisabled")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ ColumnLayout {
|
||||||
swwwCheck.running = true
|
swwwCheck.running = true
|
||||||
} else {
|
} else {
|
||||||
Settings.data.wallpaper.swww.enabled = false
|
Settings.data.wallpaper.swww.enabled = false
|
||||||
ToastService.showNotice("SWWW:\nDisabled")
|
ToastService.showNotice("SWWW", "Disabled")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -354,10 +354,10 @@ ColumnLayout {
|
||||||
// SWWW exists, enable it
|
// SWWW exists, enable it
|
||||||
Settings.data.wallpaper.swww.enabled = true
|
Settings.data.wallpaper.swww.enabled = true
|
||||||
WallpaperService.startSWWWDaemon()
|
WallpaperService.startSWWWDaemon()
|
||||||
ToastService.showNotice("SWWW:\nEnabled!")
|
ToastService.showNotice("SWWW", "Enabled!")
|
||||||
} else {
|
} else {
|
||||||
// SWWW not found
|
// SWWW not found
|
||||||
ToastService.showWarning("SWWW:\nNot installed!")
|
ToastService.showWarning("SWWW", "Not installed!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,12 +15,12 @@ QtObject {
|
||||||
property var currentToast: null
|
property var currentToast: null
|
||||||
|
|
||||||
// Methods to show different types of messages
|
// Methods to show different types of messages
|
||||||
function showNotice(message, persistent = false, duration = 3000) {
|
function showNotice(label, description = "", persistent = false, duration = 3000) {
|
||||||
showToast(message, "notice", persistent, duration)
|
showToast(label, description, "notice", persistent, duration)
|
||||||
}
|
}
|
||||||
|
|
||||||
function showWarning(message, persistent = false, duration = 4000) {
|
function showWarning(label, description = "", persistent = false, duration = 4000) {
|
||||||
showToast(message, "warning", persistent, duration)
|
showToast(label, description, "warning", persistent, duration)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Utility function to check if a command exists and show appropriate toast
|
// Utility function to check if a command exists and show appropriate toast
|
||||||
|
|
@ -139,9 +139,10 @@ QtObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generic method to show a toast
|
// Generic method to show a toast
|
||||||
function showToast(message, type = "notice", persistent = false, duration = 3000) {
|
function showToast(label, description = "", type = "notice", persistent = false, duration = 3000) {
|
||||||
var toastData = {
|
var toastData = {
|
||||||
message: message,
|
label: label,
|
||||||
|
description: description,
|
||||||
type: type,
|
type: type,
|
||||||
persistent: persistent,
|
persistent: persistent,
|
||||||
duration: duration,
|
duration: duration,
|
||||||
|
|
@ -177,7 +178,8 @@ QtObject {
|
||||||
|
|
||||||
|
|
||||||
// Configure and show toast
|
// Configure and show toast
|
||||||
currentToast.message = toastData.message
|
currentToast.label = toastData.label
|
||||||
|
currentToast.description = toastData.description
|
||||||
currentToast.type = toastData.type
|
currentToast.type = toastData.type
|
||||||
currentToast.persistent = toastData.persistent
|
currentToast.persistent = toastData.persistent
|
||||||
currentToast.duration = toastData.duration
|
currentToast.duration = toastData.duration
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,8 @@ import qs.Widgets
|
||||||
Item {
|
Item {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
property string message: ""
|
property string label: ""
|
||||||
|
property string description: ""
|
||||||
property string type: "notice" // "notice", "warning"
|
property string type: "notice" // "notice", "warning"
|
||||||
property int duration: 5000 // Auto-hide after 5 seconds, 0 = no auto-hide
|
property int duration: 5000 // Auto-hide after 5 seconds, 0 = no auto-hide
|
||||||
property bool persistent: false // If true, requires manual dismiss
|
property bool persistent: false // If true, requires manual dismiss
|
||||||
|
|
@ -129,15 +130,33 @@ Item {
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
// Message text
|
// Label and description
|
||||||
NText {
|
Column {
|
||||||
id: messageText
|
id: textColumn
|
||||||
text: root.message
|
spacing: Style.marginXXS * scaling
|
||||||
color: Color.mOnSurface
|
|
||||||
font.pointSize: Style.fontSize * scaling
|
|
||||||
wrapMode: Text.WordWrap
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.alignment: Qt.AlignVCenter
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
|
||||||
|
NText {
|
||||||
|
id: labelText
|
||||||
|
text: root.label
|
||||||
|
color: Color.mOnSurface
|
||||||
|
font.pointSize: Style.fontSize * scaling
|
||||||
|
font.weight: Style.fontWeightBold
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
width: parent.width
|
||||||
|
visible: text.length > 0
|
||||||
|
}
|
||||||
|
|
||||||
|
NText {
|
||||||
|
id: descriptionText
|
||||||
|
text: root.description
|
||||||
|
color: Color.mOnSurface
|
||||||
|
font.pointSize: Style.fontSize * scaling
|
||||||
|
wrapMode: Text.WordWrap
|
||||||
|
width: parent.width
|
||||||
|
visible: text.length > 0
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close button (only if persistent or manual dismiss needed)
|
// Close button (only if persistent or manual dismiss needed)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue