~nick-dedekind/ubuntu-ui-toolkit/prevent-slider-mouse-stealing

« back to all changes in this revision

Viewing changes to tests/resources/ubuntushape/UbuntuShapeOverlayTest.qml

staging sync

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
    focus: true
25
25
 
26
26
    // Enum to string tables.
 
27
    property variant aspectTable: [
 
28
        "Flat", "Inset"
 
29
    ]
27
30
    property variant backgroundModeTable: [
28
31
        "SolidColor", "VerticalGradient"
29
32
    ]
58
61
        "Zoom            (scroll):   x " + root.scaleFactor.toFixed(1) + "\n\n" +
59
62
        "Background colors  (a/z):   " + shape.backgroundColor + ", " + shape.secondaryBackgroundColor + "\n" +
60
63
        "Background mode      (e):   " + root.backgroundModeTable[shape.backgroundMode] + "\n\n" +
61
 
        "Overlay color        (r):   " + shape.overlayColor + "\n" +
62
 
        "Overlay geometry (t/y/u/i): " + shape.overlayRect.x.toFixed(2) + ", " + shape.overlayRect.y.toFixed(2) + ", " + shape.overlayRect.width.toFixed(2) + ", " + shape.overlayRect.height.toFixed(2) + "\n\n" +
 
64
        "Radius               (r):   " + "\"" + shape.radius + "\"\n" +
 
65
        "Aspect               (t):   " + root.aspectTable[shape.aspect] + "\n\n" +
63
66
        "Source               (o):   " + shape.source + "\n" +
64
67
        "Source opacity       (p):   " + shape.sourceOpacity.toFixed(2) + "\n" +
65
68
        "Source fill          (q):   " + root.sourceFillModeTable[shape.sourceFillMode] + "\n" +
73
76
        "Image fill           (w):   " + root.imageFillModeTable[img1.fillMode] + "\n" +
74
77
        "Image halign         (x):   " + img1.horizontalAlignment + "\n" +
75
78
        "Image valign         (c):   " + img1.verticalAlignment + "\n\n" +
76
 
        "Radius               (v):   " + "\"" + shape.radius + "\"\n" +
77
 
        "Border               (b):   " + "\"" + shape.borderSource + "\"\n\n" +
78
 
        "Colors (deprecated) (n/,):  " + shape.color + ", " + shape.gradientColor
 
79
        "Border (deprecated)  (b):   " + "\"" + shape.borderSource + "\"\n\n" +
 
80
        "Colors (deprecated) (n/,):  " + shape.color + ", " + shape.gradientColor +  "\n\n" +
 
81
        "Overlay color       (F1):   " + shape.overlayColor + "\n" +
 
82
        "Overlay rect (F2/F3/F4/F5): " + shape.overlayRect.x.toFixed(2) + ", " + shape.overlayRect.y.toFixed(2) + ", " + shape.overlayRect.width.toFixed(2) + ", " + shape.overlayRect.height.toFixed(2)
79
83
 
80
84
    // Main scene.
