Changeset View
Changeset View
Standalone View
Standalone View
src/qml/MediaPlayListView.qml
Show All 10 Lines | |||||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
12 | * Lesser General Public License for more details. | 12 | * Lesser General Public License for more details. | ||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU Lesser General Public License | 14 | * You should have received a copy of the GNU Lesser General Public License | ||
15 | * along with this program. If not, see <https://www.gnu.org/licenses/>. | 15 | * along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
16 | */ | 16 | */ | ||
17 | 17 | | |||
18 | import QtQuick 2.5 | 18 | import QtQuick 2.5 | ||
19 | import QtQuick.Controls 2.2 | 19 | import QtQuick.Controls 2.3 | ||
20 | import QtQuick.Controls 1.3 as Controls1 | | |||
21 | import QtQuick.Layouts 1.1 | 20 | import QtQuick.Layouts 1.1 | ||
22 | import QtQuick.Window 2.2 | 21 | import QtQuick.Window 2.2 | ||
23 | import QtQml.Models 2.1 | 22 | import QtQml.Models 2.1 | ||
24 | import Qt.labs.platform 1.0 as PlatformDialog | 23 | import Qt.labs.platform 1.0 as PlatformDialog | ||
25 | import org.kde.elisa 1.0 | 24 | import org.kde.elisa 1.0 | ||
26 | 25 | | |||
27 | FocusScope { | 26 | FocusScope { | ||
28 | property StackView parentStackView | 27 | property StackView parentStackView | ||
29 | property MediaPlayList playListModel | 28 | property MediaPlayList playListModel | ||
30 | 29 | | |||
31 | property int placeholderHeight: elisaTheme.dragDropPlaceholderHeight | 30 | property int placeholderHeight: elisaTheme.dragDropPlaceholderHeight | ||
32 | 31 | | |||
33 | signal startPlayback() | 32 | signal startPlayback() | ||
34 | signal pausePlayback() | 33 | signal pausePlayback() | ||
35 | signal displayError(var errorText) | 34 | signal displayError(var errorText) | ||
36 | 35 | | |||
37 | id: topItem | 36 | id: topItem | ||
38 | 37 | | |||
39 | Controls1.Action { | 38 | Action { | ||
40 | id: clearPlayList | 39 | id: clearPlayList | ||
41 | text: i18nc("Remove all tracks from play list", "Clear Playlist") | 40 | text: i18nc("Remove all tracks from play list", "Clear Playlist") | ||
42 | iconName: 'edit-clear-all' | 41 | icon.name: 'edit-clear-all' | ||
43 | enabled: playListModelDelegate.items.count > 0 | 42 | enabled: playListModelDelegate.items.count > 0 | ||
44 | onTriggered: playListModel.clearPlayList() | 43 | onTriggered: playListModel.clearPlayList() | ||
45 | } | 44 | } | ||
46 | 45 | | |||
47 | Controls1.Action { | 46 | Action { | ||
48 | id: showCurrentTrack | 47 | id: showCurrentTrack | ||
49 | text: i18nc("Show currently played track inside playlist", "Show Current Track") | 48 | text: i18nc("Show currently played track inside playlist", "Show Current Track") | ||
50 | iconName: 'media-show-active-track-amarok' | 49 | icon.name: 'media-show-active-track-amarok' | ||
51 | enabled: playListModelDelegate.items.count > 0 | 50 | enabled: playListModelDelegate.items.count > 0 | ||
52 | onTriggered: { | 51 | onTriggered: { | ||
53 | playListView.positionViewAtIndex(playListModel.currentTrackRow, ListView.Contain) | 52 | playListView.positionViewAtIndex(playListModel.currentTrackRow, ListView.Contain) | ||
54 | playListView.currentIndex = playListModel.currentTrackRow | 53 | playListView.currentIndex = playListModel.currentTrackRow | ||
55 | playListView.currentItem.forceActiveFocus() | 54 | playListView.currentItem.forceActiveFocus() | ||
56 | } | 55 | } | ||
57 | } | 56 | } | ||
58 | 57 | | |||
59 | Controls1.Action { | 58 | Action { | ||
60 | id: loadPlaylist | 59 | id: loadPlaylist | ||
61 | text: i18nc("Load a playlist file", "Load Playlist...") | 60 | text: i18nc("Load a playlist file", "Load Playlist...") | ||
62 | iconName: 'document-open' | 61 | icon.name: 'document-open' | ||
63 | onTriggered: | 62 | onTriggered: | ||
64 | { | 63 | { | ||
65 | fileDialog.fileMode = PlatformDialog.FileDialog.OpenFile | 64 | fileDialog.fileMode = PlatformDialog.FileDialog.OpenFile | ||
66 | fileDialog.file = '' | 65 | fileDialog.file = '' | ||
67 | fileDialog.open() | 66 | fileDialog.open() | ||
68 | } | 67 | } | ||
69 | } | 68 | } | ||
70 | 69 | | |||
71 | Controls1.Action { | 70 | Action { | ||
72 | id: savePlaylist | 71 | id: savePlaylist | ||
73 | text: i18nc("Save a playlist file", "Save Playlist...") | 72 | text: i18nc("Save a playlist file", "Save Playlist...") | ||
74 | iconName: 'document-save' | 73 | icon.name: 'document-save' | ||
75 | enabled: playListModelDelegate.items.count > 0 | 74 | enabled: playListModelDelegate.items.count > 0 | ||
76 | onTriggered: | 75 | onTriggered: | ||
77 | { | 76 | { | ||
78 | fileDialog.fileMode = PlatformDialog.FileDialog.SaveFile | 77 | fileDialog.fileMode = PlatformDialog.FileDialog.SaveFile | ||
79 | fileDialog.file = '' | 78 | fileDialog.file = '' | ||
80 | fileDialog.open() | 79 | fileDialog.open() | ||
81 | } | 80 | } | ||
82 | } | 81 | } | ||
▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | 126 | LabelWithToolTip { | |||
129 | text: i18nc("Title of the view of the playlist", "Playlist") | 128 | text: i18nc("Title of the view of the playlist", "Playlist") | ||
130 | 129 | | |||
131 | color: myPalette.text | 130 | color: myPalette.text | ||
132 | font.pointSize: elisaTheme.defaultFontPointSize * 2 | 131 | font.pointSize: elisaTheme.defaultFontPointSize * 2 | ||
133 | Layout.alignment: Qt.AlignLeft | Qt.AlignTop | 132 | Layout.alignment: Qt.AlignLeft | Qt.AlignTop | ||
134 | Layout.topMargin: elisaTheme.layoutVerticalMargin * 3 | 133 | Layout.topMargin: elisaTheme.layoutVerticalMargin * 3 | ||
135 | } | 134 | } | ||
136 | 135 | | |||
137 | | ||||
138 | RowLayout { | 136 | RowLayout { | ||
139 | Layout.fillWidth: true | 137 | Layout.fillWidth: true | ||
138 | spacing: 10 | ||||
140 | 139 | | |||
141 | LabelWithToolTip { | 140 | LabelWithToolTip { | ||
142 | id: playListInfo | 141 | id: playListInfo | ||
143 | 142 | | |||
144 | text: i18np("1 track", "%1 tracks", playListModel.tracksCount) | 143 | text: i18np("1 track", "%1 tracks", playListModel.tracksCount) | ||
145 | visible: playListModelDelegate.count > 0 | 144 | visible: playListModelDelegate.count > 0 | ||
146 | color: myPalette.text | 145 | color: myPalette.text | ||
147 | Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter | 146 | Layout.alignment: Qt.AlignLeft | Qt.AlignVCenter | ||
148 | } | 147 | } | ||
149 | 148 | | |||
150 | Item { Layout.fillWidth: true } | 149 | Item { Layout.fillWidth: true } | ||
151 | 150 | | |||
152 | Controls1.ToolButton { action: showCurrentTrack } | 151 | FlatButtonWithToolTip { | ||
153 | Controls1.ToolButton { action: savePlaylist } | 152 | action: showCurrentTrack | ||
154 | Controls1.ToolButton { action: loadPlaylist } | 153 | implicitHeight: elisaTheme.smallControlButtonSize | ||
155 | Controls1.ToolButton { action: clearPlayList } | 154 | implicitWidth: elisaTheme.smallControlButtonSize | ||
155 | Layout.alignment: Qt.AlignVCenter | ||||
156 | } | ||||
157 | FlatButtonWithToolTip { | ||||
158 | action: savePlaylist | ||||
159 | implicitHeight: elisaTheme.smallControlButtonSize | ||||
160 | implicitWidth: elisaTheme.smallControlButtonSize | ||||
161 | Layout.alignment: Qt.AlignVCenter | ||||
162 | } | ||||
163 | FlatButtonWithToolTip { | ||||
164 | action: loadPlaylist | ||||
165 | implicitHeight: elisaTheme.smallControlButtonSize | ||||
166 | implicitWidth: elisaTheme.smallControlButtonSize | ||||
167 | Layout.alignment: Qt.AlignVCenter | ||||
168 | } | ||||
169 | FlatButtonWithToolTip { | ||||
170 | action: clearPlayList | ||||
171 | implicitHeight: elisaTheme.smallControlButtonSize | ||||
172 | implicitWidth: elisaTheme.smallControlButtonSize | ||||
173 | Layout.alignment: Qt.AlignVCenter | ||||
174 | } | ||||
156 | } | 175 | } | ||
157 | | ||||
158 | Item { Layout.fillHeight: true } | | |||
159 | | ||||
160 | } | 176 | } | ||
161 | 177 | | |||
162 | ColumnLayout { | 178 | ColumnLayout { | ||
163 | id: emptyPlaylistText | 179 | id: emptyPlaylistText | ||
164 | spacing: 0 | 180 | spacing: 0 | ||
165 | visible: playListModelDelegate.count === 0 | 181 | visible: playListModelDelegate.count === 0 | ||
166 | Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter | 182 | Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter | ||
167 | Layout.fillHeight: true | 183 | Layout.fillHeight: true | ||
▲ Show 20 Lines • Show All 179 Lines • Show Last 20 Lines |