added more descriptive error message to LocalizedObject::getResourceUstring();

added exit() statements to catch blocks where getting resource failed
This commit is contained in:
fgerlits 2005-04-19 19:18:25 +00:00
parent 27b8a27807
commit 49c6517346
11 changed files with 122 additions and 60 deletions

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: maroy $
Version : $Revision: 1.7 $
Author : $Author: fgerlits $
Version : $Revision: 1.8 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/core/src/LocalizedObject.cxx,v $
------------------------------------------------------------------------------*/
@ -119,7 +119,12 @@ LocalizedObject :: getBundle(const char * key)
Ptr<ResourceBundle>::Ref resourceBundle(new ResourceBundle(
bundle->getWithFallback(key, status)));
if (!U_SUCCESS(status)) {
throw std::invalid_argument("can't get resource bundle");
std::string eMsg = "can't get resource bundle for key '";
eMsg += key;
eMsg += "' and locale '";
eMsg += bundle->getLocale().getName();
eMsg += "'";
throw std::invalid_argument(eMsg);
}
return resourceBundle;

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.11 $
Version : $Revision: 1.12 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LoginWindow.cxx,v $
------------------------------------------------------------------------------*/
@ -91,7 +91,8 @@ LoginWindow :: LoginWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
cancelButton = Gtk::manage(widgetFactory->createButton(
*getResourceUstring("cancelButtonLabel")));
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
std::cerr << e.what() << std::endl;\
std::exit(1);
}
// set up the login label

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: maroy $
Version : $Revision: 1.8 $
Author : $Author: fgerlits $
Version : $Revision: 1.9 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/MasterPanelUserInfoWidget.cxx,v $
------------------------------------------------------------------------------*/
@ -127,7 +127,7 @@ MasterPanelUserInfoWidget :: onLogoutButtonClicked (void) throw ()
notLoggedInMsg = getResourceUstring("notLoggedInMsg");
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
return;
std::exit(1);
}
userInfoLabel->set_label(*notLoggedInMsg);
@ -176,7 +176,12 @@ MasterPanelUserInfoWidget :: onLoginButtonClicked (void) throw ()
}
if (loggedIn) {
updateStrings();
try {
updateStrings();
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
std::exit(1);
}
// change the login button to a logout button
logInOutSignalConnection.disconnect();
@ -209,7 +214,12 @@ MasterPanelUserInfoWidget :: changeLanguage(Ptr<ResourceBundle>::Ref bundle)
throw ()
{
setBundle(bundle);
updateStrings();
try {
updateStrings();
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
std::exit(1);
}
}

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.19 $
Version : $Revision: 1.20 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx,v $
------------------------------------------------------------------------------*/
@ -204,6 +204,7 @@ MasterPanelWindow :: changeLanguage(Ptr<ResourceBundle>::Ref bundle)
*getResourceUstring("searchButtonLabel"));
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
std::exit(1);
}
userInfoWidget->changeLanguage(bundle);

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: maroy $
Version : $Revision: 1.6 $
Author : $Author: fgerlits $
Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/PlaylistListWindow.cxx,v $
------------------------------------------------------------------------------*/
@ -78,6 +78,7 @@ PlaylistListWindow :: PlaylistListWindow (
*getResourceUstring("closeButtonLabel")));
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
std::exit(1);
}
mainBox = Gtk::manage(new Gtk::VBox());
@ -133,6 +134,7 @@ PlaylistListWindow :: PlaylistListWindow (
modelColumns.tokenColumn);
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
std::exit(1);
}
// attach the event handler for the user selecting a playlist from
@ -163,6 +165,7 @@ PlaylistListWindow :: PlaylistListWindow (
modelColumns.tokenColumn);
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
std::exit(1);
}
// attach the event handler for the user selecting an entry from

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: maroy $
Version : $Revision: 1.4 $
Author : $Author: fgerlits $
Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SchedulePlaylistWindow.cxx,v $
------------------------------------------------------------------------------*/
@ -69,7 +69,6 @@ SchedulePlaylistWindow :: SchedulePlaylistWindow (
{
this->gLiveSupport = gLiveSupport;
this->playlist = playlist;
try {
set_title(*getResourceUstring("windowTitle"));
hourLabel = Gtk::manage(new Gtk::Label(*getResourceUstring(
@ -82,6 +81,7 @@ SchedulePlaylistWindow :: SchedulePlaylistWindow (
*getResourceUstring("closeButtonLabel")));
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
std::exit(1);
}
playlistLabel = Gtk::manage(new Gtk::Label(*playlist->getTitle()));

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: maroy $
Version : $Revision: 1.6 $
Author : $Author: fgerlits $
Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SchedulerWindow.cxx,v $
------------------------------------------------------------------------------*/
@ -73,6 +73,7 @@ SchedulerWindow :: SchedulerWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
*getResourceUstring("closeButtonLabel")));
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
std::exit(1);
}
calendar = Gtk::manage(new Gtk::Calendar());
@ -94,6 +95,7 @@ SchedulerWindow :: SchedulerWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
entryColumns->endColumn);
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
std::exit(1);
}
// register the signal handler for entries view entries being clicked
@ -104,10 +106,16 @@ SchedulerWindow :: SchedulerWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
entryMenu = Gtk::manage(new Gtk::Menu());
Gtk::Menu::MenuList& menuList = entryMenu->items();
// register the signal handlers for the popup menu
menuList.push_back(Gtk::Menu_Helpers::MenuElem(
try {
menuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("deleteMenuItem"),
sigc::mem_fun(*this,
&SchedulerWindow::onDeleteItem)));
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
std::exit(1);
}
entryMenu->accelerate(*this);
layout = Gtk::manage(new Gtk::Table());

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.5 $
Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/ScratchpadWindow.cxx,v $
------------------------------------------------------------------------------*/
@ -86,6 +86,7 @@ ScratchpadWindow :: ScratchpadWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
*getResourceUstring("removeButtonLabel")));
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
std::exit(1);
}
playButton->set_name("playButton");
@ -122,6 +123,7 @@ ScratchpadWindow :: ScratchpadWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
modelColumns.titleColumn);
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
std::exit(1);
}
// color the columns blue
@ -157,64 +159,77 @@ ScratchpadWindow :: ScratchpadWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
audioClipMenu = Gtk::manage(new Gtk::Menu());
Gtk::Menu::MenuList& audioClipMenuList = audioClipMenu->items();
// register the signal handlers for the popup menu
audioClipMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
try {
audioClipMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("addToPlaylistMenuItem"),
sigc::mem_fun(*this,
&ScratchpadWindow::onAddToPlaylist)));
audioClipMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
audioClipMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("upMenuItem"),
sigc::mem_fun(*this,
&ScratchpadWindow::onUpItem)));
audioClipMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
audioClipMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("downMenuItem"),
sigc::mem_fun(*this,
&ScratchpadWindow::onDownItem)));
audioClipMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
audioClipMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("removeMenuItem"),
sigc::mem_fun(*this,
&ScratchpadWindow::onRemoveItem)));
audioClipMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
audioClipMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("deleteMenuItem"),
sigc::mem_fun(*this,
&ScratchpadWindow::onDeleteItem)));
audioClipMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
audioClipMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("playMenuItem"),
sigc::mem_fun(*this,
&ScratchpadWindow::onPlayItem)));
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
std::exit(1);
}
audioClipMenu->accelerate(*this);
// create the right-click entry context menu for playlists
playlistMenu = Gtk::manage(new Gtk::Menu());
Gtk::Menu::MenuList& playlistMenuList = playlistMenu->items();
// register the signal handlers for the popup menu
playlistMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
try{
playlistMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("addToPlaylistMenuItem"),
sigc::mem_fun(*this,
&ScratchpadWindow::onAddToPlaylist)));
playlistMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
playlistMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("schedulePlaylistMenuItem"),
sigc::mem_fun(*this,
&ScratchpadWindow::onSchedulePlaylist)));
playlistMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
playlistMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("upMenuItem"),
sigc::mem_fun(*this,
&ScratchpadWindow::onUpItem)));
playlistMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
playlistMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("downMenuItem"),
sigc::mem_fun(*this,
&ScratchpadWindow::onDownItem)));
playlistMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
playlistMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("removeMenuItem"),
sigc::mem_fun(*this,
&ScratchpadWindow::onRemoveItem)));
playlistMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
playlistMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("deleteMenuItem"),
sigc::mem_fun(*this,
&ScratchpadWindow::onDeleteItem)));
playlistMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
playlistMenuList.push_back(Gtk::Menu_Helpers::MenuElem(
*getResourceUstring("playMenuItem"),
sigc::mem_fun(*this,
&ScratchpadWindow::onPlayItem)));
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
std::exit(1);
}
playlistMenu->accelerate(*this);
// show

