Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwineffects/package/contents/ui/Effect.qml
Show All 11 Lines | |||||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | 13 | * GNU General Public License for more details. | ||
14 | * | 14 | * | ||
15 | * You should have received a copy of the GNU General Public License | 15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
17 | * | 17 | * | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | import QtQuick 2.1 | 20 | import QtQuick 2.5 | ||
21 | import QtQuick.Controls 2.5 as QtControls | 21 | import QtQuick.Controls 2.5 as QQC2 | ||
22 | import QtQuick.Layouts 1.0 | 22 | import QtQuick.Layouts 1.1 | ||
23 | import org.kde.kirigami 2.5 as Kirigami | | |||
24 | | ||||
25 | Rectangle { | | |||
26 | height: row.implicitHeight | | |||
27 | 23 | | |||
28 | Kirigami.Theme.inherit: false | 24 | import org.kde.kirigami 2.5 as Kirigami | ||
29 | Kirigami.Theme.colorSet: Kirigami.Theme.View | | |||
30 | color: index % 2 ? Kirigami.Theme.backgroundColor : palette.alternateBase | | |||
31 | 25 | | |||
32 | RowLayout { | 26 | Kirigami.SwipeListItem { | ||
27 | hoverEnabled: true | ||||
28 | onClicked: { | ||||
29 | view.currentIndex = index; | ||||
30 | } | ||||
31 | contentItem: RowLayout { | ||||
33 | id: row | 32 | id: row | ||
34 | 33 | QQC2.RadioButton { | |||
35 | x: spacing | | |||
36 | width: parent.width - 2 * spacing | | |||
37 | | ||||
38 | QtControls.RadioButton { | | |||
39 | property bool _exclusive: model.ExclusiveRole != "" | 34 | property bool _exclusive: model.ExclusiveRole != "" | ||
40 | property bool _toggled: false | 35 | property bool _toggled: false | ||
41 | 36 | | |||
42 | checked: model.StatusRole | 37 | checked: model.StatusRole | ||
43 | visible: _exclusive | 38 | visible: _exclusive | ||
44 | QtControls.ButtonGroup.group: _exclusive ? effectsList.findButtonGroup(model.ExclusiveRole) : null | 39 | QQC2.ButtonGroup.group: _exclusive ? effectsList.findButtonGroup(model.ExclusiveRole) : null | ||
45 | 40 | | |||
46 | onToggled: { | 41 | onToggled: { | ||
47 | model.StatusRole = checked ? Qt.Checked : Qt.Unchecked; | 42 | model.StatusRole = checked ? Qt.Checked : Qt.Unchecked; | ||
48 | _toggled = true; | 43 | _toggled = true; | ||
49 | } | 44 | } | ||
50 | onClicked: { | 45 | onClicked: { | ||
51 | // Uncheck the radio button if it's clicked. | 46 | // Uncheck the radio button if it's clicked. | ||
52 | if (checked && !_toggled) { | 47 | if (checked && !_toggled) { | ||
53 | model.StatusRole = Qt.Unchecked; | 48 | model.StatusRole = Qt.Unchecked; | ||
54 | } | 49 | } | ||
55 | _toggled = false; | 50 | _toggled = false; | ||
56 | } | 51 | } | ||
57 | } | 52 | } | ||
58 | 53 | | |||
59 | QtControls.CheckBox { | 54 | QQC2.CheckBox { | ||
60 | checkState: model.StatusRole | 55 | checkState: model.StatusRole | ||
61 | visible: model.ExclusiveRole == "" | 56 | visible: model.ExclusiveRole == "" | ||
62 | 57 | | |||
63 | onToggled: model.StatusRole = checkState | 58 | onToggled: model.StatusRole = checkState | ||
64 | } | 59 | } | ||
65 | 60 | | |||
66 | ColumnLayout { | 61 | ColumnLayout { | ||
67 | QtControls.Label { | 62 | QQC2.Label { | ||
68 | Layout.fillWidth: true | 63 | Layout.fillWidth: true | ||
69 | 64 | | |||
70 | font.weight: Font.Bold | 65 | font.weight: Font.Bold | ||
71 | text: model.NameRole | 66 | text: model.NameRole | ||
72 | wrapMode: Text.Wrap | 67 | wrapMode: Text.Wrap | ||
73 | } | 68 | } | ||
74 | 69 | | |||
75 | QtControls.Label { | 70 | QQC2.Label { | ||
76 | Layout.fillWidth: true | 71 | Layout.fillWidth: true | ||
77 | 72 | | |||
78 | text: model.DescriptionRole | 73 | text: model.DescriptionRole | ||
79 | wrapMode: Text.Wrap | 74 | wrapMode: Text.Wrap | ||
80 | } | 75 | } | ||
81 | 76 | | |||
82 | QtControls.Label { | 77 | QQC2.Label { | ||
83 | id: aboutItem | 78 | id: aboutItem | ||
84 | 79 | | |||
85 | Layout.fillWidth: true | 80 | Layout.fillWidth: true | ||
86 | 81 | | |||
87 | font.weight: Font.Bold | 82 | font.weight: Font.Bold | ||
88 | text: i18n("Author: %1\nLicense: %2", model.AuthorNameRole, model.LicenseRole) | 83 | text: i18n("Author: %1\nLicense: %2", model.AuthorNameRole, model.LicenseRole) | ||
89 | visible: false | 84 | visible: view.currentIndex === index | ||
90 | wrapMode: Text.Wrap | 85 | wrapMode: Text.Wrap | ||
91 | } | 86 | } | ||
92 | 87 | | |||
93 | Loader { | 88 | Loader { | ||
94 | id: videoItem | 89 | id: videoItem | ||
95 | 90 | | |||
96 | active: false | 91 | active: false | ||
97 | source: "Video.qml" | 92 | source: "Video.qml" | ||
98 | visible: false | 93 | visible: false | ||
99 | 94 | | |||
100 | function showHide() { | 95 | function showHide() { | ||
101 | if (!videoItem.active) { | 96 | if (!videoItem.active) { | ||
102 | videoItem.active = true; | 97 | videoItem.active = true; | ||
103 | videoItem.visible = true; | 98 | videoItem.visible = true; | ||
104 | } else { | 99 | } else { | ||
105 | videoItem.active = false; | 100 | videoItem.active = false; | ||
106 | videoItem.visible = false; | 101 | videoItem.visible = false; | ||
107 | } | 102 | } | ||
108 | } | 103 | } | ||
109 | } | 104 | } | ||
110 | } | 105 | } | ||
111 | | ||||
112 | QtControls.Button { | | |||
113 | icon.name: "video" | | |||
114 | visible: model.VideoRole.toString() !== "" | | |||
115 | | ||||
116 | onClicked: videoItem.showHide() | | |||
117 | } | 106 | } | ||
118 | 107 | actions: [ | |||
119 | QtControls.Button { | 108 | Kirigami.Action { | ||
109 | visible: model.VideoRole.toString() !== "" | ||||
110 | icon.name: "videoclip-amarok" | ||||
111 | tooltip: i18nc("@info:tooltip", "Show/Hide Video") | ||||
112 | onTriggered: videoItem.showHide() | ||||
113 | }, | ||||
114 | Kirigami.Action { | ||||
115 | visible: model.ConfigurableRole | ||||
120 | enabled: model.StatusRole != Qt.Unchecked | 116 | enabled: model.StatusRole != Qt.Unchecked | ||
121 | icon.name: "configure" | 117 | icon.name: "configure" | ||
122 | visible: model.ConfigurableRole | 118 | tooltip: i18nc("@info:tooltip", "Configure...") | ||
123 | 119 | 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 | } | 120 | } | ||
121 | ] | ||||
140 | } | 122 | } |