Skip to content

Commit a53aedd

Browse files
committed
Color changes. Further icon scale fixes #55
1 parent 34358a4 commit a53aedd

File tree

10 files changed

+307
-24
lines changed

10 files changed

+307
-24
lines changed

package/contents/config/main.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,11 @@
7272
<default>200</default>
7373
<min>1</min>
7474
</entry>
75+
<entry name="maxButtonHeight" type="Int">
76+
<label>The max legnth of a task button.</label>
77+
<default>32</default>
78+
<min>1</min>
79+
</entry>
7580
<entry name="forceStripes" type="Bool">
7681
<label>Whether to try and always layout task buttons in as many rows/columns as set via maxStripes.</label>
7782
<default>false</default>

package/contents/ui/ColorSlider.qml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import "code/tools.js" as TaskTools
1212
Item {
1313
function applyColors(hex){
1414
colorPicker.updating = true
15-
if(!colorSlider.hue) colorSlider.hue = hex.h * 359
15+
if(!colorSlider.autoHue) colorSlider.hue = hex.h * 359
1616
if(!colorSlider.autoSaturation) colorSlider.saturation = hex.s * 100
1717
if(!colorSlider.autoLightness) colorSlider.lightness = hex.l * 100
1818
colorSlider.alpha = hex.a * 100
@@ -67,15 +67,13 @@ Item {
6767
}
6868
id: colorSlider
6969
objectName: "ColorSlider"
70-
anchors.left: parent.left
71-
anchors.right: parent.right
7270
height: childrenRect.height
7371
width: childrenRect.width
7472

75-
readonly property alias autoHue: hueComponent.checked
76-
readonly property alias autoSaturate: satComponent.checked
77-
readonly property alias autoLightness: lightComponent.checked
78-
readonly property alias autoType: autoMethod.currentIndex
73+
property alias autoHue: hueComponent.checked
74+
property alias autoSaturate: satComponent.checked
75+
property alias autoLightness: lightComponent.checked
76+
property alias autoType: autoMethod.currentIndex
7977

8078
property alias hue: hueComponent.value
8179
property alias saturation: satComponent.value
@@ -139,6 +137,7 @@ Item {
139137
}
140138
ComboBox {
141139
id: autoMethod
140+
enabled: colorSlider.autoHue || colorSlider.autoSaturate || colorSlider.autoLightness
142141
model: [
143142
i18n("Average"),
144143
i18n("Background"),

package/contents/ui/ConfigAppearance.qml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ Kirigami.FormLayout {
3030
property alias cfg_maxStripes: maxStripes.value
3131
property bool cfg_forceStripes
3232
property alias cfg_maxButtonLength: maxButtonLength.value
33+
property alias cfg_maxButtonHeight: maxButtonHeight.value
3334
property int cfg_iconSpacing: 0
3435

3536
property alias cfg_useBorders: useBorders.checked
@@ -211,6 +212,14 @@ Kirigami.FormLayout {
211212
to: 9999
212213
}
213214

215+
SpinBox {
216+
visible: plasmoidVertical && !iconOnly
217+
id: maxButtonHeight
218+
Kirigami.FormData.label: i18n("Maximum button height (px):")
219+
from: 1
220+
to: 9999
221+
}
222+
214223
SpinBox {
215224
id: taskSpacingSize
216225
Kirigami.FormData.label: i18n("Space between taskbar items (px):")

package/contents/ui/ConfigColors.qml

Lines changed: 126 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
import QtQuick 2.15
88
import QtQuick.Controls 2.15
9-
import QtQuick.Controls 1.4
109
import QtQuick.Layouts 1.15
1110

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

1716

17+
import "../libconfig" as LibConfig
1818

1919
Kirigami.FormLayout {
20+
//Props
21+
property color cfg_buttonActiveColor
22+
property color cfg_buttonInctiveColor
23+
property color cfg_buttonMinimizedColor
24+
property color cfg_buttonAttentionColor
25+
property color cfg_buttonProgressColor
26+
property color cfg_buttonHoverColor
27+
property color cfg_indicatorActiveColor
28+
property color cfg_indicatorInctiveColor
29+
property color cfg_indicatorMinimizedColor
30+
property color cfg_indicatorAttentionColor
31+
property color cfg_indicatorProgressColor
32+
property color cfg_indicatorHoverColor
33+
//Auto Enabled
34+
property int cfg_buttonActiveColorAuto
35+
property int cfg_buttonInctiveColorAuto
36+
property int cfg_buttonMinimizedColorAuto
37+
property int cfg_buttonAttentionColorAuto
38+
property int cfg_buttonProgressColorAuto
39+
property int cfg_buttonHoverColorAuto
40+
property int cfg_indicatorActiveColorAuto
41+
property int cfg_indicatorInctiveColorAuto
42+
property int cfg_indicatorMinimizedColorAuto
43+
property int cfg_indicatorAttentionColorAuto
44+
property int cfg_indicatorProgressColorAuto
45+
property int cfg_indicatorHoverColorAuto
46+
//Auto methods
47+
property int cfg_buttonActiveColorMethod
48+
property int cfg_buttonInctiveColorMethod
49+
property int cfg_buttonMinimizedColorMethod
50+
property int cfg_buttonAttentionColorMethod
51+
property int cfg_buttonProgressColorMethod
52+
property int cfg_buttonHoverColorMethod
53+
property int cfg_indicatorActiveColorMethod
54+
property int cfg_indicatorInctiveColorMethod
55+
property int cfg_indicatorMinimizedColorMethod
56+
property int cfg_indicatorAttentionColorMethod
57+
property int cfg_indicatorProgressColorMethod
58+
property int cfg_indicatorHoverColorMethod
59+
60+
wideMode: false
61+
width: parent.width
2062
anchors.left: parent.left
2163
anchors.right: parent.right
64+
ColumnLayout{
65+
TabBar{
66+
TabButton {
67+
enabled: plasmoid.configuration.buttonColorize
68+
id: buttonTab
69+
text: i18n("Button Colors")
70+
}
71+
TabButton {
72+
enabled: plasmoid.configuration.indicatorsEnabled
73+
id: indicatorTab
74+
text: i18n("Indicator Colors")
75+
checked: !plasmoid.configuration.buttonColorize && plasmoid.configuration.indicatorsEnabled
76+
}
77+
}
78+
Label{
79+
visible: !plasmoid.configuration.buttonColorize && !plasmoid.configuration.indicatorsEnabled
80+
text: i18n("Enable Button Color Overlay or Indicators to be able to use this page.")
81+
}
82+
RowLayout{
83+
Label{
84+
text: i18n("State")
85+
}
86+
ComboBox {
87+
id: state
88+
model: [
89+
i18n("Active"),
90+
i18n("Inactive"),
91+
i18n("Minimized"),
92+
i18n("Attention"),
93+
i18n("Progress"),
94+
i18n("Hover")
95+
]
96+
}
97+
}
98+
ColorSlider {
99+
id: colorSelector
100+
enabled: plasmoid.configuration.buttonColorize || plasmoid.configuration.indicatorsEnabled
101+
}
102+
}
103+
function buildColorSlider(){
104+
var autoHue
105+
var autoSat
106+
var autoLight
107+
var cfgKey = "cfg_"
108+
if(buttonTab.checked){
109+
cfgKey += "button"
110+
}
111+
else if(indicatorTab.checked){
112+
cfgKey += "indicator"
113+
}
114+
else{
115+
return //This should never be reached.
116+
}
117+
switch(state.currentIndex){
118+
case 0:
119+
cfgKey += "Active"
120+
break;
121+
case 1:
122+
cfgKey += "Inctive"
123+
break;
124+
case 2:
125+
cfgKey += "Minimized"
126+
break;
127+
case 3:
128+
cfgKey += "Attention"
129+
break;
130+
case 4:
131+
cfgKey += "Progress"
132+
break;
133+
case 5:
134+
cfgKey += "Hover"
135+
break;
136+
}
137+
138+
}
139+
function
140+
Connections{
141+
target: buttonTab
142+
function onCheckedChanged {
143+
144+
}
145+
}
146+
22147
}

package/contents/ui/Task.qml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,9 @@ MouseArea {
713713
if(!iconsOnly && plasmoid.configuration.iconSizeOverride){
714714
return plasmoid.configuration.iconSizePx
715715
}
716+
if(tasks.vertical){
717+
return parent.height
718+
}
716719
return height * (plasmoid.configuration.iconScale / 100)
717720
}
718721
height: (parent.height - adjustMargin(false, parent.height, taskFrame.margins.top)
@@ -750,6 +753,9 @@ MouseArea {
750753
if(iconsOnly && plasmoid.configuration.iconSizeOverride){
751754
return plasmoid.configuration.iconSizePx
752755
}
756+
if(tasks.vertical){
757+
return parent.height
758+
}
753759
return parent.width
754760
}
755761
height: width
@@ -785,9 +791,13 @@ MouseArea {
785791

786792
PropertyChanges {
787793
target: iconBox
788-
anchors.leftMargin: 0
789-
width: parent.width - adjustMargin(true, task.width, taskFrame.margins.left)
790-
- adjustMargin(true, task.width, taskFrame.margins.right)
794+
anchors.leftMargin: {
795+
console.log(taskFrame.margins.left + iconBox.width + LayoutManager.labelMargin)
796+
console.log(LayoutManager.taskWidth())
797+
console.log(model.decoration)
798+
console.log("standalone mode")
799+
0
800+
}
791801
}
792802
}
793803
]
@@ -832,9 +842,11 @@ MouseArea {
832842

833843
PlasmaComponents3.Label {
834844
id: label
835-
845+
property string test: {
846+
return ""
847+
}
836848
visible: (inPopup || !iconsOnly && model.IsLauncher !== true
837-
&& (parent.width - iconBox.height - PlasmaCore.Units.smallSpacing) >= (theme.mSize(theme.defaultFont).width * LayoutManager.minimumMColumns()))
849+
&& (taskFrame.margins.left + iconBox.width + LayoutManager.labelMargin) <= (task.width))
838850

839851
anchors {
840852
fill: parent

package/contents/ui/code/layout.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,16 +135,16 @@ function preferredMinHeight() {
135135

136136
function preferredMaxHeight() {
137137
if (tasks.vertical) {
138+
let iconSize = 0
139+
if(plasmoid.configuration.iconSizeOverride) iconSize = plasmoid.configuration.iconSizePx
140+
if(!plasmoid.configuration.iconSizeOverride) iconSize = PlasmaCore.Units.iconSizes.medium * (plasmoid.configuration.iconScale / 100)
138141
return verticalMargins() +
139142
Math.min(
140143
// Do not allow the preferred icon size to exceed the width of
141144
// the vertical task manager.
142145
tasks.width,
143146
tasks.iconsOnly ? tasks.width :
144-
Math.max(
145-
PlasmaCore.Theme.mSize(PlasmaCore.Theme.defaultFont).height,
146-
PlasmaCore.Units.iconSizes.medium
147-
)
147+
iconSize
148148
);
149149
} else {
150150
return verticalMargins() +
@@ -186,7 +186,8 @@ function taskHeight() {
186186
}
187187

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

191192
return (baseWidth + horizontalMargins())
192193
- (adjustMargin(baseWidth, taskFrame.margins.top) + adjustMargin(baseWidth, taskFrame.margins.bottom));

package/translate/ReadMe.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ Or if you know how to make a pull request
3535
## Status
3636
| Locale | Lines | % Done|
3737
|----------|---------|-------|
38-
| Template | 189 | |
39-
| nl | 150/189 | 79% |
40-
| zh_CN | 150/189 | 79% |
38+
| Template | 200 | |
39+
| nl | 150/200 | 75% |
40+
| zh_CN | 150/200 | 75% |

package/translate/nl.po

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ msgid ""
77
msgstr ""
88
"Project-Id-Version: fancytasks\n"
99
"Report-Msgid-Bugs-To: https://github.com/alexankitty/FancyTasks\n"
10-
"POT-Creation-Date: 2023-09-17 01:27-0600\n"
10+
"POT-Creation-Date: 2023-09-17 20:03-0600\n"
1111
"PO-Revision-Date: 2023-07-13 22:27+0200\n"
1212
"Last-Translator: Heimen Stoffels <[email protected]>\n"
1313
"Language-Team: \n"
@@ -253,6 +253,10 @@ msgstr "Taken altijd verdelen over zoveel mogelijk rijen"
253253
msgid "Maximum button length (px):"
254254
msgstr "Maximale knopbreedte (in px):"
255255

256+
#: ../contents/ui/ConfigAppearance.qml
257+
msgid "Maximum button height (px):"
258+
msgstr ""
259+
256260
#: ../contents/ui/ConfigAppearance.qml
257261
msgid "Space between taskbar items (px):"
258262
msgstr "Ruimte tussen taakbalkitems (in px):"
@@ -493,6 +497,46 @@ msgstr "Rechterkant"
493497
msgid "To the left"
494498
msgstr "Linkerkant"
495499

500+
#: ../contents/ui/ConfigColors.qml
501+
msgid "Button Colors"
502+
msgstr ""
503+
504+
#: ../contents/ui/ConfigColors.qml
505+
msgid "Indicator Colors"
506+
msgstr ""
507+
508+
#: ../contents/ui/ConfigColors.qml
509+
msgid "Enable Button Color Overlay or Indicators to be able to use this page."
510+
msgstr ""
511+
512+
#: ../contents/ui/ConfigColors.qml
513+
msgid "State"
514+
msgstr ""
515+
516+
#: ../contents/ui/ConfigColors.qml
517+
msgid "Active"
518+
msgstr ""
519+
520+
#: ../contents/ui/ConfigColors.qml
521+
msgid "Inactive"
522+
msgstr ""
523+
524+
#: ../contents/ui/ConfigColors.qml
525+
msgid "Minimized"
526+
msgstr ""
527+
528+
#: ../contents/ui/ConfigColors.qml
529+
msgid "Attention"
530+
msgstr ""
531+
532+
#: ../contents/ui/ConfigColors.qml
533+
msgid "Progress"
534+
msgstr ""
535+
536+
#: ../contents/ui/ConfigColors.qml
537+
msgid "Hover"
538+
msgstr ""
539+
496540
#: ../contents/ui/ConfigIndicators.qml
497541
msgid "Indicators:"
498542
msgstr "Indicators:"

0 commit comments

Comments
 (0)