Merge lp:~hunter.rew/steadyflow/modified into lp:steadyflow

Proposed by Hunter Rew
Status: Merged
Merged at revision: 191
Proposed branch: lp:~hunter.rew/steadyflow/modified
Merge into: lp:steadyflow
Diff against target: 236 lines (+110/-0) (has conflicts)
7 files modified
CMakeLists.txt (+16/-0)
Steadyflow.Core/GioDownloadFile.vala (+5/-0)
Steadyflow.UI/DownloadCellRenderer.vala (+66/-0)
Steadyflow/AddFileDialog.vala (+5/-0)
Steadyflow/IndicatorController.vala (+5/-0)
Steadyflow/MainWindow.vala (+9/-0)
Steadyflow/PreferencesDialog.vala (+4/-0)
Text conflict in CMakeLists.txt
Text conflict in Steadyflow.Core/GioDownloadFile.vala
Text conflict in Steadyflow.UI/DownloadCellRenderer.vala
Text conflict in Steadyflow/AddFileDialog.vala
Text conflict in Steadyflow/IndicatorController.vala
Text conflict in Steadyflow/MainWindow.vala
Text conflict in Steadyflow/PreferencesDialog.vala
To merge this branch: bzr merge lp:~hunter.rew/steadyflow/modified
Reviewer Review Type Date Requested Status
Maia Everett Approve
Review via email: mp+60065@code.launchpad.net

Description of the change

Remaining time estimation

