Skip to content

Commit

Permalink
Color changes. Further icon scale fixes #55
Browse files Browse the repository at this point in the history
  • Loading branch information
alexankitty committed Sep 18, 2023
1 parent 34358a4 commit a53aedd
Show file tree
Hide file tree
Showing 10 changed files with 307 additions and 24 deletions.
5 changes: 5 additions & 0 deletions package/contents/config/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@
<default>200</default>
<min>1</min>
</entry>
<entry name="maxButtonHeight" type="Int">
<label>The max legnth of a task button.</label>
<default>32</default>
<min>1</min>
</entry>
<entry name="forceStripes" type="Bool">
<label>Whether to try and always layout task buttons in as many rows/columns as set via maxStripes.</label>
<default>false</default>
Expand Down
13 changes: 6 additions & 7 deletions package/contents/ui/ColorSlider.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import "code/tools.js" as TaskTools
Item {
function applyColors(hex){
colorPicker.updating = true
if(!colorSlider.hue) colorSlider.hue = hex.h * 359
if(!colorSlider.autoHue) colorSlider.hue = hex.h * 359
if(!colorSlider.autoSaturation) colorSlider.saturation = hex.s * 100
if(!colorSlider.autoLightness) colorSlider.lightness = hex.l * 100
colorSlider.alpha = hex.a * 100
Expand Down Expand Up @@ -67,15 +67,13 @@ Item {
}
id: colorSlider
objectName: "ColorSlider"
anchors.left: parent.left
anchors.right: parent.right
height: childrenRect.height
width: childrenRect.width

readonly property alias autoHue: hueComponent.checked
readonly property alias autoSaturate: satComponent.checked
readonly property alias autoLightness: lightComponent.checked
readonly property alias autoType: autoMethod.currentIndex
property alias autoHue: hueComponent.checked
property alias autoSaturate: satComponent.checked
property alias autoLightness: lightComponent.checked
property alias autoType: autoMethod.currentIndex

property alias hue: hueComponent.value
property alias saturation: satComponent.value
Expand Down Expand Up @@ -139,6 +137,7 @@ Item {
}
ComboBox {
id: autoMethod
enabled: colorSlider.autoHue || colorSlider.autoSaturate || colorSlider.autoLightness
model: [
i18n("Average"),
i18n("Background"),
Expand Down
9 changes: 9 additions & 0 deletions package/contents/ui/ConfigAppearance.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Kirigami.FormLayout {
property alias cfg_maxStripes: maxStripes.value
property bool cfg_forceStripes
property alias cfg_maxButtonLength: maxButtonLength.value
property alias cfg_maxButtonHeight: maxButtonHeight.value
property int cfg_iconSpacing: 0

property alias cfg_useBorders: useBorders.checked
Expand Down Expand Up @@ -211,6 +212,14 @@ Kirigami.FormLayout {
to: 9999
}

SpinBox {
visible: plasmoidVertical && !iconOnly
id: maxButtonHeight
Kirigami.FormData.label: i18n("Maximum button height (px):")
from: 1
to: 9999
}

SpinBox {
id: taskSpacingSize
Kirigami.FormData.label: i18n("Space between taskbar items (px):")
Expand Down
127 changes: 126 additions & 1 deletion package/contents/ui/ConfigColors.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.15

import org.kde.kirigami 2.19 as Kirigami
Expand All @@ -15,8 +14,134 @@ import org.kde.plasma.plasmoid 2.0
import org.kde.kquickcontrols 2.0 as KQControls


import "../libconfig" as LibConfig

Kirigami.FormLayout {
//Props
property color cfg_buttonActiveColor
property color cfg_buttonInctiveColor
property color cfg_buttonMinimizedColor
property color cfg_buttonAttentionColor
property color cfg_buttonProgressColor
property color cfg_buttonHoverColor
property color cfg_indicatorActiveColor
property color cfg_indicatorInctiveColor
property color cfg_indicatorMinimizedColor
property color cfg_indicatorAttentionColor
property color cfg_indicatorProgressColor
property color cfg_indicatorHoverColor
//Auto Enabled
property int cfg_buttonActiveColorAuto
property int cfg_buttonInctiveColorAuto
property int cfg_buttonMinimizedColorAuto
property int cfg_buttonAttentionColorAuto
property int cfg_buttonProgressColorAuto
property int cfg_buttonHoverColorAuto
property int cfg_indicatorActiveColorAuto
property int cfg_indicatorInctiveColorAuto
property int cfg_indicatorMinimizedColorAuto
property int cfg_indicatorAttentionColorAuto
property int cfg_indicatorProgressColorAuto
property int cfg_indicatorHoverColorAuto
//Auto methods
property int cfg_buttonActiveColorMethod
property int cfg_buttonInctiveColorMethod
property int cfg_buttonMinimizedColorMethod
property int cfg_buttonAttentionColorMethod
property int cfg_buttonProgressColorMethod
property int cfg_buttonHoverColorMethod
property int cfg_indicatorActiveColorMethod
property int cfg_indicatorInctiveColorMethod
property int cfg_indicatorMinimizedColorMethod
property int cfg_indicatorAttentionColorMethod
property int cfg_indicatorProgressColorMethod
property int cfg_indicatorHoverColorMethod

wideMode: false
width: parent.width
anchors.left: parent.left
anchors.right: parent.right
ColumnLayout{
TabBar{
TabButton {
enabled: plasmoid.configuration.buttonColorize
id: buttonTab
text: i18n("Button Colors")
}
TabButton {
enabled: plasmoid.configuration.indicatorsEnabled
id: indicatorTab
text: i18n("Indicator Colors")
checked: !plasmoid.configuration.buttonColorize && plasmoid.configuration.indicatorsEnabled
}
}
Label{
visible: !plasmoid.configuration.buttonColorize && !plasmoid.configuration.indicatorsEnabled
text: i18n("Enable Button Color Overlay or Indicators to be able to use this page.")
}
RowLayout{
Label{
text: i18n("State")
}
ComboBox {
id: state
model: [
i18n("Active"),
i18n("Inactive"),
i18n("Minimized"),
i18n("Attention"),
i18n("Progress"),
i18n("Hover")
]
}
}
ColorSlider {
id: colorSelector
enabled: plasmoid.configuration.buttonColorize || plasmoid.configuration.indicatorsEnabled
}
}
function buildColorSlider(){
var autoHue
var autoSat
var autoLight
var cfgKey = "cfg_"
if(buttonTab.checked){
cfgKey += "button"
}
else if(indicatorTab.checked){
cfgKey += "indicator"
}
else{
return //This should never be reached.
}
switch(state.currentIndex){
case 0:
cfgKey += "Active"
break;
case 1:
cfgKey += "Inctive"
break;
case 2:
cfgKey += "Minimized"
break;
case 3:
cfgKey += "Attention"
break;
case 4:
cfgKey += "Progress"
break;
case 5:
cfgKey += "Hover"
break;
}

}
function
Connections{
target: buttonTab
function onCheckedChanged {

}
}

}
22 changes: 17 additions & 5 deletions package/contents/ui/Task.qml
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,9 @@ MouseArea {
if(!iconsOnly && plasmoid.configuration.iconSizeOverride){
return plasmoid.configuration.iconSizePx
}
if(tasks.vertical){
return parent.height
}
return height * (plasmoid.configuration.iconScale / 100)
}
height: (parent.height - adjustMargin(false, parent.height, taskFrame.margins.top)
Expand Down Expand Up @@ -750,6 +753,9 @@ MouseArea {
if(iconsOnly && plasmoid.configuration.iconSizeOverride){
return plasmoid.configuration.iconSizePx
}
if(tasks.vertical){
return parent.height
}
return parent.width
}
height: width
Expand Down Expand Up @@ -785,9 +791,13 @@ MouseArea {

PropertyChanges {
target: iconBox
anchors.leftMargin: 0
width: parent.width - adjustMargin(true, task.width, taskFrame.margins.left)
- adjustMargin(true, task.width, taskFrame.margins.right)
anchors.leftMargin: {
console.log(taskFrame.margins.left + iconBox.width + LayoutManager.labelMargin)
console.log(LayoutManager.taskWidth())
console.log(model.decoration)
console.log("standalone mode")
0
}
}
}
]
Expand Down Expand Up @@ -832,9 +842,11 @@ MouseArea {

PlasmaComponents3.Label {
id: label

property string test: {
return ""
}
visible: (inPopup || !iconsOnly && model.IsLauncher !== true
&& (parent.width - iconBox.height - PlasmaCore.Units.smallSpacing) >= (theme.mSize(theme.defaultFont).width * LayoutManager.minimumMColumns()))
&& (taskFrame.margins.left + iconBox.width + LayoutManager.labelMargin) <= (task.width))

anchors {
fill: parent
Expand Down
11 changes: 6 additions & 5 deletions package/contents/ui/code/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,16 @@ function preferredMinHeight() {

function preferredMaxHeight() {
if (tasks.vertical) {
let iconSize = 0
if(plasmoid.configuration.iconSizeOverride) iconSize = plasmoid.configuration.iconSizePx
if(!plasmoid.configuration.iconSizeOverride) iconSize = PlasmaCore.Units.iconSizes.medium * (plasmoid.configuration.iconScale / 100)
return verticalMargins() +
Math.min(
// Do not allow the preferred icon size to exceed the width of
// the vertical task manager.
tasks.width,
tasks.iconsOnly ? tasks.width :
Math.max(
PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).height,
PlasmaCore.Units.iconSizes.medium
)
iconSize
);
} else {
return verticalMargins() +
Expand Down Expand Up @@ -186,7 +186,8 @@ function taskHeight() {
}

function launcherWidth() {
var baseWidth = tasks.vertical ? preferredMinHeight() : Math.min(tasks.height, PlasmaCore.Units.iconSizes.small * 3);
let iconSize = plasmoid.configuration.iconSizeOverride ? plasmoid.configuration.iconSizePx : (PlasmaCore.Units.iconSizes.small * 3) * plasmoid.configuration.iconScale
var baseWidth = tasks.vertical ? preferredMinHeight() : Math.min(tasks.height,iconSize) ;

return (baseWidth + horizontalMargins())
- (adjustMargin(baseWidth, taskFrame.margins.top) + adjustMargin(baseWidth, taskFrame.margins.bottom));
Expand Down
6 changes: 3 additions & 3 deletions package/translate/ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ Or if you know how to make a pull request
## Status
| Locale | Lines | % Done|
|----------|---------|-------|
| Template | 189 | |
| nl | 150/189 | 79% |
| zh_CN | 150/189 | 79% |
| Template | 200 | |
| nl | 150/200 | 75% |
| zh_CN | 150/200 | 75% |
46 changes: 45 additions & 1 deletion package/translate/nl.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: fancytasks\n"
"Report-Msgid-Bugs-To: https://github.com/alexankitty/FancyTasks\n"
"POT-Creation-Date: 2023-09-17 01:27-0600\n"
"POT-Creation-Date: 2023-09-17 20:03-0600\n"
"PO-Revision-Date: 2023-07-13 22:27+0200\n"
"Last-Translator: Heimen Stoffels <[email protected]>\n"
"Language-Team: \n"
Expand Down Expand Up @@ -253,6 +253,10 @@ msgstr "Taken altijd verdelen over zoveel mogelijk rijen"
msgid "Maximum button length (px):"
msgstr "Maximale knopbreedte (in px):"

#: ../contents/ui/ConfigAppearance.qml
msgid "Maximum button height (px):"
msgstr ""

#: ../contents/ui/ConfigAppearance.qml
msgid "Space between taskbar items (px):"
msgstr "Ruimte tussen taakbalkitems (in px):"
Expand Down Expand Up @@ -493,6 +497,46 @@ msgstr "Rechterkant"
msgid "To the left"
msgstr "Linkerkant"

#: ../contents/ui/ConfigColors.qml
msgid "Button Colors"
msgstr ""

#: ../contents/ui/ConfigColors.qml
msgid "Indicator Colors"
msgstr ""

#: ../contents/ui/ConfigColors.qml
msgid "Enable Button Color Overlay or Indicators to be able to use this page."
msgstr ""

#: ../contents/ui/ConfigColors.qml
msgid "State"
msgstr ""

#: ../contents/ui/ConfigColors.qml
msgid "Active"
msgstr ""

#: ../contents/ui/ConfigColors.qml
msgid "Inactive"
msgstr ""

#: ../contents/ui/ConfigColors.qml
msgid "Minimized"
msgstr ""

#: ../contents/ui/ConfigColors.qml
msgid "Attention"
msgstr ""

#: ../contents/ui/ConfigColors.qml
msgid "Progress"
msgstr ""

#: ../contents/ui/ConfigColors.qml
msgid "Hover"
msgstr ""

#: ../contents/ui/ConfigIndicators.qml
msgid "Indicators:"
msgstr "Indicators:"
Expand Down
Loading

0 comments on commit a53aedd

Please sign in to comment.