first iteration of file upload window according to Charles' design

This commit is contained in:
maroy 2005-03-08 10:40:57 +00:00
parent 62ab3c8e24
commit f687b00bc5
8 changed files with 372 additions and 93 deletions

View File

@ -22,7 +22,7 @@
Author : $Author: maroy $ Author : $Author: maroy $
Version : $Revision: 1.19 $ Version : $Revision: 1.20 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -389,40 +389,40 @@ GLiveSupport :: showLoggedInUI(void) throw ()
} }
/*------------------------------------------------------------------------------
* Determine the length of an audio file
*----------------------------------------------------------------------------*/
Ptr<time_duration>::Ref
LiveSupport :: GLiveSupport ::
GLiveSupport :: getPlaylength(Ptr<const std::string>::Ref uri)
throw (std::invalid_argument)
{
Ptr<time_duration>::Ref playlength;
audioPlayer->open(*uri);
playlength = audioPlayer->getPlaylength();
audioPlayer->close();
return playlength;
}
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* Upload a file to the server. * Upload a file to the server.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
Ptr<AudioClip>::Ref void
LiveSupport :: GLiveSupport :: LiveSupport :: GLiveSupport ::
GLiveSupport :: uploadFile(Ptr<const Glib::ustring>::Ref title, GLiveSupport :: uploadFile(Ptr<AudioClip>::Ref audioClip)
Ptr<const std::string>::Ref fileName)
throw (XmlRpcException) throw (XmlRpcException)
{ {
// create a URI from the file name std::cerr << "GLiveSupport :: uploadFile #1" << std::endl;
Ptr<std::string>::Ref uri(new std::string("file://"));
*uri += *fileName;
// determine the playlength of the audio clip
Ptr<time_duration>::Ref playlength;
try {
audioPlayer->open(*uri);
playlength = audioPlayer->getPlaylength();
audioPlayer->close();
} catch (std::invalid_argument &e) {
throw XmlRpcException(e.what());
}
// create and upload an AudioClip object
Ptr<AudioClip>::Ref audioClip(new AudioClip(title,
playlength,
uri));
storage->storeAudioClip(sessionId, audioClip); storage->storeAudioClip(sessionId, audioClip);
std::cerr << "GLiveSupport :: uploadFile #2" << std::endl;
// add the uploaded file to the DJ Bag, and update it // add the uploaded file to the DJ Bag, and update it
djBagContents->push_front(audioClip); djBagContents->push_front(audioClip);
std::cerr << "GLiveSupport :: uploadFile #3" << std::endl;
masterPanel->updateDjBagWindow(); masterPanel->updateDjBagWindow();
std::cerr << "GLiveSupport :: uploadFile #4" << std::endl;
return audioClip;
} }

View File

