mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
Widgets: fix conflicts
This commit is contained in:
@@ -61,19 +61,21 @@ Item {
|
||||
}
|
||||
|
||||
readonly property int titleWidth: {
|
||||
if (smartWidth && showTitle && !isVerticalBar && combinedModel.length > 0) {
|
||||
var entriesCount = combinedModel.length;
|
||||
var baseWidth = 140;
|
||||
var calculatedWidth = baseWidth / Math.sqrt(entriesCount);
|
||||
// First, use user-defined title width if set
|
||||
var calculatedWidth = (widgetSettings.titleWidth !== undefined) ? widgetSettings.titleWidth : widgetMetadata.titleWidth;
|
||||
|
||||
// Second, shrink title width if it exceeds maxTaskbarWidth when smartWidth is enabled
|
||||
if (smartWidth && combinedModel.length > 0) {
|
||||
if (maxTaskbarWidth > 0) {
|
||||
var entriesCount = combinedModel.length;
|
||||
var maxWidthPerEntry = (maxTaskbarWidth / entriesCount) - itemSize - Style.marginS - Style.marginXL;
|
||||
calculatedWidth = Math.min(calculatedWidth, maxWidthPerEntry);
|
||||
}
|
||||
|
||||
return Math.max(Math.round(calculatedWidth), 20);
|
||||
calculatedWidth = Math.max(Math.round(calculatedWidth), 20);
|
||||
}
|
||||
return (widgetSettings.titleWidth !== undefined) ? widgetSettings.titleWidth : widgetMetadata.titleWidth;
|
||||
|
||||
return calculatedWidth;
|
||||
}
|
||||
readonly property bool showPinnedApps: (widgetSettings.showPinnedApps !== undefined) ? widgetSettings.showPinnedApps : widgetMetadata.showPinnedApps
|
||||
|
||||
|
||||
@@ -1011,6 +1011,7 @@ SmartPanel {
|
||||
verticalPolicy: ScrollBar.AlwaysOff
|
||||
reserveScrollbarSpace: false
|
||||
gradientColor: Color.mSurface
|
||||
wheelScrollMultiplier: 4.0
|
||||
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
@@ -1351,6 +1352,7 @@ SmartPanel {
|
||||
verticalPolicy: ScrollBar.AlwaysOff
|
||||
reserveScrollbarSpace: false
|
||||
gradientColor: "transparent" //Color.mSurface
|
||||
wheelScrollMultiplier: 4.0
|
||||
|
||||
width: parent.width
|
||||
height: parent.height
|
||||
|
||||
@@ -147,6 +147,16 @@ ColumnLayout {
|
||||
enabled: !isVerticalBar
|
||||
}
|
||||
|
||||
NTextInput {
|
||||
id: titleWidthInput
|
||||
visible: root.valueShowTitle && !isVerticalBar
|
||||
Layout.fillWidth: true
|
||||
label: I18n.tr("bar.taskbar.title-width-label")
|
||||
description: I18n.tr("bar.taskbar.title-width-description")
|
||||
text: widgetData.titleWidth || widgetMetadata.titleWidth
|
||||
placeholderText: I18n.tr("placeholders.enter-width-pixels")
|
||||
}
|
||||
|
||||
NToggle {
|
||||
Layout.fillWidth: true
|
||||
visible: !isVerticalBar && root.valueShowTitle
|
||||
|
||||
@@ -316,6 +316,20 @@ ColumnLayout {
|
||||
color: Color.mOnSurfaceVariant
|
||||
}
|
||||
|
||||
NText {
|
||||
visible: !!modelData.lastUpdated
|
||||
text: "•"
|
||||
font.pointSize: Style.fontSizeXS
|
||||
color: Color.mOnSurfaceVariant
|
||||
}
|
||||
|
||||
NText {
|
||||
visible: !!modelData.lastUpdated
|
||||
text: modelData.lastUpdated ? Time.formatRelativeTime(new Date(modelData.lastUpdated)) : ""
|
||||
font.pointSize: Style.fontSizeXS
|
||||
color: Color.mOnSurfaceVariant
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
@@ -105,12 +105,14 @@ ColumnLayout {
|
||||
pluginData.sourceName = PluginRegistry.getSourceNameByHash(parsed.sourceHash);
|
||||
}
|
||||
|
||||
// Look up "official" (team-maintained) status from available plugins
|
||||
// Look up "official" (team-maintained) status and lastUpdated from available plugins
|
||||
pluginData.official = false;
|
||||
pluginData.lastUpdated = null;
|
||||
var availablePlugins = PluginService.availablePlugins || [];
|
||||
for (var j = 0; j < availablePlugins.length; j++) {
|
||||
if (availablePlugins[j].id === manifest.id) {
|
||||
pluginData.official = availablePlugins[j].official === true;
|
||||
pluginData.lastUpdated = availablePlugins[j].lastUpdated || null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -333,6 +335,20 @@ ColumnLayout {
|
||||
color: Color.mTertiary
|
||||
}
|
||||
|
||||
NText {
|
||||
visible: !!modelData.lastUpdated
|
||||
text: "•"
|
||||
font.pointSize: Style.fontSizeXS
|
||||
color: Color.mOnSurfaceVariant
|
||||
}
|
||||
|
||||
NText {
|
||||
visible: !!modelData.lastUpdated
|
||||
text: modelData.lastUpdated ? Time.formatRelativeTime(new Date(modelData.lastUpdated)) : ""
|
||||
font.pointSize: Style.fontSizeXS
|
||||
color: Color.mOnSurfaceVariant
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
@@ -77,6 +77,9 @@ Item {
|
||||
property alias verticalVelocity: gridView.verticalVelocity
|
||||
property alias reuseItems: gridView.reuseItems
|
||||
|
||||
// Scroll speed multiplier for mouse wheel (1.0 = default, higher = faster)
|
||||
property real wheelScrollMultiplier: 2.0
|
||||
|
||||
// Forward GridView methods
|
||||
function positionViewAtIndex(index, mode) {
|
||||
gridView.positionViewAtIndex(index, mode);
|
||||
@@ -221,6 +224,17 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
WheelHandler {
|
||||
enabled: root.wheelScrollMultiplier !== 1.0
|
||||
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
|
||||
onWheel: event => {
|
||||
const delta = event.pixelDelta.y !== 0 ? event.pixelDelta.y : event.angleDelta.y / 8;
|
||||
const newY = gridView.contentY - (delta * root.wheelScrollMultiplier);
|
||||
gridView.contentY = Math.max(0, Math.min(newY, gridView.contentHeight - gridView.height));
|
||||
event.accepted = true;
|
||||
}
|
||||
}
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
parent: root
|
||||
x: root.mirrored ? 0 : root.width - width
|
||||
|
||||
@@ -68,6 +68,9 @@ Item {
|
||||
property alias horizontalVelocity: listView.horizontalVelocity
|
||||
property alias verticalVelocity: listView.verticalVelocity
|
||||
|
||||
// Scroll speed multiplier for mouse wheel (1.0 = default, higher = faster)
|
||||
property real wheelScrollMultiplier: 2.0
|
||||
|
||||
// Forward ListView methods
|
||||
function positionViewAtIndex(index, mode) {
|
||||
listView.positionViewAtIndex(index, mode);
|
||||
@@ -186,6 +189,17 @@ Item {
|
||||
clip: true
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
|
||||
WheelHandler {
|
||||
enabled: root.wheelScrollMultiplier !== 1.0
|
||||
acceptedDevices: PointerDevice.Mouse | PointerDevice.TouchPad
|
||||
onWheel: event => {
|
||||
const delta = event.pixelDelta.y !== 0 ? event.pixelDelta.y : event.angleDelta.y / 8;
|
||||
const newY = listView.contentY - (delta * root.wheelScrollMultiplier);
|
||||
listView.contentY = Math.max(0, Math.min(newY, listView.contentHeight - listView.height));
|
||||
event.accepted = true;
|
||||
}
|
||||
}
|
||||
|
||||
ScrollBar.vertical: ScrollBar {
|
||||
parent: root
|
||||
x: root.mirrored ? 0 : root.width - width
|
||||
|
||||
Reference in New Issue
Block a user