mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2025-12-06 21:45:38 -05:00
workaround for all the terrible default QT scrolling behavior
- DankGridView, DankFlickable, DankListView\ - Touchpad behavior greatly improved by preserving momentum - Fixed janky nested scrollers in control center
This commit is contained in:
@@ -33,46 +33,90 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
ScrollView {
|
||||
// Output Tab - DankFlickable
|
||||
DankFlickable {
|
||||
width: parent.width
|
||||
height: parent.height - 48
|
||||
visible: audioTab.audioSubTab === 0
|
||||
clip: true
|
||||
|
||||
contentHeight: outputColumn.height
|
||||
contentWidth: width
|
||||
mouseWheelSpeed: 20
|
||||
|
||||
Column {
|
||||
id: outputColumn
|
||||
width: parent.width
|
||||
spacing: Theme.spacingL
|
||||
|
||||
VolumeControl {
|
||||
|
||||
Loader {
|
||||
width: parent.width
|
||||
sourceComponent: volumeComponent
|
||||
}
|
||||
|
||||
AudioDevicesList {
|
||||
|
||||
Loader {
|
||||
width: parent.width
|
||||
sourceComponent: outputDevicesComponent
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ScrollView {
|
||||
// Input Tab - DankFlickable
|
||||
DankFlickable {
|
||||
width: parent.width
|
||||
height: parent.height - 48
|
||||
visible: audioTab.audioSubTab === 1
|
||||
clip: true
|
||||
|
||||
contentHeight: inputColumn.height
|
||||
contentWidth: width
|
||||
mouseWheelSpeed: 20
|
||||
|
||||
Column {
|
||||
id: inputColumn
|
||||
width: parent.width
|
||||
spacing: Theme.spacingL
|
||||
|
||||
MicrophoneControl {
|
||||
|
||||
Loader {
|
||||
width: parent.width
|
||||
sourceComponent: microphoneComponent
|
||||
}
|
||||
|
||||
AudioInputDevicesList {
|
||||
|
||||
Loader {
|
||||
width: parent.width
|
||||
sourceComponent: inputDevicesComponent
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Volume Control Component
|
||||
Component {
|
||||
id: volumeComponent
|
||||
VolumeControl {
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
|
||||
// Microphone Control Component
|
||||
Component {
|
||||
id: microphoneComponent
|
||||
MicrophoneControl {
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
|
||||
// Output Devices Component
|
||||
Component {
|
||||
id: outputDevicesComponent
|
||||
AudioDevicesList {
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
|
||||
// Input Devices Component
|
||||
Component {
|
||||
id: inputDevicesComponent
|
||||
AudioInputDevicesList {
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,15 @@ import qs.Widgets
|
||||
Column {
|
||||
id: root
|
||||
|
||||
property var bluetoothContextMenuWindow
|
||||
function findBluetoothContextMenu() {
|
||||
var p = parent;
|
||||
while (p) {
|
||||
if (p.bluetoothContextMenuWindow)
|
||||
return p.bluetoothContextMenuWindow;
|
||||
p = p.parent;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
@@ -117,10 +125,11 @@ Column {
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: {
|
||||
if (bluetoothContextMenuWindow) {
|
||||
bluetoothContextMenuWindow.deviceData = modelData;
|
||||
let localPos = btMenuButtonArea.mapToItem(bluetoothContextMenuWindow.parentItem, btMenuButtonArea.width / 2, btMenuButtonArea.height);
|
||||
bluetoothContextMenuWindow.show(localPos.x, localPos.y);
|
||||
var contextMenu = root.findBluetoothContextMenu();
|
||||
if (contextMenu) {
|
||||
contextMenu.deviceData = modelData;
|
||||
let localPos = btMenuButtonArea.mapToItem(contextMenu.parentItem, btMenuButtonArea.width / 2, btMenuButtonArea.height);
|
||||
contextMenu.show(localPos.x, localPos.y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,33 +12,39 @@ import qs.Widgets
|
||||
Item {
|
||||
id: bluetoothTab
|
||||
|
||||
ScrollView {
|
||||
property alias bluetoothContextMenuWindow: bluetoothContextMenuWindow
|
||||
|
||||
DankFlickable {
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
ScrollBar.vertical.policy: ScrollBar.AsNeeded
|
||||
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
|
||||
|
||||
contentHeight: mainColumn.height
|
||||
contentWidth: width
|
||||
mouseWheelSpeed: 20
|
||||
|
||||
Column {
|
||||
id: mainColumn
|
||||
width: parent.width
|
||||
spacing: Theme.spacingL
|
||||
|
||||
BluetoothToggle {
|
||||
|
||||
Loader {
|
||||
width: parent.width
|
||||
sourceComponent: toggleComponent
|
||||
}
|
||||
|
||||
PairedDevicesList {
|
||||
bluetoothContextMenuWindow: bluetoothContextMenuWindow
|
||||
|
||||
Loader {
|
||||
width: parent.width
|
||||
sourceComponent: pairedComponent
|
||||
}
|
||||
|
||||
AvailableDevicesList {
|
||||
|
||||
Loader {
|
||||
width: parent.width
|
||||
sourceComponent: availableComponent
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
BluetoothContextMenu {
|
||||
id: bluetoothContextMenuWindow
|
||||
|
||||
parentItem: bluetoothTab
|
||||
}
|
||||
|
||||
@@ -57,7 +63,26 @@ Item {
|
||||
onClicked: {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Component {
|
||||
id: toggleComponent
|
||||
BluetoothToggle {
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: pairedComponent
|
||||
PairedDevicesList {
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: availableComponent
|
||||
AvailableDevicesList {
|
||||
width: parent.width
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import qs.Modules
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
ScrollView {
|
||||
Item {
|
||||
id: displayTab
|
||||
|
||||
property var brightnessDebounceTimer
|
||||
@@ -16,19 +16,61 @@ ScrollView {
|
||||
brightnessDebounceTimer: Timer {
|
||||
property int pendingValue: 0
|
||||
|
||||
interval: BrightnessService.ddcAvailable ? 500 : 50 // 500ms for slow DDC (i2c), 50ms for fast laptop backlight
|
||||
interval: BrightnessService.ddcAvailable ? 500 : 50
|
||||
repeat: false
|
||||
onTriggered: {
|
||||
|
||||
BrightnessService.setBrightnessInternal(pendingValue);
|
||||
}
|
||||
}
|
||||
|
||||
clip: true
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingL
|
||||
DankFlickable {
|
||||
anchors.fill: parent
|
||||
clip: true
|
||||
contentHeight: mainColumn.height
|
||||
contentWidth: width
|
||||
mouseWheelSpeed: 20
|
||||
|
||||
Column {
|
||||
id: mainColumn
|
||||
width: parent.width
|
||||
spacing: Theme.spacingL
|
||||
|
||||
Loader {
|
||||
width: parent.width
|
||||
sourceComponent: brightnessComponent
|
||||
}
|
||||
|
||||
Loader {
|
||||
width: parent.width
|
||||
sourceComponent: settingsComponent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: nightModeEnableProcess
|
||||
command: ["bash", "-c", "if command -v wlsunset > /dev/null; then pkill wlsunset; wlsunset -t 3000 & elif command -v redshift > /dev/null; then pkill redshift; redshift -P -O 3000 & else echo 'No night mode tool available'; fi"]
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
if (exitCode !== 0) {
|
||||
SettingsData.setNightModeEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: nightModeDisableProcess
|
||||
command: ["bash", "-c", "pkill wlsunset; pkill redshift; if command -v wlsunset > /dev/null; then wlsunset -t 6500 -T 6500 & sleep 1; pkill wlsunset; elif command -v redshift > /dev/null; then redshift -P -O 6500; redshift -x; fi"]
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
if (exitCode !== 0) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Component {
|
||||
id: brightnessComponent
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
@@ -48,12 +90,10 @@ ScrollView {
|
||||
rightIcon: "brightness_high"
|
||||
enabled: BrightnessService.brightnessAvailable
|
||||
onSliderValueChanged: function(newValue) {
|
||||
|
||||
brightnessDebounceTimer.pendingValue = newValue;
|
||||
brightnessDebounceTimer.restart();
|
||||
}
|
||||
onSliderDragFinished: function(finalValue) {
|
||||
|
||||
brightnessDebounceTimer.stop();
|
||||
BrightnessService.setBrightnessInternal(finalValue);
|
||||
}
|
||||
@@ -66,9 +106,11 @@ ScrollView {
|
||||
visible: BrightnessService.ddcAvailable && !BrightnessService.laptopBacklightAvailable
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Component {
|
||||
id: settingsComponent
|
||||
Column {
|
||||
width: parent.width
|
||||
spacing: Theme.spacingM
|
||||
@@ -110,12 +152,10 @@ ScrollView {
|
||||
font.weight: Font.Medium
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: nightModeToggle
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
@@ -129,7 +169,6 @@ ScrollView {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Rectangle {
|
||||
@@ -158,12 +197,10 @@ ScrollView {
|
||||
font.weight: Font.Medium
|
||||
anchors.horizontalCenter: parent.horizontalCenter
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
MouseArea {
|
||||
id: lightModeToggle
|
||||
|
||||
anchors.fill: parent
|
||||
hoverEnabled: true
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
@@ -177,40 +214,9 @@ ScrollView {
|
||||
duration: Theme.shortDuration
|
||||
easing.type: Theme.standardEasing
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Process {
|
||||
id: nightModeEnableProcess
|
||||
|
||||
command: ["bash", "-c", "if command -v wlsunset > /dev/null; then pkill wlsunset; wlsunset -t 3000 & elif command -v redshift > /dev/null; then pkill redshift; redshift -P -O 3000 & else echo 'No night mode tool available'; fi"]
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
if (exitCode !== 0) {
|
||||
|
||||
SettingsData.setNightModeEnabled(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Process {
|
||||
id: nightModeDisableProcess
|
||||
|
||||
command: ["bash", "-c", "pkill wlsunset; pkill redshift; if command -v wlsunset > /dev/null; then wlsunset -t 6500 -T 6500 & sleep 1; pkill wlsunset; elif command -v redshift > /dev/null; then redshift -P -O 6500; redshift -x; fi"]
|
||||
running: false
|
||||
onExited: (exitCode) => {
|
||||
if (exitCode !== 0)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user