fixed #2036
This commit is contained in:
parent
9edd10a58c
commit
f54fd605c0
|
@ -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.
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
|
|
|
@ -178,6 +178,7 @@ es:table
|
|||
|
||||
hourLabel:string { "hora: " }
|
||||
minuteLabel:string { "minuto: " }
|
||||
secondLabel:string { "seconds: " }
|
||||
scheduleButtonLabel:string { "programado" }
|
||||
closeButtonLabel:string { "cerrar" }
|
||||
}
|
||||
|
|
|
@ -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" }
|
||||
}
|
||||
|
|
|
@ -176,6 +176,7 @@ nl:table
|
|||
|
||||
hourLabel:string { "uur: " }
|
||||
minuteLabel:string { "minuten: " }
|
||||
secondLabel:string { "seconds: " }
|
||||
scheduleButtonLabel:string { "schedule" }
|
||||
closeButtonLabel:string { "sluiten" }
|
||||
}
|
||||
|
|
|
@ -176,6 +176,7 @@ pl:table
|
|||
|
||||
hourLabel:string { "godzina: " }
|
||||
minuteLabel:string { "minuta: " }
|
||||
secondLabel:string { "seconds: " }
|
||||
scheduleButtonLabel:string { "zaprogramuj" }
|
||||
closeButtonLabel:string { "zamknij" }
|
||||
}
|
||||
|
|
|
@ -176,6 +176,7 @@ root:table
|
|||
|
||||
hourLabel:string { "hour: " }
|
||||
minuteLabel:string { "minute: " }
|
||||
secondLabel:string { "seconds: " }
|
||||
scheduleButtonLabel:string { "schedule" }
|
||||
closeButtonLabel:string { "close" }
|
||||
}
|
||||
|
|
|
@ -171,6 +171,7 @@ sr_CS:table
|
|||
|
||||
hourLabel:string { "sat: " }
|
||||
minuteLabel:string { "minut: " }
|
||||
secondLabel:string { "seconds: " }
|
||||
scheduleButtonLabel:string { "programiraj" }
|
||||
closeButtonLabel:string { "zatvori" }
|
||||
}
|
||||
|
|
|
@ -171,6 +171,7 @@ sr_CS_CYRILLIC:table
|
|||
|
||||
hourLabel:string { "сат: " }
|
||||
minuteLabel:string { "минут: " }
|
||||
secondLabel:string { "seconds: " }
|
||||
scheduleButtonLabel:string { "програмирај" }
|
||||
closeButtonLabel:string { "затвори" }
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue