summaryrefslogtreecommitdiffstats
path: root/qml/mw-ui.qml
blob: c7b285776e3b1a864b8fbd7d2fe3184b1b967a29 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
import QtQuick 2.0

import QtQml.Models 2.1
import QtQuick.Layouts 1.3
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4

Rectangle {
    id: box
    width: 800; height: 550
    property alias view: view
    Rectangle {
        id: banner
        color: "lightgray"
        width: parent.width;height: 120

        Image {
            anchors.fill: parent
            anchors.bottomMargin: 10
            anchors.topMargin: 10
            source: "img/mageia-2013-black-alpha.png"
            fillMode: Image.PreserveAspectFit
          }

    }

    Rectangle {
            id: slideshow
            property Item displayItem: null
            anchors {left: parent.left; top: buttonbox.bottom; bottom: parent.bottom; right: parent.right}
            color: "blue"
            width: parent.width

    ObjectModel {
        id: itemModel

        // Welcome page
        Rectangle {
            property var title: qsTr("Welcome")
            width: view.width; height: view.height
            color: "#FFFEF0"
            Label {
                text: qsTr("Welcome to Mageia, %1").arg(user)
                font.bold: true
                anchors.horizontalCenter: parent.horizontalCenter
            }

            Label {
                text: qsTr("We are going to guide you through a few important steps<BR />
and help you with the configuration of your newly installed system.
<BR />Now, click on <i>Media sources</i> to go to the first step.");
                textFormat: Text.RichText
                anchors.centerIn: parent
            }
        }
        // Configure source page
        Rectangle {
            property var title: qsTr("Media sources")
            width: view.width; height: view.height
            color: "#F0FFF7"
            Column {
                anchors.left: parent.left
                anchors.verticalCenter:  parent.verticalCenter
                anchors.leftMargin: 10
                Label { text: qsTr("Configure software repositories"); font.bold: true;  }
                Label { text: qsTr("Mageia official repositories contain:");   }
                GridLayout {
                    columns: 3
                    Rectangle {id: coreBg
                        color: "lightgreen"
                        width: 80;
                        height: 20
                        Layout.alignment: Qt.AlignTop
                        Layout.fillWidth: true
                        Label { text: qsTr("core");   }
                    }
                    Label {
                        text: qsTr("- the free-open-source packages");
                        wrapMode: Text.WordWrap
                        Layout.maximumWidth: slideshow.width * .6
                    }
                    Label {
                        text: ""

                    }

                    Rectangle {id: nonfreeBg
                        color: "red"
                        width: 80; height: 20
                        Layout.alignment: Qt.AlignTop
                        Layout.fillWidth: true
                        Label { text: qsTr("nonfree");

                            wrapMode: Text.WordWrap}
                        }
                    Label {
                        width: parent.width
                        text: qsTr("- closed-source programs, e.g. Nvidia proprietary drivers, non-free drivers for some Wi-Fi cards, etc");
                        Layout.maximumWidth: slideshow.width * .6
                        wrapMode: Text.WordWrap
                    }
                    Button {
                        Layout.maximumWidth: slideshow.width * .25
                        objectName: "launch"
                        onClicked: { launch.command("drakrpm-edit-media")}
                        style: ButtonStyle {
                            label: Label {
                                text: qsTr("Edit software repositories")+" *";
                                width: parent.width
                                wrapMode: Text.WordWrap
                            }
                        }
                    }
                    Rectangle {id: taintedBg
                        color: "red"
                        width: 80; height: 20
                        Layout.alignment: Qt.AlignTop
                        Layout.fillWidth: true
                        Label { text: qsTr("tainted");   }
                        }
                    Label {
                        text: qsTr("- these packages may infringe on patents or copyright laws in certain countries, eg audio and video codecs needed for certain multimedia files or commercial DVDs");
                        wrapMode: Text.WordWrap
                        Layout.maximumWidth: slideshow.width * .6
                    }
                    Label {
                        text: ""

                    }
                    Rectangle {
                        color: "white"
                        width: 80; height: 20
                        Layout.alignment: Qt.AlignTop
                        Layout.fillWidth: true
                        Label { text: qsTr("backports");   }
                        }
                    Label {
                        text: qsTr("- includes sofware published after a Mageia release, or another version of sofware already present and not replaced.");
                        wrapMode: Text.WordWrap
                        Layout.maximumWidth: slideshow.width * .6
                    }
                    Label {
                        text: "(*) Administrator password is needed"
                        Layout.maximumWidth: slideshow.width * .25
                        wrapMode: Text.WordWrap
                    }
                    Rectangle {id: noteBg
                        color: "yellow";
                        width: 70
                        height: 20
                        Layout.alignment: Qt.AlignTop
                        Layout.fillWidth: true
                        Label { text: qsTr("Note! ")
                        }
                      }
                    Label { text: qsTr("If you enabled the online repositories during installation, some media sources should be installed already. If you didn't, we will now configure these online repositories.
    If this computer will have access to the Internet, you can delete the <i>cdrom</i> entry from the list of repositories.")+"<BR />"+
                               qsTr("Now, please enable or disable the online repositories of your choice: click on the <i>Edit software repositories</i> button. Select the pair <i>release</i> with the <i>updates</i>. <i>Debug</i> and <i>Testing</i> are for special cases.")+"<BR />"+
                               qsTr("After you have checked and enabled the repositories you need, you can go to the next slide.");
                          wrapMode: Text.WordWrap
                          textFormat: Text.RichText
                          Layout.fillWidth: true
                          Layout.columnSpan: 2
                          Layout.maximumWidth: slideshow.width - 100
                    }
            }
        }
        }
        // Update page
        Rectangle {
            property var title: "Update"
            width: view.width; height: view.height
            color: "#F4F0FF"
            Column {
                anchors {left: parent.left; verticalCenter:  parent.verticalCenter; leftMargin: 10}
                Label { text: qsTr("Update"); font.bold: true;  }
                Label {
                    width: slideshow.width * .7
                    text: qsTr("
Mageia provides software which may be updated in order to fix bugs or security issues.
It is highly recommended that you update your system regularly. An Update icon will appear in your task bar when new updates are available. To run the updates, just click on this icon and give your user password or use the Software Manager (root password). This is a background process and you will be able to use your computer normally during the updates.");
                    wrapMode: Text.WordWrap
                }
            }
            Column {
                anchors.right: parent.right
                anchors.verticalCenter:  parent.verticalCenter
                Button {
                    objectName: "launch"
                    onClicked:{ launch.command("drakrpm-update")}
                    style: ButtonStyle {
                        label: Label {
                            text: qsTr("Check system update");
                            width: parent.width
                            wrapMode: Text.WordWrap
                        }
                    }
                }
                    Label {
                        text: qsTr("User password is needed")
                        wrapMode: Text.WordWrap
                    }

            }
        }
        // MCC Page
        Rectangle {
            property var title: "MCC"
            width: view.width; height: view.height
            color: "#F4F0FF"
            Column {
                   anchors.left: parent.left
                   anchors.verticalCenter:  parent.verticalCenter
                   anchors.leftMargin: 5
                   Label {
                       text: qsTr("Mageia Control Center (aka drakconf) is a set of tools to help you configure your system.")
                       width: view.width * 0.6
                       wrapMode: Text.WordWrap
                   }
                   Label {text: qsTr("Software Management"); width: view.width/2; wrapMode: Text.WordWrap}
                   Label {text: qsTr("Hardware"); width: view.width/2; wrapMode: Text.WordWrap}
                   Label {text: qsTr("Network and Internet"); width: view.width/2; wrapMode: Text.WordWrap}
                   Label {text: qsTr("System"); width: view.width/2; wrapMode: Text.WordWrap}
                   Label {text: qsTr("Network Sharing"); width: view.width/2; wrapMode: Text.WordWrap}
                   Label {text: qsTr("Local Disks"); width: view.width/2; wrapMode: Text.WordWrap}
                   Label {text: qsTr("Security"); width: view.width/2; wrapMode: Text.WordWrap}
                   Label {text: qsTr("Boot"); width: view.width/2; wrapMode: Text.WordWrap}
                   }
            Column {
                   anchors.right: parent.right
                   anchors.verticalCenter:  parent.verticalCenter
                   Button {
                       id: mcc
                       objectName: "launch"
                       onClicked: { launch.command("drakconf")}
                       style: ButtonStyle {
                           label: Label {
                               text: qsTr("Mageia Control Center");
                               wrapMode: Text.WordWrap
                           }
                       }
                   }
                   Button {
                       objectName: "link"
                       onClicked: { link.weblink("https://www.mageia.org/doc")}
                       style: ButtonStyle {
                           label: Label {
                               text: qsTr("MCC documentation");
                               wrapMode: Text.WordWrap
                           }
                       }
                   }
                   Label {
                       text: qsTr("Administrator password is needed")
                       wrapMode: Text.WordWrap
                       width: view.width * .3;
                   }
               }
        }
        // Install software page
        Rectangle {
            property var title: "Install software"
            width: view.width; height: view.height
            color: "#F4F0FF"
            Column {
                   anchors.left: parent.left
                   anchors.verticalCenter:  parent.verticalCenter
                   anchors.leftMargin: 10
                   Label {
                       text: qsTr("Install and remove software")
                       width: slideshow.width * .7
                       font.bold: true
                       wrapMode: Text.WordWrap
                   }
                   Label {
                       text: qsTr("With Mageia, you will find the software in the media repositories. Mageia users simply access these media via one of the Software Managers.");
                       width: slideshow.width * .7;
                       wrapMode: Text.WordWrap
                       textFormat: Text.RichText
                   }
                   Label {
                       text: qsTr("Next slide is a small selection of popular applications - any of which may be installed at this point.<BR/>");
                       width: slideshow.width * .7;
                       wrapMode: Text.WordWrap
                       textFormat: Text.RichText
                   }
                   Label {
                       text: qsTr("You can find a more detailed list here:");
                       width: slideshow.width * .7;
                       wrapMode: Text.WordWrap
                       textFormat: Text.RichText
                   }
                   Button {
                       id: listApplicationsWiki
                       objectName: "link"
                       onClicked: { link.weblink(qsTr("https://wiki.mageia.org/en/List_of_applications"))}
                       style: ButtonStyle {
                           label: Label {
                               text: qsTr("List of applications (wiki)");
                               width: slideshow.width * .3
                               wrapMode: Text.WordWrap
                           }
                       }
                   }
                   Label {
                       text: qsTr("We will tell you how you can get in touch with the community in the <i>More information</i> tab.");
                       width: slideshow.width * .7;
                       wrapMode: Text.WordWrap
                       textFormat: Text.RichText
                   }
            }
            Column {
                       anchors.right: parent.right
                       anchors.verticalCenter:  parent.verticalCenter
                       Button {
                           id: rpmdrake
                           style: ButtonStyle {
                               label: Label {
                                   text: qsTr("RPMdrake")+" *";
                                   width: slideshow.width * .3
                                   wrapMode: Text.WordWrap
                               }
                           }
                       }
                       Label {
                           text: qsTr("(*) Administrator password is needed")
                           width: slideshow.width * .3
                           wrapMode: Text.WordWrap
                           font.italic: true
                       }
                   }
        }
        // Applications page
        Rectangle {
            property var title: "Applications"
            width: view.width; height: view.height

            color: "#F4F0FF"
            Column {

                Rectangle {
                    // Bandeau avertissement
                    id: warning
                    width: view.width
                    height: 60
                    color: "yellow"
                    Label {anchors {verticalCenter: parent.verticalCenter;}
                        text: qsTr("Here is a small selection of popular applications - any of which may be installed at this point.")+"<BR />"+"Be sure you have enabled <i>online repositories</i>"
                        textFormat: Text.RichText
                    }
                }
               Row {
                   // Under the warning
                   Column {
                        // Software categories
                       id:categoriesColumn

                       Component { //The hightlight
                            id: catHighlight
                            Rectangle {
                                width: 200
                                height: 25
                                anchors.horizontalCenter: parent.horizontalCenter
                                color: "#8f9193"
                                y: categoriesList.currentItem.y;
                            }
                        }

                        ListView {
                            id:categoriesList
                            anchors {left: parent.left;margins: 5}
                            width: 200
                            //highlight: catHighlight
                            //highlightFollowsCurrentItem: false
                            focus: true
                            model: [{'name': qsTr("Featured"), 'group': "featured"},
                                {'name': qsTr("Games"),'group': "games"},
                                {'name':qsTr("Internet"),'group': "internet"},
                                {'name':qsTr("Video"),'group': "video"},
                                {'name':qsTr("Audio"),'group': "audio"},
                                {'name':qsTr("Office"),'group': "office"},
                                {'name':qsTr("Graphics"),'group': "graphics"},
                                {'name':qsTr("System"),'group': "system"},
                                {'name':qsTr("Programming"),'group': "programming"}]
                            height: 25 * 9
                            delegate: Rectangle{
                                    width: parent.width
                                    height: 25
                                    color:"white"
                                    Label {text: modelData.name ;}
                                    MouseArea {
                                        anchors.centerIn: parent
                                        width: parent.width
                                        height: 25
                                        onClicked: {
                                            appListDM.items.remove(0,appListDM.count );
                                            var rowCount = appList.count;
                                            for( var i = 0;i < rowCount;i++ )
                                            {
                                                var entry = appList.get(i);
                                                entry.installable = installable.installable(entry.name, entry.inst_repo)
                                                var pattern = new RegExp(modelData.group, "g");
                                                if(pattern.test(entry.group) ) {
                                                    appListDM.items.insert(entry, "group");
                                                }
                                            }
                                            appListDM.filterOnGroup = "items";}
                                    }
                                }
                            }

                    }
                    Rectangle {
                        // Software list
                        height: box.height - 222
                        x: 200

                        DelegateModel {
                            id: appListDM
                            model: AppList {id: appList}
                            groups: [
                                            DelegateModelGroup {
                                                includeByDefault: false
                                                name: "group"
                                            }
                                        ]
                            filterOnGroup: "group"
                            Component.onCompleted: {
                                    var rowCount = appList.count;
                                    items.remove(0,rowCount);
                                console.log("Init")
                                    var pattern = /featured/g;
                                    for( var i = 0;i < rowCount;i++ )
                                    {
                                        var entry = appList.get(i);
                                        entry.installable = installable.installable(entry.name, entry.inst_repo)
                                        if(pattern.test(entry.group) ) {
                                            items.insert(entry, "group");
                                        }
                                    }
                                }
                            delegate: Row {
                                Image {
                                    source: icon
                                    width: 32
                                    height: 32
                                }
                                //CheckBox{ enabled: installable
                                //}
                                Column{
                                    Label {
                                        text: title
                                        font.bold: true
                                        }
                                    Label {
                                        text: description
                                        width: view.width - (200 + 32 +30 + 100)
                                        wrapMode: Text.WordWrap
                                        }
                                    }

                                Column{
                                    Loader {
                                        Component {
                                            id: repotag
                                            Rectangle {
                                                color: "red"
                                                width: 70; height: 20
                                                Label {
                                                    anchors.centerIn: parent
                                                    text:  repo
                                                }
                                            }
                                        }
                                        Component { id: dumm; Label {text: " "}}
                                        sourceComponent: repo == "" ?  dumm : repotag
                                    }

                                    Loader {
                                        Component { id: button;
                                            Button {
                                                objectName: "launch"
                                                onClicked: {
                                                    launch.command(["gurpmi",name,])}
                                                style: ButtonStyle {
                                                    label: Label {
                                                        text: qsTr("Install");
                                                    }
                                                }
                                            }
                                        }
                                        Component { id: dummy; Label {text: " "}}
                                        sourceComponent: (installable === "True") ? button : dummy
                                    }
                                    }
                                }

                        }
                        Flickable {
                            height: 350
                            width: 500
                            ListView {
                                id: applicationsListView
                                anchors.fill: parent
                                model: appListDM
                                spacing: 5
                            }
                        }
                    }
                }
            }
        }
        // Configuration summary Page
        Rectangle {
            property var title: "Your configuration"
            width: view.width; height: view.height
            color: "#F4F0FF"
            ListView {
                id: confList
                anchors.fill: parent
                anchors.margins: 50
                model: ConfList
                delegate: Label {
                    text: name
                }
            }
        }
        // Links page
        Rectangle {
            property var title: "More information"
            width: view.width; height: view.height
            color: "#F4F0FF"
            Column {
                anchors.left: parent.left
                anchors.verticalCenter:  parent.verticalCenter
                anchors.leftMargin: 10
                Label { text: "More information"; font.bold: true;  }

                Grid {
                    columns: 3
                    spacing: 10
                    Label {
                        width: view.width * .3
                        text: qsTr("Documentation")
                        wrapMode: Text.WordWrap
                    }
                    Label {
                        width: view.width * .3
                        text: qsTr("Support")
                        wrapMode: Text.WordWrap
                    }
                    Label {
                        width: view.width * .3
                        text: qsTr("Community")
                        wrapMode: Text.WordWrap
                    }
                    Repeater{
                        model: [{'name': qsTr("Release notes"), 'url': qsTr("https://wiki.mageia.org/en/Mageia_7_Release_Notes")},
                                 {'name': qsTr("Forums"),'url': qsTr("https://forums.mageia.org/en/")},
                                 {'name': qsTr("Community Center"),'url': qsTr("https://www.mageia.org/community/")},
                                 {'name': qsTr("Errata"), 'url': qsTr("https://wiki.mageia.org/en/Mageia_7_Errata")},
                                 {'name': qsTr("Wiki"), 'url': qsTr("https://wiki.mageia.org/en/Documentation")},
                                 {'name': qsTr("Contribute"),'url': qsTr("https://www.mageia.org/contribute/")},
                                 {'name': qsTr("Newcomers Howto"),'url': qsTr("https://wiki.mageia.org/en/Newcomers_start_here")},
                                 {'name': qsTr("Chat Room"),'url': qsTr("irc://irc.freenode.net/#mageia")},
                                 {'name': qsTr("Donations"),'url': qsTr("https://www.mageia.org/donate/")},
                                 {'name': qsTr("Documentation"),'url': qsTr("https://wiki.mageia.org/en/Documentation")},
                                 {'name': qsTr("Bugs tracker"),'url': qsTr("https://bugs.mageia.org/")},
                                 {'name': qsTr("Join us!"),'url': qsTr("https://identity.mageia.org/")}]
                        delegate: Button {
                                width: view.width * .3
                                objectName: "link"
                                onClicked: { link.weblink(modelData.url)}
                                style: ButtonStyle {
                                    label: Label {text: modelData.name; width: parent.width; wrapMode: Text.WordWrap }
                                }
                            }
                        }
                    }
                }


                Component.onDestruction: if (printDestruction) print("destroyed 3")
            }
        }

        ListView {
            id: view
            z: 1
            anchors.rightMargin: 0
            anchors.leftMargin: 0
            anchors.topMargin: 0
            anchors { fill: parent; bottomMargin: 30 }
            model: itemModel
            preferredHighlightBegin: 0; preferredHighlightEnd: 0
            highlightRangeMode: ListView.StrictlyEnforceRange
            orientation: ListView.Horizontal
            snapMode: ListView.SnapOneItem; flickDeceleration: 2000
            highlightFollowsCurrentItem: true
            highlightMoveDuration: 800
            cacheBuffer: 200
        }
    }
    Rectangle {
        id: buttonbox
        width: banner.width; height: 42
        anchors { top: banner.bottom;  }
        color: "gray"

        Row {
            anchors.centerIn: parent
            spacing: 10

            Repeater {
                model: itemModel.count

                Rectangle {
                    width: banner.width/9; height: 35
                    radius: 3
                    color: view.currentIndex == index ? "blue" : "white"
                    Label{
                        text: itemModel.get(index).title
                        font.pointSize: 8
                        width: parent.width
                        color: view.currentIndex == index ? "white" : "black"
                        horizontalAlignment: Text.AlignHCenter
                        wrapMode : Text.WordWrap
                    }

                    MouseArea {
                        width: banner.width/8; height: 35
                        anchors.centerIn: parent
                        onClicked: view.currentIndex = index
                    }
                }
            }
        }
    }
}