1 /*******************************************************************************
3 This file is part of mDictionary.
5 mDictionary is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
10 mDictionary is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with mDictionary. If not, see <http://www.gnu.org/licenses/>.
18 Copyright 2010 Comarch S.A.
20 *******************************************************************************/
22 author: Marcin Kaźmierczak <marcin.kazmierczak@comarch.pl>
28 SystemPalette { id: myPalette; colorGroup: SystemPalette.Active }
30 function setEnableRemove(Boolean) { removeButton.enabled = Boolean }
31 function setEnableSettings(Boolean) { settingsButton.enabled = Boolean }
32 function changeDictionaryState(nr, state) {
33 dictList.currentIndex = nr
34 dictModel.setModelProperty(dictList.currentIndex, state, "isSelected")
35 rectangle1.setEnableRemove(true)
36 rectangle1.setEnableSettings(true)
43 signal addButtonClicked;
44 signal removeButtonClicked;
45 signal settingsButtonClicked;
46 signal saveButtonClicked;
47 signal itemActivated(int nr);
55 width: rectangle1.width
56 // height: rectangle1.height
57 anchors.top: parent.top
58 anchors.bottom: buttonsBox.top
59 anchors.bottomMargin: buttonsBox.height + buttonsBox.anchors.topMargin
60 highlightResizeSpeed: 1000
63 if ((event.key == Qt.Key_Return || event.key == Qt.Key_Enter) && currentIndex >= 0){
64 itemActivated(currentIndex)
66 if ((event.key == Qt.Key_Delete) && currentIndex >= 0){
69 if (event.key == Qt.Key_S && event.modifiers == Qt.ControlModifier){
72 if (event.key == Qt.Key_T && event.modifiers == Qt.ControlModifier){
75 if ((event.key == Qt.Key_Space) && currentIndex >= 0){
76 dictModel.setModelProperty(dictList.currentIndex, "isSelected")
80 onCurrentIndexChanged: {
81 dictModel.itemSelected(dictList.currentIndex)
87 width: rectangle1.width
89 if (nameText.height + 4 > logo.height)
90 return nameText.height + 4;
97 dictList.currentIndex = number
98 rectangle1.setEnableRemove(true)
99 rectangle1.setEnableSettings(true)
102 rectangle1.itemActivated(dictList.currentIndex)
109 width: nameText.height
111 onChanged: rectangle1.changeDictionaryState(number, selected)
119 var aspectRatio = sourceSize.height / sourceSize.width
120 return logo.width * aspectRatio
122 anchors.leftMargin: 5
123 anchors.verticalCenter: parent.verticalCenter
124 width: nameText.height + 4
130 anchors.leftMargin: 5
131 anchors.verticalCenter: parent.verticalCenter
146 anchors.bottom: parent.bottom
147 anchors.top: dictList.bottom
152 width: (parent.width - 4) / 4
153 height: buttonsBox.height
154 anchors.left: buttonsBox.left
155 anchors.leftMargin: 4
156 anchors.verticalCenter: parent.verticalCenter
157 textInButton: qsTr("Add")
158 onClicked: addButtonClicked();
163 width: (parent.width - 4) / 4
164 height: buttonsBox.height
165 anchors.left: addButton.right
166 anchors.leftMargin: 4
167 anchors.verticalCenter: parent.verticalCenter
168 textInButton: qsTr("Remove")
170 onClicked: removeButtonClicked();
175 width: (parent.width - 4) / 4
176 height: buttonsBox.height
177 anchors.left: removeButton.right
178 anchors.leftMargin: 4
179 anchors.verticalCenter: parent.verticalCenter
180 textInButton: qsTr("Settings")
182 onClicked: settingsButtonClicked();
187 width: (parent.width - 4) / 4
188 height: buttonsBox.height
189 anchors.left: settingsButton.right
190 anchors.leftMargin: 4
191 anchors.right: buttonsBox.right
192 anchors.rightMargin: 4
193 anchors.verticalCenter: parent.verticalCenter
194 textInButton: qsTr("Save")
195 onClicked: saveButtonClicked()