diff --git a/livesupport/products/gLiveSupport/etc/Makefile.in b/livesupport/products/gLiveSupport/etc/Makefile.in index 65939cdf4..1ca3a5b6b 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.7 $ +# Version : $Revision: 1.8 $ # Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/etc/Makefile.in,v $ # # @configure_input@ @@ -142,7 +142,8 @@ LDFLAGS = @LDFLAGS@ -pthread \ G_LIVESUPPORT_OBJS = ${TMP_DIR}/GLiveSupport.o \ ${TMP_DIR}/UiTestMainWindow.o \ ${TMP_DIR}/GtkLocalizedObject.o \ - ${TMP_DIR}/LoginWindow.o + ${TMP_DIR}/LoginWindow.o \ + ${TMP_DIR}/AudioClipWindow.o G_LIVESUPPORT_RES = ${TMP_DIR}/${PACKAGE_NAME}_root.res \ ${TMP_DIR}/${PACKAGE_NAME}_en.res \ diff --git a/livesupport/products/gLiveSupport/etc/gLiveSupport.xml b/livesupport/products/gLiveSupport/etc/gLiveSupport.xml index 9ea835e8b..5b08a3945 100644 --- a/livesupport/products/gLiveSupport/etc/gLiveSupport.xml +++ b/livesupport/products/gLiveSupport/etc/gLiveSupport.xml @@ -70,12 +70,38 @@ - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/livesupport/products/gLiveSupport/src/AudioClipWindow.cxx b/livesupport/products/gLiveSupport/src/AudioClipWindow.cxx new file mode 100644 index 000000000..a81ea53f7 --- /dev/null +++ b/livesupport/products/gLiveSupport/src/AudioClipWindow.cxx @@ -0,0 +1,183 @@ +/*------------------------------------------------------------------------------ + + 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/AudioClipWindow.cxx,v $ + +------------------------------------------------------------------------------*/ + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#include +#include + +#include "AudioClipWindow.h" + + +using namespace Glib; + +using namespace LiveSupport::Core; +using namespace LiveSupport::GLiveSupport; + +/* =================================================== local data structures */ + + +/* ================================================ local constants & macros */ + + +/* =============================================== local function prototypes */ + + +/* ============================================================= module code */ + +/*------------------------------------------------------------------------------ + * Constructor. + *----------------------------------------------------------------------------*/ +AudioClipWindow :: AudioClipWindow (Ptr::Ref gLiveSupport, + Ptr::Ref bundle) + throw () + : GtkLocalizedObject(bundle) +{ + this->gLiveSupport = gLiveSupport; + + try { + closeButton.reset(new Gtk::Button( + *getResourceUstring("closeButtonLabel"))); + } catch (std::invalid_argument &e) { + std::cerr << e.what() << std::endl; + } + + // set up the close button + closeButton->set_name("closeButton"); + closeButton->set_flags(Gtk::CAN_FOCUS|Gtk::CAN_DEFAULT|Gtk::HAS_DEFAULT); + closeButton->set_relief(Gtk::RELIEF_NORMAL); + // Register the signal handler for the button getting clicked. + closeButton->signal_clicked().connect(sigc::mem_fun(*this, + &AudioClipWindow::onCloseButtonClicked)); + + + set_title("LiveSupport Audio Clip Window"); + set_border_width(5); + set_default_size(400, 200); + + add(vBox); + + // Add the TreeView, inside a ScrolledWindow, with the button underneath: + scrolledWindow.add(treeView); + + // Only show the scrollbars when they are necessary: + scrolledWindow.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC); + + vBox.pack_start(scrolledWindow); + vBox.pack_start(buttonBox, Gtk::PACK_SHRINK); + + buttonBox.pack_start(*closeButton, Gtk::PACK_SHRINK); + buttonBox.set_border_width(5); + buttonBox.set_layout(Gtk::BUTTONBOX_END); + + // Create the Tree model: + treeModel = Gtk::ListStore::create(modelColumns); + treeView.set_model(treeModel); + + // Add the TreeView's view columns: + try { + treeView.append_column(*getResourceUstring("idColumnLabel"), + modelColumns.idColumn); + treeView.append_column(*getResourceUstring("lengthColumnLabel"), + modelColumns.lengthColumn); + treeView.append_column(*getResourceUstring("uriColumnLabel"), + modelColumns.uriColumn); + treeView.append_column(*getResourceUstring("tokenColumnLabel"), + modelColumns.tokenColumn); + } catch (std::invalid_argument &e) { + std::cerr << e.what() << std::endl; + } + + showAllAudioClips(); + + show_all_children(); +} + + +/*------------------------------------------------------------------------------ + * Show all audio clips + *----------------------------------------------------------------------------*/ +void +AudioClipWindow :: showAllAudioClips(void) throw () +{ + // list all audio clips + Ptr::Ref sessionId; + Ptr::Ref storage; + Ptr::Ref> >::Ref audioClips; + std::vector::Ref>::iterator it; + std::vector::Ref>::iterator end; + Ptr::Ref clip; + Gtk::TreeModel::Row row; + std::string lengthStr; + + sessionId = gLiveSupport->getSessionId(); + storage = gLiveSupport->getStorage(); + audioClips = storage->getAllAudioClips(sessionId); + it = audioClips->begin(); + end = audioClips->end(); + while (it < end) { + clip = *it; + row = *(treeModel->append()); + lengthStr = boost::posix_time::to_simple_string(*clip->getPlaylength()); + + row[modelColumns.idColumn] = clip->getId()->getId(); + row[modelColumns.lengthColumn] = lengthStr; + row[modelColumns.uriColumn] = clip->getUri().get() ? *clip->getUri() + : ""; + row[modelColumns.tokenColumn] = clip->getToken().get() + ? *clip->getUri() + : ""; + + it++; + } +} + + +/*------------------------------------------------------------------------------ + * Destructor. + *----------------------------------------------------------------------------*/ +AudioClipWindow :: ~AudioClipWindow (void) throw () +{ +} + + +/*------------------------------------------------------------------------------ + * Event handler for the close button getting clicked. + *----------------------------------------------------------------------------*/ +void +AudioClipWindow :: onCloseButtonClicked (void) throw () +{ + hide(); +} + + diff --git a/livesupport/products/gLiveSupport/src/AudioClipWindow.h b/livesupport/products/gLiveSupport/src/AudioClipWindow.h new file mode 100644 index 000000000..811e2a293 --- /dev/null +++ b/livesupport/products/gLiveSupport/src/AudioClipWindow.h @@ -0,0 +1,201 @@ +/*------------------------------------------------------------------------------ + + 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/AudioClipWindow.h,v $ + +------------------------------------------------------------------------------*/ +#ifndef AudioClipWindow_h +#define AudioClipWindow_h + +#ifndef __cplusplus +#error This is a C++ include file +#endif + + +/* ============================================================ include files */ + +#ifdef HAVE_CONFIG_H +#include "configure.h" +#endif + +#include + +#include + +#include + +#include "LiveSupport/Core/Ptr.h" +#include "GtkLocalizedObject.h" +#include "GLiveSupport.h" + +namespace LiveSupport { +namespace GLiveSupport { + +using namespace LiveSupport::Core; + +/* ================================================================ constants */ + + +/* =================================================================== macros */ + + +/* =============================================================== data types */ + +/** + * A window, showing and handling audio clips. + * + * @author $Author: maroy $ + * @version $Revision: 1.1 $ + */ +class AudioClipWindow : public Gtk::Window, public GtkLocalizedObject +{ + + protected: + + /** + * The model columns, for the audio clip window. + * Lists one clip per row. + * + * @author $Author: maroy $ + * @version $Revision: 1.1 $ + */ + class ModelColumns : public Gtk::TreeModel::ColumnRecord + { + public: + /** + * The column for the id of the audio clip. + */ + Gtk::TreeModelColumn idColumn; + + /** + * The column for the length of the audio clip. + */ + Gtk::TreeModelColumn lengthColumn; + + /** + * The column for the URI of the audio clip. + */ + Gtk::TreeModelColumn uriColumn; + + /** + * The column for the token of the audio clip. + */ + Gtk::TreeModelColumn tokenColumn; + + /** + * Constructor. + */ + ModelColumns(void) throw () + { + add(idColumn); + add(lengthColumn); + add(uriColumn); + add(tokenColumn); + } + }; + + + /** + * The GLiveSupport object, holding the state of the application. + */ + Ptr::Ref gLiveSupport; + + /** + * The column model. + */ + ModelColumns modelColumns; + + /** + * The main container in the window. + */ + Gtk::VBox vBox; + + /** + * A scrolled window, so that the list can be scrolled. + */ + Gtk::ScrolledWindow scrolledWindow; + + /** + * The tree view, now only showing rows. + */ + Gtk::TreeView treeView; + + /** + * The tree model, as a GTK reference. + */ + Glib::RefPtr treeModel; + + /** + * The box containing the close button. + */ + Gtk::HButtonBox buttonBox; + + /** + * The close button. + */ + Ptr::Ref closeButton; + + /** + * Signal handler for the close button clicked. + */ + virtual void + onCloseButtonClicked(void) throw (); + + /** + * Update the window contents, with all the video clips. + */ + void + showAllAudioClips(void) throw (); + + + public: + /** + * Constructor. + * + * @param gLiveSupport the GLiveSupport, application object. + * @param bundle the resource bundle holding the localized + * resources for this window + */ + AudioClipWindow(Ptr::Ref gLiveSupport, + Ptr::Ref bundle) throw (); + + /** + * Virtual destructor. + */ + virtual + ~AudioClipWindow(void) throw (); +}; + +/* ================================================= external data structures */ + + +/* ====================================================== function prototypes */ + + +} // namespace GLiveSupport +} // namespace LiveSupport + +#endif // AudioClipWindow_h + diff --git a/livesupport/products/gLiveSupport/src/GLiveSupport.h b/livesupport/products/gLiveSupport/src/GLiveSupport.h index 8ef1f0262..294db8223 100644 --- a/livesupport/products/gLiveSupport/src/GLiveSupport.h +++ b/livesupport/products/gLiveSupport/src/GLiveSupport.h @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.4 $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.h,v $ ------------------------------------------------------------------------------*/ @@ -85,7 +85,7 @@ using namespace LiveSupport::SchedulerClient; * respective documentation. * * @author $Author: maroy $ - * @version $Revision: 1.4 $ + * @version $Revision: 1.5 $ * @see LocalizedObject#getBundle(const xmlpp::Element &) * @see AuthenticationClientFactory * @see StorageClientFactory @@ -216,6 +216,17 @@ class GLiveSupport : public Configurable, */ void logout(void) throw (); + + /** + * Accessor function to the storage client held by this object. + * + * @return the storage client held by this object. + */ + Ptr::Ref + getStorage(void) throw () + { + return storage; + } }; /* ================================================= external data structures */ diff --git a/livesupport/products/gLiveSupport/src/LoginWindow.cxx b/livesupport/products/gLiveSupport/src/LoginWindow.cxx index 64ad94841..f4319cc65 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.3 $ + Version : $Revision: 1.4 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/LoginWindow.cxx,v $ ------------------------------------------------------------------------------*/ @@ -152,13 +152,7 @@ LoginWindow :: LoginWindow (Ptr::Ref bundle) // add the table to the window, and show everything add(*table); - loginLabel->show(); - passwordLabel->show(); - loginEntry->show(); - passwordEntry->show(); - okButton->show(); - table->show(); - show(); + show_all(); } @@ -171,7 +165,7 @@ LoginWindow :: ~LoginWindow (void) throw () /*------------------------------------------------------------------------------ - * Event handler for the button getting clicked. + * Event handler for the OK button getting clicked. *----------------------------------------------------------------------------*/ void LoginWindow :: onOkButtonClicked (void) throw () diff --git a/livesupport/products/gLiveSupport/src/UiTestMainWindow.cxx b/livesupport/products/gLiveSupport/src/UiTestMainWindow.cxx index 7a0a233df..4a7d8ac3f 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.4 $ + Version : $Revision: 1.5 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/UiTestMainWindow.cxx,v $ ------------------------------------------------------------------------------*/ @@ -40,6 +40,7 @@ #include "LiveSupport/Core/TimeConversion.h" #include "LoginWindow.h" +#include "AudioClipWindow.h" #include "UiTestMainWindow.h" @@ -82,6 +83,11 @@ UiTestMainWindow :: UiTestMainWindow (Ptr::Ref gLiveSupport, logoutButton->signal_clicked().connect(sigc::mem_fun(*this, &UiTestMainWindow::onLogoutButtonClicked)); + // set up the audio clip button + audioClipButton.reset(new Gtk::Button("audioClips")); + audioClipButton->signal_clicked().connect(sigc::mem_fun(*this, + &UiTestMainWindow::onAudioClipButtonClicked)); + // set up the quit button quitButton.reset(new Gtk::Button("quit")); quitButton->signal_clicked().connect(sigc::mem_fun(*this, @@ -95,18 +101,13 @@ UiTestMainWindow :: UiTestMainWindow (Ptr::Ref gLiveSupport, layout->add(*statusLabel); layout->add(*timeLabel); layout->add(*loginButton); + layout->add(*audioClipButton); layout->add(*logoutButton); layout->add(*quitButton); add(*layout); // show everything - statusLabel->show(); - timeLabel->show(); - loginButton->show(); - logoutButton->show(); - quitButton->show(); - layout->show(); - show(); + show_all(); // set the timer, that will update timeLabel setTimer(); @@ -150,7 +151,7 @@ UiTestMainWindow :: resetTimer(void) throw () /*------------------------------------------------------------------------------ - * Event handler for the logout getting clicked. + * Event handler for the logout button getting clicked. *----------------------------------------------------------------------------*/ void UiTestMainWindow :: onLogoutButtonClicked (void) throw () @@ -161,7 +162,7 @@ UiTestMainWindow :: onLogoutButtonClicked (void) throw () /*------------------------------------------------------------------------------ - * Event handler for the quit getting clicked. + * Event handler for the quit button getting clicked. *----------------------------------------------------------------------------*/ void UiTestMainWindow :: onQuitButtonClicked (void) throw () @@ -226,3 +227,24 @@ UiTestMainWindow :: onUpdateTime(int dummy) throw () } +/*------------------------------------------------------------------------------ + * Event handler for the audio clip button getting clicked. + *----------------------------------------------------------------------------*/ +void +UiTestMainWindow :: onAudioClipButtonClicked (void) throw () +{ + Ptr::Ref bundle; + try { + bundle = getBundle("audioClipWindow"); + } catch (std::invalid_argument &e) { + std::cerr << e.what() << std::endl; + return; + } + + Ptr::Ref audioClipWindow( + new AudioClipWindow(gLiveSupport, bundle)); + + Gtk::Main::run(*audioClipWindow); +} + + diff --git a/livesupport/products/gLiveSupport/src/UiTestMainWindow.h b/livesupport/products/gLiveSupport/src/UiTestMainWindow.h index 4d575d016..3f0732896 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.5 $ + Version : $Revision: 1.6 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/Attic/UiTestMainWindow.h,v $ ------------------------------------------------------------------------------*/ @@ -66,7 +66,7 @@ using namespace LiveSupport::Core; * A window, enabling interactive testing of UI components. * * @author $Author: maroy $ - * @version $Revision: 1.5 $ + * @version $Revision: 1.6 $ */ class UiTestMainWindow : public Gtk::Window, public GtkLocalizedObject { @@ -107,6 +107,11 @@ class UiTestMainWindow : public Gtk::Window, public GtkLocalizedObject */ Ptr::Ref logoutButton; + /** + * The button to that brings up the audio clip window. + */ + Ptr::Ref audioClipButton; + /** * The gLiveSupport object, handling the logic of the application. */ @@ -130,6 +135,12 @@ class UiTestMainWindow : public Gtk::Window, public GtkLocalizedObject virtual void onLogoutButtonClicked(void) throw (); + /** + * Signal handler for the audio clip button clicked. + */ + virtual void + onAudioClipButtonClicked(void) throw (); + /** * Function that updates timeLabel with the current time. * This is called by GTK at regular intervals. diff --git a/livesupport/products/gLiveSupport/var/hu.txt b/livesupport/products/gLiveSupport/var/hu.txt index f84fb4180..f15183c05 100644 --- a/livesupport/products/gLiveSupport/var/hu.txt +++ b/livesupport/products/gLiveSupport/var/hu.txt @@ -9,5 +9,15 @@ hu:table passwordLabel:string { "jelszó:" } okButtonLabel:string { "Belépés" } } + + audioClipWindow:table + { + idColumnLabel:string { "azonositó" } + lengthColumnLabel:string { "hossz" } + uriColumnLabel:string { "URI" } + tokenColumnLabel:string { "token" } + + closeButtonLabel:string { "Bezár" } + } } diff --git a/livesupport/products/gLiveSupport/var/root.txt b/livesupport/products/gLiveSupport/var/root.txt index 18b9d78f7..aa45eda16 100644 --- a/livesupport/products/gLiveSupport/var/root.txt +++ b/livesupport/products/gLiveSupport/var/root.txt @@ -9,5 +9,15 @@ root:table passwordLabel:string { "password:" } okButtonLabel:string { "OK" } } + + audioClipWindow:table + { + idColumnLabel:string { "id" } + lengthColumnLabel:string { "length" } + uriColumnLabel:string { "URI" } + tokenColumnLabel:string { "token" } + + closeButtonLabel:string { "close" } + } }