Warning, /multimedia/amarok/src/context/applets/lyrics/package/contents/ui/ConfigDialog.qml is written in an unsupported language. File is not indexed.

0001 /****************************************************************************************
0002  * Copyright (c) 2017 Malte Veerman <malte.veerman@gmail.com>                           *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 import QtQuick 2.4
0018 import QtQuick.Controls 2.1
0019 import QtQuick.Dialogs 1.2 as Dialogs
0020 import QtQuick.Layouts 1.3
0021 import org.kde.amarok.lyrics 1.0
0022 
0023 
0024 Dialogs.Dialog {
0025     id: dialog
0026 
0027     function accept() {
0028         LyricsEngine.fontSize = sizeBox.value;
0029         LyricsEngine.font = fontCombo.currentText;
0030         switch (alignmentCombo.currentIndex) {
0031             case 0:
0032                 LyricsEngine.alignment = TextEdit.AlignLeft;
0033                 break;
0034             case 1:
0035                 LyricsEngine.alignment = TextEdit.AlignRight;
0036                 break;
0037             case 2:
0038                 LyricsEngine.alignment = TextEdit.AlignHCenter;
0039                 break;
0040         }
0041     }
0042 
0043     onAccepted: accept()
0044     onApply: accept()
0045 
0046     title: i18n("Lyrics config")
0047     standardButtons: Dialogs.StandardButton.Ok | Dialogs.StandardButton.Apply | Dialogs.StandardButton.Cancel
0048 
0049     Column {
0050         width: 800
0051 
0052         RowLayout {
0053             width: parent.width
0054 
0055             Label {
0056                 Layout.alignment: Qt.AlignLeft
0057                 text: i18n("Font size:")
0058             }
0059             SpinBox {
0060                 id: sizeBox
0061 
0062                 Layout.alignment: Qt.AlignRight
0063                 Layout.fillWidth: true
0064                 value: LyricsEngine.fontSize
0065                 editable: true
0066             }
0067         }
0068         RowLayout {
0069             width: parent.width
0070 
0071             Label {
0072                 Layout.alignment: Qt.AlignLeft
0073                 text: i18n("Text alignment:")
0074             }
0075             ComboBox {
0076                 id: alignmentCombo
0077 
0078                 Layout.alignment: Qt.AlignRight
0079                 Layout.fillWidth: true
0080                 model: [i18n("Align left"), i18n("Align right"), i18n("Align center")]
0081                 currentIndex: {
0082                     switch (LyricsEngine.alignment) {
0083                         case TextEdit.AlignLeft:
0084                             return 0;
0085                         case TextEdit.AlignRight:
0086                             return 1;
0087                         case TextEdit.AlignHCenter:
0088                             return 2;
0089                     }
0090                     return 0;
0091                 }
0092             }
0093         }
0094         RowLayout {
0095             width: parent.width
0096 
0097             Label {
0098                 Layout.alignment: Qt.AlignLeft
0099                 text: i18n("Font:")
0100             }
0101             ComboBox {
0102                 id: fontCombo
0103 
0104                 Layout.alignment: Qt.AlignRight
0105                 Layout.fillWidth: true
0106                 model: LyricsEngine.availableFonts()
0107                 currentIndex: LyricsEngine.availableFonts().indexOf(LyricsEngine.font)
0108             }
0109         }
0110     }
0111 }