main.qml 4.08 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*
 * Copyright 2018 Furkan Tokac <furkantokac34@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, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */
import QtQuick 2.7
Nate Graham's avatar
Nate Graham committed
19
import QtQuick.Controls 2.4 as Controls
20
import QtQuick.Layouts 1.3
21
import org.kde.kirigami 2.4 as Kirigami
22
import org.kde.kcm 1.2 as KCM
23
24
25

import org.kde.plasma.core 2.0 as PlasmaCore

26
KCM.SimpleKCM {
27
28
    id: root

29
30
    KCM.ConfigModule.buttons: KCM.ConfigModule.Help | KCM.ConfigModule.Defaults | KCM.ConfigModule.Apply

31
32
    Kirigami.FormLayout {
        id: formLayout
33

34
        // Visual behavior settings
35
36
37
38
39
40
41
        Controls.CheckBox {
            id: showToolTips
            Kirigami.FormData.label: i18n("Visual behavior:")
            text: i18n("Display informational tooltips on mouse hover")
            checked: kcm.toolTip
            onCheckedChanged: kcm.toolTip = checked
        }
42

43
44
45
46
47
48
        Controls.CheckBox {
            id: showVisualFeedback
            text: i18n("Display visual feedback for status changes")
            checked: kcm.visualFeedback
            onCheckedChanged: kcm.visualFeedback = checked
        }
49

50
51
52
53
        Item {
            Kirigami.FormData.isSection: false
        }

54
55
56
        // We want to show the slider in a logarithmic way. ie
        // move from 4x, 3x, 2x, 1x, 0.5x, 0.25x, 0.125x
        // 0 is a special case
57
        ColumnLayout {
58
            Kirigami.FormData.label: i18n("Animation speed:")
59
            Kirigami.FormData.buddyFor: slider
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80

            Controls.Slider {
                id: slider
                Layout.fillWidth: true
                from: -4
                to: 4
                stepSize: 1
                snapMode: Controls.Slider.SnapAlways
                onMoved: {
                    if(value === to) {
                        kcm.animationDurationFactor = 0;
                    } else {
                        kcm.animationDurationFactor = 1.0 / Math.pow(2, value);
                    }
                }
                value: if (kcm.animationDurationFactor === 0) {
                    return slider.to;
                } else {
                    return -(Math.log(kcm.animationDurationFactor) / Math.log(2));
                }
            }
81
82
83
84
85
86
87
88
89
90
            RowLayout {
                Controls.Label {
                    text: i18nc("Animation speed", "Slow")
                }
                Item {
                    Layout.fillWidth: true
                }
                Controls.Label {
                    text: i18nc("Animation speed", "Instant")
                }
91
92
93
            }
        }

94
95
96
97
98
        Connections {
            target: kcm
            onToolTipChanged: showToolTips.checked = kcm.toolTip
            onVisualFeedbackChanged: showVisualFeedback.checked = kcm.visualFeedback
        }
99

100
        Item {
Nate Graham's avatar
Nate Graham committed
101
            Kirigami.FormData.isSection: false
102
        }
103

104
        // Click behavior settings
105

106
107
108
109
110
111
112
        Controls.RadioButton {
            id: singleClick
            Kirigami.FormData.label: i18n("Click behavior:")
            text: i18n("Single-click to open files and folders")
            checked: kcm.singleClick
            onCheckedChanged: kcm.singleClick = checked
        }
113

114
115
116
117
        Controls.RadioButton {
            id: doubleClick
            text: i18n("Double-click to open files and folders (single click to select)")
        }
118

119
120
121
122
123
        Connections {
            target: kcm
            onSingleClickChanged: {
                singleClick.checked = kcm.singleClick
                doubleClick.checked = !singleClick.checked
124
            }
125
126
127
        }
    }
}