Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwineffects/package/contents/ui/Effect.qml
Show All 16 Lines | |||||
17 | * | 17 | * | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | import QtQuick 2.1 | 20 | import QtQuick 2.1 | ||
21 | import QtQuick.Controls 2.5 as QtControls | 21 | import QtQuick.Controls 2.5 as QtControls | ||
22 | import QtQuick.Layouts 1.0 | 22 | import QtQuick.Layouts 1.0 | ||
23 | import org.kde.kirigami 2.5 as Kirigami | 23 | import org.kde.kirigami 2.5 as Kirigami | ||
24 | 24 | | |||
25 | Rectangle { | 25 | Kirigami.SwipeListItem { | ||
26 | height: row.implicitHeight | 26 | hoverEnabled: true | ||
27 | 27 | onClicked: { | |||
28 | Kirigami.Theme.inherit: false | 28 | view.currentIndex = index; | ||
29 | Kirigami.Theme.colorSet: Kirigami.Theme.View | 29 | } | ||
30 | color: index % 2 ? Kirigami.Theme.backgroundColor : palette.alternateBase | 30 | contentItem: RowLayout { | ||
31 | | ||||
32 | RowLayout { | | |||
33 | id: row | 31 | id: row | ||
34 | | ||||
35 | x: spacing | | |||
36 | width: parent.width - 2 * spacing | | |||
37 | | ||||
38 | QtControls.RadioButton { | 32 | QtControls.RadioButton { | ||
39 | property bool _exclusive: model.ExclusiveRole != "" | 33 | property bool _exclusive: model.ExclusiveRole != "" | ||
40 | property bool _toggled: false | 34 | property bool _toggled: false | ||
41 | 35 | | |||
42 | checked: model.StatusRole | 36 | checked: model.StatusRole | ||
43 | visible: _exclusive | 37 | visible: _exclusive | ||
44 | QtControls.ButtonGroup.group: _exclusive ? effectsList.findButtonGroup(model.ExclusiveRole) : null | 38 | QtControls.ButtonGroup.group: _exclusive ? effectsList.findButtonGroup(model.ExclusiveRole) : null | ||
45 | 39 | | |||
Show All 35 Lines | 60 | ColumnLayout { | |||
81 | 75 | | |||
82 | QtControls.Label { | 76 | QtControls.Label { | ||
83 | id: aboutItem | 77 | id: aboutItem | ||
84 | 78 | | |||
85 | Layout.fillWidth: true | 79 | Layout.fillWidth: true | ||
86 | 80 | | |||
87 | font.weight: Font.Bold | 81 | font.weight: Font.Bold | ||
88 | text: i18n("Author: %1\nLicense: %2", model.AuthorNameRole, model.LicenseRole) | 82 | text: i18n("Author: %1\nLicense: %2", model.AuthorNameRole, model.LicenseRole) | ||
89 | visible: false | 83 | visible: view.currentIndex === index | ||
90 | wrapMode: Text.Wrap | 84 | wrapMode: Text.Wrap | ||
91 | } | 85 | } | ||
92 | 86 | | |||
93 | Loader { | 87 | Loader { | ||
94 | id: videoItem | 88 | id: videoItem | ||
95 | 89 | | |||
96 | active: false | 90 | active: false | ||
97 | source: "Video.qml" | 91 | source: "Video.qml" | ||
98 | visible: false | 92 | visible: false | ||
99 | 93 | | |||
100 | function showHide() { | 94 | function showHide() { | ||
101 | if (!videoItem.active) { | 95 | if (!videoItem.active) { | ||
102 | videoItem.active = true; | 96 | videoItem.active = true; | ||
103 | videoItem.visible = true; | 97 | videoItem.visible = true; | ||
104 | } else { | 98 | } else { | ||
105 | videoItem.active = false; | 99 | videoItem.active = false; | ||
106 | videoItem.visible = false; | 100 | videoItem.visible = false; | ||
107 | } | 101 | } | ||
108 | } | 102 | } | ||
109 | } | 103 | } | ||
110 | } | 104 | } | ||
111 | | ||||
112 | QtControls.Button { | | |||
113 | icon.name: "video" | | |||
114 | visible: model.VideoRole.toString() !== "" | | |||
115 | | ||||
116 | onClicked: videoItem.showHide() | | |||
117 | } | 105 | } | ||
118 | 106 | actions: [ | |||
119 | QtControls.Button { | 107 | Kirigami.Action { | ||
108 | visible: model.VideoRole.toString() !== "" | ||||
109 | icon.name: "videoclip-amarok" | ||||
110 | tooltip: i18nc("@info:tooltip", "Show Video") | ||||
111 | onTriggered: videoItem.showHide() | ||||
112 | }, | ||||
113 | Kirigami.Action { | ||||
114 | visible: model.ConfigurableRole | ||||
120 | enabled: model.StatusRole != Qt.Unchecked | 115 | enabled: model.StatusRole != Qt.Unchecked | ||
121 | icon.name: "configure" | 116 | icon.name: "configure" | ||
122 | visible: model.ConfigurableRole | 117 | tooltip: i18nc("@info:tooltip", "Configure...") | ||
123 | 118 | onTriggered: kcm.configure(model.ServiceNameRole, this) | |||
124 | onClicked: kcm.configure(model.ServiceNameRole, this) | | |||
125 | } | | |||
126 | | ||||
127 | QtControls.Button { | | |||
128 | icon.name: "dialog-information" | | |||
129 | | ||||
130 | onClicked: aboutItem.visible = !aboutItem.visible; | | |||
131 | } | | |||
132 | } | | |||
133 | | ||||
134 | // Kirigami.Theme doesn't provide alternate color. | | |||
135 | SystemPalette { | | |||
136 | id: palette | | |||
137 | | ||||
138 | colorGroup: SystemPalette.Active | | |||
139 | } | 119 | } | ||
120 | ] | ||||
140 | } | 121 | } |