From b8629bf17159910adfe50d1cf1b015ca9f51de65 Mon Sep 17 00:00:00 2001 From: fgerlits Date: Wed, 14 Feb 2007 19:52:51 +0000 Subject: [PATCH] Credits in Options --> About are now read directly from the CREDITS file, eliminating duplication --- campcaster/CREDITS | 7 +++- .../LiveSupport/Core/LocalizedObject.h | 15 ++++++++ .../src/modules/core/src/LocalizedObject.cxx | 35 +++++++++++++++++++ .../gLiveSupport/src/OptionsWindow.cxx | 7 ++-- .../src/products/gLiveSupport/var/root.txt | 17 +-------- 5 files changed, 60 insertions(+), 21 deletions(-) diff --git a/campcaster/CREDITS b/campcaster/CREDITS index 9f6c50275..efc6ad864 100644 --- a/campcaster/CREDITS +++ b/campcaster/CREDITS @@ -3,7 +3,12 @@ CREDITS ======= For Campcaster, see http://campcaster.campware.org -The original Campcaster (LiveSupport) concept was drafted by Micz Flor. It was fully developed by Robert Klajn, Douglas Arellanes, Ákos Maróy, and Sava Tatić. The user interface has been designed by Charles Truett, based on the initial work done by a team of his then-fellow Parsons School of Design students Turi McKinley, Catalin Lazia and Sangita Shah. The team was led by then-head of the school's Department of Digital Design Colleen Macklin, assisted by Kunal Jain. +The original Campcaster (LiveSupport) concept was drafted by Micz Flor. It was +fully developed by Robert Klajn, Douglas Arellanes, Ákos Maróy, and Sava Tatić. +The user interface has been designed by Charles Truett, based on the initial work +done by a team of his then-fellow Parsons School of Design students Turi McKinley, +Catalin Lazia and Sangita Shah. The team was led by then-head of the school's +Department of Digital Design Colleen Macklin, assisted by Kunal Jain. Version 1.2.0 - "Kotor" ----------------------- diff --git a/campcaster/src/modules/core/include/LiveSupport/Core/LocalizedObject.h b/campcaster/src/modules/core/include/LiveSupport/Core/LocalizedObject.h index 1263e2c7e..398ef06b3 100644 --- a/campcaster/src/modules/core/include/LiveSupport/Core/LocalizedObject.h +++ b/campcaster/src/modules/core/include/LiveSupport/Core/LocalizedObject.h @@ -456,6 +456,21 @@ class LocalizedObject { return unicodeStringToUstring(getResourceString(bundle, key) ); } + + /** + * Get some binary data as a string. + * Reads the binary data either from a binary or from + * an import key, and returns it as a Glib::ustring. + * The binary data is assumed to be in UTF-8 encoding. + * + * @param key the key identifying the requested binary data. + * @return the requested binary data as a string. + * @exception std::invalid_argument if there is no such key, or the + * value is not of binary type, or it isn't valid UTF-8. + */ + Ptr::Ref + getBinaryResourceAsUstring(const char * key) + throw (std::invalid_argument); }; /* ================================================= external data structures */ diff --git a/campcaster/src/modules/core/src/LocalizedObject.cxx b/campcaster/src/modules/core/src/LocalizedObject.cxx index 774c91f72..4c55721fc 100644 --- a/campcaster/src/modules/core/src/LocalizedObject.cxx +++ b/campcaster/src/modules/core/src/LocalizedObject.cxx @@ -304,3 +304,38 @@ LocalizedObject :: ustringToUnicodeString(const Glib::ustring & gString) return uString; } + +/*------------------------------------------------------------------------------ + * Get a string from a resource bundle in the ICU string format + *----------------------------------------------------------------------------*/ +Ptr::Ref +LocalizedObject :: getBinaryResourceAsUstring(const char * key) + throw (std::invalid_argument) +{ + Ptr::Ref rb = getBundle(key); + if (rb->getType() == URES_BINARY) { + int32_t length; + UErrorCode status = U_ZERO_ERROR; + const uint8_t * data = rb->getBinary(length, status); + if (!U_SUCCESS(status)) { + throw std::invalid_argument("could not get requested " + "binary resource"); + } + char * strBuf = new char[length + 1]; + std::memcpy(strBuf, data, length); + strBuf[length] = 0; + Ptr::Ref string(new Glib::ustring(strBuf)); + if (string->validate()) { + return string; + } else { + std::string errorMessage = "invalid UTF-8 sequence found "; + errorMessage += "in resource '"; + errorMessage += key; + errorMessage += "'"; + throw std::invalid_argument(errorMessage); + } + } else { + throw std::invalid_argument("requested resource is not a binary value"); + } +} + diff --git a/campcaster/src/products/gLiveSupport/src/OptionsWindow.cxx b/campcaster/src/products/gLiveSupport/src/OptionsWindow.cxx index ba5856efb..06f8cc587 100644 --- a/campcaster/src/products/gLiveSupport/src/OptionsWindow.cxx +++ b/campcaster/src/products/gLiveSupport/src/OptionsWindow.cxx @@ -843,17 +843,16 @@ OptionsWindow :: constructAboutSection(void) throw () { Glib::ustring aboutLabelContents; + aboutLabelContents.append("\n"); aboutLabelContents.append(PACKAGE_NAME); aboutLabelContents.append(" "); aboutLabelContents.append(PACKAGE_VERSION); try { - aboutLabelContents.append(" ("); - aboutLabelContents.append(*getResourceUstring("webSiteUrlText")); - aboutLabelContents.append(")\n\n"); + aboutLabelContents.append("\n\n"); aboutLabelContents.append(*formatMessage("reportBugsToText", PACKAGE_BUGREPORT )); aboutLabelContents.append("\n\n"); - aboutLabelContents.append(*getResourceUstring("creditsText")); + aboutLabelContents.append(*getBinaryResourceAsUstring("creditsText")); } catch (std::invalid_argument &e) { // TODO: signal error diff --git a/campcaster/src/products/gLiveSupport/var/root.txt b/campcaster/src/products/gLiveSupport/var/root.txt index 739c399da..ebe8afce9 100644 --- a/campcaster/src/products/gLiveSupport/var/root.txt +++ b/campcaster/src/products/gLiveSupport/var/root.txt @@ -311,23 +311,8 @@ root:table schedulerStartButtonLabel:string { "Start" } schedulerStopButtonLabel:string { "Stop" } - webSiteUrlText:string { "http://campcaster.campware.org" } reportBugsToText:string { "Report bugs to: {0}" } - creditsText:string { "Credits:\n" - "Ferenc Gerlits (fgerlits@campware.org)\n" - " - Studio GUI, scheduler, packaging\n" - "Mark Kretschmann (markey@web.de)\n" - " - Audio player\n" - "Paul Baranowski (paul@paulbaranowski.org)\n" - " - Project manager, HTML UI, storage server, scheduler\n" - "Douglas Arellanes (Douglas.Arellanes@mdlf.org)\n" - " - Tester and user feedback\n" - "Tomáš Hlava (th@red2head.com)\n" - " - Scheduler, storage server\n" - "János Csikós (retired)\n" - " - HTML UI\n" - "Ákos Maróy (retired)\n" - " - Architecture design, scheduler, audio player" } + creditsText:import { "../../../../CREDITS" } } backupView:table