From: Mikko Rasa Date: Sun, 18 Oct 2015 11:02:13 +0000 (+0300) Subject: Move non-page qml components to a separate subdirectory X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=afa557f5c0b0debaaaf6c4c777ccc2ba10965c50;p=xinema.git Move non-page qml components to a separate subdirectory --- diff --git a/remote/qml/components/ChannelItem.qml b/remote/qml/components/ChannelItem.qml new file mode 100644 index 0000000..714e707 --- /dev/null +++ b/remote/qml/components/ChannelItem.qml @@ -0,0 +1,31 @@ +import QtQuick 2.0 +import Sailfish.Silica 1.0 + +Label +{ + id: item + + anchors + { + left: parent.left + right: parent.right + margins: Theme.paddingLarge + } + + property int channelIndex: 0 + property string channelName: "" + property bool down: false + + signal clicked() + + text: channelIndex+": "+channelName + horizontalAlignment: Text.AlignHCenter + color: down ? Theme.primaryColor : Theme.highlightColor + + MouseArea + { + anchors.fill: parent + + onClicked: item.clicked() + } +} diff --git a/remote/qml/components/ChannelSelect.qml b/remote/qml/components/ChannelSelect.qml new file mode 100644 index 0000000..43c6cf7 --- /dev/null +++ b/remote/qml/components/ChannelSelect.qml @@ -0,0 +1,78 @@ +import QtQuick 2.0 +import Sailfish.Silica 1.0 + +ValueButton +{ + id: channelSelect + + property var channels: null + property int currentChannel: -1 + property bool _channelsAvailable: channels && channels.length + enabled: _channelsAvailable + + value: (_channelsAvailable ? currentChannel>=0 ? (currentChannel+1)+": "+channels[currentChannel] : "0: (off)" : "(not available)") + + onClicked: + { + if(_channelsAvailable) + pageStack.push(selectDialog); + } + + Component + { + id: selectDialog + + Page + { + id: page + + function selectChannel(index) + { + channelSelect.currentChannel = index; + pageStack.pop(); + } + + SilicaFlickable + { + width: parent.width + contentHeight: column.height + + Column + { + id: column + width: parent.width + spacing: Theme.paddingLarge + + PageHeader + { + id: header + title: channelSelect.label + } + + ChannelItem + { + channelIndex: 0 + channelName: "(off)" + down: channelSelect.currentChannel+1==channelIndex + + onClicked: page.selectChannel(channelIndex-1); + } + Repeater + { + id: repeater + model: channelSelect.channels + + ChannelItem + { + channelIndex: index+1 + channelName: modelData + down: channelSelect.currentChannel+1==channelIndex + + onClicked: page.selectChannel(channelIndex-1); + } + } + } + } + } + } +} diff --git a/remote/qml/components/DirectoryEntry.qml b/remote/qml/components/DirectoryEntry.qml new file mode 100644 index 0000000..2c97456 --- /dev/null +++ b/remote/qml/components/DirectoryEntry.qml @@ -0,0 +1,47 @@ +import QtQuick 2.0 +import Sailfish.Silica 1.0 + +Item +{ + id: entry + + property alias icon: icon.source + property alias text: label.text + property int iconSize: Theme.iconSizeMedium + height: row.height + + signal clicked() + + Row + { + id: row + spacing: Theme.paddingMedium + anchors + { + left: parent.left + right: parent.right + margins: Theme.horizontalPageMargin + } + + Image + { + id: icon + sourceSize.width: iconSize + sourceSize.height: iconSize + width: iconSize + height: iconSize + } + Label + { + id: label + height: icon.height + verticalAlignment: Text.AlignVCenter + } + } + + MouseArea + { + anchors.fill: parent + onClicked: entry.clicked(); + } +} diff --git a/remote/qml/pages/BrowsePage.qml b/remote/qml/pages/BrowsePage.qml index 8a5d254..2a3a123 100644 --- a/remote/qml/pages/BrowsePage.qml +++ b/remote/qml/pages/BrowsePage.qml @@ -2,6 +2,7 @@ import QtQuick 2.0 import Sailfish.Silica 1.0 import org.nemomobile.configuration 1.0 import fi.mikkosoft.xinema 0.1 +import "../components" Page { diff --git a/remote/qml/pages/ChannelItem.qml b/remote/qml/pages/ChannelItem.qml deleted file mode 100644 index 714e707..0000000 --- a/remote/qml/pages/ChannelItem.qml +++ /dev/null @@ -1,31 +0,0 @@ -import QtQuick 2.0 -import Sailfish.Silica 1.0 - -Label -{ - id: item - - anchors - { - left: parent.left - right: parent.right - margins: Theme.paddingLarge - } - - property int channelIndex: 0 - property string channelName: "" - property bool down: false - - signal clicked() - - text: channelIndex+": "+channelName - horizontalAlignment: Text.AlignHCenter - color: down ? Theme.primaryColor : Theme.highlightColor - - MouseArea - { - anchors.fill: parent - - onClicked: item.clicked() - } -} diff --git a/remote/qml/pages/ChannelSelect.qml b/remote/qml/pages/ChannelSelect.qml deleted file mode 100644 index 43c6cf7..0000000 --- a/remote/qml/pages/ChannelSelect.qml +++ /dev/null @@ -1,78 +0,0 @@ -import QtQuick 2.0 -import Sailfish.Silica 1.0 - -ValueButton -{ - id: channelSelect - - property var channels: null - property int currentChannel: -1 - property bool _channelsAvailable: channels && channels.length - enabled: _channelsAvailable - - value: (_channelsAvailable ? currentChannel>=0 ? (currentChannel+1)+": "+channels[currentChannel] : "0: (off)" : "(not available)") - - onClicked: - { - if(_channelsAvailable) - pageStack.push(selectDialog); - } - - Component - { - id: selectDialog - - Page - { - id: page - - function selectChannel(index) - { - channelSelect.currentChannel = index; - pageStack.pop(); - } - - SilicaFlickable - { - width: parent.width - contentHeight: column.height - - Column - { - id: column - width: parent.width - spacing: Theme.paddingLarge - - PageHeader - { - id: header - title: channelSelect.label - } - - ChannelItem - { - channelIndex: 0 - channelName: "(off)" - down: channelSelect.currentChannel+1==channelIndex - - onClicked: page.selectChannel(channelIndex-1); - } - Repeater - { - id: repeater - model: channelSelect.channels - - ChannelItem - { - channelIndex: index+1 - channelName: modelData - down: channelSelect.currentChannel+1==channelIndex - - onClicked: page.selectChannel(channelIndex-1); - } - } - } - } - } - } -} diff --git a/remote/qml/pages/DirectoryEntry.qml b/remote/qml/pages/DirectoryEntry.qml deleted file mode 100644 index 2c97456..0000000 --- a/remote/qml/pages/DirectoryEntry.qml +++ /dev/null @@ -1,47 +0,0 @@ -import QtQuick 2.0 -import Sailfish.Silica 1.0 - -Item -{ - id: entry - - property alias icon: icon.source - property alias text: label.text - property int iconSize: Theme.iconSizeMedium - height: row.height - - signal clicked() - - Row - { - id: row - spacing: Theme.paddingMedium - anchors - { - left: parent.left - right: parent.right - margins: Theme.horizontalPageMargin - } - - Image - { - id: icon - sourceSize.width: iconSize - sourceSize.height: iconSize - width: iconSize - height: iconSize - } - Label - { - id: label - height: icon.height - verticalAlignment: Text.AlignVCenter - } - } - - MouseArea - { - anchors.fill: parent - onClicked: entry.clicked(); - } -} diff --git a/remote/qml/pages/PlaybackPage.qml b/remote/qml/pages/PlaybackPage.qml index 7bf7cc9..bf1d976 100644 --- a/remote/qml/pages/PlaybackPage.qml +++ b/remote/qml/pages/PlaybackPage.qml @@ -1,6 +1,7 @@ import QtQuick 2.0 import Sailfish.Silica 1.0 import fi.mikkosoft.xinema 0.1 +import "../components" Page {