added status bar to file upload window

This commit is contained in:
maroy 2005-01-02 12:30:43 +00:00
parent dc01754047
commit b2d171cbde
4 changed files with 30 additions and 14 deletions

View File

@ -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<AudioClip>::Ref
LiveSupport :: GLiveSupport ::
GLiveSupport :: uploadFile(Ptr<const Glib::ustring>::Ref title,
Ptr<const std::string>::Ref fileName)
@ -320,6 +320,8 @@ GLiveSupport :: uploadFile(Ptr<const Glib::ustring>::Ref title,
title,
playlength,
uri));
storage->storeAudioClip(sessionId, audioClip);
storage->storeAudioClip(sessionId, audioClip);
return audioClip;
}

View File

@ -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<AudioClip>::Ref
uploadFile(Ptr<const Glib::ustring>::Ref title,
Ptr<const std::string>::Ref fileName)
throw (StorageException);

View File

@ -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<GLiveSupport>::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<GLiveSupport>::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<const Glib::ustring>::Ref title;
Ptr<const std::string>::Ref fileName;
Ptr<AudioClip>::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());
}
}

View File

@ -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;
* </code></pre>
*
* @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<Gtk::Button>::Ref closeButton;
// TODO: add status bar
/**
* The status bar.
*/
Ptr<Gtk::Label>::Ref statusBar;
/**
* The gLiveSupport object, handling the logic of the application.