X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fmdictionary%2Fqml%2FDictManagerWidget.qml;h=db75cdeefc1056b40cf71f6ae863371084920de7;hb=f2fd884da9b79619fc72fb2a691dd94ecbdcfbcd;hp=83cce2894dd4d489d81e0d7eaff5019d3fea8f2b;hpb=324ea22239273504192afe5aea525224d1ce343f;p=mdictionary diff --git a/src/mdictionary/qml/DictManagerWidget.qml b/src/mdictionary/qml/DictManagerWidget.qml index 83cce28..db75cde 100644 --- a/src/mdictionary/qml/DictManagerWidget.qml +++ b/src/mdictionary/qml/DictManagerWidget.qml @@ -26,7 +26,15 @@ import Qt 4.7 Rectangle { SystemPalette { id: myPalette; colorGroup: SystemPalette.Active } -// signal selectedRow(int nr) + + function setEnableRemove(Boolean) { removeButton.enabled = Boolean } + function setEnableSettings(Boolean) { settingsButton.enabled = Boolean } + + signal addButtonClicked; + signal removeButtonClicked; + signal settingsButtonClicked; + signal saveButtonClicked; + signal itemActivated(int nr); id: rectangle1 color: myPalette.base @@ -37,14 +45,16 @@ Rectangle { width: rectangle1.width // height: rectangle1.height anchors.top: parent.top + anchors.bottom: buttonsBox.top + anchors.bottomMargin: buttonsBox.height + buttonsBox.anchors.topMargin highlightResizeSpeed: 1000 delegate: Component{ id: dictListDelegate Item { width: rectangle1.width height: { - if (nameText.height + 10 > logo.height) - return nameText.height + 10; + if (nameText.height + 4 > logo.height) + return nameText.height + 4; else return logo.height; } @@ -52,23 +62,24 @@ Rectangle { anchors.fill: parent onClicked: { dictList.currentIndex = number + rectangle1.setEnableRemove(true) + rectangle1.setEnableSettings(true) } onDoubleClicked: { - selectedRow(number) + rectangle1.itemActivated(dictList.currentIndex) } } Row { - //image zaznacz/odznacz anchors.fill: parent Image { id: checkbox -// source: "qrc:/button/checkbox.png" height: { var aspectRatio = sourceSize.height / sourceSize.width - return logo.width * aspectRatio + return checkbox.width * aspectRatio } anchors.verticalCenter: parent.verticalCenter - width: nameText.height + 10 + width: nameText.height + smooth: true states: [ State { name: "checked"; @@ -83,6 +94,15 @@ Rectangle { PropertyChanges { target: checkbox; source: "qrc:/button/checkbox.png" } } ] + MouseArea{ + anchors.fill: parent + onClicked: { + dictList.currentIndex = number + dictModel.setModelProperty(dictList.currentIndex, !isSelected, "isSelected") + rectangle1.setEnableRemove(true) + rectangle1.setEnableSettings(true) + } + } } Image { @@ -92,8 +112,11 @@ Rectangle { var aspectRatio = sourceSize.height / sourceSize.width return logo.width * aspectRatio } + anchors.left: checkbox.right + anchors.leftMargin: 5 anchors.verticalCenter: parent.verticalCenter - width: nameText.height + 10 + width: nameText.height + 4 + smooth: true } Text { id: nameText @@ -109,6 +132,64 @@ Rectangle { model: dictModel } - //buttonki + //buttons + + Item { + id: buttonsBox + width: parent.width + height: 30 + anchors.bottom: parent.bottom + anchors.top: dictList.bottom + anchors.topMargin: 8 + + Button { + id: addButton + width: (parent.width - 4) / 4 + height: buttonsBox.height + anchors.left: buttonsBox.left + anchors.leftMargin: 4 + anchors.verticalCenter: parent.verticalCenter + textInButton: qsTr("Add") + onClicked: rectangle1.addButtonClicked + } + + Button { + id: removeButton + width: (parent.width - 4) / 4 + height: buttonsBox.height + anchors.left: addButton.right + anchors.leftMargin: 4 + anchors.verticalCenter: parent.verticalCenter + textInButton: qsTr("Remove") + enabled: false + onClicked: rectangle1.removeButtonClicked + } + + Button { + id: settingsButton + width: (parent.width - 4) / 4 + height: buttonsBox.height + anchors.left: removeButton.right + anchors.leftMargin: 4 + anchors.verticalCenter: parent.verticalCenter + textInButton: qsTr("Settings") + enabled: false + onClicked: rectangle1.settingsButtonClicked + } + + Button { + id: saveButton + width: (parent.width - 4) / 4 + height: buttonsBox.height + anchors.left: settingsButton.right + anchors.leftMargin: 4 + anchors.right: buttonsBox.right + anchors.rightMargin: 4 + anchors.verticalCenter: parent.verticalCenter + textInButton: qsTr("Save") + onClicked: rectangle1.saveButtonClicked + } + + } }