@ -22,7 +22,7 @@
Author : $Author: maroy $ Author : $Author: maroy $
Version : $Revision: 1.19 $ Version : $Revision: 1.20 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/GLiveSupport.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -100,7 +100,7 @@ class MasterPanelWindow;
* respective documentation. * respective documentation.
* *
* @author $Author: maroy $ * @author $Author: maroy $
* @version $Revision: 1.19 $ * @version $Revision: 1.20 $
* @see LocalizedObject#getBundle(const xmlpp::Element &) * @see LocalizedObject#getBundle(const xmlpp::Element &)
* @see AuthenticationClientFactory * @see AuthenticationClientFactory
* @see StorageClientFactory * @see StorageClientFactory
@ -355,17 +355,26 @@ class GLiveSupport : public LocalizedConfigurable,
void void
showLoggedInUI(void) throw (); showLoggedInUI(void) throw ();
/**
* Determine the length of an audio file, base on a URI to the file.
*
* @param uri an URI to a binary audio file
* @return the length of the file
* @exception std::invalid_argument if there is no file at the
* specified URI
*/
Ptr<time_duration>::Ref
getPlaylength(Ptr<const std::string>::Ref uri)
throw (std::invalid_argument);
/** /**
* Upload a file to the storage. * Upload a file to the storage.
* *
* @param title the title of the audio clip. * @param audioClip the file to upload
* @param fileName the full filename of the audio clip.
* @return the audio clip that was uploaded.
* @exception XmlRpcException on upload failures. * @exception XmlRpcException on upload failures.
*/ */
Ptr<AudioClip>::Ref void
uploadFile(Ptr<const Glib::ustring>::Ref title, uploadFile(Ptr<AudioClip>::Ref audioClip)
Ptr<const std::string>::Ref fileName)
throw (XmlRpcException); throw (XmlRpcException);
/** /**

View File

@ -22,7 +22,7 @@
Author : $Author: maroy $ Author : $Author: maroy $
Version : $Revision: 1.7 $ Version : $Revision: 1.8 $
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 $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -43,6 +43,7 @@
using namespace Glib; using namespace Glib;
using namespace LiveSupport::Core; using namespace LiveSupport::Core;
using namespace LiveSupport::Widgets;
using namespace LiveSupport::GLiveSupport; using namespace LiveSupport::GLiveSupport;
/* =================================================== local data structures */ /* =================================================== local data structures */
@ -71,6 +72,8 @@ LoginWindow :: LoginWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<WidgetFactory>::Ref widgetFactory = WidgetFactory::getInstance(); Ptr<WidgetFactory>::Ref widgetFactory = WidgetFactory::getInstance();
set_default_size(350, 265);
try { try {
set_title(*getResourceUstring("windowTitle")); set_title(*getResourceUstring("windowTitle"));
loginLabel = Gtk::manage( loginLabel = Gtk::manage(

View File

@ -22,7 +22,7 @@
Author : $Author: maroy $ Author : $Author: maroy $
Version : $Revision: 1.12 $ Version : $Revision: 1.13 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/MasterPanelWindow.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -94,7 +94,6 @@ MasterPanelWindow :: MasterPanelWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
vuMeterBin = Gtk::manage(widgetFactory->createBlueBin()); vuMeterBin = Gtk::manage(widgetFactory->createBlueBin());
vuMeterBin->add(*vuMeterWidget); vuMeterBin->add(*vuMeterWidget);
vuMeterBin->set_size_request(400, 40); vuMeterBin->set_size_request(400, 40);
// set up the next playing widget // set up the next playing widget
nextPlayingWidget = Gtk::manage(new Gtk::Label("next playing")); nextPlayingWidget = Gtk::manage(new Gtk::Label("next playing"));
nextPlayingBin = Gtk::manage(widgetFactory->createBlueBin()); nextPlayingBin = Gtk::manage(widgetFactory->createBlueBin());
@ -121,7 +120,6 @@ MasterPanelWindow :: MasterPanelWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
bottomBar->attach(*userInfoAlignment, 1, 2, 0, 1, bottomBar->attach(*userInfoAlignment, 1, 2, 0, 1,
Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL,
5, 0); 5, 0);
// set up the main window, and show everything // set up the main window, and show everything
// all the localized widgets were set up in changeLanguage() // all the localized widgets were set up in changeLanguage()
set_border_width(10); set_border_width(10);
@ -143,7 +141,6 @@ MasterPanelWindow :: MasterPanelWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
layout->attach(*bottomBar, 0, 4, 2, 3, layout->attach(*bottomBar, 0, 4, 2, 3,
Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL,
0, 0); 0, 0);
add(*layout); add(*layout);
// set the background to white // set the background to white

View File

@ -22,7 +22,7 @@
Author : $Author: maroy $ Author : $Author: maroy $
Version : $Revision: 1.4 $ Version : $Revision: 1.5 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/UploadFileWindow.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/UploadFileWindow.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -34,6 +34,8 @@
#endif #endif
#include <iostream> #include <iostream>
#include <sstream>
#include <fstream>
#include <unicode/msgfmt.h> #include <unicode/msgfmt.h>
#include <gtkmm/label.h> #include <gtkmm/label.h>
#include <gtkmm/stock.h> #include <gtkmm/stock.h>
@ -43,6 +45,7 @@
#include "UploadFileWindow.h" #include "UploadFileWindow.h"
using namespace LiveSupport::Widgets;
using namespace LiveSupport::GLiveSupport; using namespace LiveSupport::GLiveSupport;
/* =================================================== local data structures */ /* =================================================== local data structures */
@ -62,50 +65,114 @@ using namespace LiveSupport::GLiveSupport;
UploadFileWindow :: UploadFileWindow (Ptr<GLiveSupport>::Ref gLiveSupport, UploadFileWindow :: UploadFileWindow (Ptr<GLiveSupport>::Ref gLiveSupport,
Ptr<ResourceBundle>::Ref bundle) Ptr<ResourceBundle>::Ref bundle)
throw () throw ()
: LocalizedObject(bundle) : WhiteWindow("",
0xffffff,
WidgetFactory::getInstance()->getWhiteWindowCorners()),
LocalizedObject(bundle)
{ {
this->gLiveSupport = gLiveSupport; this->gLiveSupport = gLiveSupport;
fileName.reset(new std::string());
isFileGood = false;
Ptr<WidgetFactory>::Ref wf = WidgetFactory::getInstance();
try { try {
// generic resources
set_title(*getResourceUstring("windowTitle")); set_title(*getResourceUstring("windowTitle"));
chooseFileLabel.reset(new Gtk::Label( chooseFileLabel = Gtk::manage(new Gtk::Label(
*getResourceUstring("chooseFileLabel"))); *getResourceUstring("chooseFileLabel")));
fileNameEntry.reset(new Gtk::Entry()); fileNameEntryBin = Gtk::manage(wf->createEntryBin());
chooseFileButton.reset(new Gtk::Button( fileNameEntry = fileNameEntryBin->getEntry();
chooseFileButton = Gtk::manage(wf->createButton(
*getResourceUstring("chooseFileButtonLabel"))); *getResourceUstring("chooseFileButtonLabel")));
nameLabel.reset(new Gtk::Label(
*getResourceUstring("nameLabel"))); // main section resources
nameEntry.reset(new Gtk::Entry()); titleLabel = Gtk::manage(new Gtk::Label(
uploadButton.reset(new Gtk::Button( *getResourceUstring("titleLabel"),
Gtk::ALIGN_RIGHT));
titleEntryBin = Gtk::manage(wf->createEntryBin());
titleEntry = titleEntryBin->getEntry();
creatorLabel = Gtk::manage(new Gtk::Label(
*getResourceUstring("creatorLabel"),
Gtk::ALIGN_RIGHT));
creatorEntryBin = Gtk::manage(wf->createEntryBin());
creatorEntry = creatorEntryBin->getEntry();
genreLabel = Gtk::manage(new Gtk::Label(
*getResourceUstring("genreLabel"),
Gtk::ALIGN_RIGHT));
genreEntryBin = Gtk::manage(wf->createEntryBin());
genreEntry = genreEntryBin->getEntry();
fileFormatLabel = Gtk::manage(new Gtk::Label(
*getResourceUstring("fileFormatLabel"),
Gtk::ALIGN_RIGHT));
fileFormatComboBox = Gtk::manage(wf->createComboBoxText());
lengthLabel = Gtk::manage(new Gtk::Label(
*getResourceUstring("lengthLabel"),
Gtk::ALIGN_RIGHT));
lengthValueLabel = Gtk::manage(new Gtk::Label());
// build up the notepad for the different metadata sections
mainSection = Gtk::manage(new Gtk::Alignment());
metadataNotebook = Gtk::manage(new Notebook());
metadataNotebook->appendPage(*mainSection,
*getResourceUstring("mainSectionLabel"));
// buttons, etc.
uploadButton = Gtk::manage(wf->createButton(
*getResourceUstring("uploadButtonLabel"))); *getResourceUstring("uploadButtonLabel")));
closeButton.reset(new Gtk::Button( closeButton = Gtk::manage(wf->createButton(
*getResourceUstring("closeButtonLabel"))); *getResourceUstring("closeButtonLabel")));
statusBar.reset(new Gtk::Label( statusBar = Gtk::manage(new Gtk::Label(
*getResourceUstring("statusBar"))); *getResourceUstring("statusBar")));
} catch (std::invalid_argument &e) { } catch (std::invalid_argument &e) {
// TODO: signal error // TODO: signal error
std::cerr << e.what() << std::endl; std::cerr << e.what() << std::endl;
} }
// build up the main section
// TODO: don't hard-code supported file format types
fileFormatComboBox->append_text("mp3");
fileFormatComboBox->set_active_text("mp3");
mainLayout = Gtk::manage(new Gtk::Table());
mainLayout->attach(*titleLabel, 0, 1, 0, 1);
mainLayout->attach(*titleEntryBin, 1, 2, 0, 1);
mainLayout->attach(*creatorLabel, 0, 1, 1, 2);
mainLayout->attach(*creatorEntryBin, 1, 2, 1, 2);
mainLayout->attach(*genreLabel, 0, 1, 2, 3);
mainLayout->attach(*genreEntryBin, 1, 2, 2, 3);
mainLayout->attach(*fileFormatLabel, 2, 3, 0, 1);
mainLayout->attach(*fileFormatComboBox, 3, 4, 0, 1);
mainLayout->attach(*lengthLabel, 2, 3, 1, 2);
mainLayout->attach(*lengthValueLabel, 3, 4, 1, 2);
mainSection->add(*mainLayout);
// build up the button bar
buttonBar = Gtk::manage(new Gtk::HBox());
buttonBar->add(*closeButton);
buttonBar->add(*uploadButton);
// set up the layout, which is a button box // set up the layout, which is a button box
layout.reset(new Gtk::Table()); layout = Gtk::manage(new Gtk::Table());
// set up the main window, and show everything // set up the main window, and show everything
set_border_width(10);
layout->attach(*chooseFileLabel, 0, 1, 0, 1); layout->attach(*chooseFileLabel, 0, 1, 0, 1);
layout->attach(*fileNameEntry, 1, 2, 0, 1); layout->attach(*fileNameEntryBin, 0, 1, 1, 2);
layout->attach(*chooseFileButton, 2, 3, 0, 1); layout->attach(*chooseFileButton, 1, 2, 1, 2);
layout->attach(*nameLabel, 0, 1, 1, 2); layout->attach(*metadataNotebook, 0, 2, 2, 3);
layout->attach(*nameEntry, 1, 2, 1, 2); layout->attach(*buttonBar, 0, 2, 3, 4);
layout->attach(*uploadButton, 1, 2, 2, 3); layout->attach(*statusBar, 0, 2, 4, 5);
layout->attach(*closeButton, 1, 2, 3, 4);
layout->attach(*statusBar, 0, 3, 4, 5);
add(*layout); add(*layout);
// bind events // bind events
chooseFileButton->signal_clicked().connect(sigc::mem_fun(*this, chooseFileButton->signal_clicked().connect(sigc::mem_fun(*this,
&UploadFileWindow::onChooseFileButtonClicked)); &UploadFileWindow::onChooseFileButtonClicked));
fileNameEntry->signal_focus_out_event().connect(sigc::mem_fun(*this,
&UploadFileWindow::onFileNameEntryLeave));
uploadButton->signal_clicked().connect(sigc::mem_fun(*this, uploadButton->signal_clicked().connect(sigc::mem_fun(*this,
&UploadFileWindow::onUploadButtonClicked)); &UploadFileWindow::onUploadButtonClicked));
closeButton->signal_clicked().connect(sigc::mem_fun(*this, closeButton->signal_clicked().connect(sigc::mem_fun(*this,
@ -137,12 +204,60 @@ UploadFileWindow :: onChooseFileButtonClicked(void) throw ()
int result = dialog->run(); int result = dialog->run();
if (result == Gtk::RESPONSE_OK) { if (result == Gtk::RESPONSE_OK) {
fileName.reset(new std::string(dialog->get_filename())); fileNameEntry->set_text(dialog->get_filename());
fileNameEntry->set_text(*fileName); updateFileInfo();
} }
} }
/*------------------------------------------------------------------------------
* Update the file information to upload.
*----------------------------------------------------------------------------*/
void
UploadFileWindow :: updateFileInfo(void) throw ()
{
std::string newFileName = fileNameEntry->get_text().raw();
if (*fileName != newFileName) {
// see if the file exists, and is readable
std::ifstream file(newFileName.c_str());
if (!file.good()) {
isFileGood = false;
file.close();
return;
}
file.close();
isFileGood = true;
fileName.reset(new std::string(newFileName));
fileURI.reset(new std::string("file://"));
*fileURI += *fileName;
playlength = gLiveSupport->getPlaylength(fileURI);
// display the new play length
std::ostringstream lengthStr;
lengthStr << std::setfill('0')
<< std::setw(2) << playlength->hours() << ":"
<< std::setw(2) << playlength->minutes() << ":"
<< std::setw(2) << playlength->seconds();
lengthValueLabel->set_text(lengthStr.str());
}
}
/*------------------------------------------------------------------------------
* The event when the user has left the file name entry box.
*----------------------------------------------------------------------------*/
bool
UploadFileWindow :: onFileNameEntryLeave(GdkEventFocus * event)
throw ()
{
updateFileInfo();
return false;
}
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* The event when the upload button has been clicked. * The event when the upload button has been clicked.
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
@ -150,14 +265,32 @@ void
UploadFileWindow :: onUploadButtonClicked(void) throw () UploadFileWindow :: onUploadButtonClicked(void) throw ()
{ {
try { try {
Ptr<const Glib::ustring>::Ref title; updateFileInfo();
Ptr<const std::string>::Ref fileName; if (!isFileGood) {
Ptr<AudioClip>::Ref audioClip; // TODO: localize error message
throw std::invalid_argument("file does not exist");
title.reset(new Glib::ustring(nameEntry->get_text())); }
fileName.reset(new std::string(fileNameEntry->get_text().raw()));
Ptr<const Glib::ustring>::Ref ustrValue;
audioClip = gLiveSupport->uploadFile(title, fileName);
ustrValue.reset(new Glib::ustring(titleEntry->get_text()));
// create and upload an AudioClip object
Ptr<AudioClip>::Ref audioClip(new AudioClip(ustrValue,
playlength,
fileURI));
// set the metadata available
ustrValue.reset(new Glib::ustring(creatorEntry->get_text()));
audioClip->setMetadata(ustrValue, "dc:creator");
ustrValue.reset(new Glib::ustring(genreEntry->get_text()));
audioClip->setMetadata(ustrValue, "dc:type");
ustrValue.reset(new Glib::ustring(
fileFormatComboBox->get_active_text()));
audioClip->setMetadata(ustrValue, "dc:format");
// upload the audio clip
gLiveSupport->uploadFile(audioClip);
// display success in the status bar // display success in the status bar
Ptr<UnicodeString>::Ref uTitle = ustringToUnicodeString( Ptr<UnicodeString>::Ref uTitle = ustringToUnicodeString(
@ -170,8 +303,10 @@ UploadFileWindow :: onUploadButtonClicked(void) throw ()
statusBar->set_text(*statusText); statusBar->set_text(*statusText);
// clean the entry fields // clean the entry fields
nameEntry->set_text(""); //titleEntry->set_text("");
fileNameEntry->set_text(""); //fileNameEntry->set_text("");
} catch (std::invalid_argument &e) {
statusBar->set_text(e.what());
} catch (XmlRpcException &e) { } catch (XmlRpcException &e) {
statusBar->set_text(e.what()); statusBar->set_text(e.what());
} }

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/UploadFileWindow.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/products/gLiveSupport/src/UploadFileWindow.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -43,10 +43,17 @@
#include <gtkmm/button.h> #include <gtkmm/button.h>
#include <gtkmm/table.h> #include <gtkmm/table.h>
#include <gtkmm/entry.h> #include <gtkmm/entry.h>
#include <gtkmm/alignment.h>
#include <gtkmm/box.h>
#include <gtkmm/window.h> #include <gtkmm/window.h>
#include "LiveSupport/Core/Ptr.h" #include "LiveSupport/Core/Ptr.h"
#include "LiveSupport/Core/LocalizedObject.h" #include "LiveSupport/Core/LocalizedObject.h"
#include "LiveSupport/Widgets/Button.h"
#include "LiveSupport/Widgets/EntryBin.h"
#include "LiveSupport/Widgets/ComboBoxText.h"
#include "LiveSupport/Widgets/Notebook.h"
#include "LiveSupport/Widgets/WhiteWindow.h"
#include "GLiveSupport.h" #include "GLiveSupport.h"
#include "MasterPanelUserInfoWidget.h" #include "MasterPanelUserInfoWidget.h"
@ -55,6 +62,7 @@ namespace LiveSupport {
namespace GLiveSupport { namespace GLiveSupport {
using namespace LiveSupport::Core; using namespace LiveSupport::Core;
using namespace LiveSupport::Widgets;
/* ================================================================ constants */ /* ================================================================ constants */
@ -79,55 +87,135 @@ using namespace LiveSupport::Core;
* </code></pre> * </code></pre>
* *
* @author $Author: maroy $ * @author $Author: maroy $
* @version $Revision: 1.2 $ * @version $Revision: 1.3 $
*/ */
class UploadFileWindow : public Gtk::Window, public LocalizedObject class UploadFileWindow : public WhiteWindow, public LocalizedObject
{ {
protected: protected:
/** /**
* The layout used in the window. * The layout used in the window.
*/ */
Ptr<Gtk::Table>::Ref layout; Gtk::Table * layout;
/** /**
* The choose file label * The choose file label
*/ */
Ptr<Gtk::Label>::Ref chooseFileLabel; Gtk::Label * chooseFileLabel;
/**
* A container holding the file name entry field.
*/
EntryBin * fileNameEntryBin;
/** /**
* The text entry for selecting a file name * The text entry for selecting a file name
*/ */
Ptr<Gtk::Entry>::Ref fileNameEntry; Gtk::Entry * fileNameEntry;
/** /**
* The file browser button. * The file browser button.
*/ */
Ptr<Gtk::Button>::Ref chooseFileButton; Button * chooseFileButton;
/** /**
* The name label * The notepad holding the different sections of metadata.
*/ */
Ptr<Gtk::Label>::Ref nameLabel; Notebook * metadataNotebook;
/** /**
* The text input for the name. * The main input section.
*/ */
Ptr<Gtk::Entry>::Ref nameEntry; Gtk::Alignment * mainSection;
/**
* The layout of the main section.
*/
Gtk::Table * mainLayout;
/**
* The title label
*/
Gtk::Label * titleLabel;
/**
* A container holding the title entry field.
*/
EntryBin * titleEntryBin;
/**
* The text input for the title.
*/
Gtk::Entry * titleEntry;
/**
* The creator label
*/
Gtk::Label * creatorLabel;
/**
* A container holding the creator entry field.
*/
EntryBin * creatorEntryBin;
/**
* The text input for the creator.
*/
Gtk::Entry * creatorEntry;
/**
* The genre label
*/
Gtk::Label * genreLabel;
/**
* A container holding the genre entry field.
*/
EntryBin * genreEntryBin;
/**
* The text input for the genre.
*/
Gtk::Entry * genreEntry;
/**
* The file format label.
*/
Gtk::Label * fileFormatLabel;
/**
* The file format combo box.
*/
ComboBoxText * fileFormatComboBox;
/**
* The length label.
*/
Gtk::Label * lengthLabel;
/**
* The length value label.
*/
Gtk::Label * lengthValueLabel;
/**
* The button bar.
*/
Gtk::HBox * buttonBar;
/** /**
* The upload button. * The upload button.
*/ */
Ptr<Gtk::Button>::Ref uploadButton; Gtk::Button * uploadButton;
/** /**
* The close button. * The close button.
*/ */
Ptr<Gtk::Button>::Ref closeButton; Gtk::Button * closeButton;
/** /**
* The status bar. * The status bar.
*/ */
Ptr<Gtk::Label>::Ref statusBar; Gtk::Label * statusBar;
/** /**
* The gLiveSupport object, handling the logic of the application. * The gLiveSupport object, handling the logic of the application.
@ -139,6 +227,22 @@ class UploadFileWindow : public Gtk::Window, public LocalizedObject
*/ */
Ptr<std::string>::Ref fileName; Ptr<std::string>::Ref fileName;
/**
* Signals if the file under fileName is good.
*/
bool isFileGood;
/**
* The URI to the file to upload.
* Basically same as fileName, with 'file://' prepended.
*/
Ptr<std::string>::Ref fileURI;
/**
* The playling length of the file to upload.
*/
Ptr<time_duration>::Ref playlength;
/** /**
* Function to catch the event of the choose file button being * Function to catch the event of the choose file button being
* pressed. * pressed.
@ -153,12 +257,29 @@ class UploadFileWindow : public Gtk::Window, public LocalizedObject
virtual void virtual void
onUploadButtonClicked(void) throw (); onUploadButtonClicked(void) throw ();
/**
* Signal handler for the user leaving the filename entry box,
* where persumably he may have types in a new filename.
*
* @param event the event recieved.
* @return true if the event has been processed, false otherwise.
*/
bool
onFileNameEntryLeave(GdkEventFocus * event) throw ();
/** /**
* Function to catch the event of the close button being pressed. * Function to catch the event of the close button being pressed.
*/ */
virtual void virtual void
onCloseButtonClicked(void) throw (); onCloseButtonClicked(void) throw ();
/**
* Update the information for the file to upload, based on the
* value of the fileNameEntry text entry field.
*/
void
updateFileInfo(void) throw ();
public: public:
/** /**

View File

@ -65,11 +65,18 @@ hu:table
uploadFileWindow:table uploadFileWindow:table
{ {
windowTitle:string { "File Feltőltés Ablak" } windowTitle:string { "File Feltőltés" }
chooseFileLabel:string { "Filenév" }
chooseFileButtonLabel:string { "Tallóz" }
mainSectionLabel:string { "Fő" }
titleLabel:string { "Cim" }
creatorLabel:string { "Szerző" }
genreLabel:string { "Stilus" }
fileFormatLabel:string { "File tipus" }
lengthLabel:string { "Hossz" }
chooseFileLabel:string { "file: " }
chooseFileButtonLabel:string { "tallóz..." }
nameLabel:string { "hang file név: " }
uploadButtonLabel:string { "feltölt" } uploadButtonLabel:string { "feltölt" }
closeButtonLabel:string { "bezár" } closeButtonLabel:string { "bezár" }
statusBar:string { "állapotsor" } statusBar:string { "állapotsor" }

View File

@ -65,13 +65,20 @@ root:table
uploadFileWindow:table uploadFileWindow:table
{ {
windowTitle:string { "Upload File Window" } windowTitle:string { "Upload File" }
chooseFileLabel:string { "file: " } chooseFileLabel:string { "Filename" }
chooseFileButtonLabel:string { "browse..." } chooseFileButtonLabel:string { "Browse" }
nameLabel:string { "audio clip name: " }
uploadButtonLabel:string { "upload" } mainSectionLabel:string { "Main" }
closeButtonLabel:string { "close" } titleLabel:string { "Title" }
creatorLabel:string { "Creator" }
genreLabel:string { "Genre" }
fileFormatLabel:string { "File Type" }
lengthLabel:string { "Duration" }
uploadButtonLabel:string { "Upload" }
closeButtonLabel:string { "Cancel" }
statusBar:string { "status bar" } statusBar:string { "status bar" }
fileChooserDialogTitle:string { "Choose a File" } fileChooserDialogTitle:string { "Choose a File" }