added error checking to ScratchpadWindow::onEditPlaylist();

prettified Widgets::MessageWindow
This commit is contained in:
fgerlits 2005-07-26 14:47:22 +00:00
parent 1769fe5b48
commit dfc8c0d356
5 changed files with 157 additions and 131 deletions

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.3 $ Version : $Revision: 1.4 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/MessageWindow.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/widgets/src/MessageWindow.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -56,25 +56,29 @@ using namespace LiveSupport::Widgets;
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
MessageWindow :: MessageWindow (Ptr<Glib::ustring>::Ref message) MessageWindow :: MessageWindow (Ptr<Glib::ustring>::Ref message)
throw () throw ()
: WhiteWindow(*message, : WhiteWindow("",
Colors::White, Colors::White,
WidgetFactory::getInstance()->getWhiteWindowCorners(), WidgetFactory::getInstance()->getWhiteWindowCorners(),
0) WhiteWindow::isModal)
{ {
Ptr<WidgetFactory>::Ref widgetFactory = WidgetFactory::getInstance(); Ptr<WidgetFactory>::Ref widgetFactory = WidgetFactory::getInstance();
messageLabel = Gtk::manage(new Gtk::Label(*message)); messageLabel = Gtk::manage(new Gtk::Label(*message));
Gtk::Box * messageLabelBox(new Gtk::HBox);
messageLabelBox->pack_start(*messageLabel, false, false, 5);
// init the okButton // init the okButton
// TODO: localize the OK text on the button // TODO: localize the OK text on the button
okButton = Gtk::manage(widgetFactory->createButton("OK")); okButton = Gtk::manage(widgetFactory->createButton("OK"));
okButton->signal_clicked().connect(sigc::mem_fun(*this, okButton->signal_clicked().connect(sigc::mem_fun(*this,
&MessageWindow::onOkButtonClicked)); &MessageWindow::onOkButtonClicked));
Gtk::ButtonBox * okButtonBox = Gtk::manage(new Gtk::HButtonBox);
okButtonBox->pack_start(*okButton, 5, 5);
layout = Gtk::manage(new Gtk::VBox()); layout = Gtk::manage(new Gtk::VBox());
layout->pack_start(*messageLabel, true, true); layout->pack_start(*messageLabelBox, true, true, 5);
layout->pack_start(*okButton); layout->pack_start(*okButtonBox, false, false, 5);
add(*layout); add(*layout);
show_all(); show_all();

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.6 $ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SchedulePlaylistWindow.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SchedulePlaylistWindow.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -142,18 +142,18 @@ SchedulePlaylistWindow :: onScheduleButtonClicked (void) throw ()
// get the hour and minute from the entries // get the hour and minute from the entries
// and construct an HH:MM:00.00 string from it // and construct an HH:MM:00.00 string from it
Glib::ustring timeStr = hourEntry->get_text(); Ptr<std::string>::Ref timeStr(new std::string(hourEntry->get_text()));
timeStr += ":"; *timeStr += ":";
timeStr += minuteEntry->get_text(); *timeStr += minuteEntry->get_text();
timeStr += ":00.00"; *timeStr += ":00.00";
Ptr<posix_time::ptime>::Ref selectedTime; Ptr<posix_time::ptime>::Ref selectedTime;
try { try {
gregorian::date date(year, month+1, day); gregorian::date date(year, month+1, day);
posix_time::time_duration time(duration_from_string(timeStr.raw())); Ptr<posix_time::time_duration>::Ref
time = TimeConversion::parseTimeDuration(timeStr);
selectedTime.reset(new posix_time::ptime(date, time)); selectedTime.reset(new posix_time::ptime(date, *time));
} catch (std::exception &e) { } catch (std::exception &e) {
// most probably duration_from_string failed // most probably duration_from_string failed
// TODO: notify user // TODO: notify user

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.27 $ Version : $Revision: 1.28 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/ScratchpadWindow.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/ScratchpadWindow.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -507,7 +507,12 @@ void
ScratchpadWindow :: onEditPlaylist(void) throw () ScratchpadWindow :: onEditPlaylist(void) throw ()
{ {
Ptr<Playable>::Ref playable = currentRow[modelColumns.playableColumn]; Ptr<Playable>::Ref playable = currentRow[modelColumns.playableColumn];
try {
gLiveSupport->openPlaylistForEditing(playable->getId()); gLiveSupport->openPlaylistForEditing(playable->getId());
} catch (XmlRpcException &e) {
gLiveSupport->displayMessageWindow(getResourceUstring(
"cannotEditPlaylistMsg" ));
}
} }

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $ Author : $Author: fgerlits $
Version : $Revision: 1.25 $ Version : $Revision: 1.26 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -453,7 +453,8 @@ SimplePlaylistManagementWindow :: onFadeInfoEdited(
Ptr<time_duration>::Ref newTime; Ptr<time_duration>::Ref newTime;
try { try {
newTime.reset(new time_duration(duration_from_string(newText))); Ptr<std::string>::Ref newTextPtr(new std::string(newText));
newTime = TimeConversion::parseTimeDuration(newTextPtr);
} catch (boost::bad_lexical_cast &e) { } catch (boost::bad_lexical_cast &e) {
showContents(); // bad time format; restore previous state showContents(); // bad time format; restore previous state
return; return;

View file

@ -8,7 +8,8 @@ root:table
liveModeButtonLabel:string { "live mode" } liveModeButtonLabel:string { "live mode" }
uploadFileButtonLabel:string { "upload file" } uploadFileButtonLabel:string { "upload file" }
scratchpadButtonLabel:string { "scratchpad" } scratchpadButtonLabel:string { "scratchpad" }
simplePlaylistMgmtButtonLabel:string { "edit playlist" } simplePlaylistMgmtButtonLabel:string
{ "edit playlist" }
schedulerButtonLabel:string { "scheduler" } schedulerButtonLabel:string { "scheduler" }
searchButtonLabel:string { "search" } searchButtonLabel:string { "search" }
@ -53,7 +54,8 @@ root:table
typeColumnLabel:string { "Type" } typeColumnLabel:string { "Type" }
titleColumnLabel:string { "Title" } titleColumnLabel:string { "Title" }
addToPlaylistButtonLabel:string { "Add to playlist" } addToPlaylistButtonLabel:string
{ "Add to playlist" }
clearListButtonLabel:string { "Clear list" } clearListButtonLabel:string { "Clear list" }
removeButtonLabel:string { "Remove item(s)" } removeButtonLabel:string { "Remove item(s)" }
@ -61,10 +63,16 @@ root:table
downMenuItem:string { "Move D_own" } downMenuItem:string { "Move D_own" }
removeMenuItem:string { "_Remove" } removeMenuItem:string { "_Remove" }
editPlaylistMenuItem:string { "_Edit" } editPlaylistMenuItem:string { "_Edit" }
addToPlaylistMenuItem:string { "_Add To Playlist" } addToPlaylistMenuItem:string
schedulePlaylistMenuItem:string { "_Schedule" } { "_Add To Playlist" }
schedulePlaylistMenuItem:string
{ "_Schedule" }
cueMenuItem:string { "Pre_view" } cueMenuItem:string { "Pre_view" }
addToLiveModeMenuItem:string { "Add To _Live Mode" } addToLiveModeMenuItem:string
{ "Add To _Live Mode" }
cannotEditPlaylistMsg:string
{ "Could not open playlist for editing." }
} }
playlistListWindow:table playlistListWindow:table
@ -87,7 +95,8 @@ root:table
windowTitle:string { "Upload File" } windowTitle:string { "Upload File" }
chooseFileLabel:string { "Filename" } chooseFileLabel:string { "Filename" }
chooseFileButtonLabel:string { "Browse" } chooseFileButtonLabel:string
{ "Browse" }
mainSectionLabel:string { "Main" } mainSectionLabel:string { "Main" }
titleLabel:string { "Title" } titleLabel:string { "Title" }
@ -99,7 +108,8 @@ root:table
uploadButtonLabel:string { "Upload" } uploadButtonLabel:string { "Upload" }
closeButtonLabel:string { "Cancel" } closeButtonLabel:string { "Cancel" }
fileChooserDialogTitle:string { "Choose a File" } fileChooserDialogTitle:string
{ "Choose a File" }
clipUploadedMsg:string { "Uploaded clip ''{0}''." } clipUploadedMsg:string { "Uploaded clip ''{0}''." }
couldNotOpenFileMsg:string { "The file could not be opened." } couldNotOpenFileMsg:string { "The file could not be opened." }
missingTitleMsg:string { "Please enter a title." } missingTitleMsg:string { "Please enter a title." }
@ -107,7 +117,8 @@ root:table
simplePlaylistManagementWindow:table simplePlaylistManagementWindow:table
{ {
windowTitle:string { "LiveSupport Simple Playlist Management Window" } windowTitle:string { "LiveSupport Simple Playlist Management"
" Window" }
startColumnLabel:string { "Start" } startColumnLabel:string { "Start" }
titleColumnLabel:string { "Title" } titleColumnLabel:string { "Title" }
@ -126,7 +137,8 @@ root:table
removeMenuItem:string { "_Remove" } removeMenuItem:string { "_Remove" }
playlistSavedMsg:string { "Saved playlist ''{0}''." } playlistSavedMsg:string { "Saved playlist ''{0}''." }
savePlaylistDialogMsg:string { "Do you want to save the playlist?" } savePlaylistDialogMsg:string
{ "Do you want to save the playlist?" }
emptyTitleErrorMsg:string { "Please enter a title." } emptyTitleErrorMsg:string { "Please enter a title." }
} }
@ -169,16 +181,20 @@ root:table
creatorColumnLabel:string { "Creator" } creatorColumnLabel:string { "Creator" }
lengthColumnLabel:string { "Length" } lengthColumnLabel:string { "Length" }
partialOperatorDisplay:string { "contains" } partialOperatorDisplay:string
prefixOperatorDisplay:string { "starts with" } { "contains" }
prefixOperatorDisplay:string
{ "starts with" }
=OperatorDisplay:string { "equals" } =OperatorDisplay:string { "equals" }
<=OperatorDisplay:string { "<=" } <=OperatorDisplay:string { "<=" }
>=OperatorDisplay:string { ">=" } >=OperatorDisplay:string { ">=" }
allStringForBrowse { "--- all ---" } allStringForBrowse { "--- all ---" }
addToScratchpadMenuItem:string { "_Add To Scratchpad" } addToScratchpadMenuItem:string
addToLiveModeMenuItem:string { "Add To _Live Mode" } { "_Add To Scratchpad" }
addToLiveModeMenuItem:string
{ "Add To _Live Mode" }
} }
liveModeWindow:table liveModeWindow:table