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
KScreen
Commits
49c5d9c5
Commit
49c5d9c5
authored
Oct 14, 2020
by
Jan Blackquill
🌈
Browse files
refactor(kded): refactor OSD
parent
7223eaa5
Changes
3
Hide whitespace changes
Inline
Side-by-side
kded/qml/OsdItem.qml
View file @
49c5d9c5
...
...
@@ -18,39 +18,26 @@
import
QtQuick
2.5
import
QtQuick
.
Window
2.2
import
QtQuick
.
Layouts
1.10
import
org
.
kde
.
plasma
.
core
2.0
as
PlasmaCore
import
org
.
kde
.
plasma
.
extras
2.0
as
PlasmaExtras
Item
{
property
QtObject
rootItem
height
:
Math
.
min
(
units
.
gridUnit
*
15
,
Screen
.
desktopAvailableHeight
/
5
)
width
:
height
ColumnLayout
{
PlasmaCore.IconItem
{
id
:
icon
height
:
parent
.
height
-
label
.
height
-
((
units
.
smallSpacing
/
2
)
*
3
)
width
:
parent
.
width
source
:
rootItem
.
icon
Layout.preferredHeight
:
PlasmaCore
.
Units
.
gridUnit
*
10
Layout.preferredWidth
:
implicitHeight
}
PlasmaExtras.Heading
{
id
:
label
anchors
{
bottom
:
parent
.
bottom
left
:
parent
.
left
right
:
parent
.
right
margins
:
Math
.
floor
(
units
.
smallSpacing
/
2
)
}
text
:
rootItem
.
infoText
horizontalAlignment
:
Text
.
AlignHCenter
wrapMode
:
Text
.
WordWrap
maximumLineCount
:
2
elide
:
Text
.
ElideLeft
minimumPointSize
:
theme
.
defaultFont
.
pointSize
fontSizeMode
:
Text
.
HorizontalFit
Layout.fillWidth
:
true
}
Component.onCompleted
:
print
(
"
osditem loaded...
"
+
root
.
infoText
);
}
kded/qml/OsdSelector.qml
View file @
49c5d9c5
...
...
@@ -17,10 +17,11 @@
import
QtQuick
2.5
import
QtQuick
.
Window
2.2
import
QtQuick
.
Layouts
1.10
import
org
.
kde
.
plasma
.
core
2.0
as
PlasmaCore
import
org
.
kde
.
plasma
.
components
2.0
as
PlasmaComponents
import
org
.
kde
.
plasma
.
extras
2.0
as
PlasmaExtras
import
org
.
kde
.
plasma
.
components
3.0
as
PlasmaComponents
import
org
.
kde
.
KScreen
1.0
...
...
@@ -38,17 +39,8 @@ PlasmaCore.Dialog {
signal
clicked
(
int
actionId
)
mainItem
:
Item
{
height
:
Math
.
min
(
units
.
gridUnit
*
15
,
Screen
.
desktopAvailableHeight
/
5
)
width
:
buttonRow
.
width
Row
{
id
:
buttonRow
spacing
:
theme
.
defaultFont
.
pointSize
height
:
parent
.
height
-
label
.
height
-
((
units
.
smallSpacing
/
2
)
*
3
)
width
:
(
actionRepeater
.
count
*
height
)
+
((
actionRepeater
.
count
-
1
)
*
buttonRow
.
spacing
);
mainItem
:
ColumnLayout
{
RowLayout
{
Repeater
{
id
:
actionRepeater
property
int
currentIndex
:
0
...
...
@@ -59,25 +51,21 @@ PlasmaCore.Dialog {
label
:
OsdAction
.
actionLabel
(
layout
),
action
:
layout
}
})
;
})
}
delegate
:
PlasmaComponents.Button
{
property
var
action
:
modelData
.
action
action
:
modelData
.
action
Accessible.name
:
modelData
.
label
PlasmaCore.IconItem
{
source
:
modelData
.
iconSource
height
:
buttonRow
.
height
-
((
units
.
smallSpacing
/
2
)
*
3
)
width
:
height
anchors.centerIn
:
parent
}
height
:
parent
.
height
width
:
height
icon.name
:
modelData
.
iconSource
icon.height
:
PlasmaCore
.
Units
.
gridUnit
*
8
icon.width
:
PlasmaCore
.
Units
.
gridUnit
*
8
onClicked
:
root
.
clicked
(
action
)
onHoveredChanged
:
{
actionRepeater
.
currentIndex
=
index
}
onClicked
:
root
.
clicked
(
action
)
activeFocusOnTab
:
true
// use checked only indirectly, since its binding will break
...
...
@@ -99,62 +87,35 @@ PlasmaCore.Dialog {
}
}
}
PlasmaExtras.Heading
{
id
:
label
anchors
{
bottom
:
parent
.
bottom
left
:
parent
.
left
right
:
parent
.
right
margins
:
Math
.
floor
(
units
.
smallSpacing
/
2
)
}
text
:
root
.
infoText
horizontalAlignment
:
Text
.
AlignHCenter
wrapMode
:
Text
.
WordWrap
maximumLineCount
:
2
elide
:
Text
.
ElideLeft
minimumPointSize
:
theme
.
defaultFont
.
pointSize
fontSizeMode
:
Text
.
HorizontalFit
}
Component.onCompleted
:
print
(
"
OsdSelector loaded...
"
);
wrapMode
:
Text
.
WordWrap
function
next
()
{
var
index
=
actionRepeater
.
currentIndex
+
1
if
(
index
>=
actionRepeater
.
count
)
{
index
=
0
}
actionRepeater
.
currentIndex
=
index
Layout.fillWidth
:
true
Layout.margins
:
Math
.
floor
(
PlasmaCore
.
Units
.
smallSpacing
/
2
)
}
function
previous
()
{
var
index
=
actionRepeater
.
currentIndex
-
1
if
(
index
<
0
)
{
index
=
actionRepeater
.
count
-
1
}
actionRepeater
.
currentIndex
=
index
function
move
(
delta
)
{
actionRepeater
.
currentIndex
=
((
actionRepeater
.
currentIndex
+
delta
)
+
actionRepeater
.
count
)
%
actionRepeater
.
count
}
Keys.onPressed
:
{
if
(
event
.
key
===
Qt
.
Key_Return
||
event
.
key
===
Qt
.
Key_Enter
)
{
event
.
accepted
=
true
clicked
(
buttonRow
.
children
[
actionRepeater
.
currentIndex
].
action
)
return
}
if
(
event
.
key
===
Qt
.
Key_Right
)
{
event
.
accepted
=
true
next
()
return
}
if
(
event
.
key
===
Qt
.
Key_Left
)
{
event
.
accepted
=
true
previous
()
return
}
if
(
event
.
key
===
Qt
.
Key_Escape
)
{
event
.
accepted
=
true
clicked
(
OsdAction
.
NoAction
)
return
switch
(
event
.
key
)
{
case
Qt
.
Key_Return
:
case
Qt
.
Key_Enter
:
clicked
(
actionRepeater
.
itemAt
(
actionRepeater
.
currentIndex
).
action
)
break
case
Qt
.
Key_Right
:
move
(
1
)
break
case
Qt
.
Key_Left
:
move
(
-
1
)
break
case
Qt
.
Key_Escape
:
clicked
(
OsdAction
.
NoAction
)
break
}
}
}
...
...
kded/qml/OutputIdentifier.qml
View file @
49c5d9c5
...
...
@@ -20,7 +20,7 @@ import QtQuick.Layouts 1.3
import
QtQuick
.
Window
2.2
import
org
.
kde
.
plasma
.
core
2.0
as
PlasmaCore
import
org
.
kde
.
plasma
.
components
2
.0
as
PlasmaComponents
import
org
.
kde
.
plasma
.
components
3
.0
as
PlasmaComponents
ColumnLayout
{
...
...
Méven Car
@meven
mentioned in merge request
!77 (merged)
·
Dec 22, 2021
mentioned in merge request
!77 (merged)
mentioned in merge request !77
Toggle commit list
Méven Car
@meven
mentioned in commit
b499deca
·
Jan 04, 2022
mentioned in commit
b499deca
mentioned in commit b499deca0b078daf1276dc141cb981df94ed3ce3
Toggle commit list
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