To post a comment you must log in.
Revision history for this message
Maia Everett (linneris) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2011-05-05 07:40:08 +0000
3+++ CMakeLists.txt 2011-05-05 13:37:23 +0000
4@@ -32,7 +32,12 @@
5 include(Po)
6 include(sources)
7
8+<<<<<<< TREE
9 ensure_vala_version(0.12.0 MINIMUM)
10+=======
11+# Vala 0.11.6 required for parse functions
12+ensure_vala_version(0.11.6 MINIMUM)
13+>>>>>>> MERGE-SOURCE
14
15 configure_file(${CMAKE_SOURCE_DIR}/cmake/config.h.in ${CMAKE_BINARY_DIR}/config.h @ONLY)
16
17@@ -41,7 +46,18 @@
18 ${CMAKE_SOURCE_DIR}/vapi/AppConfig.vapi
19 )
20
21+<<<<<<< TREE
22 set(VALA_PACKAGES
23+=======
24+vala_precompile(VALA_C
25+ ${STEADYFLOW_SOURCES}
26+OPTIONS
27+ --vapidir=${CMAKE_SOURCE_DIR}/vapi
28+CUSTOM_VAPIS
29+ ${CUSTOM_VAPIS}
30+PACKAGES
31+ dbus-glib-1
32+>>>>>>> MERGE-SOURCE
33 gee-1.0
34 gio-2.0
35 glib-2.0
36
37=== modified file 'Steadyflow.Core/GioDownloadFile.vala'
38--- Steadyflow.Core/GioDownloadFile.vala 2011-05-04 17:46:48 +0000
39+++ Steadyflow.Core/GioDownloadFile.vala 2011-05-05 13:37:23 +0000
40@@ -197,8 +197,13 @@
41 set_status (IDownloadFile.Status.FINISHED);
42 break;
43 }
44+<<<<<<< TREE
45
46 yield output.write_async (buf[0:read]);
47+=======
48+
49+ yield output.write_async (buf[0:read]);
50+>>>>>>> MERGE-SOURCE
51 on_download_progress (_downloaded_size + read, _size);
52 }
53 } catch (Error e) {
54
55=== modified file 'Steadyflow.UI/DownloadCellRenderer.vala'
56--- Steadyflow.UI/DownloadCellRenderer.vala 2011-05-05 05:35:00 +0000
57+++ Steadyflow.UI/DownloadCellRenderer.vala 2011-05-05 13:37:23 +0000
58@@ -61,9 +61,15 @@
59
60 switch (_file.status) {
61 case IDownloadFile.Status.DOWNLOADING:
62+<<<<<<< TREE
63 string time_str = get_time_remaining(_file.size, _file.downloaded_size, _file.speed);
64 text_under_renderer.text = _("Downloading at speed %s/s").printf (
65 format_size_for_display (_file.speed)) + " (%s)".printf (time_str);
66+=======
67+ string timeRemaining = getTimeRemaining(_file.size, _file.downloaded_size, _file.speed);
68+ text_under_renderer.text = _("Downloading at speed %s/s (%s)").printf (
69+ format_size_for_display (_file.speed), timeRemaining);
70+>>>>>>> MERGE-SOURCE
71 break;
72 case IDownloadFile.Status.CONNECTING:
73 text_under_renderer.text = _("Connecting...");
74@@ -102,7 +108,11 @@
75 pixbuf = IconTheme.get_default ().load_icon (icon_name, ICON_SIZE, 0);
76 } catch (Error e) {
77 try {
78+<<<<<<< TREE
79 pixbuf = IconTheme.get_default ().load_icon (Stock.FILE, ICON_SIZE, 0);
80+=======
81+ pixbuf = IconTheme.get_default ().load_icon (Gtk.Stock.FILE, ICON_SIZE, 0);
82+>>>>>>> MERGE-SOURCE
83 } catch (Error e) {
84 pixbuf = null;
85 }
86@@ -163,6 +173,7 @@
87 /*
88 * Estimate remaining time to completion
89 */
90+<<<<<<< TREE
91 private string get_time_remaining(int64 file_size, int64 downloaded_size, int64 speed) {
92 if (speed <= 0) {
93 return _("Unknown time remaining");
94@@ -198,6 +209,61 @@
95
96 return ngettext ("%s, %d hour remaining", "%s, %d hour remaining", hours).printf(
97 ngettext ("%d day", "%d days", days).printf(days), hours);
98+=======
99+ private string getTimeRemaining(int64 fileSize, int64 fileDownloadedSize, int64 fileSpeed) {
100+ string timeRemaining;
101+ if (fileSpeed > 0) {
102+ if (fileSize > fileDownloadedSize) { // fileSize is 0 for small downloads
103+ int64 sizeRemaining = fileSize - fileDownloadedSize;
104+ int64 nRemSecs = sizeRemaining / fileSpeed;
105+ string secsAppend = "";
106+ if (nRemSecs > 1) {
107+ secsAppend = "s";
108+ }
109+ timeRemaining = nRemSecs.to_string() + " second" + secsAppend;
110+ if ((nRemSecs / 60) >= 1) {
111+ int64 nRemMins = nRemSecs / 60;
112+ string minAppend = "";
113+ if (nRemMins > 1) {
114+ minAppend = "s";
115+ }
116+ timeRemaining = nRemMins.to_string() + " minute" + minAppend;
117+ if ((nRemMins / 60) >= 1) {
118+ int64 nRemHours = nRemMins / 60;
119+ nRemMins = nRemMins % 60;
120+ string hourAppend = "";
121+ if (nRemMins > 1) {
122+ minAppend = "s";
123+ }
124+ if (nRemHours > 1) {
125+ hourAppend = "s";
126+ }
127+ timeRemaining = nRemHours.to_string() + " hour" + hourAppend + ", " + nRemMins.to_string() + " minute" + minAppend;
128+ if ((nRemHours / 24) >= 1) {
129+ int64 nRemDays = nRemHours / 24;
130+ nRemHours = nRemHours % 24;
131+ string dayAppend = "";
132+ if (nRemHours > 1) {
133+ hourAppend = "s";
134+ }
135+ if (nRemDays > 1) {
136+ dayAppend = "s";
137+ }
138+ timeRemaining = nRemDays.to_string() + " day" + dayAppend + ", " + nRemHours.to_string() + " hour" + hourAppend;
139+ }
140+ }
141+ }
142+ }
143+ else {
144+ timeRemaining = "A few seconds";
145+ }
146+ }
147+ else {
148+ timeRemaining = "Unknown time";
149+ }
150+ timeRemaining += " remaining";
151+ return timeRemaining;
152+>>>>>>> MERGE-SOURCE
153 }
154 }
155
156
157=== modified file 'Steadyflow/AddFileDialog.vala'
158--- Steadyflow/AddFileDialog.vala 2011-05-05 06:35:09 +0000
159+++ Steadyflow/AddFileDialog.vala 2011-05-05 13:37:23 +0000
160@@ -51,8 +51,13 @@
161 finished_action.add_attribute (renderer, "text", 0);
162 finished_action.active = Services.settings.get_enum ("default-post-download-action");
163
164+<<<<<<< TREE
165 add_button (Stock.CANCEL, ResponseType.CANCEL);
166 add_button (Stock.ADD, ResponseType.OK);
167+=======
168+ add_button (Gtk.Stock.CANCEL, ResponseType.CANCEL);
169+ add_button (Gtk.Stock.ADD, ResponseType.OK);
170+>>>>>>> MERGE-SOURCE
171 set_default_response (ResponseType.OK);
172 autoconnect ();
173
174
175=== modified file 'Steadyflow/IndicatorController.vala'
176--- Steadyflow/IndicatorController.vala 2011-05-04 17:46:48 +0000
177+++ Steadyflow/IndicatorController.vala 2011-05-05 13:37:23 +0000
178@@ -36,8 +36,13 @@
179
180 public class IndicatorController : GLib.Object {
181 private ActionEntry[] actions = {
182+<<<<<<< TREE
183 ActionEntry () { name = "Add", stock_id = Stock.ADD, label = _("_Add download...") },
184 ActionEntry () { name = "Quit", stock_id = Stock.QUIT }
185+=======
186+ ActionEntry () { name = "Add", stock_id = Gtk.Stock.ADD, label = _("_Add download...") },
187+ ActionEntry () { name = "Quit", stock_id = Gtk.Stock.QUIT }
188+>>>>>>> MERGE-SOURCE
189 };
190
191 private ToggleActionEntry[] toggle_actions = {
192
193=== modified file 'Steadyflow/MainWindow.vala'
194--- Steadyflow/MainWindow.vala 2011-05-05 06:00:38 +0000
195+++ Steadyflow/MainWindow.vala 2011-05-05 13:37:23 +0000
196@@ -190,7 +190,11 @@
197 _("The file you are trying to save the download to already exists. " +
198 "Are you sure you want to overwrite it?"));
199
200+<<<<<<< TREE
201 md.add_button (Stock.CANCEL, ResponseType.CANCEL);
202+=======
203+ md.add_button (Gtk.Stock.CANCEL, ResponseType.CANCEL);
204+>>>>>>> MERGE-SOURCE
205 md.add_button (_("Overwrite"), ResponseType.OK);
206 response = md.run ();
207 md.destroy ();
208@@ -255,8 +259,13 @@
209 _("The file you request to be removed from the download list is not yet fully downloaded. " +
210 "Are you sure you want to remove it?"));
211
212+<<<<<<< TREE
213 md.add_button (Stock.CANCEL, ResponseType.CANCEL);
214 md.add_button (Stock.REMOVE, ResponseType.OK);
215+=======
216+ md.add_button (Gtk.Stock.CANCEL, ResponseType.CANCEL);
217+ md.add_button (Gtk.Stock.REMOVE, ResponseType.OK);
218+>>>>>>> MERGE-SOURCE
219 int response = md.run ();
220 md.destroy ();
221
222
223=== modified file 'Steadyflow/PreferencesDialog.vala'
224--- Steadyflow/PreferencesDialog.vala 2011-05-04 17:46:48 +0000
225+++ Steadyflow/PreferencesDialog.vala 2011-05-05 13:37:23 +0000
226@@ -53,7 +53,11 @@
227
228 finish_action_map = new HashMap<RadioButton, IDownloadFile.FinishAction> ();
229 load_settings ();
230+<<<<<<< TREE
231 add_button (Stock.CLOSE, ResponseType.CLOSE);
232+=======
233+ add_button (Gtk.Stock.CLOSE, ResponseType.CLOSE);
234+>>>>>>> MERGE-SOURCE
235 autoconnect ();
236 }
237

Subscribers

People subscribed via source and target branches

to all changes: