kwin/kcmkwin/kwineffects/package/contents/ui/Effect.qml
David Redondo 52eba31ea2 [kcmkwin/kwineffects] Rework the Effects KCM
Summary:
Use the same list style as the Virtual Desktops KCM and Kirigami actions with tooltips.
Also removes the info button. The copyright info can now be accessed by clicking on the item.

BUG: 409693
BUG: 335197
BUG: 335198

Test Plan:
Together with D22827:
{F7138726}

Reviewers: #kwin, #vdg, filipf, GB_2, ngraham, davidedmundson

Reviewed By: #kwin, #vdg, filipf, GB_2, ngraham, davidedmundson

Subscribers: ngraham, GB_2, filipf, kwin

Tags: #kwin, #vdg

Maniphest Tasks: T10273

Differential Revision: https://phabricator.kde.org/D22830
2019-08-03 09:43:22 +02:00

122 lines
3.7 KiB
QML

/*
* Copyright (C) 2013 Antonis Tsiapaliokas <kok3rs@gmail.com>
* Copyright (C) 2019 Vlad Zagorodniy <vladzzag@gmail.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
import QtQuick 2.5
import QtQuick.Controls 2.5 as QQC2
import QtQuick.Layouts 1.1
import org.kde.kirigami 2.5 as Kirigami
Kirigami.SwipeListItem {
hoverEnabled: true
onClicked: {
view.currentIndex = index;
}
contentItem: RowLayout {
id: row
QQC2.RadioButton {
property bool _exclusive: model.ExclusiveRole != ""
property bool _toggled: false
checked: model.StatusRole
visible: _exclusive
QQC2.ButtonGroup.group: _exclusive ? effectsList.findButtonGroup(model.ExclusiveRole) : null
onToggled: {
model.StatusRole = checked ? Qt.Checked : Qt.Unchecked;
_toggled = true;
}
onClicked: {
// Uncheck the radio button if it's clicked.
if (checked && !_toggled) {
model.StatusRole = Qt.Unchecked;
}
_toggled = false;
}
}
QQC2.CheckBox {
checkState: model.StatusRole
visible: model.ExclusiveRole == ""
onToggled: model.StatusRole = checkState
}
ColumnLayout {
QQC2.Label {
Layout.fillWidth: true
font.weight: Font.Bold
text: model.NameRole
wrapMode: Text.Wrap
}
QQC2.Label {
Layout.fillWidth: true
text: model.DescriptionRole
wrapMode: Text.Wrap
}
QQC2.Label {
id: aboutItem
Layout.fillWidth: true
font.weight: Font.Bold
text: i18n("Author: %1\nLicense: %2", model.AuthorNameRole, model.LicenseRole)
visible: view.currentIndex === index
wrapMode: Text.Wrap
}
Loader {
id: videoItem
active: false
source: "Video.qml"
visible: false
function showHide() {
if (!videoItem.active) {
videoItem.active = true;
videoItem.visible = true;
} else {
videoItem.active = false;
videoItem.visible = false;
}
}
}
}
}
actions: [
Kirigami.Action {
visible: model.VideoRole.toString() !== ""
icon.name: "videoclip-amarok"
tooltip: i18nc("@info:tooltip", "Show/Hide Video")
onTriggered: videoItem.showHide()
},
Kirigami.Action {
visible: model.ConfigurableRole
enabled: model.StatusRole != Qt.Unchecked
icon.name: "configure"
tooltip: i18nc("@info:tooltip", "Configure...")
onTriggered: kcm.configure(model.ServiceNameRole, this)
}
]
}