123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159 |
- import QtQuick 1.1
- import DictWebLib 1.0
- import com.nokia.meego 1.0
- Page {
- id: downloadPage
- property string loadUrl
- onStatusChanged: {
- if(status == PageStatus.Active) {
- return_img.visible = true
- moveButtons.visible = true
- }
- }
-
- function movePage(direction) {
- downloadView.movePage(direction)
- dictDownload.returnToBounds()
- }
-
- Flickable {
- id: dictDownload
- anchors.top: parent.top
- anchors.left: parent.left
- anchors.right: parent.right
- height: parent.height - commonTools.height
- flickableDirection: Flickable.HorizontalAndVerticalFlick
- contentHeight: downloadView.height
- contentWidth: downloadView.width
-
- PinchArea {
- anchors.fill: parent
- onPinchUpdated: downloadView.zoomFactor = pinch.scale * downloadView.currentScale
- onPinchFinished: {
- downloadView.zoomFactor = pinch.scale * downloadView.currentScale
- downloadView.currentScale = downloadView.zoomFactor
- if(pinch.scale < 1.0) {
- downloadView.height *= pinch.scale
- downloadView.width *= pinch.scale
- dictDownload.returnToBounds()
- }
- }
- }
-
- DictWebView {
- id: downloadView
- property real preferredHeight
- property real preferredWidth
- property real currentScale: 1.0
- signal completedImport(string dicts)
- signal failedImport()
- url: downloadPage.loadUrl
-
- onContentSizeChanged: {
- height = contentHeight
- width = contentWidth
- }
-
- onImportCompleted: {
- if(dicts == "")
- failedImport()
- else
- completedImport(dicts)
- }
- width: parent.width
- height: parent.height
- preferredHeight: parent.height
- preferredWidth: parent.width
-
- onCompletedImport: {
- downloadProgress.visible = false
- dictCore.enableDictionaries(dicts)
- successReport.text = successReport.success
- successReport.opacity = 1
- }
-
- onFailedImport: {
- downloadProgress.visible = false
- successReport.text = successReport.failure
- successReport.opacity = 1
- }
-
- onDownloadProgress: {
- downloadProgress.maximumValue = total
- downloadProgress.value = current
- downloadProgress.visible = true
- }
-
- onLinkClicked: {
- busy.visible = true
- back_img.enabled = true
- forward_img.enabled = false
- }
-
- onLoadFinished: busy.visible = false
-
- onHideButton: {
- if(back)
- back_img.enabled = false
- else
- forward_img.enabled = false
- }
- }
- }
-
- ScrollDecorator {
- flickableItem: dictDownload
- }
-
- ProgressBar {
- id: downloadProgress
- width: parent.width / 2
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- minimumValue: 0
- visible: false
- }
-
- Text {
- id: successReport
- property string failure: "<b><font color=\"red\">"+qsTr("Dictionary import failed.")+"</font></b>"
- property string success: "<b><font color=\"green\">"+qsTr("Dictionary successfully imported.")+"</font></b>"
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- font.pixelSize: 25
- opacity: 0
- onOpacityChanged: PropertyAnimation { target: successReport; property: "opacity"; to: 0; duration: 2000 }
- }
-
- BusyIndicator {
- id: busy
- running: true
- visible: true
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.verticalCenter: parent.verticalCenter
- platformStyle: BusyIndicatorStyle {
- period: 800
- numberOfFrames: 5
- }
- }
- }
|