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];
gLiveSupport->openPlaylistForEditing(playable->getId()); try {
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

@ -1,29 +1,30 @@
root:table root:table
{ {
windowTitle:string { "LiveSupport Master Panel" } windowTitle:string { "LiveSupport Master Panel" }
notLoggedInMsg:string { "Not logged in" } notLoggedInMsg:string { "Not logged in" }
loggedInMsg:string { "Logged in as {0}" } loggedInMsg:string { "Logged in as {0}" }
loginButtonLabel:string { "log in" } loginButtonLabel:string { "log in" }
logoutButtonLabel:string { "log out" } logoutButtonLabel:string { "log out" }
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
schedulerButtonLabel:string { "scheduler" } { "edit playlist" }
searchButtonLabel:string { "search" } schedulerButtonLabel:string { "scheduler" }
searchButtonLabel:string { "search" }
cancelButtonLabel:string { "Cancel" } cancelButtonLabel:string { "Cancel" }
noButtonLabel:string { "No" } noButtonLabel:string { "No" }
yesButtonLabel:string { "Yes" } yesButtonLabel:string { "Yes" }
okButtonLabel:string { "OK" } okButtonLabel:string { "OK" }
localeNotAvailableMsg:string { "Locale {0} not available" } localeNotAvailableMsg:string { "Locale {0} not available" }
schedulerNotReachableMsg:string { "Scheduler server not available" } schedulerNotReachableMsg:string { "Scheduler server not available" }
storageNotReachableMsg:string { "Storage server not available" } storageNotReachableMsg:string { "Storage server not available" }
authenticationNotReachableMsg:string authenticationNotReachableMsg:string
{ "Authentication server not available" } { "Authentication server not available" }
audioErrorMsg { "Audio player error: " } audioErrorMsg { "Audio player error: " }
sureToExitMsg:string { "Are you sure you want to exit?" } sureToExitMsg:string { "Are you sure you want to exit?" }
loginWindow:table loginWindow:table
{ {
@ -37,161 +38,176 @@ root:table
audioClipListWindow:table audioClipListWindow:table
{ {
windowTitle:string { "LiveSupport Audio Clip Window" } windowTitle:string { "LiveSupport Audio Clip Window" }
idColumnLabel:string { "id" } idColumnLabel:string { "id" }
lengthColumnLabel:string { "length" } lengthColumnLabel:string { "length" }
uriColumnLabel:string { "URI" } uriColumnLabel:string { "URI" }
tokenColumnLabel:string { "token" } tokenColumnLabel:string { "token" }
closeButtonLabel:string { "close" } closeButtonLabel:string { "close" }
} }
scratchpadWindow:table scratchpadWindow:table
{ {
windowTitle:string { "LiveSupport Scratchpad" } windowTitle:string { "LiveSupport Scratchpad" }
typeColumnLabel:string { "Type" } typeColumnLabel:string { "Type" }
titleColumnLabel:string { "Title" } titleColumnLabel:string { "Title" }
addToPlaylistButtonLabel:string { "Add to playlist" } addToPlaylistButtonLabel:string
clearListButtonLabel:string { "Clear list" } { "Add to playlist" }
removeButtonLabel:string { "Remove item(s)" } clearListButtonLabel:string { "Clear list" }
removeButtonLabel:string { "Remove item(s)" }
upMenuItem:string { "Move _Up" } upMenuItem:string { "Move _Up" }
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" }
cueMenuItem:string { "Pre_view" } schedulePlaylistMenuItem:string
addToLiveModeMenuItem:string { "Add To _Live Mode" } { "_Schedule" }
cueMenuItem:string { "Pre_view" }
addToLiveModeMenuItem:string
{ "Add To _Live Mode" }
cannotEditPlaylistMsg:string
{ "Could not open playlist for editing." }
} }
playlistListWindow:table playlistListWindow:table
{ {
windowTitle:string { "LiveSupport Playlist Window" } windowTitle:string { "LiveSupport Playlist Window" }
listBoxLabel { "Playlists" } listBoxLabel { "Playlists" }
detailBoxLabel { "Playlist details" } detailBoxLabel { "Playlist details" }
idColumnLabel:string { "id" } idColumnLabel:string { "id" }
lengthColumnLabel:string { "length" } lengthColumnLabel:string { "length" }
uriColumnLabel:string { "URI" } uriColumnLabel:string { "URI" }
tokenColumnLabel:string { "token" } tokenColumnLabel:string { "token" }
closeButtonLabel:string { "close" } closeButtonLabel:string { "close" }
} }
uploadFileWindow:table uploadFileWindow: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" }
creatorLabel:string { "Creator" } creatorLabel:string { "Creator" }
genreLabel:string { "Genre" } genreLabel:string { "Genre" }
fileFormatLabel:string { "File Type" } fileFormatLabel:string { "File Type" }
lengthLabel:string { "Duration" } lengthLabel:string { "Duration" }
uploadButtonLabel:string { "Upload" } uploadButtonLabel:string { "Upload" }
closeButtonLabel:string { "Cancel" } closeButtonLabel:string { "Cancel" }
fileChooserDialogTitle:string { "Choose a File" } fileChooserDialogTitle:string
clipUploadedMsg:string { "Uploaded clip ''{0}''." } { "Choose a File" }
couldNotOpenFileMsg:string { "The file could not be opened." } clipUploadedMsg:string { "Uploaded clip ''{0}''." }
missingTitleMsg:string { "Please enter a title." } couldNotOpenFileMsg:string { "The file could not be opened." }
missingTitleMsg:string { "Please enter a title." }
} }
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" }
lengthColumnLabel:string { "Length" } lengthColumnLabel:string { "Length" }
fadeInColumnLabel:string { "Fade in" } fadeInColumnLabel:string { "Fade in" }
fadeOutColumnLabel:string { "Fade out" } fadeOutColumnLabel:string { "Fade out" }
nameLabel:string { "Name" } nameLabel:string { "Name" }
saveButtonLabel:string { "Save" } saveButtonLabel:string { "Save" }
closeButtonLabel:string { "Close" } closeButtonLabel:string { "Close" }
lockFadesCheckButtonLabel:string lockFadesCheckButtonLabel:string
{ "Lock fade-out to following fade-in" } { "Lock fade-out to following fade-in" }
statusBar:string { "status bar" } statusBar:string { "status bar" }
upMenuItem:string { "Move _Up" } upMenuItem:string { "Move _Up" }
downMenuItem:string { "Move D_own" } downMenuItem:string { "Move D_own" }
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
emptyTitleErrorMsg:string { "Please enter a title." } { "Do you want to save the playlist?" }
emptyTitleErrorMsg:string { "Please enter a title." }
} }
schedulerWindow:table schedulerWindow:table
{ {
windowTitle:string { "LiveSupport Scheduler Window" } windowTitle:string { "LiveSupport Scheduler Window" }
startColumnLabel:string { "start" } startColumnLabel:string { "start" }
titleColumnLabel:string { "title" } titleColumnLabel:string { "title" }
endColumnLabel:string { "end" } endColumnLabel:string { "end" }
deleteMenuItem:string { "_Delete" } deleteMenuItem:string { "_Delete" }
closeButtonLabel:string { "close" } closeButtonLabel:string { "close" }
} }
schedulePlaylistWindow:table schedulePlaylistWindow:table
{ {
windowTitle:string { "LiveSupport Schedule Playlist Window" } windowTitle:string { "LiveSupport Schedule Playlist Window" }
hourLabel:string { "hour: " } hourLabel:string { "hour: " }
minuteLabel:string { "minute: " } minuteLabel:string { "minute: " }
scheduleButtonLabel:string { "schedule" } scheduleButtonLabel:string { "schedule" }
closeButtonLabel:string { "close" } closeButtonLabel:string { "close" }
} }
searchWindow:table searchWindow:table
{ {
windowTitle:string { "LiveSupport Search/Browse Window" } windowTitle:string { "LiveSupport Search/Browse Window" }
simpleSearchTab:string { "Search" } simpleSearchTab:string { "Search" }
advancedSearchTab:string { "Advanced Search" } advancedSearchTab:string { "Advanced Search" }
browseTab:string { "Browse" } browseTab:string { "Browse" }
searchByTextLabel:string { "Search by" } searchByTextLabel:string { "Search by" }
searchButtonLabel:string { "Search" } searchButtonLabel:string { "Search" }
typeColumnLabel:string { "Type" } typeColumnLabel:string { "Type" }
titleColumnLabel:string { "Title" } titleColumnLabel:string { "Title" }
creatorColumnLabel:string { "Creator" } creatorColumnLabel:string { "Creator" }
lengthColumnLabel:string { "Length" } lengthColumnLabel:string { "Length" }
partialOperatorDisplay:string { "contains" } partialOperatorDisplay:string
prefixOperatorDisplay:string { "starts with" } { "contains" }
=OperatorDisplay:string { "equals" } prefixOperatorDisplay:string
<=OperatorDisplay:string { "<=" } { "starts with" }
>=OperatorDisplay:string { ">=" } =OperatorDisplay:string { "equals" }
<=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
{ {
windowTitle:string { "LiveSupport Live Mode Window" } windowTitle:string { "LiveSupport Live Mode Window" }
cueMenuItem:string { "Pre_view" } cueMenuItem:string { "Pre_view" }
upMenuItem:string { "Move _Up" } upMenuItem:string { "Move _Up" }
downMenuItem:string { "Move D_own" } downMenuItem:string { "Move D_own" }
removeMenuItem:string { "_Remove" } removeMenuItem:string { "_Remove" }
playMenuItem:string { "_Play" } playMenuItem:string { "_Play" }
cuePlayerLabel:string { "Preview" } cuePlayerLabel:string { "Preview" }
} }
metadataTypes:table metadataTypes:table