progress bar
This commit is contained in:
parent
bdb8db1c19
commit
0fe02bffcc
3 changed files with 46 additions and 4 deletions
|
@ -110,7 +110,9 @@ NowPlaying :: NowPlaying (GuiObject * parent)
|
||||||
setStyle(remainsTimeText, 7);
|
setStyle(remainsTimeText, 7);
|
||||||
elapsedTimeText->set_text(*getResourceUstring("elapsedTimeLabel"));
|
elapsedTimeText->set_text(*getResourceUstring("elapsedTimeLabel"));
|
||||||
remainsTimeText->set_text(*getResourceUstring("remainingTimeLabel"));
|
remainsTimeText->set_text(*getResourceUstring("remainingTimeLabel"));
|
||||||
|
|
||||||
|
glade->get_widget("progressBar1", progressBar);
|
||||||
|
|
||||||
Ptr<Playable>::Ref nullPointer;
|
Ptr<Playable>::Ref nullPointer;
|
||||||
setPlayable(nullPointer);
|
setPlayable(nullPointer);
|
||||||
}
|
}
|
||||||
|
@ -175,6 +177,7 @@ NowPlaying :: setPlayable (Ptr<Playable>::Ref playable) throw ()
|
||||||
elapsedTimeLabel->set_text("");
|
elapsedTimeLabel->set_text("");
|
||||||
remainsTimeLabel->set_text("");
|
remainsTimeLabel->set_text("");
|
||||||
playlistLabel->set_text("");
|
playlistLabel->set_text("");
|
||||||
|
progressBar->set_fraction(0);
|
||||||
resetRemainsTimeState();
|
resetRemainsTimeState();
|
||||||
this->playable.reset();
|
this->playable.reset();
|
||||||
this->currentInnerPlayable.reset();
|
this->currentInnerPlayable.reset();
|
||||||
|
@ -324,6 +327,18 @@ NowPlaying :: onUpdateTime (void) throw ()
|
||||||
remainsTimeLabel->set_text(*TimeConversion::timeDurationToHhMmSsString(
|
remainsTimeLabel->set_text(*TimeConversion::timeDurationToHhMmSsString(
|
||||||
innerRemains ));
|
innerRemains ));
|
||||||
|
|
||||||
|
long elapsedMilliSec = innerElapsed->total_milliseconds();
|
||||||
|
long totalMilliSec = elapsedMilliSec
|
||||||
|
+ innerRemains->total_milliseconds();
|
||||||
|
double fraction = double(elapsedMilliSec) / double(totalMilliSec);
|
||||||
|
if (fraction < 0.0) {
|
||||||
|
fraction = 0.0; // can't happen afaik
|
||||||
|
}
|
||||||
|
if (fraction > 1.0) {
|
||||||
|
fraction = 1.0; // can and does happen!
|
||||||
|
}
|
||||||
|
progressBar->set_fraction(fraction);
|
||||||
|
|
||||||
currentInnerPlayable = innerPlayable;
|
currentInnerPlayable = innerPlayable;
|
||||||
|
|
||||||
// END synchronized block
|
// END synchronized block
|
||||||
|
|
|
@ -107,6 +107,11 @@ class NowPlaying : public GuiComponent
|
||||||
*/
|
*/
|
||||||
Gtk::Label * playlistLabel;
|
Gtk::Label * playlistLabel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The progress bar.
|
||||||
|
*/
|
||||||
|
Gtk::ProgressBar * progressBar;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The label which says "elapsed time".
|
* The label which says "elapsed time".
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
|
||||||
<!--Generated with glade3 3.2.0 on Tue Aug 14 14:08:34 2007 by fgerlits@desktop-->
|
<!--Generated with glade3 3.2.0 on Thu Oct 25 15:07:19 2007 by fgerlits@desktop-->
|
||||||
<glade-interface>
|
<glade-interface>
|
||||||
<widget class="GtkWindow" id="mainWindow1">
|
<widget class="GtkWindow" id="mainWindow1">
|
||||||
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
@ -119,6 +119,28 @@
|
||||||
<property name="position">1</property>
|
<property name="position">1</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkHBox" id="hbox2">
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<child>
|
||||||
|
<widget class="GtkProgressBar" id="progressBar1">
|
||||||
|
<property name="width_request">322</property>
|
||||||
|
<property name="height_request">8</property>
|
||||||
|
<property name="visible">True</property>
|
||||||
|
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
|
||||||
|
<property name="text" translatable="yes"></property>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="expand">False</property>
|
||||||
|
<property name="fill">False</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
<packing>
|
||||||
|
<property name="position">2</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHBox" id="nowPlayingTimeBox1">
|
<widget class="GtkHBox" id="nowPlayingTimeBox1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
|
@ -214,7 +236,7 @@
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="position">2</property>
|
<property name="position">3</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
|
@ -227,7 +249,7 @@
|
||||||
<property name="single_line_mode">True</property>
|
<property name="single_line_mode">True</property>
|
||||||
</widget>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="position">3</property>
|
<property name="position">4</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue