now utilizing LiveSupport::Core::LocalizedObject and GtkLocalizedObject

added -pthread to build parameters
This commit is contained in:
maroy 2004-11-23 12:07:17 +00:00
parent 723e0459fa
commit 1e833bc16b
13 changed files with 336 additions and 40 deletions

View File

@ -21,7 +21,7 @@
# #
# #
# Author : $Author: maroy $ # 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 $ # Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/etc/Makefile.in,v $
# #
# @configure_input@ # @configure_input@
@ -38,6 +38,8 @@ DOXYGEN = doxygen
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Basic directory and file definitions # Basic directory and file definitions
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
PACKAGE_NAME = @PACKAGE_NAME@
BASE_DIR = @builddir@ BASE_DIR = @builddir@
DOC_DIR = ${BASE_DIR}/doc DOC_DIR = ${BASE_DIR}/doc
DOXYGEN_DIR = ${DOC_DIR}/doxygen DOXYGEN_DIR = ${DOC_DIR}/doxygen
@ -45,13 +47,21 @@ COVERAGE_DIR = ${DOC_DIR}/coverage
ETC_DIR = ${BASE_DIR}/etc ETC_DIR = ${BASE_DIR}/etc
SRC_DIR = ${BASE_DIR}/src SRC_DIR = ${BASE_DIR}/src
TMP_DIR = ${BASE_DIR}/tmp TMP_DIR = ${BASE_DIR}/tmp
VAR_DIR = ${BASE_DIR}/var
USR_DIR = ${BASE_DIR}/../../usr USR_DIR = ${BASE_DIR}/../../usr
USR_INCLUDE_DIR = ${USR_DIR}/include USR_INCLUDE_DIR = ${USR_DIR}/include
USR_LIB_DIR = ${USR_DIR}/lib USR_LIB_DIR = ${USR_DIR}/lib
USR_BIN_DIR = ${USR_DIR}/bin
BOOST_INCLUDE_DIR = ${USR_INCLUDE_DIR}/boost-1_31 BOOST_INCLUDE_DIR = ${USR_INCLUDE_DIR}/boost-1_31
LIBXMLPP_INCLUDE_DIR = ${USR_INCLUDE_DIR}/libxml++-1.0 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} VPATH = ${SRC_DIR}
MODULES_DIR = ${BASE_DIR}/../../modules MODULES_DIR = ${BASE_DIR}/../../modules
@ -71,6 +81,9 @@ STORAGE_LIB_FILE = ${STORAGE_LIB_DIR}/lib${STORAGE_LIB}.a
GTKMM_CFLAGS=@GTKMM_CFLAGS@ GTKMM_CFLAGS=@GTKMM_CFLAGS@
GTKMM_LIBS=@GTKMM_LIBS@ GTKMM_LIBS=@GTKMM_LIBS@
ICU_CFLAGS=
ICU_LIBS=`${USR_DIR}/bin/icu-config --ldflags-toolutil --ldflags-icuio`
TEST_RESULTS = ${DOC_DIR}/testResults.xml TEST_RESULTS = ${DOC_DIR}/testResults.xml
# the text result XSLT has to be relative to the test result file, e.g. TMP_DIR # the text result XSLT has to be relative to the test result file, e.g. TMP_DIR
TEST_XSLT = ../etc/testResultToHtml.xsl TEST_XSLT = ../etc/testResultToHtml.xsl
@ -81,13 +94,16 @@ TEST_RUNNER = ${TMP_DIR}/testRunner
DOXYGEN_CONFIG = ${ETC_DIR}/doxygen.config DOXYGEN_CONFIG = ${ETC_DIR}/doxygen.config
export LD_LIBRARY_PATH=${USR_LIB_DIR}
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Configuration parameters # Configuration parameters
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
CPPFLAGS = @CPPFLAGS@ CPPFLAGS = @CPPFLAGS@
CXXFLAGS = @CXXFLAGS@ @DEFS@ @COVERAGE_CXXFLAGS@ \ CXXFLAGS = @CXXFLAGS@ @DEFS@ @COVERAGE_CXXFLAGS@ -pthread \
-pedantic -Wall -Wno-long-long \ -pedantic -Wall -Wno-long-long \
${ICU_CFLAGS} \
${GTKMM_CFLAGS} \ ${GTKMM_CFLAGS} \
-I${USR_INCLUDE_DIR} \ -I${USR_INCLUDE_DIR} \
-I${BOOST_INCLUDE_DIR} \ -I${BOOST_INCLUDE_DIR} \
@ -95,7 +111,10 @@ CXXFLAGS = @CXXFLAGS@ @DEFS@ @COVERAGE_CXXFLAGS@ \
-I${CORE_INCLUDE_DIR} \ -I${CORE_INCLUDE_DIR} \
-I${STORAGE_INCLUDE_DIR} \ -I${STORAGE_INCLUDE_DIR} \
-I${TMP_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${CORE_LIB_DIR} \
-L${STORAGE_LIB_DIR} -L${STORAGE_LIB_DIR}
@ -104,13 +123,18 @@ LDFLAGS = @LDFLAGS@ -L${USR_LIB_DIR} \
# Dependencies # Dependencies
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
G_LIVESUPPORT_OBJS = ${TMP_DIR}/UiTestMainWindow.o \ G_LIVESUPPORT_OBJS = ${TMP_DIR}/UiTestMainWindow.o \
${TMP_DIR}/GtkLocalizedObject.o \
${TMP_DIR}/LoginWindow.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 ${TMP_DIR}/main.o
G_LIVESUPPORT_EXE_LIBS = -l${STORAGE_LIB} -l${CORE_LIB} \ G_LIVESUPPORT_EXE_LIBS = -l${CORE_LIB} \
${GTKMM_LIBS} \
-lboost_date_time-gcc \ -lboost_date_time-gcc \
-lxmlrpc++ -lssl -lxml++-1.0 -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: all dir_setup doc clean docclean depclean distclean
.PHONY: install start run_tests stop uninstall .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} dir_setup: ${TMP_DIR} ${DOXYGEN_DIR}
@ -133,7 +157,7 @@ doc:
${DOXYGEN} ${DOXYGEN_CONFIG} ${DOXYGEN} ${DOXYGEN_CONFIG}
clean: 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} ${TEST_RUNNER_OBJS} ${TEST_RUNNER}
${RM} ${TMP_DIR}/*.bb ${TMP_DIR}/*.bbg ${TMP_DIR}/*.da ${TMP_DIR}/*.info ${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 check: all ${TEST_RUNNER} run_tests
run_tests: ${TEST_RUNNER} run_tests: ${TEST_RUNNER}
LD_LIBRARY_PATH=${USR_LIB_DIR} ${TEST_RUNNER} \ ${TEST_RUNNER} -o ${TEST_RESULTS} -s ${TEST_XSLT}
-o ${TEST_RESULTS} -s ${TEST_XSLT}
run: ${G_LIVESUPPORT_EXE} run: all
LD_LIBRARY_PATH=${USR_LIB_DIR} ${G_LIVESUPPORT_EXE} ${G_LIVESUPPORT_EXE}
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# Specific targets # Specific targets
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
${G_LIVESUPPORT_EXE}: ${CORE_LIB_FILE} ${STORAGE_LIB_FILE} \ ${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} ${CXX} ${LDFLAGS} -o $@ $^ ${G_LIVESUPPORT_EXE_LIBS}
${TMP_DIR}: ${TMP_DIR}:
@ -189,3 +212,6 @@ ${STORAGE_LIB_FILE}:
${TMP_DIR}/%.o : ${SRC_DIR}/%.cxx ${TMP_DIR}/%.o : ${SRC_DIR}/%.cxx
${CXX} ${CPPFLAGS} ${CXXFLAGS} -c -o $@ $< ${CXX} ${CPPFLAGS} ${CXXFLAGS} -c -o $@ $<
${TMP_DIR}/${PACKAGE_NAME}_%.res : ${VAR_DIR}/%.txt
${GENRB} ${GENRBOPTS} $^

View File

@ -21,7 +21,7 @@ dnl Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
dnl dnl
dnl dnl
dnl Author : $Author: maroy $ 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 Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/etc/configure.ac,v $
dnl----------------------------------------------------------------------------- dnl-----------------------------------------------------------------------------
@ -35,7 +35,7 @@ dnl-----------------------------------------------------------------------------
AC_INIT(gLiveSupport, 0.1, bugs@campware.org) AC_INIT(gLiveSupport, 0.1, bugs@campware.org)
AC_PREREQ(2.59) AC_PREREQ(2.59)
AC_COPYRIGHT([Copyright (c) 2004 Media Development Loan Fund under the GNU GPL]) 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) AC_CONFIG_SRCDIR(../src/main.cxx)
@ -43,7 +43,7 @@ AC_CONFIG_HEADERS(configure.h)
AC_PROG_CXX() AC_PROG_CXX()
AC_CHECK_HEADERS(sys/types.h unistd.h getopt.h signal.h sys/stat.h time.h) 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]) PKG_CHECK_MODULES(GTKMM,[gtkmm-2.4 >= 2.4.0])
AC_SUBST(GTKMM_CFLAGS) AC_SUBST(GTKMM_CFLAGS)

View File

@ -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<Glib::ustring>::Ref
GtkLocalizedObject :: unicodeStringToUstring(
Ptr<const UnicodeString>::Ref unicodeString)
throw ()
{
const UChar * uchars = unicodeString->getBuffer();
int32_t length = unicodeString->length();
Ptr<Glib::ustring>::Ref ustr(new Glib::ustring());
ustr->reserve(length);
while (length--) {
ustr->push_back((gunichar) (*(uchars++)));
}
return ustr;
}

View File

@ -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 <glibmm/ustring.h>
#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<ResourceBundle>::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<Glib::ustring>::Ref
unicodeStringToUstring(Ptr<const UnicodeString>::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<Glib::ustring>::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

View File

@ -22,7 +22,7 @@
Author : $Author: maroy $ 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 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LoginWindow.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -34,10 +34,13 @@
#endif #endif
#include <iostream> #include <iostream>
#include <stdexcept>
#include "LoginWindow.h" #include "LoginWindow.h"
using namespace Glib;
using namespace LiveSupport::Core; using namespace LiveSupport::Core;
using namespace LiveSupport::GLiveSupport; using namespace LiveSupport::GLiveSupport;
@ -55,14 +58,21 @@ using namespace LiveSupport::GLiveSupport;
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Constructor. * Constructor.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
LoginWindow :: LoginWindow (void) throw () LoginWindow :: LoginWindow (Ptr<ResourceBundle>::Ref bundle)
throw ()
: GtkLocalizedObject(bundle)
{ {
table.reset(new Gtk::Table(2, 2, false)); try {
loginLabel.reset(new Gtk::Label("login:")); table.reset(new Gtk::Table(2, 2, false));
passwordLabel.reset(new Gtk::Label("password:")); loginLabel.reset(new Gtk::Label(*getResourceUstring("loginLabel")));
loginEntry.reset(new Gtk::Entry()); passwordLabel.reset(new Gtk::Label(
passwordEntry.reset(new Gtk::Entry()); *getResourceUstring("passwordLabel")));
okButton.reset(new Gtk::Button("OK")); 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 // set up the login label
loginLabel->set_name("loginLabel"); loginLabel->set_name("loginLabel");

View File

@ -22,7 +22,7 @@
Author : $Author: maroy $ 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 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LoginWindow.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -42,6 +42,8 @@
#include <string> #include <string>
#include <unicode/resbund.h>
#include <gtkmm/window.h> #include <gtkmm/window.h>
#include <gtkmm/button.h> #include <gtkmm/button.h>
#include <gtkmm/label.h> #include <gtkmm/label.h>
@ -49,6 +51,7 @@
#include <gtkmm/table.h> #include <gtkmm/table.h>
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
#include "GtkLocalizedObject.h"
namespace LiveSupport { namespace LiveSupport {
namespace GLiveSupport { namespace GLiveSupport {
@ -67,9 +70,9 @@ using namespace LiveSupport::Core;
* A window, handling user login. * A window, handling user login.
* *
* @author $Author: maroy $ * @author $Author: maroy $
* @version $Revision: 1.1 $ * @version $Revision: 1.2 $
*/ */
class LoginWindow : public Gtk::Window class LoginWindow : public Gtk::Window, public GtkLocalizedObject
{ {
protected: protected:
@ -123,8 +126,11 @@ class LoginWindow : public Gtk::Window
public: public:
/** /**
* Constructor. * Constructor.
*
* @param bundle the resource bundle holding the localized
* resources for this window
*/ */
LoginWindow(void) throw (); LoginWindow(Ptr<ResourceBundle>::Ref bundle) throw ();
/** /**
* Virtual destructor. * Virtual destructor.

View File

@ -22,7 +22,7 @@
Author : $Author: maroy $ 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 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/UiTestMainWindow.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -34,7 +34,6 @@
#endif #endif
#include <iostream> #include <iostream>
#include <gtkmm/main.h> #include <gtkmm/main.h>
#include "LoginWindow.h" #include "LoginWindow.h"
@ -57,7 +56,9 @@ using namespace LiveSupport::GLiveSupport;
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Constructor. * Constructor.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
UiTestMainWindow :: UiTestMainWindow (void) throw () UiTestMainWindow :: UiTestMainWindow (Ptr<ResourceBundle>::Ref bundle)
throw ()
: GtkLocalizedObject(bundle)
{ {
// set up the quit button // set up the quit button
quitButton.reset(new Gtk::Button("quit")); quitButton.reset(new Gtk::Button("quit"));
@ -110,9 +111,15 @@ UiTestMainWindow :: onQuitButtonClicked (void) throw ()
void void
UiTestMainWindow :: onLoginButtonClicked (void) throw () UiTestMainWindow :: onLoginButtonClicked (void) throw ()
{ {
std::cout << "invoking loginWindow" << std::endl; Ptr<ResourceBundle>::Ref loginBundle;
try {
loginBundle = getBundle("loginWindow");
} catch (std::invalid_argument &e) {
std::cerr << e.what() << std::endl;
return;
}
Ptr<LoginWindow>::Ref loginWindow(new LoginWindow()); Ptr<LoginWindow>::Ref loginWindow(new LoginWindow(loginBundle));
Gtk::Main::run(*loginWindow); Gtk::Main::run(*loginWindow);

View File

@ -22,7 +22,7 @@
Author : $Author: maroy $ 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 $ 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 "LiveSupport/Core/Ptr.h"
#include "GtkLocalizedObject.h"
namespace LiveSupport { namespace LiveSupport {
namespace GLiveSupport { namespace GLiveSupport {
@ -63,9 +65,9 @@ using namespace LiveSupport::Core;
* A window, enabling interactive testing of UI components. * A window, enabling interactive testing of UI components.
* *
* @author $Author: maroy $ * @author $Author: maroy $
* @version $Revision: 1.1 $ * @version $Revision: 1.2 $
*/ */
class UiTestMainWindow : public Gtk::Window class UiTestMainWindow : public Gtk::Window, public GtkLocalizedObject
{ {
protected: protected:
/** /**
@ -99,8 +101,11 @@ class UiTestMainWindow : public Gtk::Window
public: public:
/** /**
* Constructor. * Constructor.
*
* @param bundle the resource bundle holding localized resources
*/ */
UiTestMainWindow(void) throw (); UiTestMainWindow(Ptr<ResourceBundle>::Ref bundle)
throw ();
/** /**
* Virtual destructor. * Virtual destructor.

View File

@ -22,7 +22,7 @@
Author : $Author: maroy $ 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 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/main.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -37,9 +37,13 @@
#include "configure.h" #include "configure.h"
#endif #endif
#include <iostream>
#include <unicode/resbund.h>
#include <gtkmm/main.h> #include <gtkmm/main.h>
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/LocalizedObject.h"
#include "UiTestMainWindow.h" #include "UiTestMainWindow.h"
@ -68,11 +72,28 @@ int main ( int argc,
{ {
Gtk::Main kit(argc, argv); Gtk::Main kit(argc, argv);
Ptr<UiTestMainWindow>::Ref mainWindow(new UiTestMainWindow()); UErrorCode status = U_ZERO_ERROR;
Ptr<ResourceBundle>::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<UiTestMainWindow>::Ref mainWindow(new UiTestMainWindow(bundle));
Ptr<ResourceBundle>::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. // Shows the window and returns when it is closed.
Gtk::Main::run(*mainWindow); Gtk::Main::run(*mainWindow);
return 0; exit(EXIT_SUCCESS);
} }

View File

@ -0,0 +1 @@
keep me

View File

@ -0,0 +1,3 @@
en:table
{
}

View File

@ -0,0 +1,10 @@
hu:table
{
loginWindow:table
{
loginLabel:string { "azonositó:" }
passwordLabel:string { "jelszó:" }
okButtonLabel:string { "Belépés" }
}
}

View File

@ -0,0 +1,10 @@
root:table
{
loginWindow:table
{
loginLabel:string { "login:" }
passwordLabel:string { "password:" }
okButtonLabel:string { "OK" }
}
}