Merge lp:~artem-anufrij/audience/Bugfix-1045937 into lp:~audience-members/audience/trunk

Proposed by Artem Anufrij
Status: Merged
Approved by: Cody Garver
Approved revision: 452
Merged at revision: 447
Proposed branch: lp:~artem-anufrij/audience/Bugfix-1045937
Merge into: lp:~audience-members/audience/trunk
Diff against target: 285 lines (+67/-41)
3 files modified
src/Audience.vala (+46/-35)
src/Widgets/BottomBar.vala (+2/-2)
src/Widgets/PlaylistPopover.vala (+19/-4)
To merge this branch: bzr merge lp:~artem-anufrij/audience/Bugfix-1045937
Reviewer Review Type Date Requested Status
Danielle Foré ux Approve
Artem Anufrij (community) Needs Information
elementary Apps team code Pending
Review via email: mp+240168@code.launchpad.net

Commit message

Added a "Repeat Playlist" toggle button into playlist popover (lp:1045937)

Description of the change

Added a "Repeat Playlist" toggle button into playlist popup.

We need a new settings item, if the state should be saved permanently.

To post a comment you must log in.
446. By artem-anufrij

Grid.attach adjust

447. By artem-anufrij

Tooltip fixed

Revision history for this message
Danielle Foré (danrabbit) wrote :

Check the behavior of the repeat button in Noise. We should change the icon and tooltip to help indicate the state and what will happen when you toggle the button.

I think I liked the version better where the repeat button was not homogenously sized. It helps create a separation since it's behavior is a little different than the others.

Is it possible to make the UI not show when the video repeats? I imagine a use case for this feature is a looping video on a projector or television and it would be odd to see the UI pop up in this setting.

review: Needs Fixing (ux)
Revision history for this message
Artem Anufrij (artem-anufrij) wrote :

@Dan:

Button location:

playlist popup
or
bottom bar like noise?

review: Needs Information
448. By artem-anufrij

Repeate button tooltip and symbolic like noise

Revision history for this message
Artem Anufrij (artem-anufrij) wrote :

Please test the UX

Revision history for this message
Artem Anufrij (artem-anufrij) wrote :

I'm working on:

> Is it possible to make the UI not show when the video repeats? I imagine a use case for this feature is a looping video on a projector or television and it would be odd to see the UI pop up in this setting.

449. By artem-anufrij

Bottom bar stays hidden between each videos of the playlist, or if repeat function is enabled.

Revision history for this message
Artem Anufrij (artem-anufrij) wrote :

I think, now it works fine.

Revision history for this message
Danielle Foré (danrabbit) wrote :

Yep, everything seems to work as expected now :)

review: Approve (ux)
Revision history for this message
Cody Garver (codygarver) wrote :

diff comment

