diff --git a/applets/taskmanager/package/contents/code/layout.js b/applets/taskmanager/package/contents/code/layout.js --- a/applets/taskmanager/package/contents/code/layout.js +++ b/applets/taskmanager/package/contents/code/layout.js @@ -17,6 +17,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA . * ***************************************************************************/ +var iconSizes = ["small", "smallMedium", "medium", "large", "huge", "enormous"]; + function horizontalMargins() { return taskFrame.margins.left + taskFrame.margins.right; } @@ -132,7 +134,33 @@ } function preferredMaxHeight() { - return verticalMargins() + Math.min(units.iconSizes.small * 3, theme.mSize(theme.defaultFont).height * 3); + if (tasks.vertical) { + return verticalMargins() + + Math.min( + // Do not allow the preferred icon size to exceed the width of the vertical task manager. + tasks.width, + Math.max( + // This assumes that we show some text and that we need some minimal vertical space for it. + // In reality, we do not always show the text. We show the text only if there + // is enough horizontal space for some hard coded amount of 'm' characters + // - see minimumMColumns() below. + // Hence in case the user prefers icons smaller than the height of his font, + // the font height will win even if the text will stay invisible. + // We leave it for the future developers to improve this expresssion if the + // named corner case turns out to be important. + units.iconSizes[iconSizes[plasmoid.configuration.iconSize]], + theme.mSize(theme.defaultFont).height + ) + ); + } else { + return verticalMargins() + Math.min(units.iconSizes.small * 3, theme.mSize(theme.defaultFont).height * 3); + } +} + +// Returns the number of 'm' characters whose joint width must be available in the task button label +// so that the button text is rendered at all. +function minimumMColumns() { + return tasks.vertical ? 4 : 5; } function taskWidth() { diff --git a/applets/taskmanager/package/contents/config/main.xml b/applets/taskmanager/package/contents/config/main.xml --- a/applets/taskmanager/package/contents/config/main.xml +++ b/applets/taskmanager/package/contents/config/main.xml @@ -101,6 +101,18 @@ 0 + + + + + + + + + + + 3 + diff --git a/applets/taskmanager/package/contents/ui/ConfigGeneral.qml b/applets/taskmanager/package/contents/ui/ConfigGeneral.qml --- a/applets/taskmanager/package/contents/ui/ConfigGeneral.qml +++ b/applets/taskmanager/package/contents/ui/ConfigGeneral.qml @@ -32,6 +32,7 @@ readonly property bool plasmaPaAvailable: Qt.createComponent("PulseAudio.qml").status === Component.Ready property alias cfg_forceStripes: forceStripes.checked + property alias cfg_iconSize: iconSize.value property alias cfg_showToolTips: showToolTips.checked property alias cfg_wheelEnabled: wheelEnabled.checked property alias cfg_highlightWindows: highlightWindows.checked @@ -58,7 +59,7 @@ flat: true GridLayout { - columns: 2 + columns: 4 Layout.fillWidth: true Label { @@ -68,15 +69,45 @@ SpinBox { id: maxStripes minimumValue: 1 + Layout.columnSpan: 3 } CheckBox { id: forceStripes Layout.column: 1 Layout.row: 1 text: vertical ? i18n("Always arrange tasks in rows of as many columns") : i18n("Always arrange tasks in columns of as many rows") enabled: maxStripes.value > 1 + Layout.columnSpan: 3 } + + Label { + visible: vertical + text: i18n("Icon size:") + } + + Label { + visible: vertical + text: i18n("Small") + } + + Slider { + Layout.fillWidth: true + visible: vertical + id: iconSize + + minimumValue: 0 + maximumValue: 5 + stepSize: 1 + + tickmarksEnabled: true + } + + Label { + visible: vertical + text: i18n("Large") + } + } } diff --git a/applets/taskmanager/package/contents/ui/Task.qml b/applets/taskmanager/package/contents/ui/Task.qml --- a/applets/taskmanager/package/contents/ui/Task.qml +++ b/applets/taskmanager/package/contents/ui/Task.qml @@ -474,7 +474,7 @@ id: label visible: (inPopup || !iconsOnly && model.IsLauncher !== true - && (parent.width - iconBox.height - units.smallSpacing) >= (theme.mSize(theme.defaultFont).width * 5)) + && (parent.width - iconBox.height - units.smallSpacing) >= (theme.mSize(theme.defaultFont).width * LayoutManager.minimumMColumns())) anchors { fill: parent