got rid of fractions when displaying playlengths

this fixes #1437
This commit is contained in:
fgerlits 2005-11-03 19:42:52 +00:00
parent 026056f026
commit e97352bc6b
3 changed files with 13 additions and 14 deletions

View file

@ -37,6 +37,7 @@
#include <stdexcept> #include <stdexcept>
#include <glibmm.h> #include <glibmm.h>
#include "LiveSupport/Core/TimeConversion.h"
#include "LiveSupport/Widgets/WidgetFactory.h" #include "LiveSupport/Widgets/WidgetFactory.h"
#include "SchedulePlaylistWindow.h" #include "SchedulePlaylistWindow.h"
#include "LiveModeWindow.h" #include "LiveModeWindow.h"
@ -239,7 +240,8 @@ LiveModeWindow :: addItem(Ptr<Playable>::Ref playable) throw ()
infoString->append("\n<span font_desc='Bitstream Vera Sans 12'>" infoString->append("\n<span font_desc='Bitstream Vera Sans 12'>"
"duration: "); "duration: ");
infoString->append(to_simple_string(*playable->getPlaylength())); infoString->append(*TimeConversion::timeDurationToHhMmSsString(
playable->getPlaylength() ));
infoString->append("</span>"); infoString->append("</span>");
row[modelColumns.infoColumn] = *infoString; row[modelColumns.infoColumn] = *infoString;

View file

@ -37,6 +37,7 @@
#include <stdexcept> #include <stdexcept>
#include <boost/date_time/posix_time/posix_time.hpp> #include <boost/date_time/posix_time/posix_time.hpp>
#include "LiveSupport/Core/TimeConversion.h"
#include "LiveSupport/Widgets/WidgetFactory.h" #include "LiveSupport/Widgets/WidgetFactory.h"
#include "LiveSupport/Widgets/ScrolledNotebook.h" #include "LiveSupport/Widgets/ScrolledNotebook.h"
#include "LiveSupport/Widgets/Button.h" #include "LiveSupport/Widgets/Button.h"
@ -244,11 +245,11 @@ SearchWindow :: constructSearchResultsView(void) throw ()
searchResults->appendColumn(*getResourceUstring("typeColumnLabel"), searchResults->appendColumn(*getResourceUstring("typeColumnLabel"),
modelColumns.typeColumn, 20); modelColumns.typeColumn, 20);
searchResults->appendColumn(*getResourceUstring("titleColumnLabel"), searchResults->appendColumn(*getResourceUstring("titleColumnLabel"),
modelColumns.titleColumn, 200); modelColumns.titleColumn, 360);
searchResults->appendColumn(*getResourceUstring("creatorColumnLabel"), searchResults->appendColumn(*getResourceUstring("creatorColumnLabel"),
modelColumns.creatorColumn, 200); modelColumns.creatorColumn, 260);
searchResults->appendColumn(*getResourceUstring("lengthColumnLabel"), searchResults->appendColumn(*getResourceUstring("lengthColumnLabel"),
modelColumns.lengthColumn, 120); modelColumns.lengthColumn, 50);
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl; std::cerr << e.what() << std::endl;
std::exit(1); std::exit(1);
@ -377,8 +378,8 @@ SearchWindow :: onSearch(Ptr<SearchCriteria>::Ref criteria)
: ""; : "";
Ptr<time_duration>::Ref length = playable->getPlaylength(); Ptr<time_duration>::Ref length = playable->getPlaylength();
row[modelColumns.lengthColumn] = length ? to_simple_string(*length) row[modelColumns.lengthColumn] = length ?
: ""; *TimeConversion::timeDurationToHhMmSsString(length) : "";
} }
} }

View file

@ -327,14 +327,10 @@ UploadFileWindow :: updateFileInfo(void) throw ()
} }
// display the new play length // display the new play length
std::ostringstream lengthStr; Ptr<const std::string>::Ref lengthStr
lengthStr << std::setfill('0') = TimeConversion::timeDurationToHhMmSsString(
<< std::setw(2) << playlength->hours() << ":" playlength);
<< std::setw(2) << playlength->minutes() << ":" lengthValueLabel->set_text(*lengthStr);
<< std::setw(2) << (playlength->fractional_seconds() < 500000
? playlength->seconds()
: playlength->seconds() + 1);
lengthValueLabel->set_text(lengthStr.str());
// read the id3 tags // read the id3 tags
Ptr<const Glib::ustring>::Ref tempTitle(new const Glib::ustring); Ptr<const Glib::ustring>::Ref tempTitle(new const Glib::ustring);