Changeset View
Changeset View
Standalone View
Standalone View
kcmkwin/kwindecoration/qml/Previews.qml
Show All 22 Lines | |||||
23 | import org.kde.kwin.private.kdecoration 1.0 as KDecoration | 23 | import org.kde.kwin.private.kdecoration 1.0 as KDecoration | ||
24 | 24 | | |||
25 | ScrollView { | 25 | ScrollView { | ||
26 | objectName: "themeList" | 26 | objectName: "themeList" | ||
27 | frameVisible: true | 27 | frameVisible: true | ||
28 | GridView { | 28 | GridView { | ||
29 | id: gridView | 29 | id: gridView | ||
30 | objectName: "listView" | 30 | objectName: "listView" | ||
31 | signal userChangedSelection() | ||||
31 | model: decorationsModel | 32 | model: decorationsModel | ||
32 | cellWidth: 20 * units.gridUnit | 33 | cellWidth: 20 * units.gridUnit | ||
33 | cellHeight: cellWidth / 1.6 | 34 | cellHeight: cellWidth / 1.6 | ||
35 | highlightFollowsCurrentItem: true | ||||
34 | onContentHeightChanged: { | 36 | onContentHeightChanged: { | ||
35 | if (gridView.currentIndex == -1) { | 37 | if (gridView.currentIndex == -1 && initialThemeIndex != -1) { | ||
36 | gridView.currentIndex = savedIndex; | 38 | gridView.currentIndex = initialThemeIndex | ||
37 | } | 39 | } | ||
38 | gridView.positionViewAtIndex(gridView.currentIndex, GridView.Visible); | 40 | gridView.positionViewAtIndex(gridView.currentIndex, GridView.Visible) | ||
39 | } | 41 | } | ||
40 | | ||||
41 | Rectangle { | 42 | Rectangle { | ||
42 | z: -1 | 43 | z: -1 | ||
43 | anchors.fill: parent | 44 | anchors.fill: parent | ||
44 | color: baseColor | 45 | color: baseColor | ||
45 | } | 46 | } | ||
46 | highlight: Rectangle { | 47 | highlight: Rectangle { | ||
47 | color: highlightColor | 48 | color: highlightColor | ||
48 | opacity: 0.6 | 49 | opacity: 0.6 | ||
Show All 9 Lines | 57 | KDecoration.Bridge { | |||
58 | plugin: model["plugin"] | 59 | plugin: model["plugin"] | ||
59 | theme: model["theme"] | 60 | theme: model["theme"] | ||
60 | } | 61 | } | ||
61 | KDecoration.Settings { | 62 | KDecoration.Settings { | ||
62 | id: settingsItem | 63 | id: settingsItem | ||
63 | bridge: bridgeItem.bridge | 64 | bridge: bridgeItem.bridge | ||
64 | borderSizesIndex: gridView.borderSizesIndex | 65 | borderSizesIndex: gridView.borderSizesIndex | ||
65 | } | 66 | } | ||
67 | Component.onCompleted: { | ||||
68 | if (gridView.currentIndex == -1 && initialThemeIndex != -1) { | ||||
69 | gridView.currentIndex = initialThemeIndex | ||||
70 | } | ||||
71 | } | ||||
66 | MouseArea { | 72 | MouseArea { | ||
67 | hoverEnabled: false | 73 | hoverEnabled: false | ||
68 | anchors.fill: parent | 74 | anchors.fill: parent | ||
69 | onClicked: { | 75 | onClicked: { | ||
70 | gridView.currentIndex = index; | 76 | gridView.currentIndex = index | ||
77 | gridView.userChangedSelection() | ||||
71 | } | 78 | } | ||
72 | } | 79 | } | ||
73 | ColumnLayout { | 80 | ColumnLayout { | ||
74 | id: decorationPreviews | 81 | id: decorationPreviews | ||
75 | property string themeName: model["display"] | 82 | property string themeName: model["display"] | ||
76 | anchors.fill: parent | 83 | anchors.fill: parent | ||
77 | Item { | 84 | Item { | ||
78 | KDecoration.Decoration { | 85 | KDecoration.Decoration { | ||
Show All 23 Lines | 104 | Component.onCompleted: { | |||
102 | anchors.topMargin = Qt.binding(function() { return 40 - (activePreview.shadow ? activePreview.shadow.paddingTop : 0);}); | 109 | anchors.topMargin = Qt.binding(function() { return 40 - (activePreview.shadow ? activePreview.shadow.paddingTop : 0);}); | ||
103 | anchors.bottomMargin = Qt.binding(function() { return 10 - (activePreview.shadow ? activePreview.shadow.paddingBottom : 0);}); | 110 | anchors.bottomMargin = Qt.binding(function() { return 10 - (activePreview.shadow ? activePreview.shadow.paddingBottom : 0);}); | ||
104 | } | 111 | } | ||
105 | } | 112 | } | ||
106 | MouseArea { | 113 | MouseArea { | ||
107 | hoverEnabled: false | 114 | hoverEnabled: false | ||
108 | anchors.fill: parent | 115 | anchors.fill: parent | ||
109 | onClicked: { | 116 | onClicked: { | ||
110 | gridView.currentIndex = index; | 117 | gridView.currentIndex = index | ||
118 | gridView.userChangedSelection() | ||||
111 | } | 119 | } | ||
112 | } | 120 | } | ||
113 | Layout.fillWidth: true | 121 | Layout.fillWidth: true | ||
114 | Layout.fillHeight: true | 122 | Layout.fillHeight: true | ||
115 | /* Create an invisible rectangle that's the same size as the inner content rect | 123 | /* Create an invisible rectangle that's the same size as the inner content rect | ||
116 | of the foreground window preview so that we can center the button within it. | 124 | of the foreground window preview so that we can center the button within it. | ||
117 | We have to center rather than using anchors because the button width varies | 125 | We have to center rather than using anchors because the button width varies | ||
118 | with different localizations */ | 126 | with different localizations */ | ||
Show All 14 Lines | 140 | anchors { | |||
133 | horizontalCenter: parent.horizontalCenter | 141 | horizontalCenter: parent.horizontalCenter | ||
134 | verticalCenter: parent.verticalCenter | 142 | verticalCenter: parent.verticalCenter | ||
135 | } | 143 | } | ||
136 | enabled: model["configureable"] | 144 | enabled: model["configureable"] | ||
137 | iconName: "configure" | 145 | iconName: "configure" | ||
138 | text: i18n("Configure %1...", decorationPreviews.themeName) | 146 | text: i18n("Configure %1...", decorationPreviews.themeName) | ||
139 | onClicked: { | 147 | onClicked: { | ||
140 | gridView.currentIndex = index | 148 | gridView.currentIndex = index | ||
149 | gridView.userChangedSelection() | ||||
141 | bridgeItem.bridge.configure() | 150 | bridgeItem.bridge.configure() | ||
142 | } | 151 | } | ||
143 | } | 152 | } | ||
144 | } | 153 | } | ||
145 | } | 154 | } | ||
146 | } | 155 | } | ||
147 | } | 156 | } | ||
148 | } | 157 | } | ||
149 | Layout.preferredHeight: 20 * units.gridUnit | 158 | Layout.preferredHeight: 20 * units.gridUnit | ||
150 | } | 159 | } | ||
151 | 160 | |