450. By artem-anufrij

 } else {

Revision history for this message
Artem Anufrij (artem-anufrij) wrote :

code fixed
" } else {"

451. By artem-anufrij

code style fixed

452. By artem-anufrij

code style fixed

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Audience.vala'
2--- src/Audience.vala 2014-10-29 12:24:42 +0000
3+++ src/Audience.vala 2014-11-02 19:13:44 +0000
4@@ -47,6 +47,8 @@
5 /// TRANSLATORS: This is the shortcut used to view information about the application itself when its displayed name is the localized equivalent of "Videos".
6 public const string ABOUT_GENERIC = N_("About Videos");
7
8+ public bool repeat { get; set; }
9+
10 construct {
11 program_name = PROGRAM_NAME;
12 exec_name = "audience";
13@@ -110,6 +112,8 @@
14
15 Gtk.Settings.get_default ().gtk_application_prefer_dark_theme = true;
16 this.flags |= GLib.ApplicationFlags.HANDLES_OPEN;
17+
18+ repeat = false;
19 }
20
21 public static App get_instance () {
22@@ -141,9 +145,9 @@
23
24 bottom_bar = new Widgets.BottomBar ();
25 bottom_bar.set_valign (Gtk.Align.END);
26- bottom_bar.play_toggled.connect (() => {video_player.playing = !video_player.playing;});
27- bottom_bar.seeked.connect ((val) => {video_player.progress = val;});
28- bottom_bar.unfullscreen.connect (() => {toggle_fullscreen ();});
29+ bottom_bar.play_toggled.connect (() => { video_player.playing = !video_player.playing; });
30+ bottom_bar.seeked.connect ((val) => { video_player.progress = val; });
31+ bottom_bar.unfullscreen.connect (() => { toggle_fullscreen (); });
32
33 //tagview.select_external_subtitle.connect (video_player.set_subtitle_uri);
34
35@@ -223,17 +227,24 @@
36 Idle.add (() => {
37 int last_played_index = playlist.get_current ();
38 if (!playlist.next ()) {
39- welcome.set_item_visible (1, false);
40- if (last_played_index > 0) {
41- welcome.set_item_visible (2, false);
42- welcome.set_item_visible (3, true);
43+
44+ if (repeat) {
45+ open_file (playlist.get_first_item ().get_path ());
46+ Idle.add (() => { video_player.progress = 0; return false; });
47+ video_player.playing = true;
48 } else {
49- welcome.set_item_visible (2, true);
50- welcome.set_item_visible (3, false);
51+ welcome.set_item_visible (1, false);
52+ if (last_played_index > 0) {
53+ welcome.set_item_visible (2, false);
54+ welcome.set_item_visible (3, true);
55+ } else {
56+ welcome.set_item_visible (2, true);
57+ welcome.set_item_visible (3, false);
58+ }
59+
60+ welcome.show_all ();
61+ clutter.hide ();
62 }
63-
64- welcome.show_all ();
65- clutter.hide ();
66 }
67 return false;
68 });
69@@ -364,13 +375,13 @@
70 }
71
72 welcome.set_item_visible (1, show_last_file);
73-
74+
75 welcome.append ("media-playlist-repeat", _("Replay"), _("Replay last video"));
76 welcome.set_item_visible (2, false);
77-
78+
79 welcome.append ("media-playlist-repeat", _("Replay"), _("Replay last playlist"));
80 welcome.set_item_visible (3, false);
81-
82+
83 welcome.append ("media-cdrom", _("Play from Disc"), _("Watch a DVD or open a file from disc"));
84 welcome.set_item_visible (4, false);
85
86@@ -386,8 +397,8 @@
87 welcome.set_item_visible (4, disk_manager.has_media_volumes ());
88 });
89
90-
91-
92+
93+
94 //handle welcome
95 welcome.activated.connect ((index) => {
96 switch (index) {
97@@ -402,7 +413,7 @@
98 video_player.playing = false;
99 Idle.add (() => {video_player.progress = settings.last_stopped; return false;});
100 video_player.playing = true;
101- break;
102+ break;
103 case 2:
104 case 3:
105 welcome.hide ();
106@@ -565,7 +576,7 @@
107 foreach (var uri in sel.get_uris ()) {
108 open_file (uri);
109 }
110-
111+
112 welcome.hide ();
113 clutter.show_all ();
114 });
115@@ -578,8 +589,8 @@
116 }
117
118 if (video_player.uri == null || video_player.uri == "")
119- return;
120-
121+ return;
122+
123 save_last_played_videos ();
124 }
125
126@@ -626,13 +637,13 @@
127 settings.last_stopped = 0;
128 }
129 }
130-
131+
132 private inline void clear_video_settings () {
133 settings.last_stopped = 0;
134 settings.last_played_videos = null;
135 settings.current_video = "";
136 }
137-
138+
139
140 private void restore_playlist () {
141 foreach (var filename in settings.last_played_videos) {
142@@ -661,17 +672,17 @@
143 if (welcome.is_visible ()) {
144 playlist.clear_items ();
145 }
146-
147+
148 foreach (File item in file.get_files ()) {
149 playlist.add_item (item);
150 }
151-
152+
153 if (video_player.uri == null || welcome.is_visible ())
154 open_file (file.get_uri ());
155-
156+
157 welcome.hide ();
158 clutter.show_all ();
159-
160+
161 settings.last_folder = file.get_current_folder ();
162 }
163
164@@ -741,12 +752,12 @@
165 string without_ext;
166 int last_dot = uri.last_index_of (".", 0);
167 int last_slash = uri.last_index_of ("/", 0);
168-
169+
170 if (last_dot < last_slash) //we dont have extension
171 without_ext = uri;
172 else
173 without_ext = uri.slice (0, last_dot);
174-
175+
176 foreach (string ext in SUBTITLE_EXTENSIONS){
177 string sub_uri = without_ext + "." + ext;
178 if (File.new_for_uri (sub_uri).query_exists ())
179@@ -791,12 +802,12 @@
180 //the application started
181 public override void activate () {
182 build ();
183- if (settings.resume_videos == true
184- && settings.last_played_videos.length > 0
185+ if (settings.resume_videos == true
186+ && settings.last_played_videos.length > 0
187 && settings.current_video != ""
188 && file_exists (settings.current_video)) {
189 restore_playlist ();
190-
191+
192 if (settings.last_stopped > 0) {
193 welcome.hide ();
194 clutter.show_all ();
195@@ -812,7 +823,7 @@
196 public override void open (File[] files, string hint) {
197 if (mainwindow == null)
198 build ();
199-
200+
201 welcome.hide ();
202 clutter.show_all ();
203 foreach (var file in files) {
204@@ -822,7 +833,7 @@
205 if (video_player.uri != null) { // we already play some file
206 if (files.length == 1)
207 show_notification (_("Video added to playlist"), files[0].get_basename ());
208- else
209+ else
210 show_notification (_("%i videos added to playlist").printf (files.length), "");
211 } else
212 open_file(files[0].get_uri ());
213@@ -843,4 +854,4 @@
214 var app = Audience.App.get_instance ();
215
216 app.run (args);
217-}
218+}
219\ No newline at end of file
220
221=== modified file 'src/Widgets/BottomBar.vala'
222--- src/Widgets/BottomBar.vala 2014-10-14 03:51:08 +0000
223+++ src/Widgets/BottomBar.vala 2014-11-02 19:13:44 +0000
224@@ -113,7 +113,7 @@
225 } else {
226 play_button.image = new Gtk.Image.from_icon_name ("media-playback-start-symbolic", Gtk.IconSize.BUTTON);
227 play_button.tooltip_text = _("Play");
228- set_reveal_child (true);
229+ set_reveal_child (!VideoPlayer.get_default ().at_end);
230 }
231 }
232
233@@ -156,4 +156,4 @@
234 return false;
235 });
236 }
237-}
238+}
239\ No newline at end of file
240
241=== modified file 'src/Widgets/PlaylistPopover.vala'
242--- src/Widgets/PlaylistPopover.vala 2014-10-05 02:03:16 +0000
243+++ src/Widgets/PlaylistPopover.vala 2014-11-02 19:13:44 +0000
244@@ -32,6 +32,9 @@
245 var dvd = new Gtk.Button.from_icon_name ("media-optical-symbolic", Gtk.IconSize.BUTTON);
246 dvd.set_tooltip_text (_("Play from Disc"));
247 dvd.no_show_all = true;
248+ var rep = new Gtk.ToggleButton ();
249+ rep.set_image (new Gtk.Image.from_icon_name ("media-playlist-no-repeat-symbolic", Gtk.IconSize.BUTTON));
250+ rep.set_tooltip_text (_("Enable Repeat"));
251
252 playlist_scrolled = new Gtk.ScrolledWindow (null, null);
253 playlist_scrolled.set_min_content_height (100);
254@@ -49,9 +52,21 @@
255 app.run_open_dvd ();
256 });
257
258- grid.attach (playlist_scrolled, 0, 0, 2, 1);
259- grid.attach (fil, 0, 1, 1, 1);
260- grid.attach (dvd, 1, 1, 1, 1);
261+ rep.toggled.connect ( () => {
262+ app.repeat = rep.active;
263+ if (rep.active) {
264+ rep.set_image (new Gtk.Image.from_icon_name ("media-playlist-repeat-symbolic", Gtk.IconSize.BUTTON));
265+ rep.set_tooltip_text (_("Disable Repeat"));
266+ } else {
267+ rep.set_image (new Gtk.Image.from_icon_name ("media-playlist-no-repeat-symbolic", Gtk.IconSize.BUTTON));
268+ rep.set_tooltip_text (_("Enable Repeat"));
269+ }
270+ });
271+
272+ grid.attach (playlist_scrolled, 0, 0, 7, 1);
273+ grid.attach (fil, 0, 1, 3, 1);
274+ grid.attach (dvd, 3, 1, 3, 1);
275+ grid.attach (rep, 6, 1, 1, 1);
276
277 //look for dvd
278 var disk_manager = DiskManager.get_default ();
279@@ -99,4 +114,4 @@
280 natural_height = minimum_height;
281 }
282 }
283-}
284+}
285\ No newline at end of file

Subscribers

People subscribed via source and target branches