From 1e833bc16bd428b71b4e7bf5707c29cfd00cb843 Mon Sep 17 00:00:00 2001 From: maroy Date: Tue, 23 Nov 2004 12:07:17 +0000 Subject: [PATCH] now utilizing LiveSupport::Core::LocalizedObject and GtkLocalizedObject added -pthread to build parameters --- .../products/gLiveSupport/etc/Makefile.in | 52 ++++++-- .../products/gLiveSupport/etc/configure.ac | 6 +- .../gLiveSupport/src/GtkLocalizedObject.cxx | 72 ++++++++++ .../gLiveSupport/src/GtkLocalizedObject.h | 125 ++++++++++++++++++ .../products/gLiveSupport/src/LoginWindow.cxx | 26 ++-- .../products/gLiveSupport/src/LoginWindow.h | 14 +- .../gLiveSupport/src/UiTestMainWindow.cxx | 17 ++- .../gLiveSupport/src/UiTestMainWindow.h | 13 +- .../products/gLiveSupport/src/main.cxx | 27 +++- livesupport/products/gLiveSupport/var/.keepme | 1 + livesupport/products/gLiveSupport/var/en.txt | 3 + livesupport/products/gLiveSupport/var/hu.txt | 10 ++ .../products/gLiveSupport/var/root.txt | 10 ++ 13 files changed, 336 insertions(+), 40 deletions(-) create mode 100644 livesupport/products/gLiveSupport/src/GtkLocalizedObject.cxx create mode 100644 livesupport/products/gLiveSupport/src/GtkLocalizedObject.h create mode 100644 livesupport/products/gLiveSupport/var/.keepme create mode 100644 livesupport/products/gLiveSupport/var/en.txt create mode 100644 livesupport/products/gLiveSupport/var/hu.txt create mode 100644 livesupport/products/gLiveSupport/var/root.txt diff --git a/livesupport/products/gLiveSupport/etc/Makefile.in b/livesupport/products/gLiveSupport/etc/Makefile.in index 2b6cfe647..3342792d4 100644 --- a/livesupport/products/gLiveSupport/etc/Makefile.in +++ b/livesupport/products/gLiveSupport/etc/Makefile.in @@ -21,7 +21,7 @@ # # # Author : $Author: maroy $ -# Version : $Revision: 1.3 $ +# Version : $Revision: 1.4 $ # Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/etc/Makefile.in,v $ # # @configure_input@ @@ -38,6 +38,8 @@ DOXYGEN = doxygen #------------------------------------------------------------------------------- # Basic directory and file definitions #------------------------------------------------------------------------------- +PACKAGE_NAME = @PACKAGE_NAME@ + BASE_DIR = @builddir@ DOC_DIR = ${BASE_DIR}/doc DOXYGEN_DIR = ${DOC_DIR}/doxygen @@ -45,13 +47,21 @@ COVERAGE_DIR = ${DOC_DIR}/coverage ETC_DIR = ${BASE_DIR}/etc SRC_DIR = ${BASE_DIR}/src TMP_DIR = ${BASE_DIR}/tmp +VAR_DIR = ${BASE_DIR}/var USR_DIR = ${BASE_DIR}/../../usr USR_INCLUDE_DIR = ${USR_DIR}/include USR_LIB_DIR = ${USR_DIR}/lib +USR_BIN_DIR = ${USR_DIR}/bin BOOST_INCLUDE_DIR = ${USR_INCLUDE_DIR}/boost-1_31 LIBXMLPP_INCLUDE_DIR = ${USR_INCLUDE_DIR}/libxml++-1.0 +GENRB = ${USR_BIN_DIR}/genrb +GENRBOPTS = --destdir ${TMP_DIR} \ + --encoding utf-8 \ + --package-name ${PACKAGE_NAME} \ + --strict + VPATH = ${SRC_DIR} MODULES_DIR = ${BASE_DIR}/../../modules @@ -71,6 +81,9 @@ STORAGE_LIB_FILE = ${STORAGE_LIB_DIR}/lib${STORAGE_LIB}.a GTKMM_CFLAGS=@GTKMM_CFLAGS@ GTKMM_LIBS=@GTKMM_LIBS@ +ICU_CFLAGS= +ICU_LIBS=`${USR_DIR}/bin/icu-config --ldflags-toolutil --ldflags-icuio` + TEST_RESULTS = ${DOC_DIR}/testResults.xml # the text result XSLT has to be relative to the test result file, e.g. TMP_DIR TEST_XSLT = ../etc/testResultToHtml.xsl @@ -81,13 +94,16 @@ TEST_RUNNER = ${TMP_DIR}/testRunner DOXYGEN_CONFIG = ${ETC_DIR}/doxygen.config +export LD_LIBRARY_PATH=${USR_LIB_DIR} + #------------------------------------------------------------------------------- # Configuration parameters #------------------------------------------------------------------------------- CPPFLAGS = @CPPFLAGS@ -CXXFLAGS = @CXXFLAGS@ @DEFS@ @COVERAGE_CXXFLAGS@ \ +CXXFLAGS = @CXXFLAGS@ @DEFS@ @COVERAGE_CXXFLAGS@ -pthread \ -pedantic -Wall -Wno-long-long \ + ${ICU_CFLAGS} \ ${GTKMM_CFLAGS} \ -I${USR_INCLUDE_DIR} \ -I${BOOST_INCLUDE_DIR} \ @@ -95,7 +111,10 @@ CXXFLAGS = @CXXFLAGS@ @DEFS@ @COVERAGE_CXXFLAGS@ \ -I${CORE_INCLUDE_DIR} \ -I${STORAGE_INCLUDE_DIR} \ -I${TMP_DIR} -LDFLAGS = @LDFLAGS@ -L${USR_LIB_DIR} \ +LDFLAGS = @LDFLAGS@ -pthread \ + ${ICU_LIBS} \ + ${GTKMM_LIBS} \ + -L${USR_LIB_DIR} \ -L${CORE_LIB_DIR} \ -L${STORAGE_LIB_DIR} @@ -104,13 +123,18 @@ LDFLAGS = @LDFLAGS@ -L${USR_LIB_DIR} \ # Dependencies #------------------------------------------------------------------------------- G_LIVESUPPORT_OBJS = ${TMP_DIR}/UiTestMainWindow.o \ + ${TMP_DIR}/GtkLocalizedObject.o \ ${TMP_DIR}/LoginWindow.o +G_LIVESUPPORT_RES = ${TMP_DIR}/${PACKAGE_NAME}_root.res \ + ${TMP_DIR}/${PACKAGE_NAME}_en.res \ + ${TMP_DIR}/${PACKAGE_NAME}_hu.res -G_LIVESUPPORT_EXE_OBJS = ${G_LIVESUPPORT_OBJS} \ +G_LIVESUPPORT_EXE_OBJS = ${TMP_DIR}/main.o + +FSDF = ${G_LIVESUPPORT_OBJS} \ ${TMP_DIR}/main.o -G_LIVESUPPORT_EXE_LIBS = -l${STORAGE_LIB} -l${CORE_LIB} \ - ${GTKMM_LIBS} \ +G_LIVESUPPORT_EXE_LIBS = -l${CORE_LIB} \ -lboost_date_time-gcc \ -lxmlrpc++ -lssl -lxml++-1.0 @@ -125,7 +149,7 @@ TEST_RUNNER_LIBS = ${G_LIVESUPPORT_EXE_LIBS} -lcppunit -ldl .PHONY: all dir_setup doc clean docclean depclean distclean .PHONY: install start run_tests stop uninstall -all: dir_setup ${G_LIVESUPPORT_EXE} +all: dir_setup ${G_LIVESUPPORT_EXE} ${G_LIVESUPPORT_RES} dir_setup: ${TMP_DIR} ${DOXYGEN_DIR} @@ -133,7 +157,7 @@ doc: ${DOXYGEN} ${DOXYGEN_CONFIG} clean: - ${RM} ${G_LIVESUPPORT_EXE_OBJS} ${G_LIVESUPPORT_EXE} + ${RM} ${G_LIVESUPPORT_EXE_OBJS} ${G_LIVESUPPORT_RES} ${G_LIVESUPPORT_EXE} ${RM} ${TEST_RUNNER_OBJS} ${TEST_RUNNER} ${RM} ${TMP_DIR}/*.bb ${TMP_DIR}/*.bbg ${TMP_DIR}/*.da ${TMP_DIR}/*.info @@ -152,18 +176,17 @@ distclean: clean docclean check: all ${TEST_RUNNER} run_tests run_tests: ${TEST_RUNNER} - LD_LIBRARY_PATH=${USR_LIB_DIR} ${TEST_RUNNER} \ - -o ${TEST_RESULTS} -s ${TEST_XSLT} + ${TEST_RUNNER} -o ${TEST_RESULTS} -s ${TEST_XSLT} -run: ${G_LIVESUPPORT_EXE} - LD_LIBRARY_PATH=${USR_LIB_DIR} ${G_LIVESUPPORT_EXE} +run: all + ${G_LIVESUPPORT_EXE} #------------------------------------------------------------------------------- # Specific targets #------------------------------------------------------------------------------- ${G_LIVESUPPORT_EXE}: ${CORE_LIB_FILE} ${STORAGE_LIB_FILE} \ - ${G_LIVESUPPORT_EXE_OBJS} + ${G_LIVESUPPORT_OBJS} ${G_LIVESUPPORT_EXE_OBJS} ${CXX} ${LDFLAGS} -o $@ $^ ${G_LIVESUPPORT_EXE_LIBS} ${TMP_DIR}: @@ -189,3 +212,6 @@ ${STORAGE_LIB_FILE}: ${TMP_DIR}/%.o : ${SRC_DIR}/%.cxx ${CXX} ${CPPFLAGS} ${CXXFLAGS} -c -o $@ $< +${TMP_DIR}/${PACKAGE_NAME}_%.res : ${VAR_DIR}/%.txt + ${GENRB} ${GENRBOPTS} $^ + diff --git a/livesupport/products/gLiveSupport/etc/configure.ac b/livesupport/products/gLiveSupport/etc/configure.ac index 7007609f7..7b573e41c 100644 --- a/livesupport/products/gLiveSupport/etc/configure.ac +++ b/livesupport/products/gLiveSupport/etc/configure.ac @@ -21,7 +21,7 @@ dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA dnl dnl dnl Author : $Author: maroy $ -dnl Version : $Revision: 1.3 $ +dnl Version : $Revision: 1.4 $ dnl Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/etc/configure.ac,v $ dnl----------------------------------------------------------------------------- @@ -35,7 +35,7 @@ dnl----------------------------------------------------------------------------- AC_INIT(gLiveSupport, 0.1, bugs@campware.org) AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (c) 2004 Media Development Loan Fund under the GNU GPL]) -AC_REVISION($Revision: 1.3 $) +AC_REVISION($Revision: 1.4 $) AC_CONFIG_SRCDIR(../src/main.cxx) @@ -43,7 +43,7 @@ AC_CONFIG_HEADERS(configure.h) AC_PROG_CXX() AC_CHECK_HEADERS(sys/types.h unistd.h getopt.h signal.h sys/stat.h time.h) -AC_CHECK_HEADERS(stdio.h fcntl.h pthread.h sys/time.h) +AC_CHECK_HEADERS(stdio.h fcntl.h sys/time.h) PKG_CHECK_MODULES(GTKMM,[gtkmm-2.4 >= 2.4.0]) AC_SUBST(GTKMM_CFLAGS) diff --git a/livesupport/products/gLiveSupport/src/GtkLocalizedObject.cxx b/livesupport/products/gLiveSupport/src/GtkLocalizedObject.cxx new file mode 100644 index 000000000..eb1931185 --- /dev/null +++ b/livesupport/products/gLiveSupport/src/GtkLocalizedObject.cxx @@ -0,0 +1,72 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: maroy $ + Version : $Revision: 1.1 $ + Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/GtkLocalizedObject.cxx,v $ + +------------------------------------------------------------------------------*/ + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#include "GtkLocalizedObject.h" + + +using namespace LiveSupport::Core; +using namespace LiveSupport::GLiveSupport; + +/* =================================================== local data structures */ + + +/* ================================================ local constants & macros */ + + +/* =============================================== local function prototypes */ + + +/* ============================================================= module code */ + +/*------------------------------------------------------------------------------ + * Create a Glib ustring from an ICU UnicodeString + *----------------------------------------------------------------------------*/ +Ptr::Ref +GtkLocalizedObject :: unicodeStringToUstring( + Ptr::Ref unicodeString) + throw () +{ + const UChar * uchars = unicodeString->getBuffer(); + int32_t length = unicodeString->length(); + Ptr::Ref ustr(new Glib::ustring()); + ustr->reserve(length); + + while (length--) { + ustr->push_back((gunichar) (*(uchars++))); + } + + return ustr; +} + diff --git a/livesupport/products/gLiveSupport/src/GtkLocalizedObject.h b/livesupport/products/gLiveSupport/src/GtkLocalizedObject.h new file mode 100644 index 000000000..599e06d45 --- /dev/null +++ b/livesupport/products/gLiveSupport/src/GtkLocalizedObject.h @@ -0,0 +1,125 @@ +/*------------------------------------------------------------------------------ + + Copyright (c) 2004 Media Development Loan Fund + + This file is part of the LiveSupport project. + http://livesupport.campware.org/ + To report bugs, send an e-mail to bugs@campware.org + + LiveSupport is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + LiveSupport is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LiveSupport; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + + Author : $Author: maroy $ + Version : $Revision: 1.1 $ + Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/GtkLocalizedObject.h,v $ + +------------------------------------------------------------------------------*/ +#ifndef GtkLocalizedObject_h +#define GtkLocalizedObject_h + +#ifndef __cplusplus +#error This is a C++ include file +#endif + + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#include + +#include "LiveSupport/Core/Ptr.h" +#include "LiveSupport/Core/LocalizedObject.h" + +namespace LiveSupport { +namespace GLiveSupport { + +using namespace LiveSupport::Core; + +/* ================================================================ constants */ + + +/* =================================================================== macros */ + + +/* =============================================================== data types */ + +/** + * Base class for localized objects, using GTK+ strings. + * + * @author $Author: maroy $ + * @version $Revision: 1.1 $ + */ +class GtkLocalizedObject : public LocalizedObject +{ + public: + /** + * Constructor. + * + * @param bundle the resource bundle holding the localized + * resources for this window + */ + GtkLocalizedObject(Ptr::Ref bundle) throw () + : LocalizedObject(bundle) + { + } + + /** + * Virtual destructor. + */ + virtual + ~GtkLocalizedObject(void) throw () + { + } + + /** + * Convert an ICU unicode string to a Glib ustring. + * + * @param unicodeString the ICU unicode string to conver. + * @return the same string as supplied, in Glib ustring form. + */ + static Ptr::Ref + unicodeStringToUstring(Ptr::Ref unicodeString) + throw (); + + /** + * Get a string from the resource bundle, as a Glib ustring. + * + * @param key the key identifying the requested string. + * @return the requested string + * @exception std::invalid_argument if there is no string for the + * specified key. + */ + Ptr::Ref + getResourceUstring(const char * key) + throw (std::invalid_argument) + { + return unicodeStringToUstring(getResourceString(key)); + } +}; + +/* ================================================= external data structures */ + + +/* ====================================================== function prototypes */ + + +} // namespace Core +} // namespace LiveSupport + +#endif // GtkLocalizedObject_h + diff --git a/livesupport/products/gLiveSupport/src/LoginWindow.cxx b/livesupport/products/gLiveSupport/src/LoginWindow.cxx index 0ec67402d..fe3e44d65 100644 --- a/livesupport/products/gLiveSupport/src/LoginWindow.cxx +++ b/livesupport/products/gLiveSupport/src/LoginWindow.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.1 $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LoginWindow.cxx,v $ ------------------------------------------------------------------------------*/ @@ -34,10 +34,13 @@ #endif #include +#include #include "LoginWindow.h" +using namespace Glib; + using namespace LiveSupport::Core; using namespace LiveSupport::GLiveSupport; @@ -55,14 +58,21 @@ using namespace LiveSupport::GLiveSupport; /*------------------------------------------------------------------------------ * Constructor. *----------------------------------------------------------------------------*/ -LoginWindow :: LoginWindow (void) throw () +LoginWindow :: LoginWindow (Ptr::Ref bundle) + throw () + : GtkLocalizedObject(bundle) { - table.reset(new Gtk::Table(2, 2, false)); - loginLabel.reset(new Gtk::Label("login:")); - passwordLabel.reset(new Gtk::Label("password:")); - loginEntry.reset(new Gtk::Entry()); - passwordEntry.reset(new Gtk::Entry()); - okButton.reset(new Gtk::Button("OK")); + try { + table.reset(new Gtk::Table(2, 2, false)); + loginLabel.reset(new Gtk::Label(*getResourceUstring("loginLabel"))); + passwordLabel.reset(new Gtk::Label( + *getResourceUstring("passwordLabel"))); + loginEntry.reset(new Gtk::Entry()); + passwordEntry.reset(new Gtk::Entry()); + okButton.reset(new Gtk::Button(*getResourceUstring("okButtonLabel"))); + } catch (std::invalid_argument &e) { + std::cerr << e.what() << std::endl; + } // set up the login label loginLabel->set_name("loginLabel"); diff --git a/livesupport/products/gLiveSupport/src/LoginWindow.h b/livesupport/products/gLiveSupport/src/LoginWindow.h index 019002826..a7ab290c5 100644 --- a/livesupport/products/gLiveSupport/src/LoginWindow.h +++ b/livesupport/products/gLiveSupport/src/LoginWindow.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.1 $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LoginWindow.h,v $ ------------------------------------------------------------------------------*/ @@ -42,6 +42,8 @@ #include +#include + #include #include #include @@ -49,6 +51,7 @@ #include #include "LiveSupport/Core/Ptr.h" +#include "GtkLocalizedObject.h" namespace LiveSupport { namespace GLiveSupport { @@ -67,9 +70,9 @@ using namespace LiveSupport::Core; * A window, handling user login. * * @author $Author: maroy $ - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ -class LoginWindow : public Gtk::Window +class LoginWindow : public Gtk::Window, public GtkLocalizedObject { protected: @@ -123,8 +126,11 @@ class LoginWindow : public Gtk::Window public: /** * Constructor. + * + * @param bundle the resource bundle holding the localized + * resources for this window */ - LoginWindow(void) throw (); + LoginWindow(Ptr::Ref bundle) throw (); /** * Virtual destructor. diff --git a/livesupport/products/gLiveSupport/src/UiTestMainWindow.cxx b/livesupport/products/gLiveSupport/src/UiTestMainWindow.cxx index 79d8f95e0..2677a4d91 100644 --- a/livesupport/products/gLiveSupport/src/UiTestMainWindow.cxx +++ b/livesupport/products/gLiveSupport/src/UiTestMainWindow.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.1 $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/UiTestMainWindow.cxx,v $ ------------------------------------------------------------------------------*/ @@ -34,7 +34,6 @@ #endif #include - #include #include "LoginWindow.h" @@ -57,7 +56,9 @@ using namespace LiveSupport::GLiveSupport; /*------------------------------------------------------------------------------ * Constructor. *----------------------------------------------------------------------------*/ -UiTestMainWindow :: UiTestMainWindow (void) throw () +UiTestMainWindow :: UiTestMainWindow (Ptr::Ref bundle) + throw () + : GtkLocalizedObject(bundle) { // set up the quit button quitButton.reset(new Gtk::Button("quit")); @@ -110,9 +111,15 @@ UiTestMainWindow :: onQuitButtonClicked (void) throw () void UiTestMainWindow :: onLoginButtonClicked (void) throw () { - std::cout << "invoking loginWindow" << std::endl; + Ptr::Ref loginBundle; + try { + loginBundle = getBundle("loginWindow"); + } catch (std::invalid_argument &e) { + std::cerr << e.what() << std::endl; + return; + } - Ptr::Ref loginWindow(new LoginWindow()); + Ptr::Ref loginWindow(new LoginWindow(loginBundle)); Gtk::Main::run(*loginWindow); diff --git a/livesupport/products/gLiveSupport/src/UiTestMainWindow.h b/livesupport/products/gLiveSupport/src/UiTestMainWindow.h index f5f079d4b..e5e269a49 100644 --- a/livesupport/products/gLiveSupport/src/UiTestMainWindow.h +++ b/livesupport/products/gLiveSupport/src/UiTestMainWindow.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.1 $ + Version : $Revision: 1.2 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/UiTestMainWindow.h,v $ ------------------------------------------------------------------------------*/ @@ -46,6 +46,8 @@ #include "LiveSupport/Core/Ptr.h" +#include "GtkLocalizedObject.h" + namespace LiveSupport { namespace GLiveSupport { @@ -63,9 +65,9 @@ using namespace LiveSupport::Core; * A window, enabling interactive testing of UI components. * * @author $Author: maroy $ - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ -class UiTestMainWindow : public Gtk::Window +class UiTestMainWindow : public Gtk::Window, public GtkLocalizedObject { protected: /** @@ -99,8 +101,11 @@ class UiTestMainWindow : public Gtk::Window public: /** * Constructor. + * + * @param bundle the resource bundle holding localized resources */ - UiTestMainWindow(void) throw (); + UiTestMainWindow(Ptr::Ref bundle) + throw (); /** * Virtual destructor. diff --git a/livesupport/products/gLiveSupport/src/main.cxx b/livesupport/products/gLiveSupport/src/main.cxx index 67ad9221e..a67b1d836 100644 --- a/livesupport/products/gLiveSupport/src/main.cxx +++ b/livesupport/products/gLiveSupport/src/main.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.2 $ + Version : $Revision: 1.3 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/main.cxx,v $ ------------------------------------------------------------------------------*/ @@ -37,9 +37,13 @@ #include "configure.h" #endif +#include + +#include #include #include "LiveSupport/Core/Ptr.h" +#include "LiveSupport/Core/LocalizedObject.h" #include "UiTestMainWindow.h" @@ -68,11 +72,28 @@ int main ( int argc, { Gtk::Main kit(argc, argv); - Ptr::Ref mainWindow(new UiTestMainWindow()); + UErrorCode status = U_ZERO_ERROR; + Ptr::Ref bundle(new ResourceBundle("./tmp/" PACKAGE_NAME, + "en", + status)); + if (!U_SUCCESS(status)) { + std::cerr << "opening resource bundle a failure" << std::endl; + exit(EXIT_FAILURE); + } + + Ptr::Ref mainWindow(new UiTestMainWindow(bundle)); + + Ptr::Ref loginBundle; + try { + loginBundle = mainWindow->getBundle("loginWindow"); + } catch (std::invalid_argument &e) { + std::cerr << e.what() << std::endl; + exit(EXIT_FAILURE); + } // Shows the window and returns when it is closed. Gtk::Main::run(*mainWindow); - return 0; + exit(EXIT_SUCCESS); } diff --git a/livesupport/products/gLiveSupport/var/.keepme b/livesupport/products/gLiveSupport/var/.keepme new file mode 100644 index 000000000..e0808fa16 --- /dev/null +++ b/livesupport/products/gLiveSupport/var/.keepme @@ -0,0 +1 @@ +keep me diff --git a/livesupport/products/gLiveSupport/var/en.txt b/livesupport/products/gLiveSupport/var/en.txt new file mode 100644 index 000000000..d59f768a0 --- /dev/null +++ b/livesupport/products/gLiveSupport/var/en.txt @@ -0,0 +1,3 @@ +en:table +{ +} diff --git a/livesupport/products/gLiveSupport/var/hu.txt b/livesupport/products/gLiveSupport/var/hu.txt new file mode 100644 index 000000000..cd162f77c --- /dev/null +++ b/livesupport/products/gLiveSupport/var/hu.txt @@ -0,0 +1,10 @@ +hu:table +{ + loginWindow:table + { + loginLabel:string { "azonositó:" } + passwordLabel:string { "jelszó:" } + okButtonLabel:string { "Belépés" } + } +} + diff --git a/livesupport/products/gLiveSupport/var/root.txt b/livesupport/products/gLiveSupport/var/root.txt new file mode 100644 index 000000000..b0e266eff --- /dev/null +++ b/livesupport/products/gLiveSupport/var/root.txt @@ -0,0 +1,10 @@ +root:table +{ + loginWindow:table + { + loginLabel:string { "login:" } + passwordLabel:string { "password:" } + okButtonLabel:string { "OK" } + } +} +