View file

@ -22,7 +22,7 @@
Author : $Author: fgerlits $
Version : $Revision: 1.2 $
Version : $Revision: 1.3 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SearchWindow.cxx,v $
------------------------------------------------------------------------------*/
@ -80,11 +80,16 @@ SearchWindow :: SearchWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
Gtk::VBox * advancedSearchView = constructAdvancedSearchView();
Gtk::VBox * browseView = Gtk::manage(new Gtk::VBox);
Notebook * views = Gtk::manage(new Notebook);
views->appendPage(*searchView, *getResourceUstring("searchTab"));
views->appendPage(*advancedSearchView, *getResourceUstring(
Notebook * views = Gtk::manage(new Notebook);
try {
views->appendPage(*searchView, *getResourceUstring("searchTab"));
views->appendPage(*advancedSearchView, *getResourceUstring(
"advancedSearchTab"));
views->appendPage(*browseView, *getResourceUstring("browseTab"));
views->appendPage(*browseView, *getResourceUstring("browseTab"));
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
std::exit(1);
}
add(*views);
@ -128,39 +133,44 @@ SearchWindow :: constructAdvancedSearchView(void) throw ()
view->pack_start(*searchResults, Gtk::PACK_SHRINK, 5);
// set up the search options box
Gtk::Label * searchByLabel = Gtk::manage(new Gtk::Label(
try {
Gtk::Label * searchByLabel = Gtk::manage(new Gtk::Label(
*getResourceUstring("searchByTextLabel") ));
searchOptionsBox->pack_start(*searchByLabel, Gtk::PACK_SHRINK, 5);
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
std::exit(1);
}
ComboBoxText * metadataType = Gtk::manage(wf->createComboBoxText());
metadataType->append_text("Title");
metadataType->append_text("Creator");
metadataType->append_text("Length");
metadataType->set_active_text("Title");
searchOptionsBox->pack_start(*metadataType, Gtk::PACK_EXPAND_WIDGET, 5);
ComboBoxText * operatorType = Gtk::manage(wf->createComboBoxText());
operatorType->append_text("contains");
operatorType->append_text("equals");
operatorType->append_text(">=");
operatorType->append_text("<");
operatorType->set_active_text("contains");
EntryBin * entryBin = Gtk::manage(wf->createEntryBin());
searchOptionsBox->pack_start(*searchByLabel, Gtk::PACK_SHRINK, 5);
searchOptionsBox->pack_start(*metadataType, Gtk::PACK_EXPAND_WIDGET, 5);
searchOptionsBox->pack_start(*operatorType, Gtk::PACK_EXPAND_WIDGET, 5);
EntryBin * entryBin = Gtk::manage(wf->createEntryBin());
searchOptionsBox->pack_start(*entryBin, Gtk::PACK_EXPAND_WIDGET, 5);
// set up the search button box
Button * searchButton = Gtk::manage(wf->createButton(
try {
Button * searchButton = Gtk::manage(wf->createButton(
*getResourceUstring("searchButtonLabel") ));
searchButtonBox->pack_start(*searchButton, Gtk::PACK_SHRINK, 5);
searchButtonBox->pack_start(*searchButton, Gtk::PACK_SHRINK, 5);
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
std::exit(1);
}
return view;
}

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: maroy $
Version : $Revision: 1.8 $
Author : $Author: fgerlits $
Version : $Revision: 1.9 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/SimplePlaylistManagementWindow.cxx,v $
------------------------------------------------------------------------------*/
@ -76,6 +76,7 @@ SimplePlaylistManagementWindow :: SimplePlaylistManagementWindow (
*getResourceUstring("closeButtonLabel")));
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
std::exit(1);
}
nameEntry = Gtk::manage(new Gtk::Entry());
@ -99,12 +100,14 @@ SimplePlaylistManagementWindow :: SimplePlaylistManagementWindow (
modelColumns.titleColumn);
entriesView->append_column(*getResourceUstring("lengthColumnLabel"),
modelColumns.lengthColumn);
statusBar = Gtk::manage(new Gtk::Label(
*getResourceUstring("statusBar")));
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
std::exit(1);
}
statusBar = Gtk::manage(new Gtk::Label(*getResourceUstring("statusBar")));
// set up the layout
layout = Gtk::manage(new Gtk::Table());

View file

@ -21,8 +21,8 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Author : $Author: maroy $
Version : $Revision: 1.7 $
Author : $Author: fgerlits $
Version : $Revision: 1.8 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/UploadFileWindow.cxx,v $
------------------------------------------------------------------------------*/
@ -131,6 +131,7 @@ UploadFileWindow :: UploadFileWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
} catch (std::invalid_argument &e) {
// TODO: signal error
std::cerr << e.what() << std::endl;
std::exit(1);
}
// build up the main section
@ -191,9 +192,14 @@ UploadFileWindow :: onChooseFileButtonClicked(void) throw ()
{
Ptr<Gtk::FileChooserDialog>::Ref dialog;
dialog.reset(new Gtk::FileChooserDialog(
try {
dialog.reset(new Gtk::FileChooserDialog(
*getResourceUstring("fileChooserDialogTitle"),
Gtk::FILE_CHOOSER_ACTION_OPEN));
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
std::exit(1);
}
dialog->set_transient_for(*this);