ElisaConfigurationDialog.qml 3.52 KB
Newer Older
1 2 3
/*
 * Copyright 2017 Matthieu Gallien <matthieu_gallien@yahoo.fr>
 *
4 5
 * This program is free software: you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
6 7 8
 * License as published by the Free Software Foundation; either
 * version 3 of the License, or (at your option) any later version.
 *
9
 * This program is distributed in the hope that it will be useful,
10 11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12
 * Lesser General Public License for more details.
13
 *
14 15
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
16 17
 */

18 19
import QtQuick 2.11
import QtQuick.Controls 2.4
20 21
import QtQuick.Layouts 1.12
import QtQuick.Window 2.12
22
import QtQml.Models 2.3
23
import org.kde.kirigami 2.5 as Kirigami
24

25
Window {
26
    id: dialog
27 28

    title: i18n("Configure")
29

30 31
    visible: true
    modality: Qt.ApplicationModal
32 33 34

    minimumWidth: 600
    minimumHeight: 400
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52

    SystemPalette {
        id: myPalette
        colorGroup: SystemPalette.Active
    }

    Component {
        id: highlightBar

        Rectangle {
            width: 200; height: 50
            color: myPalette.highlight
        }
    }

    RowLayout {
        spacing: 0

53 54 55
        anchors.fill: parent
        anchors.margins: 0

Alexander Stippich's avatar
Alexander Stippich committed
56
        ListView {
57
            id: pagesList
58 59

            Layout.fillHeight: true
60 61
            Layout.preferredWidth: 150

Alexander Stippich's avatar
Alexander Stippich committed
62
            boundsBehavior: Flickable.StopAtBounds
63

64 65 66 67 68
            delegate: ItemDelegate {
                text: model.pageName
                icon.name: model.iconName

                width: pagesList.width
69

70 71 72 73 74
                onClicked: pagesList.currentIndex = index
            }

            model: ListModel {
                id: settingsPagesModel
Alexander Stippich's avatar
Alexander Stippich committed
75
            }
76

Alexander Stippich's avatar
Alexander Stippich committed
77 78
            ScrollBar.vertical: ScrollBar {
                id: scrollBar
79
            }
Alexander Stippich's avatar
Alexander Stippich committed
80 81

            highlight: highlightBar
82 83
        }

84
        Kirigami.Separator {
85
            Layout.fillHeight: true
86
        }
87

88 89 90
        Rectangle {
            Layout.fillHeight: true
            Layout.fillWidth: true
91

92
            color: myPalette.window
93

94 95
            ColumnLayout {
                spacing: 0
96

97
                anchors.fill: parent
98

99 100 101
                StackLayout {
                    Layout.fillWidth: true
                    Layout.fillHeight: true
102

103 104 105 106 107 108 109 110 111 112 113
                    Layout.leftMargin: 10
                    Layout.rightMargin: 10
                    Layout.topMargin: 10
                    Layout.bottomMargin: 10

                    currentIndex: pagesList.currentIndex

                    Item {
                    }

                    FileScanningConfiguration {
114 115 116
                    }
                }

117 118 119 120 121 122 123 124 125 126 127 128 129 130
                DialogButtonBox {
                    Layout.fillWidth: true

                    standardButtons: DialogButtonBox.Ok | DialogButtonBox.Apply | DialogButtonBox.Cancel

                    onAccepted: {
                        config.save()
                        close()
                    }

                    onApplied: config.save()

                    onRejected: close()
                }
131 132 133
            }
        }
    }
134

135 136 137
    Component.onCompleted: {
        settingsPagesModel.insert(0, { "pageName": i18nc("Settings page about main preference", "General"), "iconName": 'settings-configure' })
        settingsPagesModel.insert(1, { "pageName": i18nc("Settings page about music search folders configuration", "Music Search Folders"), "iconName": 'folder-music' })
138
    }
139
}