/* * vdr-tv-client: TV frontend for watching tv streams from the vdr server. * * Copyright (c) 2011, Mika Laitio. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * Or, point your browser to http://www.gnu.org/copyleft/gpl.html * */ import Qt 4.7 import com.nokia.meego 1.0 import com.meego.vdrclient 1.0 Item { property string locTxt_CaptionServerSelection: qsTr("Enter VDR server address:") property string locTxt_BtnRestoreDefault: qsTr("Restore Default Address") property string locTxt_BtnConnect: qsTr("Watch VDR TV") property string defaultVDRServerAddress: "xvdr+tcp://192.168.2.1:37890" property TextInput textInput: editVDRServerSelectionAddress id: cmp VDRClient { id: adapter } // callback to QMLVDRClient c++ class function restoreDefaultVDRServerAddress() { editVDRServerSelectionAddress.color = "red"; editVDRServerSelectionAddress.text = defaultVDRServerAddress; } function connectVDRServer() { if (editVDRServerSelectionAddress.text.length > 5) { adapter.launch_viewer(editVDRServerSelectionAddress.text); } } Text { font.pointSize: 24 anchors {top: parent.top; left: parent.left; margins: 10} text: locTxt_CaptionServerSelection id: captionServerSelection } TextInput { id: editVDRServerSelectionAddress anchors {top: captionServerSelection.bottom; left: parent.left; right: parent.right; margins: 10} color: style.foregroundLight cursorVisible: true //activeFocusOnPress: true font {pixelSize: 36} text: defaultVDRServerAddress //focus: true onTextChanged: { if (text.length == 0) { cmp.restoreDefaultVDRServerAddress(); } if (text == defaultVDRServerAddress) { color = "red"; } else { color = "black"; } } onAccepted: { if (text.length > 5) { cmp.connectVDRServer(text) } } } Button { id: btnRestoreDefault anchors {top: editVDRServerSelectionAddress.bottom; left: parent.left; margins: 24} text: locTxt_BtnRestoreDefault MouseArea { anchors.fill: parent onClicked: { if (editVDRServerSelectionAddress.text != defaultVDRServerAddress) { cmp.restoreDefaultVDRServerAddress(); } } } } Button { id: btnConnect anchors {top: editVDRServerSelectionAddress.bottom; right: parent.right; margins: 24} text: locTxt_BtnConnect MouseArea { anchors.fill: parent onClicked: { if (editVDRServerSelectionAddress.text.length > 5) { cmp.connectVDRServer(editVDRServerSelectionAddress.text); } } } } }