81
85
    Item {
203
207
    // Keyboard handling.
204
208
    Keys.onPressed: {
205
209
        var shift = Qt.ShiftModifier;
 
210
        var alt = Qt.AltModifier;
206
211
 
207
212
        // Background.
208
213
        if (event.key == Qt.Key_A) {
214
219
        } else if (event.key == Qt.Key_E) {
215
220
            shape.backgroundMode = (shape.backgroundMode + 1) % 3;
216
221
 
217
 
        // Overlay.
 
222
        // Styling.
218
223
        } else if (event.key == Qt.Key_R) {
219
 
            shape.overlayColor = Qt.rgba(
220
 
                Math.random(), Math.random(), Math.random(), Math.random());
 
224
            shape.radius = (shape.radius == "medium") ? "small" : "medium";
221
225
        } else if (event.key == Qt.Key_T) {
222
 
            var x = Math.max(0.0, Math.min(1.0,
223
 
            shape.overlayRect.x + ((event.modifiers & shift) ? 0.005 : -0.005)));
224
 
            shape.overlayRect = Qt.rect(
225
 
                x, shape.overlayRect.y, shape.overlayRect.width,
226
 
                shape.overlayRect.height);
227
 
        } else if (event.key == Qt.Key_Y) {
228
 
            var y = Math.max(0.0, Math.min(1.0,
229
 
            shape.overlayRect.y + ((event.modifiers & shift) ? 0.005 : -0.005)));
230
 
            shape.overlayRect = Qt.rect(
231
 
                shape.overlayRect.x, y, shape.overlayRect.width,
232
 
                shape.overlayRect.height);
233
 
        } else if (event.key == Qt.Key_U) {
234
 
            var width = Math.max(0.0, Math.min(1.0,
235
 
            shape.overlayRect.width + ((event.modifiers & shift) ? 0.005 : -0.005)));
236
 
            shape.overlayRect = Qt.rect(
237
 
                shape.overlayRect.x, shape.overlayRect.y, width,
238
 
                shape.overlayRect.height);
239
 
        } else if (event.key == Qt.Key_I) {
240
 
            var height = Math.max(0.0, Math.min(1.0,
241
 
            shape.overlayRect.height + ((event.modifiers & shift) ? 0.005 : -0.005)));
242
 
            shape.overlayRect = Qt.rect(
243
 
                shape.overlayRect.x, shape.overlayRect.y, shape.overlayRect.width,
244
 
                height);
 
226
            shape.aspect = (shape.aspect + 1) % 2;
245
227
 
246
228
        // Source.
247
229
        } else if (event.key == Qt.Key_O) {
280
262
                shape.sourceScale.x,
281
263
                shape.sourceScale.y + ((event.modifiers & shift) ? 0.02 : -0.02));
282
264
 
283
 
        // Image.
 
265
        // Deprecated image.
284
266
        } else if (event.key == Qt.Key_M) {
285
267
            if (shape.image == null) {
286
268
                shape.image = img1;
306
288
                img1.verticalAlignment = Image.AlignTop;
307
289
            }
308
290
 
309
 
        // Styling.
310
 
        } else if (event.key == Qt.Key_V) {
311
 
            shape.radius = (shape.radius == "medium") ? "small" : "medium";
 
291
        // Deprecated styling.
312
292
        } else if (event.key == Qt.Key_B) {
313
293
            if (shape.borderSource == "radius_idle.sci") {
314
294
                shape.borderSource = "radius_pressed.sci";
317
297
            } else {
318
298
                shape.borderSource = "radius_idle.sci";
319
299
            }
320
 
 
321
 
        // Colors.
322
300
        } else if (event.key == Qt.Key_N) {
323
301
            shape.color = Qt.rgba(
324
302
                Math.random(), Math.random(), Math.random(), Math.random());
325
303
        } else if (event.key == Qt.Key_Comma) {
326
304
            shape.gradientColor = Qt.rgba(
327
305
                Math.random(), Math.random(), Math.random(), Math.random());
 
306
 
 
307
        // Overlay.
 
308
        } else if (event.key == Qt.Key_F1) {
 
309
            shape.overlayColor = Qt.rgba(
 
310
                Math.random(), Math.random(), Math.random(), Math.random());
 
311
        } else if (event.key == Qt.Key_F2) {
 
312
            var x = Math.max(0.0, Math.min(1.0,
 
313
            shape.overlayRect.x + ((event.modifiers & shift) ? 0.005 : -0.005)));
 
314
            shape.overlayRect = Qt.rect(
 
315
                x, shape.overlayRect.y, shape.overlayRect.width,
 
316
                shape.overlayRect.height);
 
317
        } else if (event.key == Qt.Key_F3) {
 
318
            var y = Math.max(0.0, Math.min(1.0,
 
319
            shape.overlayRect.y + ((event.modifiers & shift) ? 0.005 : -0.005)));
 
320
            shape.overlayRect = Qt.rect(
 
321
                shape.overlayRect.x, y, shape.overlayRect.width,
 
322
                shape.overlayRect.height);
 
323
        } else if (event.key == Qt.Key_F4) {
 
324
            var width = Math.max(0.0, Math.min(1.0,
 
325
            shape.overlayRect.width + ((event.modifiers & shift) ? 0.005 : -0.005)));
 
326
            shape.overlayRect = Qt.rect(
 
327
                shape.overlayRect.x, shape.overlayRect.y, width,
 
328
                shape.overlayRect.height);
 
329
        } else if (event.key == Qt.Key_F5) {
 
330
            var height = Math.max(0.0, Math.min(1.0,
 
331
            shape.overlayRect.height + ((event.modifiers & shift) ? 0.005 : -0.005)));
 
332
            shape.overlayRect = Qt.rect(
 
333
                shape.overlayRect.x, shape.overlayRect.y, shape.overlayRect.width,
 
334
                height);
328
335
        }
329
336
    }
330
337
}