Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
KWin
Commits
a3caf7f6
Commit
a3caf7f6
authored
Sep 30, 2020
by
Cyril Rossi
Browse files
Port KCM KWin Decoration to SettingStateBinding
parent
743b06d3
Changes
4
Hide whitespace changes
Inline
Side-by-side
kcmkwin/kwindecoration/package/contents/ui/ButtonGroup.qml
View file @
a3caf7f6
...
...
@@ -33,6 +33,7 @@ ListView {
Drag.active
:
dragArea
.
drag
.
active
Drag.onActiveChanged
:
view
.
dragging
=
Drag
.
active
color
:
palette
.
windowText
opacity
:
parent
.
enabled
?
1.0
:
0.3
}
MouseArea
{
id
:
dragArea
...
...
kcmkwin/kwindecoration/package/contents/ui/Buttons.qml
View file @
a3caf7f6
...
...
@@ -11,6 +11,7 @@ import QtQuick.Controls 2.4 as Controls
import
org
.
kde
.
plasma
.
core
2.0
as
PlasmaCore
import
org
.
kde
.
kirigami
2.5
as
Kirigami
import
org
.
kde
.
kwin
.
private
.
kdecoration
1.0
as
KDecoration
import
org
.
kde
.
kcm
1.3
as
KCM
ColumnLayout
{
Layout.fillWidth
:
true
...
...
@@ -64,7 +65,24 @@ ColumnLayout {
iconSize
:
buttonIconSize
model
:
kcm
.
leftButtonsModel
key
:
"
decoButtonLeft
"
Rectangle
{
visible
:
stateBindingButtonLeft
.
nonDefaultHighlightVisible
anchors.fill
:
parent
Layout.margins
:
units
.
smallSpacing
color
:
"
transparent
"
border.color
:
Kirigami
.
Theme
.
neutralTextColor
border.width
:
Kirigami
.
Units
.
devicePixelRatio
radius
:
units
.
smallSpacing
}
KCM.SettingStateBinding
{
id
:
stateBindingButtonLeft
configObject
:
kcm
.
settings
settingName
:
"
buttonsOnLeft
"
}
}
Controls.Label
{
id
:
titleBarLabel
Layout.fillWidth
:
true
...
...
@@ -77,6 +95,22 @@ ColumnLayout {
iconSize
:
buttonIconSize
model
:
kcm
.
rightButtonsModel
key
:
"
decoButtonRight
"
Rectangle
{
visible
:
stateBindingButtonRight
.
nonDefaultHighlightVisible
anchors.fill
:
parent
Layout.margins
:
units
.
smallSpacing
color
:
"
transparent
"
border.color
:
Kirigami
.
Theme
.
neutralTextColor
border.width
:
Kirigami
.
Units
.
devicePixelRatio
radius
:
units
.
smallSpacing
}
KCM.SettingStateBinding
{
id
:
stateBindingButtonRight
configObject
:
kcm
.
settings
settingName
:
"
buttonsOnRight
"
}
}
}
DropArea
{
...
...
@@ -94,9 +128,13 @@ ColumnLayout {
var
left
=
drag
.
x
-
(
leftButtonsView
.
x
+
leftButtonsView
.
width
);
var
right
=
drag
.
x
-
rightButtonsView
.
x
;
if
(
Math
.
abs
(
left
)
<=
Math
.
abs
(
right
))
{
view
=
leftButtonsView
;
if
(
leftButtonsView
.
enabled
)
{
view
=
leftButtonsView
;
}
}
else
{
view
=
rightButtonsView
;
if
(
rightButtonsView
.
enabled
)
{
view
=
rightButtonsView
;
}
}
if
(
!
view
)
{
return
;
...
...
kcmkwin/kwindecoration/package/contents/ui/Themes.qml
View file @
a3caf7f6
...
...
@@ -5,7 +5,7 @@
SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
import
QtQuick
2.7
import
org
.
kde
.
kcm
1.
1
as
KCM
import
org
.
kde
.
kcm
1.
3
as
KCM
import
org
.
kde
.
kirigami
2.2
as
Kirigami
import
org
.
kde
.
kwin
.
private
.
kdecoration
1.0
as
KDecoration
...
...
kcmkwin/kwindecoration/package/contents/ui/main.qml
View file @
a3caf7f6
...
...
@@ -7,11 +7,13 @@
import
QtQuick
2.7
import
QtQuick
.
Layouts
1.3
import
QtQuick
.
Controls
2.4
as
Controls
import
org
.
kde
.
kcm
1.
1
as
KCM
import
org
.
kde
.
kcm
1.
3
as
KCM
import
org
.
kde
.
kconfig
1.0
// for KAuthorized
import
org
.
kde
.
kirigami
2.4
as
Kirigami
Kirigami.Page
{
id
:
root
KCM.ConfigModule.quickHelp
:
i18n
(
"
This module lets you configure the window decorations.
"
)
title
:
kcm
.
name
...
...
@@ -62,54 +64,75 @@ Kirigami.Page {
currentIndex
:
tabBar
.
currentIndex
ColumnLayout
{
Themes
{
Layout.fillWidth
:
true
Layout.fillHeight
:
true
enabled
:
!
kcm
.
settings
.
isImmutable
(
"
pluginName
"
)
&&
!
kcm
.
settings
.
isImmutable
(
"
theme
"
)
Item
{
KCM.SettingStateBinding
{
target
:
themes
configObject
:
kcm
.
settings
settingName
:
"
pluginName
"
}
RowLayout
{
Controls.CheckBox
{
id
:
borderSizeAutoCheckbox
// Let it elide but don't make it push the ComboBox away from it
ColumnLayout
{
anchors.fill
:
parent
Themes
{
id
:
themes
Layout.fillWidth
:
true
Layout.maximumWidth
:
implicitWidth
text
:
i18nc
(
"
checkbox label
"
,
"
Use theme's default window border size
"
)
enabled
:
!
kcm
.
settings
.
isImmutable
(
"
borderSizeAuto
"
)
checked
:
kcm
.
settings
.
borderSizeAuto
onToggled
:
{
kcm
.
settings
.
borderSizeAuto
=
checked
;
borderSizeComboBox
.
autoBorderUpdate
()
}
Layout.fillHeight
:
true
}
Controls.ComboBox
{
id
:
borderSizeComboBox
enabled
:
!
borderSizeAutoCheckbox
.
checked
&&
!
kcm
.
settings
.
isImmutable
(
"
borderSize
"
)
model
:
kcm
.
borderSizesModel
currentIndex
:
kcm
.
borderSize
onActivated
:
{
kcm
.
borderSize
=
currentIndex
}
function
autoBorderUpdate
()
{
if
(
borderSizeAutoCheckbox
.
checked
)
{
kcm
.
borderSize
=
kcm
.
recommendedBorderSize
RowLayout
{
Controls.CheckBox
{
id
:
borderSizeAutoCheckbox
// Let it elide but don't make it push the ComboBox away from it
Layout.fillWidth
:
true
Layout.maximumWidth
:
implicitWidth
text
:
i18nc
(
"
checkbox label
"
,
"
Use theme's default window border size
"
)
checked
:
kcm
.
settings
.
borderSizeAuto
onToggled
:
{
kcm
.
settings
.
borderSizeAuto
=
checked
;
borderSizeComboBox
.
autoBorderUpdate
()
}
KCM.SettingStateBinding
{
configObject
:
kcm
.
settings
settingName
:
"
borderSizeAuto
"
}
}
Controls.ComboBox
{
id
:
borderSizeComboBox
model
:
kcm
.
borderSizesModel
currentIndex
:
kcm
.
borderSize
onActivated
:
{
kcm
.
borderSize
=
currentIndex
}
KCM.SettingStateBinding
{
configObject
:
kcm
.
settings
settingName
:
"
borderSize
"
extraEnabledConditions
:
!
borderSizeAutoCheckbox
.
checked
}
function
autoBorderUpdate
()
{
if
(
borderSizeAutoCheckbox
.
checked
)
{
kcm
.
borderSize
=
kcm
.
recommendedBorderSize
}
}
Connections
{
target
:
kcm
onThemeChanged
:
borderSizeComboBox
.
autoBorderUpdate
()
Connections
{
target
:
kcm
onThemeChanged
:
borderSizeComboBox
.
autoBorderUpdate
()
}
}
Item
{
Layout.fillWidth
:
true
}
Controls.Button
{
text
:
i18nc
(
"
button text
"
,
"
Get New Window Decorations...
"
)
icon.name
:
"
get-hot-new-stuff
"
onClicked
:
kcm
.
getNewStuff
(
this
)
visible
:
KAuthorized
.
authorize
(
"
ghns
"
)
}
}
Item
{
Layout.fillWidth
:
true
}
Controls.Button
{
text
:
i18nc
(
"
button text
"
,
"
Get New Window Decorations...
"
)
icon.name
:
"
get-hot-new-stuff
"
onClicked
:
kcm
.
getNewStuff
(
this
)
visible
:
KAuthorized
.
authorize
(
"
ghns
"
)
}
}
}
...
...
@@ -118,18 +141,21 @@ Kirigami.Page {
Buttons
{
Layout.fillWidth
:
true
Layout.fillHeight
:
true
enabled
:
!
kcm
.
settings
.
isImmutable
(
"
buttonsOnLeft
"
)
&&
!
kcm
.
settings
.
isImmutable
(
"
buttonsOnRight
"
)
}
Controls.CheckBox
{
id
:
closeOnDoubleClickOnMenuCheckBox
text
:
i18nc
(
"
checkbox label
"
,
"
Close windows by double clicking the menu button
"
)
enabled
:
!
kcm
.
settings
.
isImmutable
(
"
closeOnDoubleClickOnMenu
"
)
checked
:
kcm
.
settings
.
closeOnDoubleClickOnMenu
onToggled
:
{
kcm
.
settings
.
closeOnDoubleClickOnMenu
=
checked
infoLabel
.
visible
=
checked
}
KCM.SettingStateBinding
{
configObject
:
kcm
.
settings
settingName
:
"
closeOnDoubleClickOnMenu
"
}
}
Kirigami.InlineMessage
{
...
...
@@ -144,9 +170,13 @@ Kirigami.Page {
Controls.CheckBox
{
id
:
showToolTipsCheckBox
text
:
i18nc
(
"
checkbox label
"
,
"
Show titlebar button tooltips
"
)
enabled
:
!
kcm
.
settings
.
isImmutable
(
"
showToolTips
"
)
checked
:
kcm
.
settings
.
showToolTips
onToggled
:
kcm
.
settings
.
showToolTips
=
checked
KCM.SettingStateBinding
{
configObject
:
kcm
.
settings
settingName
:
"
showToolTips
"
}
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment