From f54fd605c0577b815a4933cc2aa9a353f178d7ed Mon Sep 17 00:00:00 2001 From: fgerlits <fgerlits@cfc7b370-4200-0410-a6e3-cb6bdb053afe> Date: Mon, 27 Nov 2006 16:50:55 +0000 Subject: [PATCH] fixed #2036 --- .../LiveSupport/Widgets/WidgetFactory.h | 12 +++++-- .../src/modules/widgets/src/WidgetFactory.cxx | 12 +++++-- .../src/SchedulePlaylistWindow.cxx | 31 ++++++++++++++----- .../gLiveSupport/src/SchedulePlaylistWindow.h | 10 ++++++ .../src/products/gLiveSupport/var/es.txt | 1 + .../src/products/gLiveSupport/var/hu.txt | 1 + .../src/products/gLiveSupport/var/nl.txt | 1 + .../src/products/gLiveSupport/var/pl.txt | 1 + .../src/products/gLiveSupport/var/root.txt | 1 + .../src/products/gLiveSupport/var/sr_CS.txt | 1 + .../gLiveSupport/var/sr_CS_CYRILLIC.txt | 1 + .../products/scheduler/src/PlaylistEvent.cxx | 7 +++++ 12 files changed, 65 insertions(+), 14 deletions(-) diff --git a/campcaster/src/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h b/campcaster/src/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h index 1efb4a04d..341f878ce 100644 --- a/campcaster/src/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h +++ b/campcaster/src/modules/widgets/include/LiveSupport/Widgets/WidgetFactory.h @@ -187,10 +187,13 @@ class WidgetFactory : * Convert an integer to a string. * * @param number the number to be converted. + * @param minLength the minimum length of the result; smaller + * numbers get padded with zeroes (optional). * @return the string value of the number (in base 10). */ static Glib::ustring - itoa(int number) throw (); + itoa(int number, + int minLength = 0) throw (); public: @@ -320,11 +323,14 @@ class WidgetFactory : * * @param lowerLimit the lowest entry in the combo box. * @param upperLimit the highest entry in the combo box. + * @param minLength the minimum length of the entries; smaller + * numbers get padded with zeroes (optional). * @return a combo box, that holds numeric entries. */ ComboBoxText * - createNumericComboBoxText(int lowerLimit, - int upperLimit) throw (); + createNumericComboBoxText(int lowerLimit, + int upperLimit, + int minLength = 0) throw (); /** * Create and return a blue singular container. diff --git a/campcaster/src/modules/widgets/src/WidgetFactory.cxx b/campcaster/src/modules/widgets/src/WidgetFactory.cxx index e67b0ea89..385d51c1e 100644 --- a/campcaster/src/modules/widgets/src/WidgetFactory.cxx +++ b/campcaster/src/modules/widgets/src/WidgetFactory.cxx @@ -511,14 +511,15 @@ WidgetFactory :: createOperatorComboBoxText( *----------------------------------------------------------------------------*/ ComboBoxText * WidgetFactory :: createNumericComboBoxText(int lowerLimit, - int upperLimit) + int upperLimit, + int minLength) throw () { ComboBoxText * comboBox = new ComboBoxText(comboBoxLeftImage, comboBoxCenterImage, comboBoxRightImage); for (int i = lowerLimit; i <= upperLimit; ++i) { - comboBox->append_text(itoa(i)); + comboBox->append_text(itoa(i, minLength)); } return comboBox; } @@ -707,9 +708,14 @@ WidgetFactory :: createDateTimeChooserWindow(Ptr<ResourceBundle>::Ref bundle) * Convert an integer to a string. *----------------------------------------------------------------------------*/ Glib::ustring -WidgetFactory :: itoa(int number) throw () +WidgetFactory :: itoa(int number, + int minLength) throw () { std::ostringstream stream; + if (minLength > 0) { + stream << std::setw(minLength) + << std::setfill('0'); + } stream << number; Glib::ustring string = stream.str(); return string; diff --git a/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.cxx b/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.cxx index 2f390c965..537b18ab9 100644 --- a/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.cxx @@ -78,6 +78,8 @@ SchedulePlaylistWindow :: SchedulePlaylistWindow ( "hourLabel"))); minuteLabel = Gtk::manage(new Gtk::Label(*getResourceUstring( "minuteLabel"))); + secondLabel = Gtk::manage(new Gtk::Label(*getResourceUstring( + "secondLabel"))); scheduleButton = Gtk::manage(wf->createButton( *getResourceUstring("scheduleButtonLabel"))); closeButton = Gtk::manage(wf->createButton( @@ -90,18 +92,21 @@ SchedulePlaylistWindow :: SchedulePlaylistWindow ( playlistLabel = Gtk::manage(new Gtk::Label(*playlist->getTitle())); calendar = Gtk::manage(new Gtk::Calendar()); hourEntry = Gtk::manage(wf->createNumericComboBoxText(0, 23)); - minuteEntry = Gtk::manage(wf->createNumericComboBoxText(0, 59)); + minuteEntry = Gtk::manage(wf->createNumericComboBoxText(0, 59, 2)); + secondEntry = Gtk::manage(wf->createNumericComboBoxText(0, 59, 2)); layout = Gtk::manage(new Gtk::Table()); - layout->attach(*playlistLabel, 0, 4, 0, 1); - layout->attach(*calendar, 0, 4, 1, 2); + layout->attach(*playlistLabel, 0, 6, 0, 1); + layout->attach(*calendar, 0, 6, 1, 2); layout->attach(*hourLabel, 0, 1, 2, 3); layout->attach(*hourEntry, 1, 2, 2, 3); layout->attach(*minuteLabel, 2, 3, 2, 3); layout->attach(*minuteEntry, 3, 4, 2, 3); - layout->attach(*scheduleButton, 2, 4, 3, 4); - layout->attach(*closeButton , 2, 4, 4, 5); + layout->attach(*secondLabel, 4, 5, 2, 3); + layout->attach(*secondEntry, 5, 6, 2, 3); + layout->attach(*scheduleButton, 4, 6, 3, 4); + layout->attach(*closeButton , 4, 6, 4, 5); // register the signal handler for the schedule getting clicked. scheduleButton->signal_clicked().connect(sigc::mem_fun(*this, @@ -142,9 +147,19 @@ SchedulePlaylistWindow :: onScheduleButtonClicked (void) throw () Ptr<std::string>::Ref timeStr(new std::string( hourEntry->get_active_text())); *timeStr += ":"; - *timeStr += minuteEntry->get_active_text(); - *timeStr += ":00.00"; - + Glib::ustring minutes = minuteEntry->get_active_text(); + if (minutes == "") { + minutes = "00"; + } + *timeStr += minutes; + *timeStr += ":"; + Glib::ustring seconds = secondEntry->get_active_text(); + if (seconds == "") { + seconds = "00"; + } + *timeStr += seconds; + *timeStr += ".00"; + Ptr<posix_time::ptime>::Ref selectedTime; try { diff --git a/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.h b/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.h index 678e65c41..2f98dc564 100644 --- a/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.h +++ b/campcaster/src/products/gLiveSupport/src/SchedulePlaylistWindow.h @@ -134,6 +134,16 @@ class SchedulePlaylistWindow : public GuiWindow */ ComboBoxText * minuteEntry; + /** + * The second label. + */ + Gtk::Label * secondLabel; + + /** + * The second entry field. + */ + ComboBoxText * secondEntry; + /** * The schedule button. */ diff --git a/campcaster/src/products/gLiveSupport/var/es.txt b/campcaster/src/products/gLiveSupport/var/es.txt index 2b3d42f8a..4b9920c93 100644 --- a/campcaster/src/products/gLiveSupport/var/es.txt +++ b/campcaster/src/products/gLiveSupport/var/es.txt @@ -178,6 +178,7 @@ es:table hourLabel:string { "hora: " } minuteLabel:string { "minuto: " } + secondLabel:string { "seconds: " } scheduleButtonLabel:string { "programado" } closeButtonLabel:string { "cerrar" } } diff --git a/campcaster/src/products/gLiveSupport/var/hu.txt b/campcaster/src/products/gLiveSupport/var/hu.txt index 7edaf42c3..b8be8ffb9 100644 --- a/campcaster/src/products/gLiveSupport/var/hu.txt +++ b/campcaster/src/products/gLiveSupport/var/hu.txt @@ -174,6 +174,7 @@ hu:table hourLabel:string { "óra: " } minuteLabel:string { "perc: " } + secondLabel:string { "másodperc: " } scheduleButtonLabel:string { "időzít" } closeButtonLabel:string { "bezár" } } diff --git a/campcaster/src/products/gLiveSupport/var/nl.txt b/campcaster/src/products/gLiveSupport/var/nl.txt index 2a4618470..f16f40f40 100644 --- a/campcaster/src/products/gLiveSupport/var/nl.txt +++ b/campcaster/src/products/gLiveSupport/var/nl.txt @@ -176,6 +176,7 @@ nl:table hourLabel:string { "uur: " } minuteLabel:string { "minuten: " } + secondLabel:string { "seconds: " } scheduleButtonLabel:string { "schedule" } closeButtonLabel:string { "sluiten" } } diff --git a/campcaster/src/products/gLiveSupport/var/pl.txt b/campcaster/src/products/gLiveSupport/var/pl.txt index 029217a48..904475a36 100644 --- a/campcaster/src/products/gLiveSupport/var/pl.txt +++ b/campcaster/src/products/gLiveSupport/var/pl.txt @@ -176,6 +176,7 @@ pl:table hourLabel:string { "godzina: " } minuteLabel:string { "minuta: " } + secondLabel:string { "seconds: " } scheduleButtonLabel:string { "zaprogramuj" } closeButtonLabel:string { "zamknij" } } diff --git a/campcaster/src/products/gLiveSupport/var/root.txt b/campcaster/src/products/gLiveSupport/var/root.txt index 6ef312aa9..3d8b7d183 100644 --- a/campcaster/src/products/gLiveSupport/var/root.txt +++ b/campcaster/src/products/gLiveSupport/var/root.txt @@ -176,6 +176,7 @@ root:table hourLabel:string { "hour: " } minuteLabel:string { "minute: " } + secondLabel:string { "seconds: " } scheduleButtonLabel:string { "schedule" } closeButtonLabel:string { "close" } } diff --git a/campcaster/src/products/gLiveSupport/var/sr_CS.txt b/campcaster/src/products/gLiveSupport/var/sr_CS.txt index 11e24113d..82285deb0 100644 --- a/campcaster/src/products/gLiveSupport/var/sr_CS.txt +++ b/campcaster/src/products/gLiveSupport/var/sr_CS.txt @@ -171,6 +171,7 @@ sr_CS:table hourLabel:string { "sat: " } minuteLabel:string { "minut: " } + secondLabel:string { "seconds: " } scheduleButtonLabel:string { "programiraj" } closeButtonLabel:string { "zatvori" } } diff --git a/campcaster/src/products/gLiveSupport/var/sr_CS_CYRILLIC.txt b/campcaster/src/products/gLiveSupport/var/sr_CS_CYRILLIC.txt index fb9119b9f..a3a8b5cc3 100644 --- a/campcaster/src/products/gLiveSupport/var/sr_CS_CYRILLIC.txt +++ b/campcaster/src/products/gLiveSupport/var/sr_CS_CYRILLIC.txt @@ -171,6 +171,7 @@ sr_CS_CYRILLIC:table hourLabel:string { "сат: " } minuteLabel:string { "минут: " } + secondLabel:string { "seconds: " } scheduleButtonLabel:string { "програмирај" } closeButtonLabel:string { "затвори" } } diff --git a/campcaster/src/products/scheduler/src/PlaylistEvent.cxx b/campcaster/src/products/scheduler/src/PlaylistEvent.cxx index 2eaa73abe..de255bcc5 100644 --- a/campcaster/src/products/scheduler/src/PlaylistEvent.cxx +++ b/campcaster/src/products/scheduler/src/PlaylistEvent.cxx @@ -92,6 +92,7 @@ PlaylistEvent :: PlaylistEvent( void PlaylistEvent :: initialize(void) throw (std::exception) { +std::cerr << "PlaylistEvent :: initialize BEGIN\n"; if (state != created) { throw std::logic_error("PlaylistEvent in bad state"); } @@ -102,6 +103,7 @@ PlaylistEvent :: initialize(void) throw (std::exception) ->getId())); try { playlist = storage->acquirePlaylist(sessionId, playlistId); +std::cerr << "PlaylistEvent :: initialize acquired playlist\n"; } catch (Core::XmlRpcException &e) { std::string errorMessage = "storage server error: "; errorMessage += e.what(); @@ -130,6 +132,7 @@ PlaylistEvent :: deInitialize(void) throw () } playlist.reset(); state = deInitialized; +std::cerr << "PlaylistEvent :: deInitialize END\n"; } @@ -139,6 +142,7 @@ PlaylistEvent :: deInitialize(void) throw () void PlaylistEvent :: start(void) throw () { +std::cerr << "PlaylistEvent :: start BEGIN\n"; if (state != initialized) { // TODO: handle error? return; @@ -147,6 +151,7 @@ PlaylistEvent :: start(void) throw () try { audioPlayer->open(*playlist->getUri()); audioPlayer->start(); +std::cerr << "PlaylistEvent :: audio player started\n"; playLog->addPlayLogEntry(playlist->getId(), TimeConversion::now()); } catch (std::invalid_argument &e) { @@ -166,6 +171,7 @@ PlaylistEvent :: start(void) throw () void PlaylistEvent :: stop(void) throw () { +std::cerr << "PlaylistEvent :: stop BEGIN\n"; if (state != running) { // TODO: handle error? return; @@ -174,6 +180,7 @@ PlaylistEvent :: stop(void) throw () try { audioPlayer->stop(); audioPlayer->close(); +std::cerr << "PlaylistEvent :: audio player stopped\n"; } catch (std::logic_error &e) { // TODO: handle error // NOTE: this may not be an error, because the user may have stopped