mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-01-24 21:42:51 -05:00
settings: add IPCs to open specific settings tabs
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import Quickshell
|
||||
import qs.Common
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
@@ -17,20 +16,18 @@ PluginComponent {
|
||||
ccWidgetPrimaryText: I18n.tr("Printers")
|
||||
ccWidgetSecondaryText: {
|
||||
if (CupsService.cupsAvailable && CupsService.getPrintersNum() > 0) {
|
||||
return I18n.tr("Printers: ") + CupsService.getPrintersNum() + " - " + I18n.tr("Jobs: ") + CupsService.getTotalJobsNum()
|
||||
return I18n.tr("Printers: ") + CupsService.getPrintersNum() + " - " + I18n.tr("Jobs: ") + CupsService.getTotalJobsNum();
|
||||
} else {
|
||||
if (!CupsService.cupsAvailable) {
|
||||
return I18n.tr("Print Server not available")
|
||||
return I18n.tr("Print Server not available");
|
||||
} else {
|
||||
return I18n.tr("No printer found")
|
||||
return I18n.tr("No printer found");
|
||||
}
|
||||
}
|
||||
}
|
||||
ccWidgetIsActive: CupsService.cupsAvailable && CupsService.getTotalJobsNum() > 0
|
||||
|
||||
onCcWidgetToggled: {
|
||||
|
||||
}
|
||||
onCcWidgetToggled: {}
|
||||
|
||||
ccDetailContent: Component {
|
||||
Rectangle {
|
||||
@@ -39,6 +36,21 @@ PluginComponent {
|
||||
radius: Theme.cornerRadius
|
||||
color: Theme.surfaceContainerHigh
|
||||
|
||||
DankActionButton {
|
||||
anchors.top: parent.top
|
||||
anchors.right: parent.right
|
||||
anchors.topMargin: Theme.spacingS
|
||||
anchors.rightMargin: Theme.spacingS
|
||||
iconName: "settings"
|
||||
buttonSize: 24
|
||||
iconSize: 14
|
||||
iconColor: Theme.surfaceVariantText
|
||||
onClicked: {
|
||||
PopoutService.closeControlCenter();
|
||||
PopoutService.openSettingsWithTab("printers");
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
visible: !CupsService.cupsAvailable || CupsService.getPrintersNum() == 0
|
||||
anchors.centerIn: parent
|
||||
@@ -58,7 +70,7 @@ PluginComponent {
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Column {
|
||||
id: detailColumn
|
||||
anchors.fill: parent
|
||||
@@ -78,12 +90,12 @@ PluginComponent {
|
||||
Layout.maximumWidth: parent.width - 180
|
||||
description: ""
|
||||
currentValue: {
|
||||
CupsService.getSelectedPrinter()
|
||||
CupsService.getSelectedPrinter();
|
||||
}
|
||||
options: CupsService.getPrintersNames()
|
||||
onValueChanged: value => {
|
||||
CupsService.setSelectedPrinter(value)
|
||||
}
|
||||
CupsService.setSelectedPrinter(value);
|
||||
}
|
||||
}
|
||||
|
||||
Column {
|
||||
@@ -135,11 +147,11 @@ PluginComponent {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
enabled: true
|
||||
onClicked: {
|
||||
const selected = CupsService.getSelectedPrinter()
|
||||
const selected = CupsService.getSelectedPrinter();
|
||||
if (CupsService.getCurrentPrinterState() === "stopped") {
|
||||
CupsService.resumePrinter(selected)
|
||||
CupsService.resumePrinter(selected);
|
||||
} else {
|
||||
CupsService.pausePrinter(selected)
|
||||
CupsService.pausePrinter(selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -180,8 +192,8 @@ PluginComponent {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
enabled: true
|
||||
onClicked: {
|
||||
const selected = CupsService.getSelectedPrinter()
|
||||
CupsService.purgeJobs(selected)
|
||||
const selected = CupsService.getSelectedPrinter();
|
||||
CupsService.purgeJobs(selected);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -275,8 +287,8 @@ PluginComponent {
|
||||
|
||||
StyledText {
|
||||
text: {
|
||||
var date = new Date(modelData.timeCreated)
|
||||
return date.toLocaleString(Qt.locale(), Locale.ShortFormat)
|
||||
var date = new Date(modelData.timeCreated);
|
||||
return date.toLocaleString(Qt.locale(), Locale.ShortFormat);
|
||||
}
|
||||
font.pixelSize: Theme.fontSizeSmall
|
||||
color: Theme.surfaceTextMedium
|
||||
@@ -296,7 +308,7 @@ PluginComponent {
|
||||
iconName: "delete"
|
||||
buttonSize: 36
|
||||
onClicked: {
|
||||
CupsService.cancelJob(CupsService.getSelectedPrinter(), modelData.id)
|
||||
CupsService.cancelJob(CupsService.getSelectedPrinter(), modelData.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,8 +69,8 @@ Rectangle {
|
||||
height: 40
|
||||
|
||||
StyledText {
|
||||
id: headerText
|
||||
text: I18n.tr("Network Settings")
|
||||
id: headerLeft
|
||||
text: I18n.tr("Network")
|
||||
font.pixelSize: Theme.fontSizeLarge
|
||||
color: Theme.surfaceText
|
||||
font.weight: Font.Medium
|
||||
@@ -79,7 +79,7 @@ Rectangle {
|
||||
|
||||
Item {
|
||||
height: 1
|
||||
width: parent.width - headerText.width - rightControls.width
|
||||
width: parent.width - headerLeft.width - rightControls.width
|
||||
}
|
||||
|
||||
Row {
|
||||
@@ -115,6 +115,8 @@ Rectangle {
|
||||
id: preferenceControls
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
visible: NetworkService.backend === "networkmanager" && DMSService.apiVersion > 10
|
||||
buttonHeight: 28
|
||||
textSize: Theme.fontSizeSmall
|
||||
|
||||
model: ["Ethernet", "WiFi"]
|
||||
currentIndex: currentPreferenceIndex
|
||||
@@ -125,6 +127,18 @@ Rectangle {
|
||||
NetworkService.setNetworkPreference(index === 0 ? "ethernet" : "wifi");
|
||||
}
|
||||
}
|
||||
|
||||
DankActionButton {
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
iconName: "settings"
|
||||
buttonSize: 28
|
||||
iconSize: 16
|
||||
iconColor: Theme.surfaceVariantText
|
||||
onClicked: {
|
||||
PopoutService.closeControlCenter();
|
||||
PopoutService.openSettingsWithTab("network");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user