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
Plasma Nano
Commits
22dd8555
Commit
22dd8555
authored
Apr 05, 2022
by
Devin Lin
🎨
Committed by
Marco Martin
Apr 11, 2022
Browse files
Add containment switcher to wallpaper dialog
parent
9dcc73b3
Pipeline
#162592
passed with stage
in 45 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
shell/contents/configuration/ConfigurationContainmentAppearance.qml
View file @
22dd8555
...
...
@@ -4,11 +4,12 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
import
QtQuick
2.
0
import
QtQuick
2.
15
import
org
.
kde
.
plasma
.
configuration
2.0
import
QtQuick
.
Controls
2.3
as
Q
tControls
import
QtQuick
.
Controls
2.3
as
Q
QC2
import
QtQuick
.
Layouts
1.1
import
org
.
kde
.
newstuff
1.62
as
NewStuff
import
org
.
kde
.
kirigami
2.5
as
Kirigami
import
org
.
kde
.
plasma
.
core
2.0
as
PlasmaCore
...
...
@@ -17,6 +18,7 @@ ColumnLayout {
property
int
formAlignment
:
wallpaperComboBox
.
Kirigami
.
ScenePosition
.
x
-
root
.
Kirigami
.
ScenePosition
.
x
+
(
PlasmaCore
.
Units
.
largeSpacing
/
2
)
property
string
currentWallpaper
:
""
property
string
containmentPlugin
:
""
signal
configurationChanged
//BEGIN functions
...
...
@@ -31,6 +33,7 @@ ColumnLayout {
}
configDialog
.
currentWallpaper
=
root
.
currentWallpaper
;
configDialog
.
applyWallpaper
()
configDialog
.
containmentPlugin
=
root
.
containmentPlugin
}
//END functions
...
...
@@ -47,19 +50,55 @@ ColumnLayout {
Kirigami.InlineMessage
{
visible
:
plasmoid
.
immutable
||
animating
text
:
i18nd
(
"
plasma_shell_org.kde.plasma.desktop
"
,
"
Layout can
not be changed while widgets are locked
"
)
text
:
i18nd
(
"
plasma_shell_org.kde.plasma.desktop
"
,
"
Layout c
h
an
ges have been restricted by the system administrator
"
)
showCloseButton
:
true
Layout.fillWidth
:
true
Layout.leftMargin
:
Kirigami
.
Units
.
smallSpacing
Layout.rightMargin
:
Kirigami
.
Units
.
smallSpacing
Layout.bottomMargin
:
Kirigami
.
Units
.
smallSpacing
*
2
// we need this because ColumnLayout's spacing is 0
}
Kirigami.FormLayout
{
Layout.fillWidth
:
true
Component.onCompleted
:
{
for
(
var
i
=
0
;
i
<
configDialog
.
containmentPluginsConfigModel
.
count
;
++
i
)
{
var
data
=
configDialog
.
containmentPluginsConfigModel
.
get
(
i
);
if
(
configDialog
.
containmentPlugin
===
data
.
pluginName
)
{
pluginComboBox
.
currentIndex
=
i
pluginComboBox
.
activated
(
i
);
break
;
}
}
for
(
var
i
=
0
;
i
<
configDialog
.
wallpaperConfigModel
.
count
;
++
i
)
{
var
data
=
configDialog
.
wallpaperConfigModel
.
get
(
i
);
if
(
configDialog
.
currentWallpaper
===
data
.
pluginName
)
{
wallpaperComboBox
.
currentIndex
=
i
wallpaperComboBox
.
activated
(
i
);
break
;
}
}
}
QQC2.ComboBox
{
id
:
pluginComboBox
Layout.preferredWidth
:
Math
.
max
(
implicitWidth
,
wallpaperComboBox
.
implicitWidth
)
Kirigami.FormData.label
:
i18nd
(
"
plasma_shell_org.kde.plasma.desktop
"
,
"
Layout:
"
)
enabled
:
!
plasmoid
.
immutable
model
:
configDialog
.
containmentPluginsConfigModel
textRole
:
"
name
"
onActivated
:
{
var
model
=
configDialog
.
containmentPluginsConfigModel
.
get
(
currentIndex
)
root
.
containmentPlugin
=
model
.
pluginName
root
.
settingValueChanged
()
}
}
RowLayout
{
Layout.fillWidth
:
true
Kirigami.FormData.label
:
i18nd
(
"
plasma_shell_org.kde.plasma.desktop
"
,
"
Wallpaper Type:
"
)
Q
tControls
.ComboBox
{
Q
QC2
.ComboBox
{
id
:
wallpaperComboBox
Layout.preferredWidth
:
Math
.
max
(
implicitWidth
,
pluginComboBox
.
implicitWidth
)
model
:
configDialog
.
wallpaperConfigModel
...
...
@@ -73,20 +112,54 @@ ColumnLayout {
root
.
configurationChanged
()
}
}
// TODO Add "Get new plugins.." button when KNS is mobile friendly
NewStuff.Button
{
configFile
:
"
wallpaperplugin.knsrc
"
text
:
i18nd
(
"
plasma_shell_org.kde.plasma.desktop
"
,
"
Get New Plugins…
"
)
Layout.preferredHeight
:
wallpaperComboBox
.
height
}
}
}
ColumnLayout
{
id
:
switchContainmentWarning
Layout.fillWidth
:
true
visible
:
configDialog
.
containmentPlugin
!==
root
.
containmentPlugin
QQC2.Label
{
Layout.fillWidth
:
true
text
:
i18nd
(
"
plasma_shell_org.kde.plasma.desktop
"
,
"
Layout changes must be applied before other changes can be made
"
)
wrapMode
:
Text
.
Wrap
horizontalAlignment
:
Text
.
AlignHCenter
}
QQC2.Button
{
Layout.alignment
:
Qt
.
AlignHCenter
text
:
i18nd
(
"
plasma_shell_org.kde.plasma.desktop
"
,
"
Apply now
"
)
onClicked
:
saveConfig
()
}
Binding
{
target
:
categoriesScroll
//from parent scope AppletConfiguration
property
:
"
enabled
"
value
:
!
switchContainmentWarning
.
visible
}
}
Item
{
Layout.fillHeight
:
true
visible
:
switchContainmentWarning
.
visible
}
Item
{
id
:
emptyConfig
}
Q
tControls
.StackView
{
Q
QC2
.StackView
{
id
:
main
Layout.fillHeight
:
true
;
Layout.fillWidth
:
true
;
visible
:
!
switchContainmentWarning
.
visible
// Bug 360862: if wallpaper has no config, sourceFile will be ""
// so we wouldn't load emptyConfig and break all over the place
// hence set it to some random value initially
...
...
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