1/* 2 SPDX-FileCopyrightText: 2013-2015 Andreas Cord-Landwehr <cordlandwehr@kde.org> 3 4 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 5*/ 6 7import QtQuick 2.1 8import QtQuick.Controls 1.4 9import QtQuick.Layouts 1.2 10import artikulate 1.0 11 12Item { 13 id: root 14 15 property Phrase phrase 16 17 width: typeController.width 18 height: typeController.height 19 20 Component.onCompleted: { 21 updateCheckedStates(); 22 } 23 24 onPhraseChanged: { 25 updateCheckedStates() 26 } 27 28 function updateCheckedStates() 29 { 30 if (root.phrase == null) { 31 return; 32 } 33 switch (root.phrase.type) { 34 case Phrase.Word: 35 buttonWord.checked = true; 36 break; 37 case Phrase.Expression: 38 buttonExpression.checked = true; 39 break; 40 case Phrase.Sentence: 41 buttonSentence.checked = true; 42 break; 43 case Phrase.Paragraph: 44 buttonParagraph.checked = true; 45 break; 46 } 47 } 48 49 GroupBox { 50 id: typeController 51 title: i18n("Difficulty:") 52 53 RowLayout { 54 ExclusiveGroup { id: editTypeGroup } 55 RadioButton { 56 id: buttonWord 57 text: i18n("Word") 58 onClicked: { 59 root.phrase.type = Phrase.Word 60 } 61 exclusiveGroup: editTypeGroup 62 } 63 RadioButton { 64 id: buttonExpression 65 text: i18n("Expression") 66 onClicked: { 67 root.phrase.type = Phrase.Expression 68 } 69 exclusiveGroup: editTypeGroup 70 } 71 RadioButton { 72 id: buttonSentence 73 text: i18n("Sentence") 74 onClicked: { 75 root.phrase.type = Phrase.Sentence 76 } 77 exclusiveGroup: editTypeGroup 78 } 79 RadioButton { 80 id: buttonParagraph 81 text: i18n("Paragraph") 82 onClicked: { 83 root.phrase.type = Phrase.Paragraph 84 } 85 exclusiveGroup: editTypeGroup 86 } 87 } 88 } 89} 90