[longomatch] Show times with the hour digit
- From: Andoni Morales Alastruey <amorales src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [longomatch] Show times with the hour digit
- Date: Wed, 24 Sep 2014 20:24:09 +0000 (UTC)
commit c2f59bb9abdbf7b4e3786434bdcd8c76ffdd6fa5
Author: Andoni Morales Alastruey <ylatuya gmail com>
Date: Fri Sep 5 17:57:42 2014 +0200
Show times with the hour digit
This fixes a problem with the player rescalling
when the time label has different number of digits
LongoMatch.Core/Store/Time.cs | 8 ++++----
LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs | 8 ++++----
.../gtk-gui/LongoMatch.Gui.PlayerBin.cs | 1 +
LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic | 1 +
4 files changed, 10 insertions(+), 8 deletions(-)
---
diff --git a/LongoMatch.Core/Store/Time.cs b/LongoMatch.Core/Store/Time.cs
index e2710f4..7490927 100644
--- a/LongoMatch.Core/Store/Time.cs
+++ b/LongoMatch.Core/Store/Time.cs
@@ -89,7 +89,7 @@ namespace LongoMatch.Core.Store
/// <returns>
/// A <see cref="System.String"/>
/// </returns>
- public string ToSecondsString()
+ public string ToSecondsString(bool includeHour=false)
{
int _h, _m, _s, _time;
@@ -98,7 +98,7 @@ namespace LongoMatch.Core.Store
_m = ((_time % 3600) / 60);
_s = ((_time % 3600) % 60);
- if(_h > 0)
+ if(_h > 0 || includeHour)
return String.Format("{0}:{1}:{2}", _h, _m.ToString("d2"),
_s.ToString("d2"));
@@ -111,12 +111,12 @@ namespace LongoMatch.Core.Store
/// <returns>
/// A <see cref="System.String"/>
/// </returns>
- public string ToMSecondsString()
+ public string ToMSecondsString(bool includeHour=false)
{
int _ms ;
_ms = ((MSeconds % 3600000)%60000)%1000;
- return String.Format("{0},{1}", ToSecondsString(), _ms.ToString("d3"));
+ return String.Format("{0},{1}", ToSecondsString(includeHour), _ms.ToString("d3"));
}
public override bool Equals(object o)
diff --git a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
index 59a7517..63d7d80 100644
--- a/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
+++ b/LongoMatch.GUI.Multimedia/Gui/PlayerBin.cs
@@ -488,7 +488,7 @@ namespace LongoMatch.Gui
seekType = SeekType.Keyframe;
}
seeker.Seek (seekType, seekPos);
- timelabel.Text = seekPos.ToMSecondsString () + "/" + duration.ToMSecondsString ();
+ timelabel.Text = seekPos.ToMSecondsString (true) + "/" + duration.ToMSecondsString
(true);
}
void CreatePlayer ()
@@ -588,8 +588,8 @@ namespace LongoMatch.Gui
}
ct = currentTime - segment.Start;
cp = (float)ct.MSeconds / (float)(dur.MSeconds);
- slength = dur.ToMSecondsString ();
- timelabel.Text = ct.ToMSecondsString () + "/" + slength;
+ slength = dur.ToMSecondsString (true);
+ timelabel.Text = ct.ToMSecondsString (true) + "/" + slength;
timescale.Value = cp;
if (loadedPlay != null && loadedPlay.Drawings.Count > 0) {
FrameDrawing fd = loadedPlay.Drawings.FirstOrDefault (f => f.Render >
lastTime && f.Render <= currentTime);
@@ -599,7 +599,7 @@ namespace LongoMatch.Gui
}
} else {
slength = length.ToMSecondsString ();
- timelabel.Text = currentTime.ToMSecondsString () + "/" + slength;
+ timelabel.Text = currentTime.ToMSecondsString (true) + "/" + slength;
if (timescale.Visible) {
timescale.Value = (double)currentTime.MSeconds / length.MSeconds;
}
diff --git a/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.PlayerBin.cs
b/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.PlayerBin.cs
index 14bcb63..405c498 100644
--- a/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.PlayerBin.cs
+++ b/LongoMatch.GUI.Multimedia/gtk-gui/LongoMatch.Gui.PlayerBin.cs
@@ -330,6 +330,7 @@ namespace LongoMatch.Gui
this.controlsbox.Add (this.timelabel);
global::Gtk.Box.BoxChild w69 = ((global::Gtk.Box.BoxChild)(this.controlsbox
[this.timelabel]));
w69.Position = 4;
+ w69.Expand = false;
// Container child controlsbox.Gtk.Box+BoxChild
this.volumebutton = new global::Gtk.Button ();
this.volumebutton.Name = "volumebutton";
diff --git a/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic b/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic
index 58493fe..2283d20 100644
--- a/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic
+++ b/LongoMatch.GUI.Multimedia/gtk-gui/gui.stetic
@@ -372,6 +372,7 @@
<packing>
<property name="Position">4</property>
<property name="AutoSize">False</property>
+ <property name="Expand">False</property>
</packing>
</child>
<child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]