Changeset View
Changeset View
Standalone View
Standalone View
applets/mediaframe/package/contents/ui/ConfigGeneral.qml
Show First 20 Lines • Show All 79 Lines • ▼ Show 20 Line(s) | 78 | RowLayout { | |||
---|---|---|---|---|---|
80 | 80 | | |||
81 | Label { | 81 | Label { | ||
82 | text: i18n("Fill mode") | 82 | text: i18n("Fill mode") | ||
83 | } | 83 | } | ||
84 | 84 | | |||
85 | ComboBox { | 85 | ComboBox { | ||
86 | id: comboBox | 86 | id: comboBox | ||
87 | currentIndex: fillModeToIndex(fillMode) | 87 | currentIndex: fillModeToIndex(fillMode) | ||
88 | model: ListModel { | 88 | model: | ||
89 | id: comboBoxItems | 89 | [ | ||
90 | ListElement { text: "Stretch"; value: Image.Stretch; description: "The image is scaled to fit" } | 90 | { | ||
91 | ListElement { text: "Preserve aspect fit"; value: Image.PreserveAspectFit; description: "The image is scaled uniformly to fit without cropping" } | 91 | "text": i18n("Stretch"), | ||
92 | ListElement { text: "Preserve aspect crop"; value: Image.PreserveAspectCrop; description: "The image is scaled uniformly to fill, cropping if necessary" } | 92 | "value": Image.Stretch, | ||
93 | ListElement { text: "Tile"; value: Image.Tile; description: "The image is duplicated horizontally and vertically" } | 93 | "description": i18n("The image is scaled to fit") | ||
94 | ListElement { text: "Tile vertically"; value: Image.TileVertically; description: "The image is stretched horizontally and tiled vertically" } | 94 | }, | ||
95 | ListElement { text: "Tile horizontally"; value: Image.TileHorizontally; description: "The image is stretched vertically and tiled horizontally" } | 95 | { | ||
96 | ListElement { text: "Pad"; value: Image.Pad; description: "The image is not transformed" } | 96 | "text": i18n("Preserve aspect fit"), | ||
97 | "value": Image.PreserveAspectFit, | ||||
98 | "description": i18n("The image is scaled uniformly to fit without cropping") | ||||
99 | }, | ||||
100 | { | ||||
101 | "text": i18n("Preserve aspect crop"), | ||||
102 | "value": Image.PreserveAspectCrop, | ||||
103 | "description": i18n("The image is scaled uniformly to fill, cropping if necessary") | ||||
104 | }, | ||||
105 | { | ||||
106 | "text": i18n("Tile"), | ||||
107 | "value": Image.Tile, | ||||
108 | "description": i18n("The image is duplicated horizontally and vertically") | ||||
109 | }, | ||||
110 | { | ||||
111 | "text": i18n("Tile vertically"), | ||||
112 | "value": Image.TileVertically, | ||||
113 | "description": i18n("The image is stretched horizontally and tiled vertically") | ||||
114 | }, | ||||
115 | { | ||||
116 | "text": i18n("Tile horizontally"), | ||||
117 | "value": Image.TileHorizontally, | ||||
118 | "description": i18n("The image is stretched vertically and tiled horizontally") | ||||
119 | }, | ||||
120 | { | ||||
121 | "text": i18n("Pad"), | ||||
122 | "value": Image.Pad, | ||||
123 | "description": i18n("The image is not transformed") | ||||
97 | } | 124 | } | ||
125 | ] | ||||
98 | 126 | | |||
99 | onActivated: root.fillMode = comboBoxItems.get(index).value | 127 | onActivated: root.fillMode = comboBoxItems.get(index).value | ||
100 | 128 | | |||
101 | onCurrentIndexChanged: fillModeDescription.text = comboBoxItems.get(currentIndex).description | 129 | onCurrentIndexChanged: fillModeDescription.text = comboBoxItems.get(currentIndex).description | ||
102 | 130 | | |||
103 | Component.onCompleted: { | | |||
104 | // Stupid hack to avoid "ListElement: Cannot use script for property value" error | | |||
105 | for (var i=0; i < comboBoxItems.count; i++) { | | |||
106 | var text = comboBoxItems.get(i).text | | |||
107 | comboBoxItems.get(i).text = i18n(text) | | |||
108 | var description = comboBoxItems.get(i).description | | |||
109 | comboBoxItems.get(i).description = description | | |||
110 | } | | |||
111 | | ||||
112 | } | | |||
113 | | ||||
114 | function fillModeToIndex(fillMode) { | 131 | function fillModeToIndex(fillMode) { | ||
115 | if(fillMode == Image.Stretch) | 132 | if(fillMode == Image.Stretch) | ||
116 | return 0 | 133 | return 0 | ||
117 | else if(fillMode == Image.PreserveAspectFit) | 134 | else if(fillMode == Image.PreserveAspectFit) | ||
118 | return 1 | 135 | return 1 | ||
119 | else if(fillMode == Image.PreserveAspectCrop) | 136 | else if(fillMode == Image.PreserveAspectCrop) | ||
120 | return 2 | 137 | return 2 | ||
121 | else if(fillMode == Image.Tile) | 138 | else if(fillMode == Image.Tile) | ||
▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines |