diff --git a/livesupport/products/gLiveSupport/src/GLiveSupport.cxx b/livesupport/products/gLiveSupport/src/GLiveSupport.cxx index 1092d6bae..5730ce4bb 100644 --- a/livesupport/products/gLiveSupport/src/GLiveSupport.cxx +++ b/livesupport/products/gLiveSupport/src/GLiveSupport.cxx @@ -22,7 +22,7 @@ Author : $Author: maroy $ - Version : $Revision: 1.8 $ + Version : $Revision: 1.9 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $ ------------------------------------------------------------------------------*/ @@ -292,7 +292,7 @@ GLiveSupport :: showLoggedInUI(void) throw () /*------------------------------------------------------------------------------ * Upload a file to the server. *----------------------------------------------------------------------------*/ -void +Ptr::Ref LiveSupport :: GLiveSupport :: GLiveSupport :: uploadFile(Ptr::Ref title, Ptr::Ref fileName) @@ -320,6 +320,8 @@ GLiveSupport :: uploadFile(Ptr::Ref title, title, playlength, uri)); - storage->storeAudioClip(sessionId, audioClip); + storage->storeAudioClip(sessionId, audioClip); + + return audioClip; } diff --git a/livesupport/products/gLiveSupport/src/GLiveSupport.h b/livesupport/products/gLiveSupport/src/GLiveSupport.h index e683b8d72..569eea3bd 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.10 $ + Version : $Revision: 1.11 $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.h,v $ ------------------------------------------------------------------------------*/ @@ -94,7 +94,7 @@ class MasterPanelWindow; * respective documentation. * * @author $Author: maroy $ - * @version $Revision: 1.10 $ + * @version $Revision: 1.11 $ * @see LocalizedObject#getBundle(const xmlpp::Element &) * @see AuthenticationClientFactory * @see StorageClientFactory @@ -320,9 +320,10 @@ class GLiveSupport : public LocalizedConfigurable, * * @param title the title of the audio clip. * @param fileName the full filename of the audio clip. + * @return the audio clip that was uploaded. * @exception StorageException on upload failures. */ - void + Ptr::Ref uploadFile(Ptr::Ref title, Ptr::Ref fileName) throw (StorageException); diff --git a/livesupport/products/gLiveSupport/src/UploadFileWindow.cxx b/livesupport/products/gLiveSupport/src/UploadFileWindow.cxx index d53d5c590..1c05bc61f 100644 --- a/livesupport/products/gLiveSupport/src/UploadFileWindow.cxx +++ b/livesupport/products/gLiveSupport/src/UploadFileWindow.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/UploadFileWindow.cxx,v $ ------------------------------------------------------------------------------*/ @@ -74,6 +74,7 @@ UploadFileWindow :: UploadFileWindow (Ptr::Ref gLiveSupport, nameEntry.reset(new Gtk::Entry()); uploadButton.reset(new Gtk::Button("upload")); closeButton.reset(new Gtk::Button("close")); + statusBar.reset(new Gtk::Label("status bar")); // set up the layout, which is a button box layout.reset(new Gtk::Table()); @@ -87,6 +88,7 @@ UploadFileWindow :: UploadFileWindow (Ptr::Ref gLiveSupport, layout->attach(*nameEntry, 1, 2, 1, 2); layout->attach(*uploadButton, 1, 2, 2, 3); layout->attach(*closeButton, 1, 2, 3, 4); + layout->attach(*statusBar, 0, 3, 4, 5); add(*layout); @@ -135,18 +137,26 @@ UploadFileWindow :: onChooseFileButtonClicked(void) throw () void UploadFileWindow :: onUploadButtonClicked(void) throw () { - std::cerr << "upload clicked" << std::endl; try { Ptr::Ref title; Ptr::Ref fileName; + Ptr::Ref audioClip; title.reset(new Glib::ustring(nameEntry->get_text())); fileName.reset(new std::string(fileNameEntry->get_text().raw())); - gLiveSupport->uploadFile(title, fileName); + audioClip = gLiveSupport->uploadFile(title, fileName); + + // display success in the status bar + Glib::ustring statusText("uploaded clip "); + statusText += *audioClip->getTitle(); + statusBar->set_text(statusText); + + // clean the entry fields + nameEntry->set_text(""); + fileNameEntry->set_text(""); } catch (StorageException &e) { - // TODO: signal error here - std::cerr << "StorageException: " << e.what() << std::endl; + statusBar->set_text(e.what()); } } diff --git a/livesupport/products/gLiveSupport/src/UploadFileWindow.h b/livesupport/products/gLiveSupport/src/UploadFileWindow.h index 34774e87e..43dd8f3ea 100644 --- a/livesupport/products/gLiveSupport/src/UploadFileWindow.h +++ b/livesupport/products/gLiveSupport/src/UploadFileWindow.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/UploadFileWindow.h,v $ ------------------------------------------------------------------------------*/ @@ -79,7 +79,7 @@ using namespace LiveSupport::Core; * * * @author $Author: maroy $ - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ class UploadFileWindow : public Gtk::Window, public LocalizedObject { @@ -124,7 +124,10 @@ class UploadFileWindow : public Gtk::Window, public LocalizedObject */ Ptr::Ref closeButton; - // TODO: add status bar + /** + * The status bar. + */ + Ptr::Ref statusBar; /** * The gLiveSupport object, handling the logic of the application.