From dfc8c0d35688e40a9dc370309eb5b648980ea9f4 Mon Sep 17 00:00:00 2001 From: fgerlits Date: Tue, 26 Jul 2005 14:47:22 +0000 Subject: [PATCH] added error checking to ScratchpadWindow::onEditPlaylist(); prettified Widgets::MessageWindow --- .../modules/widgets/src/MessageWindow.cxx | 14 +- .../src/SchedulePlaylistWindow.cxx | 18 +- .../gLiveSupport/src/ScratchpadWindow.cxx | 9 +- .../src/SimplePlaylistManagementWindow.cxx | 5 +- .../products/gLiveSupport/var/root.txt | 242 ++++++++++-------- 5 files changed, 157 insertions(+), 131 deletions(-) diff --git a/livesupport/modules/widgets/src/MessageWindow.cxx b/livesupport/modules/widgets/src/MessageWindow.cxx index cd21fba84..a3591cfea 100644 --- a/livesupport/modules/widgets/src/MessageWindow.cxx +++ b/livesupport/modules/widgets/src/MessageWindow.cxx @@ -22,7 +22,7 @@ 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 $ ------------------------------------------------------------------------------*/ @@ -56,25 +56,29 @@ using namespace LiveSupport::Widgets; *----------------------------------------------------------------------------*/ MessageWindow :: MessageWindow (Ptr::Ref message) throw () - : WhiteWindow(*message, + : WhiteWindow("", Colors::White, WidgetFactory::getInstance()->getWhiteWindowCorners(), - 0) + WhiteWindow::isModal) { Ptr::Ref widgetFactory = WidgetFactory::getInstance(); messageLabel = Gtk::manage(new Gtk::Label(*message)); + Gtk::Box * messageLabelBox(new Gtk::HBox); + messageLabelBox->pack_start(*messageLabel, false, false, 5); // init the okButton // TODO: localize the OK text on the button okButton = Gtk::manage(widgetFactory->createButton("OK")); okButton->signal_clicked().connect(sigc::mem_fun(*this, &MessageWindow::onOkButtonClicked)); + Gtk::ButtonBox * okButtonBox = Gtk::manage(new Gtk::HButtonBox); + okButtonBox->pack_start(*okButton, 5, 5); layout = Gtk::manage(new Gtk::VBox()); - layout->pack_start(*messageLabel, true, true); - layout->pack_start(*okButton); + layout->pack_start(*messageLabelBox, true, true, 5); + layout->pack_start(*okButtonBox, false, false, 5); add(*layout); show_all(); diff --git a/livesupport/products/gLiveSupport/src/SchedulePlaylistWindow.cxx b/livesupport/products/gLiveSupport/src/SchedulePlaylistWindow.cxx index 1efac9f81..bceaf5af1 100644 --- a/livesupport/products/gLiveSupport/src/SchedulePlaylistWindow.cxx +++ b/livesupport/products/gLiveSupport/src/SchedulePlaylistWindow.cxx @@ -22,7 +22,7 @@ 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 $ ------------------------------------------------------------------------------*/ @@ -142,18 +142,18 @@ SchedulePlaylistWindow :: onScheduleButtonClicked (void) throw () // get the hour and minute from the entries // and construct an HH:MM:00.00 string from it - Glib::ustring timeStr = hourEntry->get_text(); - timeStr += ":"; - timeStr += minuteEntry->get_text(); - timeStr += ":00.00"; + Ptr::Ref timeStr(new std::string(hourEntry->get_text())); + *timeStr += ":"; + *timeStr += minuteEntry->get_text(); + *timeStr += ":00.00"; Ptr::Ref selectedTime; try { - gregorian::date date(year, month+1, day); - posix_time::time_duration time(duration_from_string(timeStr.raw())); - - selectedTime.reset(new posix_time::ptime(date, time)); + gregorian::date date(year, month+1, day); + Ptr::Ref + time = TimeConversion::parseTimeDuration(timeStr); + selectedTime.reset(new posix_time::ptime(date, *time)); } catch (std::exception &e) { // most probably duration_from_string failed // TODO: notify user diff --git a/livesupport/products/gLiveSupport/src/ScratchpadWindow.cxx b/livesupport/products/gLiveSupport/src/ScratchpadWindow.cxx index d9b62ee7b..83cf91ebd 100644 --- a/livesupport/products/gLiveSupport/src/ScratchpadWindow.cxx +++ b/livesupport/products/gLiveSupport/src/ScratchpadWindow.cxx @@ -22,7 +22,7 @@ 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 $ ------------------------------------------------------------------------------*/ @@ -507,7 +507,12 @@ void ScratchpadWindow :: onEditPlaylist(void) throw () { Ptr::Ref playable = currentRow[modelColumns.playableColumn]; - gLiveSupport->openPlaylistForEditing(playable->getId()); + try { + gLiveSupport->openPlaylistForEditing(playable->getId()); + } catch (XmlRpcException &e) { + gLiveSupport->displayMessageWindow(getResourceUstring( + "cannotEditPlaylistMsg" )); + } } diff --git a/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.cxx b/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.cxx index d813b5005..084d217b9 100644 --- a/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.cxx +++ b/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.cxx @@ -22,7 +22,7 @@ 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 $ ------------------------------------------------------------------------------*/ @@ -453,7 +453,8 @@ SimplePlaylistManagementWindow :: onFadeInfoEdited( Ptr::Ref newTime; try { - newTime.reset(new time_duration(duration_from_string(newText))); + Ptr::Ref newTextPtr(new std::string(newText)); + newTime = TimeConversion::parseTimeDuration(newTextPtr); } catch (boost::bad_lexical_cast &e) { showContents(); // bad time format; restore previous state return; diff --git a/livesupport/products/gLiveSupport/var/root.txt b/livesupport/products/gLiveSupport/var/root.txt index 41bd29227..427c0549f 100644 --- a/livesupport/products/gLiveSupport/var/root.txt +++ b/livesupport/products/gLiveSupport/var/root.txt @@ -1,29 +1,30 @@ root:table { - windowTitle:string { "LiveSupport Master Panel" } - notLoggedInMsg:string { "Not logged in" } - loggedInMsg:string { "Logged in as {0}" } - loginButtonLabel:string { "log in" } - logoutButtonLabel:string { "log out" } - liveModeButtonLabel:string { "live mode" } - uploadFileButtonLabel:string { "upload file" } - scratchpadButtonLabel:string { "scratchpad" } - simplePlaylistMgmtButtonLabel:string { "edit playlist" } - schedulerButtonLabel:string { "scheduler" } - searchButtonLabel:string { "search" } + windowTitle:string { "LiveSupport Master Panel" } + notLoggedInMsg:string { "Not logged in" } + loggedInMsg:string { "Logged in as {0}" } + loginButtonLabel:string { "log in" } + logoutButtonLabel:string { "log out" } + liveModeButtonLabel:string { "live mode" } + uploadFileButtonLabel:string { "upload file" } + scratchpadButtonLabel:string { "scratchpad" } + simplePlaylistMgmtButtonLabel:string + { "edit playlist" } + schedulerButtonLabel:string { "scheduler" } + searchButtonLabel:string { "search" } cancelButtonLabel:string { "Cancel" } noButtonLabel:string { "No" } yesButtonLabel:string { "Yes" } okButtonLabel:string { "OK" } - localeNotAvailableMsg:string { "Locale {0} not available" } - schedulerNotReachableMsg:string { "Scheduler server not available" } - storageNotReachableMsg:string { "Storage server not available" } + localeNotAvailableMsg:string { "Locale {0} not available" } + schedulerNotReachableMsg:string { "Scheduler server not available" } + storageNotReachableMsg:string { "Storage server not available" } authenticationNotReachableMsg:string - { "Authentication server not available" } - audioErrorMsg { "Audio player error: " } - sureToExitMsg:string { "Are you sure you want to exit?" } + { "Authentication server not available" } + audioErrorMsg { "Audio player error: " } + sureToExitMsg:string { "Are you sure you want to exit?" } loginWindow:table { @@ -37,161 +38,176 @@ root:table audioClipListWindow:table { - windowTitle:string { "LiveSupport Audio Clip Window" } + windowTitle:string { "LiveSupport Audio Clip Window" } - idColumnLabel:string { "id" } - lengthColumnLabel:string { "length" } - uriColumnLabel:string { "URI" } - tokenColumnLabel:string { "token" } + idColumnLabel:string { "id" } + lengthColumnLabel:string { "length" } + uriColumnLabel:string { "URI" } + tokenColumnLabel:string { "token" } - closeButtonLabel:string { "close" } + closeButtonLabel:string { "close" } } scratchpadWindow:table { - windowTitle:string { "LiveSupport Scratchpad" } + windowTitle:string { "LiveSupport Scratchpad" } - typeColumnLabel:string { "Type" } - titleColumnLabel:string { "Title" } - addToPlaylistButtonLabel:string { "Add to playlist" } - clearListButtonLabel:string { "Clear list" } - removeButtonLabel:string { "Remove item(s)" } + typeColumnLabel:string { "Type" } + titleColumnLabel:string { "Title" } + addToPlaylistButtonLabel:string + { "Add to playlist" } + clearListButtonLabel:string { "Clear list" } + removeButtonLabel:string { "Remove item(s)" } - upMenuItem:string { "Move _Up" } - downMenuItem:string { "Move D_own" } - removeMenuItem:string { "_Remove" } - editPlaylistMenuItem:string { "_Edit" } - addToPlaylistMenuItem:string { "_Add To Playlist" } - schedulePlaylistMenuItem:string { "_Schedule" } - cueMenuItem:string { "Pre_view" } - addToLiveModeMenuItem:string { "Add To _Live Mode" } + upMenuItem:string { "Move _Up" } + downMenuItem:string { "Move D_own" } + removeMenuItem:string { "_Remove" } + editPlaylistMenuItem:string { "_Edit" } + addToPlaylistMenuItem:string + { "_Add To Playlist" } + schedulePlaylistMenuItem:string + { "_Schedule" } + cueMenuItem:string { "Pre_view" } + addToLiveModeMenuItem:string + { "Add To _Live Mode" } + + cannotEditPlaylistMsg:string + { "Could not open playlist for editing." } } playlistListWindow:table { - windowTitle:string { "LiveSupport Playlist Window" } + windowTitle:string { "LiveSupport Playlist Window" } - listBoxLabel { "Playlists" } - detailBoxLabel { "Playlist details" } + listBoxLabel { "Playlists" } + detailBoxLabel { "Playlist details" } - idColumnLabel:string { "id" } - lengthColumnLabel:string { "length" } - uriColumnLabel:string { "URI" } - tokenColumnLabel:string { "token" } + idColumnLabel:string { "id" } + lengthColumnLabel:string { "length" } + uriColumnLabel:string { "URI" } + tokenColumnLabel:string { "token" } - closeButtonLabel:string { "close" } + closeButtonLabel:string { "close" } } uploadFileWindow:table { - windowTitle:string { "Upload File" } + windowTitle:string { "Upload File" } - chooseFileLabel:string { "Filename" } - chooseFileButtonLabel:string { "Browse" } + chooseFileLabel:string { "Filename" } + chooseFileButtonLabel:string + { "Browse" } - mainSectionLabel:string { "Main" } - titleLabel:string { "Title" } - creatorLabel:string { "Creator" } - genreLabel:string { "Genre" } - fileFormatLabel:string { "File Type" } - lengthLabel:string { "Duration" } + mainSectionLabel:string { "Main" } + titleLabel:string { "Title" } + creatorLabel:string { "Creator" } + genreLabel:string { "Genre" } + fileFormatLabel:string { "File Type" } + lengthLabel:string { "Duration" } - uploadButtonLabel:string { "Upload" } - closeButtonLabel:string { "Cancel" } + uploadButtonLabel:string { "Upload" } + closeButtonLabel:string { "Cancel" } - fileChooserDialogTitle:string { "Choose a File" } - clipUploadedMsg:string { "Uploaded clip ''{0}''." } - couldNotOpenFileMsg:string { "The file could not be opened." } - missingTitleMsg:string { "Please enter a title." } + fileChooserDialogTitle:string + { "Choose a File" } + clipUploadedMsg:string { "Uploaded clip ''{0}''." } + couldNotOpenFileMsg:string { "The file could not be opened." } + missingTitleMsg:string { "Please enter a title." } } simplePlaylistManagementWindow:table { - windowTitle:string { "LiveSupport Simple Playlist Management Window" } + windowTitle:string { "LiveSupport Simple Playlist Management" + " Window" } - startColumnLabel:string { "Start" } - titleColumnLabel:string { "Title" } - lengthColumnLabel:string { "Length" } - fadeInColumnLabel:string { "Fade in" } - fadeOutColumnLabel:string { "Fade out" } - nameLabel:string { "Name" } - saveButtonLabel:string { "Save" } - closeButtonLabel:string { "Close" } + startColumnLabel:string { "Start" } + titleColumnLabel:string { "Title" } + lengthColumnLabel:string { "Length" } + fadeInColumnLabel:string { "Fade in" } + fadeOutColumnLabel:string { "Fade out" } + nameLabel:string { "Name" } + saveButtonLabel:string { "Save" } + closeButtonLabel:string { "Close" } lockFadesCheckButtonLabel:string - { "Lock fade-out to following fade-in" } - statusBar:string { "status bar" } + { "Lock fade-out to following fade-in" } + statusBar:string { "status bar" } - upMenuItem:string { "Move _Up" } - downMenuItem:string { "Move D_own" } - removeMenuItem:string { "_Remove" } + upMenuItem:string { "Move _Up" } + downMenuItem:string { "Move D_own" } + removeMenuItem:string { "_Remove" } - playlistSavedMsg:string { "Saved playlist ''{0}''." } - savePlaylistDialogMsg:string { "Do you want to save the playlist?" } - emptyTitleErrorMsg:string { "Please enter a title." } + playlistSavedMsg:string { "Saved playlist ''{0}''." } + savePlaylistDialogMsg:string + { "Do you want to save the playlist?" } + emptyTitleErrorMsg:string { "Please enter a title." } } schedulerWindow:table { - windowTitle:string { "LiveSupport Scheduler Window" } + windowTitle:string { "LiveSupport Scheduler Window" } - startColumnLabel:string { "start" } - titleColumnLabel:string { "title" } - endColumnLabel:string { "end" } - deleteMenuItem:string { "_Delete" } + startColumnLabel:string { "start" } + titleColumnLabel:string { "title" } + endColumnLabel:string { "end" } + deleteMenuItem:string { "_Delete" } - closeButtonLabel:string { "close" } + closeButtonLabel:string { "close" } } schedulePlaylistWindow:table { - windowTitle:string { "LiveSupport Schedule Playlist Window" } + windowTitle:string { "LiveSupport Schedule Playlist Window" } - hourLabel:string { "hour: " } - minuteLabel:string { "minute: " } - scheduleButtonLabel:string { "schedule" } - closeButtonLabel:string { "close" } + hourLabel:string { "hour: " } + minuteLabel:string { "minute: " } + scheduleButtonLabel:string { "schedule" } + closeButtonLabel:string { "close" } } searchWindow:table { - windowTitle:string { "LiveSupport Search/Browse Window" } + windowTitle:string { "LiveSupport Search/Browse Window" } - simpleSearchTab:string { "Search" } - advancedSearchTab:string { "Advanced Search" } - browseTab:string { "Browse" } + simpleSearchTab:string { "Search" } + advancedSearchTab:string { "Advanced Search" } + browseTab:string { "Browse" } - searchByTextLabel:string { "Search by" } - searchButtonLabel:string { "Search" } + searchByTextLabel:string { "Search by" } + searchButtonLabel:string { "Search" } - typeColumnLabel:string { "Type" } - titleColumnLabel:string { "Title" } - creatorColumnLabel:string { "Creator" } - lengthColumnLabel:string { "Length" } + typeColumnLabel:string { "Type" } + titleColumnLabel:string { "Title" } + creatorColumnLabel:string { "Creator" } + lengthColumnLabel:string { "Length" } - partialOperatorDisplay:string { "contains" } - prefixOperatorDisplay:string { "starts with" } - =OperatorDisplay:string { "equals" } - <=OperatorDisplay:string { "<=" } - >=OperatorDisplay:string { ">=" } + partialOperatorDisplay:string + { "contains" } + prefixOperatorDisplay:string + { "starts with" } + =OperatorDisplay:string { "equals" } + <=OperatorDisplay:string { "<=" } + >=OperatorDisplay:string { ">=" } - allStringForBrowse { "--- all ---" } + allStringForBrowse { "--- all ---" } - addToScratchpadMenuItem:string { "_Add To Scratchpad" } - addToLiveModeMenuItem:string { "Add To _Live Mode" } + addToScratchpadMenuItem:string + { "_Add To Scratchpad" } + addToLiveModeMenuItem:string + { "Add To _Live Mode" } } liveModeWindow:table { - windowTitle:string { "LiveSupport Live Mode Window" } + windowTitle:string { "LiveSupport Live Mode Window" } - cueMenuItem:string { "Pre_view" } - upMenuItem:string { "Move _Up" } - downMenuItem:string { "Move D_own" } - removeMenuItem:string { "_Remove" } - playMenuItem:string { "_Play" } + cueMenuItem:string { "Pre_view" } + upMenuItem:string { "Move _Up" } + downMenuItem:string { "Move D_own" } + removeMenuItem:string { "_Remove" } + playMenuItem:string { "_Play" } - cuePlayerLabel:string { "Preview" } + cuePlayerLabel:string { "Preview" } } metadataTypes:table